Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
6]/ @ s, d dl mZ d dlZd dlZd dlmZmZmZmZ ddddgZ dZ
d Zd
ZdZ
dZd
ZG dd deZe ZG dd deZG dd deZG dd deZdd ZG dd deZddlmZ ee yddlmZ ee W n ek
r Y nX yddlmZ ee W n ek
r& Y nX dS ) )defaultdictN)CharsetMetaAttributeValueContentMetaAttributeValueHTMLAwareEntitySubstitution
whitespace_reHTMLTreeBuilderSAXTreeBuilderTreeBuilderTreeBuilderRegistryZfastZ
permissivestrictZxmlZhtmlZhtml5c @ s$ e Zd Zdd Zdd Zdd ZdS )r
c C s t t| _g | _d S )N)r listbuilders_for_featurebuilders)self r /usr/lib/python3.6/__init__.py__init__ s
zTreeBuilderRegistry.__init__c C s4 x |j D ]}| j| jd| qW | jjd| dS )z8Register a treebuilder based on its advertised features.r N)featuresr
insertr )r Ztreebuilder_classfeaturer r r register$ s zTreeBuilderRegistry.registerc G s t | jdkrd S t |dkr(| jd S t|}|j d }d }xVt |dkr|j }| jj|g }t |dkrB|d kr|}t|}qB|jt|}qBW |d krd S x|D ]}||kr|S qW d S )Nr ) lenr r reversepopr
getsetintersection)r r Z
candidatesZ
candidate_setr Zwe_have_the_feature candidater r r lookup* s.
zTreeBuilderRegistry.lookupN)__name__
__module____qualname__r r r r r r r r
s c @ st e Zd ZdZdZg Zg ZdZdZe Z
dZi Zdd Z
dd Zd d
Zdd Zdd
dZdd Zdd Zdd ZdS )r z2Turn a document into a Beautiful Soup object tree.z[Unknown tree builder]FNc C s
d | _ d S )N)soup)r r r r r f s zTreeBuilder.__init__c C s d S )Nr )r r r r reseti s zTreeBuilder.resetc C s | j dkrdS || j kS )a Might a tag with this name be an empty-element tag?
The final markup may or may not actually present this tag as
self-closing.
For instance: an HTMLBuilder does not consider a tag to be
an empty-element tag (it's not in
HTMLBuilder.empty_element_tags). This means an empty
tag
will be presented as "
", not "".
The default implementation has no opinion about which tags are
empty-element tags, so a tag will be presented as an
empty-element tag if and only if it has no contents.
"" will become "", and "bar" will
be left alone.
NT)empty_element_tags)r tag_namer r r can_be_empty_elementl s
z TreeBuilder.can_be_empty_elementc C s
t d S )N)NotImplementedError)r markupr r r feed s zTreeBuilder.feedc C s |d d dfS )NFr )r r( Zuser_specified_encodingZdocument_declared_encodingr r r prepare_markup s zTreeBuilder.prepare_markupc C s |S )a Wrap an HTML fragment to make it look like a document.
Different parsers do this differently. For instance, lxml
introduces an empty tag, and html5lib
doesn't. Abstracting this away lets us write simple tests
which run HTML fragments through the parser and compare the
results against other HTML fragments.
This method should not be used outside of tests.
r )r Zfragmentr r r test_fragment_to_document s z%TreeBuilder.test_fragment_to_documentc C s dS )NFr )r tagr r r set_up_substitutions s z TreeBuilder.set_up_substitutionsc C s |s|S | j r| j jdg }| j j|j d}xRt|j D ]B}||ksT|r<||kr<|| }t|trrtj|}n|}|||<