Files
cms-website/.deps_siteforge_v812/bs4/__pycache__/element.cpython-312.pyc
T

1231 lines
113 KiB
Plaintext
Raw Normal View History

Ë
ïÅÙj­Õãó€—UddlmZdZddlZddlZddlmZddlmZm Z m
Z
ddl m Z m
Z
mZddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$dd l%m&Z&m'Z'er>dd
l(m)Z)dd l*m+Z+dd l,m-Z-dd
l m.Z.m/Z/ddl0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@e"e dee dfZAdeBd<ee"dZCdeBd<eDd¬«ZEejŒd«ZGdeBd<dTd„ZHdZIdeBd<ejŒd«ZJdeBd<eKgd¢«ZLd eBd!<Gd"„d#eM«ZNGd$„d%eM«ZOGd&„d'eO«ZPGd(„d)eeM«ZQGd*„d+eeef«ZRGd,„d-eR«ZSGd.„d/eR«ZTGd0„d1eO«ZUGd2„d3eV«ZWGd4„deMeW«ZXGd5„d6eX«ZYGd7„d8eY«ZZGd9„d:eY«Z[Gd;„d<e[«Z\Gd=„d>eY«Z]Gd?„d@eY«Z^GdA„dBeY«Z_GdC„dDeX«Z`GdE„dFeX«ZaGdG„dHeX«ZbGdI„dJeX«ZcGdK„dLeX«ZdGdM„dNeW«Zee!dOeW¬P«ZfGdQ„dReefeef«ZgddSl,mhZhy)Ué)Ú annotationsÚMITN©ÚCSS)Ú _deprecatedÚ_deprecated_aliasÚ_deprecated_function_alias)Ú FormatterÚ
HTMLFormatterÚ XMLFormatter)Ú!AttributeResemblesVariableWarning)ÚAnyÚCallableÚDictÚGenericÚIterableÚIteratorÚListÚMappingÚMutableSequenceÚOptionalÚPatternÚSetÚ
TYPE_CHECKINGÚTupleÚTypeÚTypeVarÚUnionÚcastÚoverload)ÚSelfÚ TypeAlias©Ú
BeautifulSoup)Ú TreeBuilder©Ú
ElementFilter)Ú_EntitySubstitutionFunctionÚ_FormatterOrName)Ú_AtMostOneElementÚ
_AtMostOneTagÚ_AtMostOneNavigableStringÚ_AttributeValueÚ_AttributeValuesÚ _EncodingÚ_InsertableElementÚ _OneElementÚ
_QueryResultsÚ_RawOrProcessedAttributeValuesÚ_StrainableElementÚ_StrainableAttributeÚ_StrainableAttributesÚ_StrainableStringÚ_SomeNavigableStringsÚ _SomeTagsÚNavigableStringr"Ú_OneOrMoreStringTypes)r4r'Ú_FindMethodNamezYThe {name} attribute was deprecated in version 4.7.0. If you need it, make your own copy.)Ú
whitespace_rez\s+ú Pattern[str]Ú_deprecated_whitespace_reÚstrcóÆ—|tvrEt|}tj|j|¬«td¬«t «d|›�St
dt›d|›�«‚)N©Únameé©Ú
stacklevelÚ _deprecated_zmodule z has no attribute )Ú_deprecated_namesÚwarningsÚwarnÚformatÚDeprecationWarningÚglobalsÚAttributeErrorÚ__name__)rCÚmessages úOC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\bs4/element.pyÚ __getattr__rRZs_€Ø Ô Ñ Ü# DÑ)ˆÜ�
‰
�g—n‘n¨$�nÓ/Ô1CÐPQÕRä‹y˜<¨ vÐ.Ñ/Ð/Ü
˜7¤8 ,Ð.@ÀÀÐIÓ
JÐJóúutf-8ÚDEFAULT_OUTPUT_ENCODINGz\S+Únonwhitespace_re) ÚidnaÚmbcsÚoemÚpalmosÚpunycodeÚraw_unicode_escapeÚ undefinedÚunicode_escapezraw-unicode-escapezunicode-escapez
string-escapeÚ
string_escapezSet[_Encoding]ÚPYTHON_SPECIFIC_ENCODINGScóL—eZdZUdZded<ded<ded< d d d„Zy)
ÚNamespacedAttributez¬A namespaced attribute (e.g. the 'xml:lang' in 'xml:lang="en"')
which remembers the namespace prefix ('xml') and the name ('lang')
that were used to create it.
ú
Optional[str]ÚprefixrCÚ namespaceNcóÔ—|sd}|stj||«}n5|stj||«}ntj||dz|z«}||_||_||_|S)NÚ:)r@Ú__new__rdrCre)ÚclsrdrCreÚobjs rQrhzNamespacedAttribute.__new__“sg€ñ ðˆDáÜ—+‘+˜c 6Ó*‰CÙä—+‘+˜c 4Ó(‰Cä—+‘+˜c 6¨C¡<°$Ñ#6Ó7ˆC؈Œ
؈ŒØ!ˆŒ
؈
rS©NN)rdrcrCrcrercÚreturnr!)rOÚ
__module__Ú __qualname__Ú__doc__Ú__annotations__rh©rSrQrbrb‰sN…ñð
ÓØ
ÓØÓð
#Ø#'ð àðððð!ð ð
ô rSrbcó$—eZdZUdZded<dd„Zy)Ú%AttributeValueWithCharsetSubstitutionaÒAn abstract class standing in for a character encoding specified
inside an HTML ``<meta>`` tag.
Subclasses exist for each place such a character encoding might be
found: either inside the ``charset`` attribute
(`CharsetMetaAttributeValue`) or inside the ``content`` attribute
(`ContentMetaAttributeValue`)
This allows Beautiful Soup to replace that part of the HTML file
with a different encoding when ouputting a tree as a string.
r@Úoriginal_valuecó—t«‚)z‡Do whatever's necessary in this implementation-specific
portion an HTML document to substitute in a specific encoding.
©ÚNotImplementedError©ÚselfÚeventual_encodings rQÚsubstitute_encodingz9AttributeValueWithCharsetSubstitution.substitute_encoding¼s
€ô"Ó#Ð#rSN)rzr@rlr@)rOrmrnrorpr{rqrSrQrsrs«s…ñ
ðÓô$rSrscó"—eZdZdZdd„Zddd„Zy)ÚCharsetMetaAttributeValueazA generic stand-in for the value of a ``<meta>`` tag's ``charset``
attribute.
When Beautiful Soup parses the markup ``<meta charset="utf8">``, the
value of the ``charset`` attribute will become one of these objects.
If the document is later encoded to an encoding other than UTF-8, its
``<meta>`` tag will mention the new encoding instead of ``utf8``.
có@—tj||«}||_|S©N)r@rhrt©rirtrjs rQrhz!CharsetMetaAttributeValue.__new__Îs!€ô�k‰k˜#˜~Ó.ˆØ+ˆÔ؈
rScó—|tvry|S)z¢When an HTML document is being encoded to a given encoding, the
value of a ``<meta>`` tag's ``charset`` becomes the name of
the encoding.
Ú)r`rxs rQr{z-CharsetMetaAttributeValue.substitute_encodingÕs€ð
Ô 9Ñ 9ØØ Ð rSN©rtr@rlr!©rT©rzr/rlr@)rOrmrnrorhr{rqrSrQr}r}Ãs„ñóõ!rSr}có—eZdZdZy)ÚAttributeValueLista-Class for the list used to hold the values of attributes which
have multiple values (such as HTML's 'class'). It's just a regular
list, but you can subclass it and pass it in to the TreeBuilder
constructor as attribute_value_list_class, to have your subclass
instantiated instead.
N©rOrmrnrorqrSrQr‡r‡ßó„òrSr‡có—eZdZdZy)Ú
AttributeDictz‘Superclass for the dictionary used to hold a tag's
attributes. You can use this, but it's just a regular dict with no
special logic.
NrˆrqrSrQr‹r‹ès„òrSr‹có$‡—eZdZdZdˆfd„ ZˆxZS)ÚXMLAttributeDictzyA dictionary for holding a Tag's attributes, which processes
incoming values for consistency with the HTML spec.
có’•—|€d}t|t«rn!t|ttf«r t |«}t
‰|�||«y)zíSet an attribute value, possibly modifying it to comply with
the XML spec.
This just means converting common non-string values to
strings: XML attributes may have "any literal string as a
value."
Nr‚)Ú
isinstanceÚboolÚintÚfloatr@ÚsuperÚ __setitem__©ryÚkeyÚvalueÚ __class__s €rQr”zXMLAttributeDict.__setitem__ôsFø€ð ˆ=؈EÜ �eœTÔ "ð
Ü
˜¤¤U˜|Ô
,ô ˜“JˆEä
‰Ñ˜C Õ'rS©r–r@r—rrlÚNone©rOrmrnror”Ú
__classcell__©r˜s@rQr�r�ïsø„ñ÷(ñ(rSr�có$‡—eZdZdZdˆfd„ ZˆxZS)ÚHTMLAttributeDictaŽA dictionary for holding a Tag's attributes, which processes
incoming values for consistency with the HTML spec, which says
'Attribute values are a mixture of text and character
references...'
Basically, this means converting common non-string values into
strings, like XMLAttributeDict, though HTML also has some rules
around boolean attributes that XML doesn't have.
cóà•—|dvr||vr||=yt|t«r t|t«r
|j}n$|}n!t|tt
f«r t
|«}t‰|�!||«y)z\Set an attribute value, possibly modifying it to comply
with the HTML spec,
)FNN) r�r�rbrCr‘r’r@r“r”r•s €rQr”zHTMLAttributeDict.__setitem__smø€ð �MÑ !ð�d‰{ؘ�IØ Ü �eœTÔ "ô˜#Ô2Ô3ØŸ™‘à‘Ü
˜¤¤U˜|Ô
,ô˜“JˆEÜ
‰Ñ˜C Õ'rSr™r›r�s@rQrŸrŸsø„ñ÷(ñ(rSrŸcóh—eZdZUdZej
dej «Zded<dd„Z d d
d„Z
y) ÚContentMetaAttributeValuea­A generic stand-in for the value of a ``<meta>`` tag's ``content``
attribute.
When Beautiful Soup parses the markup:
``<meta http-equiv="content-type" content="text/html; charset=utf8">``
The value of the ``content`` attribute will become one of these objects.
If the document is later encoded to an encoding other than UTF-8, its
``<meta>`` tag will mention the new encoding instead of ``utf8``.
z((^|;)\s*charset=)([^;]*)r>Ú
CHARSET_REcóv—|jj|«tj||«}||_|Sr)r£Úsearchr@rhrtr€s rQrhz!ContentMetaAttributeValue.__new__Ls1€Ø �‰×јnÔ-Ü�k‰k˜#˜~Ó.ˆØ+ˆÔ؈
rSc󸇗‰tvr&|jjd|j«Sdˆfd„ }|jj||j«S)z¶When an HTML document is being encoded to a given encoding, the
value of the ``charset=`` in a ``<meta>`` tag's ``content`` becomes
the name of the encoding.
r‚có,•—|jd«‰zS)Né)Úgroup)Úmatchrzs €rQÚrewritez>ContentMetaAttributeValue.substitute_encoding.<locals>.rewriteZsø€Ø—;‘;˜q“>Ð$5Ñ5Ð 5rS)rªz
re.Match[str]rlr@)r`r£Úsubrt)ryrzr«s ` rQr{z-ContentMetaAttributeValue.substitute_encodingRsOø€ð
Ô 9Ñ 9Ø—?‘?×&Ñ& r¨4×+>Ñ+>Ó?Ð ?õ 6ð�‰×"Ñ" 7¨D×,?Ñ,?Ó@Ð@rSNrƒr„r…) rOrmrnroÚreÚcompileÚMr£rprhr{rqrSrQr¢r¢:s0…ñ
ð *˜rŸz™zÐ*FÈÏÉÓM€J� ÓMóõ ArSr¢cót —eZdZUdZdZded<ded<ded<d ed
<d ed <d ed <d ed
<dZded< dw dxd„Zdyd„Z dzd„Z e
d{d„«Z e dd d«Z
e dd
d«Zd|d}d„Zd~d„Ze«Zded<def dd„Ze
d€d„«Zddef d�d„ZeZe
e«Zd‚d„Zed d!d«Zdƒd"„Zd„d…d#„Zd†d$„Z d‡ dˆd%„Ze d&d'd«Zd‰d(„Z d‰d)„Z!e" dŠ d‹d*„«Z#e" dŒ d�d+„«Z# dŠ dŽd,„Z#ed-d.d«Z$e" d� d�d/„«Z%e" d‘ d’d0„«Z% d� d“d1„Z%ed2d3d«Z&e" dŠ d‹d4„«Z'e" dŒ d�d5„«Z' dŠ dŽd6„Z'ed7d8d«Z(e" d� d�d9„«Z)e" d‘ d’d:„«Z) d� d“d;„Z)ed<d=d«Z*ed>d=d?«Z+e" dŠ d‹d@„«Z,e" dŒ d�dA„«Z, dŠ dŽdB„Z,edCdDd?«Z-e" d� d�dE„«Z.e" d‘ d’dF„«Z. d� d“dG„Z.edHdId«Z/edJdId?«Z0e" dŠ d‹dK„«Z1e" dŒ d�dL„«Z1 dŠ dŽdM„Z1edNdOd«Z2e" d� d�dP„«Z3e" d‘ d’dQ„«Z3 d� d“dR„Z3edSdTd«Z4edUdTd?«Z5 d” d•dV„Z6edWdXd«Z7 d– d—dY„Z8edZd[d«Z9ed\d[d?«Z:e
d˜d]„«Z;e
d˜d^„«Z< d™d_„Z= dš d›d`„Z>e
dœda„«Z?e
dœdb„«Z@e
dœdc„«ZAe
dœdd„«ZBe
dœde„«ZCe
dœdf„«ZDe
dœdg„«ZEe
dœdh„«ZFe
d�di„«ZGe
dœdj„«ZHdždk„ZIe
d{dl„«ZJeKdmd«dœdn„«ZLeKdod«dœdp„«ZMeKdqd«dœdr„«ZNeKdsd«dœdt„«ZOeKdud«dœdv„«ZPy)ŸÚ PageElementazAn abstract class representing a single element in the parse tree.
`NavigableString`, `Tag`, etc. are all subclasses of
`PageElement`. For this reason you'll see a lot of methods that
return `PageElement`, but you'll never see an actual `PageElement`
object. For the most part you can think of `PageElement` as
meaning "a `Tag` or a `NavigableString`."
NúOptional[bool]Ú known_xmlr�Ú _decomposedú
Optional[Tag]Úparentr*Ú next_elementÚprevious_elementÚ next_siblingÚprevious_siblingFÚhiddencó®—||_||_|j�||j_||_|j�||j_||_|j�||j_|€;|j�/|jj
r|jj
d}||_|j�||j_yy)aISets up the initial relations between this element and
other elements.
:param parent: The parent of this element.
:param previous_element: The element parsed immediately before
this one.
:param next_element: The element parsed immediately after
this one.
:param previous_sibling: The most recently encountered element
on the same level of the parse tree as this one.
:param previous_sibling: The next element to be encountered
on the same level of the parse tree as this one.
Néÿÿÿÿ)r¶r¸r·r¹rºÚcontents)ryr¶r¸r·rºr¹s rQÚsetupzPageElement.setup~sÌ€ð2ˆŒ à 0ˆÔØ × Ñ Ð ,Ø15ˆD× !Ñ !Ô .à(ˆÔØ × Ñ Ð (Ø15ˆD× Ñ Ô .à(ˆÔØ × Ñ Ð (Ø15ˆD× Ñ Ô .ð
Ð $Ø— ‘ Ð'Ø— ‘ ×$Ò$à#Ÿ{™{×3Ñ3°BÑ7Ð à 0ˆÔØ × Ñ Ð ,Ø15ˆD× !Ñ !Õ .ð -rScór—|€|St|t«s|j|«}|j|«}|S)z¹Format the given string using the given formatter.
:param s: A string.
:param formatter: A Formatter object, or a string naming one of the standard formatters.
)r�r
Úformatter_for_nameÚ
substitute)ryÚsÚ formatterÚoutputs rQÚ
format_stringzPageElement.format_string°s>€ð Р؈Hܘ)¤YÔ/Ø×/Ñ/° Ó:ˆIØ×%Ñ% aÓ(ˆØˆ
rScóÊ—t|t«r|S|jrt}tj}nt
}t
j}t
|«r ||¬«S||S)aËLook up or create a Formatter for the given identifier,
if necessary.
:param formatter: Can be a `Formatter` object (used as-is), a
function (used as the entity substitution hook for an
`bs4.formatter.XMLFormatter` or
`bs4.formatter.HTMLFormatter`), or a string (used to look
up an `bs4.formatter.XMLFormatter` or
`bs4.formatter.HTMLFormatter` in the appropriate registry.
)Úentity_substitution)r�r
Ú_is_xmlr ÚREGISTRYr Úcallable)ryÚformatter_nameÚcÚregistrys rQrÁzPageElement.formatter_for_name½s[€ô �n¤iÔ 0Ø!Ð !ð �<Š<܈AÜ#×,Ñ,‰HäˆAÜ$×-Ñ-ˆHÜ �NÔ #Ù¨Ô8Ð 8ؘÑ'Ð'rScó�—|j� |jS|j€
t|dd«S|jjS)aIs this element part of an XML tree or an HTML tree?
This is used in formatter_for_name, when deciding whether an
XMLFormatter or HTMLFormatter is more appropriate. It can be
inefficient, but it should be called very rarely.
Úis_xmlF)r³r¶ÚgetattrrÉ©rys rQrÉzPageElement._is_xmlÙsG€ð �>‰>Ð %ð—>‘>Ð !ð
�;‰;Ð ô˜4 ¨5Ó1Ð 1Ø�{‰{×"Ñ"Ð"rSÚ nextSiblingú4.0.0ÚpreviousSiblingcó—t«‚rrv©ryÚmemoÚ recursives rQÚ __deepcopy__zPageElement.__deepcopy__ós €Ü!Ó#Ð#rScó$—|ji«S)zˆA copy of a PageElement can only be a deep copy, because
only one PageElement can occupy a given place in a parse tree.
)rÚrÒs rQÚ__copy__zPageElement.__copy__ös€ð× Ñ  Ó$Ð$rSúIterable[type[NavigableString]]Údefaultcó—t«‚)z�Yield all strings of certain classes, possibly stripping them.
This is implemented differently in `Tag` and `NavigableString`.
rv)ryÚstripÚtypess rQÚ _all_stringszPageElement._all_stringsþs
€ô"Ó#Ð#rSc#ó@K—|jd«D]}|–—Œy­w)zÄYield all interesting strings in this PageElement, stripping them
first.
See `Tag` for information on which strings are considered
interesting in a given context.
TN©râ)ryÚstrings rQÚstripped_stringszPageElement.stripped_stringss"èø€ð×'Ñ'¨Ö-ˆFØ‹Lñ.ùs‚r‚cól—|j|j||¬«D�cgc]}|‘Œc}«Scc}w)a˜Get all child strings of this PageElement, concatenated using the
given separator.
:param separator: Strings will be concatenated using this separator.
:param strip: If True, strings will be stripped before being
concatenated.
:param types: A tuple of NavigableString subclasses. Any
strings of a subclass not found in this list will be
ignored. Although there are exceptions, the default
behavior in most cases is to consider only NavigableString
and CData objects. That means no comments, processing
instructions, etc.
:return: A string.
)rá)Újoinrâ)ryÚ separatorràrárÃs rQÚget_textzPageElement.get_texts7€ð.�~‰~¨$×*;Ñ*;¸EÈÐ*;Ô*OÓPÑ*O QšqÐ*OÑPÓQÐQùÒPs¡ 1cób‡—‰j€ td«‚t|«dk(r |d‰ur‰Stˆfd„|D««r td«‚‰j}‰jj ‰«}‰j |¬«t
||¬«D]\}}|j||«Œ‰S)z¾Replace this `PageElement` with one or more other elements,
objects, keeping the rest of the tree the same.
:return: This `PageElement`, no longer part of the tree.
z^Cannot replace one element with another when the element to be replaced is not part of a tree.r¨rc3ó:•K—|]}|‰ju–—Œy­wr©r¶©Ú.0Úxrys €rQÚ <genexpr>z+PageElement.replace_with.<locals>.<genexpr><søèø€Ð.© Aˆq�D—K‘KÔ©ùsƒz%Cannot replace a Tag with its parent.©Ú _self_index)Ústart)r¶Ú
ValueErrorÚlenÚanyÚindexÚextractÚ enumerateÚinsert)ryÚargsÚ
old_parentÚmy_indexÚidxÚ replace_withs` rQrzPageElement.replace_with.s¯ø€ð �;‰;Ð Üð@óð
ô ˆt‹9˜Š>˜d 1™g¨™oàˆKÜ Ó.©Ó.Ô .ÜÐDÓEÐ EØ—[‘[ˆ
Ø—;‘;×$Ñ$ TÓ*ˆØ � ‰  ˆ Ô*Ü!*¨4°x×!@Ñ ˆC�Ø × Ñ ˜c <Õ 0ð"Aàˆ rSÚ replaceWithrcóJ—|j|«}|j|«|S)zÎWrap this `PageElement` inside a `Tag`.
:return: ``wrap_inside``, occupying the position in the tree that used
to be occupied by this object, and with this object now inside it.
)rÚappend)ryÚ wrap_insideÚmes rQÚwrapzPageElement.wrapGs(€ð ×
Ñ
˜{Ó
+ˆØ×ј2ÔØÐrScó¸—|j�4|€|jj|«}|jj|=|j«}t t
|«}|j }|j�|j|ur||j_|�||jur|j|_d|_d|_d|_|j�3|j|jur|j|j_ |j�3|j|jur|j|j_dx|_|_ |S)a'Destructively rips this element out of the tree.
:param _self_index: The location of this element in its parent's
.contents, if known. Passing this in allows for a performance
optimization.
:return: this `PageElement`, no longer part of the tree.
N)
r¶rør¾Ú_last_descendantrr±r·r¸rºr¹)ryróÚ
last_childr·s rQrùzPageElement.extractQs@€ð �;‰;Ð "ØÐ"Ø"Ÿk™k×/Ñ/°Ó5� Ø— ‘ ×$Ñ$ [Ð1ð
×*Ñ*Ó,ˆ
ô œ+ zÓ2ˆ
Ø!×.Ñ.ˆ à × Ñ Ð ,Ø×$Ñ$¨LÑ8Ø5A�×%Ñ%Ô2Ø Ð #¨ ¸D×<QÑ<QÑ(QØ,0×,AÑ,AˆLÔ )Ø $ˆÔØ"&ˆ
ÔàˆŒ à × !Ñ !Ð -Ø×%Ñ%¨T×->Ñ->Ñ>à15×1BÑ1BˆD× !Ñ !Ô .à × Ñ Ð )Ø×!Ñ!¨×)>Ñ)>Ñ>à15×1FÑ1FˆD× Ñ Ô .Ø48Ð8ˆÔ Ô 1؈ rScóÒ—|j«|}d}|�Q|j}|jj«t |t
«rd|_g|_d|_|}|�ŒPyy)a¥Recursively destroys this `PageElement` and its children.
The element will be removed from the tree and wiped out; so
will everything beneath it.
The behavior of a decomposed `PageElement` is undefined and you
should never use one for anything, but if you need to *check*
whether an element has been decomposed, you can use the
`PageElement.decomposed` property.
Nr‚T) rùr·Ú__dict__Úclearr�ÚTagrCr¾r´)ryÚeÚnext_ups rQÚ decomposezPageElement.decompose�s`€ð
� ‰ ŒØ#ˆØ%)ˆØˆmØ—n‘nˆGØ
�J‰J× Ñ Ô Ü˜!œSÔ!Ø�”Ø�”
Ø ˆAŒM؈Að‹mrScóô—|r#|j�|jj}nJ|}t|t«r8|jr,|jd}t|t«r
|jrŒ,|s||urd}|S)apFinds the last element beneath this object to be parsed.
Special note to help you figure things out if your type
checking is tripped up by the fact that this method returns
_AtMostOneElement instead of PageElement: the only time
this method returns None is if `accept_self` is False and the
`PageElement` has no children--either it's a NavigableString
or an empty Tag.
:param is_initialized: Has `PageElement.setup` been called on
this `PageElement` yet?
:param accept_self: Is ``self`` an acceptable answer to the
question?
Nr½)r¹r¸r�r
r¾)ryÚis_initializedÚ accept_selfr s rQrzPageElement._last_descendant˜ss€ñ$ ˜d×/Ñ/Ð;Ø×*Ñ*×;Ñ;‰JàˆJܘZ¬Ô-°*×2EÒ2EØ'×0Ñ0°Ñ4�
ô˜Z¬Ô-°*×2EÓ2Eá˜z¨TÑ1؈JØÐrSÚ_lastRecursiveChildrcó.‡—‰j}|€ td«‚tˆfd„|D««r td«‚g}|D]T}t|t«r|j «|j
‰«}|j|j||««ŒV|S)aVMakes the given element(s) the immediate predecessor of this one.
All the elements will have the same `PageElement.parent` as
this one, and the given elements will occur immediately before
this one.
:param args: One or more PageElements.
:return The list of PageElements that were inserted.
z2Element has no parent, so 'before' has no meaning.c3ó&•K—|]}|‰u–—Œ
y­wrrqrîs €rQrñz,PageElement.insert_before.<locals>.<genexpr>Æóøèø€Ð'¡$˜Qˆq�DŒy¡$ùóƒz&Can't insert an element before itself.© r¶rõr÷r�r±rùrøÚextendrû)ryrür¶ÚresultsÚ predecessorrøs` rQÚ
insert_beforezPageElement.insert_before¸sŒø€ð—‘ˆØ ˆ>ÜÐQÓRÐ RÜ Ó'¡$Ó'Ô 'ÜÐEÓFÐ FØ%'ˆÛˆKô˜+¤{Ô3Ø×#Ñ#Ô%Ø—L‘L Ó&ˆEØ �N‰N˜6Ÿ=™=¨° Ó<Õ =ð
 ðˆrScóH‡—‰j}|€ td«‚tˆfd„|D««r td«‚d}g}|D]_}t|t«r|j «|j
‰«}|j|j|dz|z|««|dz
}Œa|S)aOMakes the given element(s) the immediate successor of this one.
The elements will have the same `PageElement.parent` as this
one, and the given elements will occur immediately after this
one.
:param args: One or more PageElements.
:return The list of PageElements that were inserted.
z1Element has no parent, so 'after' has no meaning.c3ó&•K—|]}|‰u–—Œ
y­wrrqrîs €rQrñz+PageElement.insert_after.<locals>.<genexpr>ârrz%Can't insert an element after itself.rr¨r)ryrür¶ÚoffsetrÚ successorrøs` rQÚ insert_afterzPageElement.insert_afterÓs£ø€ð—‘ˆØ ˆ>ÜÐPÓQÐ QÜ Ó'¡$Ó'Ô 'ÜÐDÓEÐ EàˆØ%'ˆÛˆIô˜)¤[Ô1Ø×!Ñ!Ô#Ø—L‘L Ó&ˆEØ �N‰N˜6Ÿ=™=¨°©°VÑ);¸YÓGÔ HØ �a‰K‰FððˆrSc ó—yrrq©ryrCÚattrsråÚkwargss rQÚ find_nextzPageElement.find_nextôó€ð rSc ó—yrrqr$s rQr'zPageElement.find_nextþr(rSc óB—|j|j|||fi|¤ŽS)aíFind the first PageElement that matches the given criteria and
appears later in the document than this PageElement.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a NavigableString with specific text.
:kwargs: Additional filters on attribute values.
)Ú _find_oneÚ
find_all_nextr$s rQr'zPageElement.find_nexts&€ð$ˆt�~‰~˜d×0Ñ0°$¸¸vÑPÈÑPÐPrSÚfindNextr'c ó—yrrq©ryrCr%råÚlimitÚ _stacklevelr&s rQr,zPageElement.find_all_nextó€ð rSc ó—yrrqr/s rQr,zPageElement.find_all_next*r2rSc óN—|j|||||jfd|dzi|¤ŽS)a}Find all `PageElement` objects that match the given criteria and
appear later in the document than this `PageElement`.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a NavigableString with specific text.
:param limit: Stop looking after finding this many results.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
r1r¨)Ú _find_allÚ
next_elementsr/s rQr,zPageElement.find_all_next6óD€ð,ˆt�~‰~Ø Ø Ø Ø Ø × Ñ ñ 
ð $ a™ð

ðñ
ð
rSÚ findAllNextr,c ó—yrrqr$s rQÚfind_next_siblingzPageElement.find_next_siblingXr(rSc ó—yrrqr$s rQr:zPageElement.find_next_siblingbr(rSc óB—|j|j|||fi|¤ŽS)aëFind the closest sibling to this PageElement that matches the
given criteria and appears later in the document.
All find_* methods take a common set of arguments. See the
online documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a `NavigableString` with specific text.
:kwargs: Additional filters on attribute values.
)r+Úfind_next_siblingsr$s rQr:zPageElement.find_next_siblingls&€ð$ˆt�~‰~˜d×5Ñ5°t¸UÀFÑUÈfÑUÐUrSÚfindNextSiblingr:c ó—yrrqr/s rQr=zPageElement.find_next_siblings„r2rSc ó—yrrqr/s rQr=zPageElement.find_next_siblings�r2rSc óN—|j|||||jfd|dzi|¤ŽS)apFind all siblings of this `PageElement` that match the given criteria
and appear later in the document.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a `NavigableString` with specific text.
:param limit: Stop looking after finding this many results.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
r1r¨)r5Ú
next_siblingsr/s rQr=zPageElement.find_next_siblingsœr7rSÚfindNextSiblingsr=ÚfetchNextSiblingsú3.0.0c ó—yrrqr$s rQÚ
find_previouszPageElement.find_previousÃr(rSc ó—yrrqr$s rQrGzPageElement.find_previousÍr(rSc óB—|j|j|||fi|¤ŽS)aôLook backwards in the document from this `PageElement` and find the
first `PageElement` that matches the given criteria.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a `NavigableString` with specific text.
:kwargs: Additional filters on attribute values.
)r+Úfind_all_previousr$s rQrGzPageElement.find_previous×s&€ð$ˆt�~‰~˜d×4Ñ4°d¸EÀ6ÑTÈVÑTÐTrSÚ findPreviousrGc ó—yrrqr/s rQrJzPageElement.find_all_previousír2rSc ó—yrrqr/s rQrJzPageElement.find_all_previousùr2rSc óN—|j|||||jfd|dzi|¤ŽS)ayLook backwards in the document from this `PageElement` and find all
`PageElement` that match the given criteria.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a `NavigableString` with specific text.
:param limit: Stop looking after finding this many results.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
r1r¨)r5Úprevious_elementsr/s rQrJzPageElement.find_all_previousóD€ð,ˆt�~‰~Ø Ø Ø Ø Ø × "Ñ "ñ 
ð $ a™ð

ðñ
ð
rSÚfindAllPreviousrJÚfetchAllPreviousc ó—yrrqr$s rQÚfind_previous_siblingz!PageElement.find_previous_sibling,r(rSc ó—yrrqr$s rQrTz!PageElement.find_previous_sibling6r(rSc óB—|j|j|||fi|¤ŽS)aòReturns the closest sibling to this `PageElement` that matches the
given criteria and appears earlier in the document.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a `NavigableString` with specific text.
:kwargs: Additional filters on attribute values.
)r+Úfind_previous_siblingsr$s rQrTz!PageElement.find_previous_sibling@s.€ð$ˆt�~‰~Ø × 'Ñ '¨¨u°fñ
Ø@Fñ
ð
rSÚfindPreviousSiblingrTc ó—yrrqr/s rQrWz"PageElement.find_previous_siblingsZr2rSc ó—yrrqr/s rQrWz"PageElement.find_previous_siblingsfr2rSc óN—|j|||||jfd|dzi|¤ŽS)aqReturns all siblings to this PageElement that match the
given criteria and appear earlier in the document.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param string: A filter for a NavigableString with specific text.
:param limit: Stop looking after finding this many results.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
r1r¨)r5Úprevious_siblingsr/s rQrWz"PageElement.find_previous_siblingsrrPrSÚfindPreviousSiblingsrWÚfetchPreviousSiblingsc óF—d}|j||dfddi|¤Ž}|r|d}|S)aéFind the closest parent of this PageElement that matches the given
criteria.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param self: Whether the PageElement itself should be considered
as one of its 'parents'.
:kwargs: Additional filters on attribute values.
Nr¨r1ér)Ú find_parents)ryrCr%r&Úrrs rQÚ find_parentzPageElement.find_parent™sE€ð(
ˆØ#�$×#Ñ#Ø �%˜ñ
Ø()ð
Ø-3ñ
ˆñ ؘ‘
ˆA؈rSÚ
findParentrcc
ó|—|j}ttt|j||d||fd|dzi|¤Ž«S)aúFind all parents of this `PageElement` that match the given criteria.
All find_* methods take a common set of arguments. See the online
documentation for detailed explanations.
:param name: A filter on tag name.
:param attrs: Additional filters on attribute values.
:param limit: Stop looking after finding this many results.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
Nr1r¨)ÚparentsrÚ ResultSetr
r5)ryrCr%r0r1r&Úiterators rQrazPageElement.find_parents·sN€ð&—<‘<ˆô”Iœc‘N N D§N¡NØ �%˜˜u hñ%
Ø<GÈ!¹Oð%
ØOUñ%
ó ð rSÚ findParentsraÚ fetchParentscó—|jS)z?The `PageElement`, if any, that was parsed just after this one.©r·rÒs rQÚnextzPageElement.nextÔs€ð× Ñ Ð rScó—|jS)z@The `PageElement`, if any, that was parsed just before this one.©r¸rÒs rQÚpreviouszPageElement.previousÙó€ð×$Ñ$Ð$rSc ó4—d}||||dfddi|¤Ž}|r|d}|S)Nr¨r1érrq)ryÚmethodrCr%rår&rbrs rQr+zPageElement._find_oneàs5€ð $ˆÙ!'¨¨e°V¸QÑ!XÈAÐ!XÐQWÑ!XˆÙ ؘ‘
ˆA؈rSc ó—|€1d|vr-|jd«}tjdt|¬«d|vr8tjtj
t
dd¬«zt|¬«dd lm}t||«r|} nt|||fi|¤Ž} |€Þ|sÜ|sÚ|sØ|d
us|€,|D�
cgc]}
t|
t«sŒ|
‘Œ} }
t| | «St|t«r–|jd «d k(r|jd d «\} }
nd} |}
g} |D]U}
t|
t«sŒ|
j |k(s"|
j |
k(sŒ3| �|
j"| k(sŒE| j%|
«ŒWt| | «S| j'||«Scc}
w)
z8Iterates over a generator looking for things that match.NÚtextzOThe 'text' argument to find()-type methods is deprecated. Use 'string' instead.rEÚ_classÚclass_)ÚoriginalÚ autocorrectrr&Trgr¨)ÚpoprIrJrLr
ÚMESSAGEÚdictÚ
bs4.filterr'r�Ú SoupStrainerr
rgr@ÚcountÚsplitrCrdrÚfind_all)ryrCr%rår0Ú generatorr1r&r'ÚmatcherÚelementÚresultrdÚ
local_names rQr5zPageElement._find_allòsŠ€ð ˆ>˜f¨Ñ.Ø—Z‘Z Ó'ˆFÜ �M‰MØaÜ"Ø&õ
ð �vÑ Ü �M‰MÜ1×9Ñ9ÜØ%Ø (ôñô
2Ø&õ
õ -ä �d˜MÔ *؉Gä" 4¨°ÑA¸&ÑAˆGð ˆ>¡%±¹fØ�t‰|˜t˜|á1:ÓW± g¼jÈÔRUÕ>Vš'°�ÐWÜ  ¨&Ó1Ð1ܘD¤#Ô&à—:‘:˜c“? aÒ'ð*.¯©°C¸Ó);Ñ&�F™Jà!�FØ!%�JØ�Û(�GÜ% g¬sÔ3Ø Ø—|‘| tÒ+ØŸ ™ ¨
Ó2Ø#˜^¨w¯~©~ÀÓ/GàŸ
™
 gÕ.ð )ô! ¨&Ó1Ð1Ø×Ñ  ¨5Ó1Ð1ùò-Xs Â%FÂ;Fc#óTK—|j}|�|j}|–—|}|�Œyy­w)z1All PageElements that were parsed after this one.Nrl©ryÚir!s rQr6zPageElement.next_elements6s2èø€ð
× Ñ ˆØˆmØŸ™ˆIØŠG؈Að‹mùó‚#(¦(có8—|j|j«S)zBThis PageElement, then all PageElements that were parsed after it.)Ú _self_andr6rÒs rQÚself_and_next_elementsz"PageElement.self_and_next_elements?ó€ð�~‰~˜d×0Ñ0Ó1Ð1rSc#óTK—|j}|�|j}|–—|}|�Œyy­w)zVAll PageElements that are siblings of this one but were parsed
later.
N)r¹r‰s rQrBzPageElement.next_siblingsDs2èø€ð
× Ñ ˆØˆmØŸ™ˆIØŠG؈Að‹mùr‹có8—|j|j«S)z+This PageElement, then all of its siblings.)r�rBrÒs rQÚself_and_next_siblingsz"PageElement.self_and_next_siblingsOr�rSc#óTK—|j}|�|j}|–—|}|�Œyy­w)zhAll PageElements that were parsed before this one.
:yield: A sequence of PageElements.
Nror‰s rQrOzPageElement.previous_elementsTs4èø€ð
× !Ñ !ˆØˆmØ×*Ñ*ˆIØŠG؈Að‹mùr‹có8—|j|j«S)zEThis PageElement, then all elements that were parsed
earlier.)r�rOrÒs rQÚself_and_previous_elementsz&PageElement.self_and_previous_elements`ó€ð�~‰~˜d×4Ñ4Ó5Ð5rSc#óTK—|j}|�|j}|–—|}|�Œyy­w)z…All PageElements that are siblings of this one but were parsed
earlier.
:yield: A sequence of PageElements.
N)rºr‰s rQr\zPageElement.previous_siblingsfs4èø€ð
× !Ñ !ˆØˆmØ×*Ñ*ˆIØŠG؈Að‹mùr‹có8—|j|j«S)zLThis PageElement, then all of its siblings that were parsed
earlier.)r�r\rÒs rQÚself_and_previous_siblingsz&PageElement.self_and_previous_siblingssr–rSc#óTK—|j}|�|j}|–—|}|�Œyy­w)z„All elements that are parents of this PageElement.
:yield: A sequence of Tags, ending with a BeautifulSoup object.
Nrír‰s rQrfzPageElement.parentsys0èø€ð
�K‰KˆØˆmØŸ™ˆIØŠG؈Að‹mùr‹có8—|j|j«S)z€This element, then all of its parents.
:yield: A sequence of PageElements, ending with a BeautifulSoup object.
)r�rfrÒs rQÚself_and_parentszPageElement.self_and_parents…s€ð �~‰~˜dŸl™lÓ+Ð+rSc#óBK—|js|–—|D]}|–—Œy­w)zmModify a generator by yielding this element, then everything
yielded by the other generator.
N)r»)ryÚother_generatorrŠs rQr�zPageElement._self_and�s#èø€ð�{Š{ØŠJÛ ˆAØ‹Gñ!ùs‚có$—t|dd«xsdS)z0Check whether a PageElement has been decomposed.r´F)rÑrÒs rQÚ
decomposedzPageElement.decomposed–s€ô�t˜]¨EÓ2Ò;°eÐ;rSr6có—|jS©z:meta private:)r6rÒs rQÚ
nextGeneratorzPageElement.nextGenerator›ó€ð×!Ñ!Ð!rSrBcó—|jSr¢)rBrÒs rQÚnextSiblingGeneratorz PageElement.nextSiblingGenerator r¤rSrOcó—|jSr¢)rOrÒs rQÚpreviousGeneratorzPageElement.previousGenerator¥ó€ð×%Ñ%Ð%rSr\có—|jSr¢)r\rÒs rQÚpreviousSiblingGeneratorz$PageElement.previousSiblingGeneratorªr©rSrfcó—|jSr¢)rfrÒs rQÚparentGeneratorzPageElement.parentGenerator¯s€ð�|‰|ÐrS)NNNNN) r¶rµr¸r*r·r*rºr*r¹r*rlrš)rÃr@rÄúOptional[_FormatterOrName]rlr@)rÌz4Union[_FormatterOrName, _EntitySubstitutionFunction]rlr
©rlr�©F©rØzDict[Any, Any]rÙr�rlr!©rlr!)ràr�rárÝrlú
Iterator[str]©rlr³)rér@ràr�rázIterable[Type[NavigableString]]rlr@)rür0rlr!)rr
rlr
r)róú
Optional[int]rlr!©rlrš)TT)rr�rr�rlr*)rür0rlúList[PageElement])NNN)
rCr<r%úOptional[_StrainableAttributes]råršr&r5rlr+)NNr‚)
rCršr%ršrår7r&r5rlr,)
rCr<r%r¸råúOptional[_StrainableString]r&r5rlúBUnion[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement])NNNNrD)rCr<r%r¸råršr0rµr1r‘r&r5rlr9)NNr‚NrD)rCršr%ršrår7r0rµr1r‘r&r5rlr8)rCr<r%r¸rår¹r0rµr1r‘r&r5rlú6Union[_SomeTags, _SomeNavigableStrings, _QueryResults]rk)rCr<r%r¸r&r5rlr+)NNNrD) rCr<r%r¸r0rµr1r‘r&r5rlr9)rlr*) rtrrCr<r%r¸rår¹r&r5rlr*)r`)rCr<r%r¸rår¹r0rµrƒúIterator[PageElement]r1r‘r&r5rlr2©rlr¼)rlz
Iterator[Tag])ržr¼rlr¼)QrOrmrnror³rpr»r¿rÆrÁÚpropertyrÉrrÓrÕrÚrÜÚtuplerÞrârærêÚgetTextrvrr rrrùrrrrr"r r'r-r,r8r:r>r=rCrDrGrKrJrQrRrTrXrWr]r^rcrdrarirjrmrpr+r5r6rŽrBr’rOr•r\r™rfrœr�r rr£r¦r¨r«r­rqrSrQr±r±`sÝ
…ñð!%€Iˆ~Ó$ðÓà ÓØ#Ó#Ø'Ó'Ø#Ó#Ø'Ó'ð€FˆDÓð!%Ø.2Ø*.Ø.2Ø*.ð
06àð06ð,ð06ð(ð 06ð
,ð 06ð (ð
06ð
ó06ód ð(ØRð(à ó(ð8ò#óð#ñ,$ M°>À7ÓK€KÙ'Ð(9Ð;MÈwÓW€Oô$ó%ñ 05«w€GÐ
,Ó6ð"ÈGð$Øð$Ø*Ið$à ó$ðòóððØØ18ð RàðRððRð/ð Rð
ó Rð2€GÙ �HÓ €Dóñ.-¨]¸NÈGÓT€Kóô.ó`ð0@DðØ"ðØ8<ðà óñ8,ØÐ1°7óÐóó6ðBð%)Ø59Øð  à!ð ð3ð ðð  ð
+ð  ð
ò
 óð ððØØ&(ð  àð ðð ð&ð  ð
+ð  ð
#ò
 óð ð!%Ø15Ø.2ð QàðQð/ðQð,ð Qð
'ð Qð
Jó
Qñ(*¨*°kÀ7ÓK€Hà
ð!%Ø15ØØ#Øð
 àð  ð/ð  ðð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ððØØ$&Ø#Øð
 àð  ðð  ð"ð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ð!%Ø15Ø.2Ø#Øð

àð
ð/ð
ð,ð 
ð
ð 
ð ð

ð'ð
ð
>ó
ñ@-¨]¸OÈWÓU€Kà
ð%)Ø59Øð  à!ð ð3ð ðð  ð
+ð  ð
ò
 óð ððØØ&(ð  àð ðð ð&ð  ð
+ð  ð
#ò
 óð ð!%Ø15Ø.2ð VàðVð/ðVð,ð Vð
'ð Vð
Jó
Vñ(1ØÐ.°ó€Oðð!%Ø15ØØ#Øð
 àð  ð/ð  ðð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ððØØ$&Ø#Øð
 àð  ðð  ð"ð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ð!%Ø15Ø.2Ø#Øð

àð
ð/ð
ð,ð 
ð
ð 
ð ð

ð'ð
ð
>ó
ñ@2ØÐ0°'óÐñ3ØÐ1°7óÐðð%)Ø59Øð  à!ð ð3ð ðð  ð
+ð  ð
ò
 óð ððØØ&(ð  àð ðð ð&ð  ð
*ð  ð
#ò
 óð ð!%Ø15Ø.2ð UàðUð/ðUð,ð Uð
'ð Uð
Jó
Uñ(.¨n¸oÈwÓW€Là
ð!%Ø15ØØ#Øð
 àð  ð/ð  ðð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ððØØ$&Ø#Øð
 àð  ðð  ð"ð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ð!%Ø15Ø.2Ø#Øð

àð
ð/ð
ð,ð 
ð
ð 
ð ð

ð'ð
ð
>ó
ñ@1ØÐ.°ó€Oñ2ØÐ/°óÐðð%)Ø59Øð  à!ð ð3ð ðð  ð
+ð  ð
ò
 óð ððØØ&(ð  àð ðð ð&ð  ð
*ð  ð
#ò
 óð ð!%Ø15Ø.2ð 
àð
ð/ð
ð,ð 
ð
'ð 
ð
Jó

ñ,5ØÐ6¸óÐðð!%Ø15ØØ#Øð
 àð  ð/ð  ðð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ððØØ$&Ø#Øð
 àð  ðð  ð"ð  ð
ð  ð ð
 ð'ð  ð
ò  óð  ð!%Ø15Ø.2Ø#Øð

àð
ð/ð
ð,ð 
ð
ð 
ð ð

ð'ð
ð
>ó
ñ@6ØÐ 8¸'óÐñ7ØÐ!9¸7óÐð !%Ø15ðàðð/ðð'ð ð
ó ñ8,¨L¸-ÈÓQ€Jð!%Ø15Ø#Øð  àð ð/ð ðð  ð
ð  ð 'ð
 ð
ó ñ4-¨]¸NÈGÓT€KÙ-¨n¸nÈgÓV€Là
ò!óð!ðò%óð%ð ð ð
ððð/ðð,ðð'ðð
óð2ð@2àð@2ð/ð@2ð,ð @2ð
ð @2ð )ð
@2ðð@2ð'ð@2ð
ó@2ðHòóððò2óð2ðòóððò2óð2ðò óð ðò6óð6ð
ò
óð
ðò6óð6ð
ò óð ðò,óð,óðò<óð<ñ� 'Ó*ò"ó+ð"ñ� 'Ó*ò"ó+ð"ñÐ$ gÓ.ò&ó/ð&ñÐ$ gÓ.ò&ó/ð&ñ�˜GÓ$òó%ñrSr±cóeZdZUdZdZded<dZded<dd„Zddd„Zdd „Z dˆfd
„ Z
e dd „«Z ddd „Z
e dd
„«Zejdd„«Zdej"f dd„Ze dd„«ZˆxZS)r:z²A Python string that is part of a parse tree.
When Beautiful Soup parses the markup ``<b>penguin</b>``, it will
create a `NavigableString` for the string "penguin".
r‚r@ÚPREFIXÚSUFFIXcó¸—t|t«rtj||«}ntj||t«}d|_|j «|S)a-Create a new NavigableString.
When unpickling a NavigableString, this method is called with
the string in DEFAULT_OUTPUT_ENCODING. That encoding needs to be
passed in to the superclass's __new__ or the superclass won't know
how to handle non-ASCII characters.
F)r�r@rhrUr»r¿)rir—Úus rQrhzNavigableString.__new__ÆsF€ô �eœSÔ !Ü— ‘ ˜C Ó'‰Aä— ‘ ˜C Ô(?Ó@ˆA؈ŒØ �‰Œ ؈rSFcó$—t|«|«S)a>A copy of a NavigableString has the same contents and class
as the original, but it is not connected to the parse tree.
:param recursive: This parameter is ignored; it's only defined
so that NavigableString.__deepcopy__ implements the same
signature as Tag.__deepcopy__.
)Útyper×s rQrÚzNavigableString.__deepcopy__Ös€ðŒt�D‹z˜$ÓÐrScó—t|«fSr)r@rÒs rQÚ__getnewargs__zNavigableString.__getnewargs__às€Ü�D“ ˆ|ÐrSc󦕗t|t«r.tdj|jj
««‚t t|�#|«S)zRaise an exception zZstring indices must be integers, not '{0}'. Are you treating a NavigableString like a Tag?) r�r@Ú TypeErrorrKr˜rOr“r:Ú __getitem__)ryr–r˜s €rQrÌzNavigableString.__getitem__ås`ø€ä �cœ3Ô ÜÐx×ÑðAD÷ANñAN÷AWñAWóXóYð
YÜ”_ dÑ7¸Ó<Ð<rScó—|S)z¶Convenience property defined to match `Tag.string`.
:return: This property always returns the `NavigableString` it was
called on.
:meta private:
rqrÒs rQråzNavigableString.stringës €ðˆ rScó^—|j||«}|j|z|jzS)zîRun the string through the provided formatter, making it
ready for output as part of an HTML or XML document.
:param formatter: A `Formatter` object, or a string naming one
of the standard formatters.
©rÆrÂrÃ)ryrÄrÅs rQÚ output_readyzNavigableString.output_readyös.€ð×#Ñ# D¨)Ó4ˆØ�{‰{˜VÑ# d§k¡kÑ1Ð1rScó—y)aSince a NavigableString is not a Tag, it has no .name.
This property is implemented so that code like this doesn't crash
when run on a mixture of Tag and NavigableString objects:
[x.name for x in tag.children]
:meta private:
NrqrÒs rQrCzNavigableString.names€ðrScó—td«‚)zRPrevent NavigableString.name from ever being set.
:meta private:
z)A NavigableString cannot be given a name.©rN)ryrCs rQrCzNavigableString.name s€ô ÐHÓIÐIrSc#óêK—||jurtj}t|«}|�t |t«r||ury||vry|}|r|j «}n|}t
|«dkDr|–—yy­w)aîYield all strings of certain classes, possibly stripping them.
This makes it easy for NavigableString to implement methods
like get_text() as conveniences, creating a consistent
text-extraction API across all PageElements.
:param strip: If True, all strings will be stripped before being
yielded.
:param types: A tuple of NavigableString subclasses. If this
NavigableString isn't one of those subclasses, the
sequence will be empty. By default, the subclasses
considered are NavigableString and CData objects. That
means no comments, processing instructions, etc.
:yield: A sequence that either contains this string, or is empty.
Nr)rÞr
ÚMAIN_CONTENT_STRING_TYPESrÇr�ràrö)ryràráÚmy_typer—Ú final_values rQrâzNavigableString._all_stringss‚èø€ð( �D—L‘LÑ ô×1Ñ1ˆEô�t“*ˆØ Рܘ%¤Ô&à %Ñ'ØØ Ñ%ààˆÙ ØŸ+™+›-‰KàˆKÜ ˆ{Ó ˜aÒ ØÓ ð ùs‚A1A3có"—|j«S)a1Yield this string, but only if it is interesting.
This is defined the way it is for compatibility with
`Tag.strings`. See `Tag` for information on which strings are
interesting in a given context.
:yield: A sequence that either contains this string, or is empty.
rärÒs rQÚstringszNavigableString.stringsFs€ð× Ñ Ó"Ð"rS)r—úUnion[str, bytes]rlr!r°r±)rlz
Tuple[str])r–zUnion[int | slice]rlr@©rlr@©Úminimal)rÄr)rlr@r¶)rCr@rlrš©ràr�rár;rlr³r´)rOrmrnrorÂrprÃrhrÚrÉrÌr¾rårÐrCÚsetterr±rÞrârÙrœr�s@rQr:r:µsºø…ñð€FˆCÓð
€FˆCÓóô  óõ
=ð òóðô2ðò óð ð
‡[�[òJóðJð"À+×BUÑBUð0Øð0Ø*?ð0à ó0ðdò #óô #rScó8—eZdZUdZdZded<dZded<dd d„Zy)
ÚPreformattedStringzÂA `NavigableString` not subject to the normal formatting rules.
This is an abstract class used for special kinds of strings such
as comments (`Comment`) and CDATA blocks (`CData`).
r‚r@rÂrÃNcób—|�|j||«|j|z|jzS)aÃMake this string ready for output by adding any subclass-specific
prefix or suffix.
:param formatter: A `Formatter` object, or a string naming one
of the standard formatters. The string will be passed into the
`Formatter`, but only to trigger any side effects: the return
value is ignored.
:return: The string, with any subclass-specific prefix and
suffix added on.
rÏ)ryrÄs rQrÐzPreformattedString.output_ready]s2€ð Ð Ø × Ñ ˜t YÔ /Ø�{‰{˜TÑ! D§K¡KÑ/Ð/rSr)rÄr®rlr@)rOrmrnrorÂrprÃrÐrqrSrQráráSs"…ñð €FˆCÓØ€FˆCÓõ0rSrácó.—eZdZUdZdZded<dZded<y)ÚCDatazQA `CDATA section <https://dev.w3.org/html5/spec-LC/syntax.html#cdata-sections>`_.z <![CDATA[r@rÂz]]>rÃN©rOrmrnrorÂrprÃrqrSrQräräns…Ù[à€FˆCÓØ€FˆCÔrSräcó.—eZdZUdZdZded<dZded<y)ÚProcessingInstructionzA SGML processing instruction.ú<?r@rÂÚ>rÃNrårqrSrQrçrçus…Ù(à€FˆCÓØ€FˆCÔrSrçcó.—eZdZUdZdZded<dZded<y)ÚXMLProcessingInstructionzIAn `XML processing instruction <https://www.w3.org/TR/REC-xml/#sec-pi>`_.rèr@rÂú?>rÃNrårqrSrQrërë|s…ÙSà€FˆCÓØ€FˆCÔrSrëcó.—eZdZUdZdZded<dZded<y)ÚCommentz‹An `HTML comment <https://dev.w3.org/html5/spec-LC/syntax.html#comments>`_ or `XML comment <https://www.w3.org/TR/REC-xml/#sec-comments>`_.z<!--r@rÂz-->rÃNrårqrSrQrîrîƒs…ñVà€FˆCÓØ€FˆCÔrSrîcó.—eZdZUdZdZded<dZded<y)Ú DeclarationzFAn `XML declaration <https://www.w3.org/TR/REC-xml/#sec-prolog-dtd>`_.rèr@rÂrìrÃNrårqrSrQrðrðŠs…ÙPà€FˆCÓØ€FˆCÔrSrðcór—eZdZUdZe d
d„«Ze d d„«ZdZded<dZ ded<y ) ÚDoctypezKA `document type declaration <https://www.w3.org/TR/REC-xml/#dt-doctype>`_.r@có:—t|j|||««S)a¿Generate an appropriate document type declaration for a given
public ID and system ID.
:param name: The name of the document's root element, e.g. 'html'.
:param pub_id: The Formal Public Identifier for this document type,
e.g. '-//W3C//DTD XHTML 1.1//EN'
:param system_id: The system identifier for this document type,
e.g. 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
)ròÚ_string_for_name_and_ids)rirCÚpub_idÚ system_ids rQÚfor_name_and_idszDoctype.for_name_and_ids”s€ô�s×3Ñ3°D¸&À)ÓLÓMÐMrScóR—|xsd}|�|d|zz
}|�|d|zz
}|S|�|d|zz
}|S)z¹Generate a string to be used as the basis of a Doctype object.
This is a separate method from for_name_and_ids() because the lxml
TreeBuilder needs to call it.
r‚z PUBLIC "%s"z "%s"z SYSTEM "%s"rq)rirCrõrör—s rQrôz Doctype._string_for_name_and_ids£sZ€ð’
˜ˆØ Ð Ø �^ fÑ,Ñ ,ˆEØÐ$ؘ 9Ñ,Ñ,�ðˆ ðÐ
"Ø �^ iÑ/Ñ /ˆE؈ rSz
<!DOCTYPE rÂz>
rÃN)rCr@rõrcrörcrlrò)rCr@rõrcrörcrlr@)
rOrmrnroÚ classmethodr÷rôrÂrprÃrqrSrQròrò‘s‡…ÙUàð NØð NØ -ð NØ:Gð Nà ò Nóð NððØðØ -ðØ:Gðà òóðð"€FˆCÓØ€FˆCÔrSròcó—eZdZdZy)Ú
StylesheetzêA `NavigableString` representing the contents of a `<style> HTML
tag <https://dev.w3.org/html5/spec-LC/Overview.html#the-style-element>`_
(probably CSS).
Used to distinguish embedded stylesheets from textual content.
NrˆrqrSrQrûrû¹r‰rSrûcó—eZdZdZy)ÚScriptzòA `NavigableString` representing the contents of a `<script>
HTML tag
<https://dev.w3.org/html5/spec-LC/Overview.html#the-script-element>`_
(probably Javascript).
Used to distinguish executable code from textual content.
NrˆrqrSrQrýrýÂs„òrSrýcó—eZdZdZy)ÚTemplateStringaA `NavigableString` representing a string found inside an `HTML
<template> tag <https://html.spec.whatwg.org/multipage/scripting.html#the-template-element>`_
embedded in a larger document.
Used to distinguish such strings from the main body of the document.
NrˆrqrSrQrÿrÿÌr‰rSrÿcó—eZdZdZy)ÚRubyTextStringzîA NavigableString representing the contents of an `<rt> HTML
tag <https://dev.w3.org/html5/spec-LC/text-level-semantics.html#the-rt-element>`_.
Can be used to distinguish such strings from the strings they're
annotating.
NrˆrqrSrQrrÕr‰rSrcó—eZdZdZy)ÚRubyParenthesisStringz˜A NavigableString representing the contents of an `<rp> HTML
tag <https://dev.w3.org/html5/spec-LC/text-level-semantics.html#the-rp-element>`_.
NrˆrqrSrQrrÞs„òrSrcó˜—eZdZUdZ dn dod„Zded<ded<ded<ded<ded<d
ed <d
ed <ded<ded<ded<ded<ded <ded
<ded<eddd«Zdpdqd„Zdrd „Z e
dsd!„«Z e d"d«dsd#„«Z
e
dtd$„«Zejdud%„«ZeehZd&ej(f dvd'„Ze
e«Zdwd(„Zdxd)„Zdrd*„ZeZe d+d«dyd,„«Zdzd-„Zd{d.„Zd|d}d/„Zd~d0„Zdd1„Z d€ d�d2„Z! d€ d‚d3„Z"dƒd4„Z#d„d5„Z$d…d6„Z%d†d7„Z&d„d8„Z'd‡d9„Z(dsd:„Z)dˆd;„Z*d‰d<„Z+e, dŠ d‹d=„«Z-e, dŒ d�d>„«Z- dŠ dŽd?„Z-d�d@„Z.d�dA„Z/d�dB„Z0d‘dC„Z1e1xZ2Z3e4ddDdEf d’dF„Z5de4dDdf d“dG„Z6GdH„dIe7«Z8e8«Z9e8«Z:e8«Z;e8«Z< d€ d”dJ„Z= d•dK„Z> d–dL„Z?d—d˜dM„Z@e, d™ dšdN„«ZAe, d› dœdO„«ZA d™ d�dP„ZAde4dDf dždQ„ZBde4dDf dŸdR„ZCe dSd«e4d&dTf d dU„«ZDe, d¡ d¢dV„«ZEe, d£ d¤dW„«ZE d¡ d¥dX„ZEeFdYdZd[«ZGe, dŠ d‹d\„«ZHe, dŒ d�d]„«ZH dŠ dŽd^„ZHeFd_d`d«ZIeFdad`d[«ZJe
d†db„«ZKe
d†dc„«ZLe
d†dd„«ZM d€ d¦de„ZN d§ d¨df„ZOe
d©dg„«ZPe dhd«d†di„«ZQe djd«d†dk„«ZRe dld«dƒdm„«ZSy)ªr
aÄ An HTML or XML tag that is part of a parse tree, along with its
attributes, contents, and relationships to other parts of the tree.
When Beautiful Soup parses the markup ``<b>penguin</b>``, it will
create a `Tag` object representing the ``<b>`` tag. You can
instantiate `Tag` objects directly, but it's not necessary unless
you're adding entirely new markup to a parsed document. Most of
the constructor arguments are intended for use by the `TreeBuilder`
that's parsing a document.
:param parser: A `BeautifulSoup` object representing the parse tree this
`Tag` will be part of.
:param builder: The `TreeBuilder` being used to build the tree.
:param name: The name of the tag.
:param namespace: The URI of this tag's XML namespace, if any.
:param prefix: The prefix for this tag's XML namespace, if any.
:param attrs: A dictionary of attribute values.
:param parent: The `Tag` to use as the parent of this `Tag`. May be
the `BeautifulSoup` object itself.
:param previous: The `PageElement` that was parsed immediately before
parsing this tag.
:param is_xml: If True, this is an XML tag. Otherwise, this is an
HTML tag.
:param sourceline: The line number where this tag was found in its
source document.
:param sourcepos: The character position within ``sourceline`` where this
tag was found.
:param can_be_empty_element: If True, this tag should be
represented as <tag/>. If False, this tag should be represented
as <tag></tag>.
:param cdata_list_attributes: A dictionary of attributes whose values should
be parsed as lists of strings if they ever show up on this tag.
:param preserve_whitespace_tags: Names of tags whose contents
should have their whitespace preserved if they are encountered inside
this tag.
:param interesting_string_types: When iterating over this tag's
string contents in methods like `Tag.strings` or
`PageElement.get_text`, these are the types of strings that are
interesting enough to be considered. By default,
`NavigableString` (normal strings) and `CData` (CDATA
sections) are the only interesting string subtypes.
:param namespaces: A dictionary mapping currently active
namespace prefixes to URIs, as of the point in the parsing process when
this tag was encountered. This can be used later to
construct CSS selectors.
NrCrcrerdr%r²Ú
sourcelinerµÚ sourceposÚcan_be_empty_elementÚcdata_list_attributesúOptional[Dict[str, Set[str]]]Úpreserve_whitespace_tagsúOptional[Set[str]]Úinteresting_string_typesú$Optional[Set[Type[NavigableString]]]có€—|€d|_n|j|_|€ td«‚||_||_|xsi|_||_|r |jr|
€| �|
|_| |_ n|
|_| |_ |€| rt}nt}t}n|j}|j}||_|€
|«|_n„|�.|j r"|j#|j|«|_nT|«|_|j%«D]5\}}t'|t(«r|j|«}||j|<Œ7|r|j*|_n| |_g|_|j1||«d|_|€| |_|
|_||_||_y|j|_|j;|«|j5|«|_|j |_|j6|_|j|j<vr |j<|jh|_y|j>|_y)Nz%No value provided for new tag's name.F) Ú parser_classr˜rõrCreÚ _namespacesrdÚstore_line_numbersrrr�rŸr‡Úattribute_dict_classÚattribute_value_list_classr%rÚ$_replace_cdata_list_attribute_valuesÚitemsr�ÚlistrÐr³r¾r¿r»rr
r Úset_up_substitutionsÚstring_containersrÕ)ryÚparserÚbuilderrCrerdr%r¶rprÐrrrrr
r Ú
namespacesÚattr_dict_classrÚkÚvs rQÚ__init__z Tag.__init__s&€ð, ˆ>Ø $ˆDÕ ð!'× 0Ñ 0ˆDÔ Ø ˆ<ÜÐDÓEÐ E؈Œ Ø"ˆŒØ%Ò+¨ˆÔ؈Œ Ù˜7×5Ò5Ø Ð " iÐ&;à(ˆDŒOØ&ˆD�Nà(ˆDŒOØ&ˆDŒNð ˆ?ÙÜ"2‘ä"3�Ü);Ñ &à%×:Ñ:ˆOØ)0×)KÑ)KÐ &Ø*DˆÔ'à ˆ=Ù(Ó*ˆD�JàÐ" w×'DÒ'DØ$×IÑIØ—I‘I˜uó�•
ñ-Ó.�”
ð"ŸK™KžM‘D�A�qÜ! !¤TÔ*ØŸK™K¨›N˜Ø$%�D—J‘J˜q’Mð*ñ Ø$Ÿ^™^ˆD�Nà#ˆDŒNØ+-ˆŒ
Ø �
‰
�6˜8Ô$؈Œ à ˆ?ð)=ˆDÔ %Ø)>ˆDÔ &Ø,DˆDÔ )Ø,DˆDÕ )ð/6×.PÑ.PˆDÔ +Ø × (Ñ (¨Ô .ð)0×(DÑ(DÀTÓ(JˆDÔ %ð*1×)FÑ)FˆDÔ &ð-4×,LÑ,LˆDÔ )à�y‰y˜G×5Ñ5Ñ5ð29×1JÑ1JÈ4Ï9É9Ñ1UÐ0V�Õ-à04×0NÑ0N�Õ-rSzOptional[type[BeautifulSoup]]rr@r.r³r·r¾r�r»Ú parserClassrÔcón—|j«}|r¢|g}|j|j«D]�\}}|tjur|j «Œ)|j
|d¬«}|dj|«|tjusŒc|jtt|««Œƒ|S)z„A deepcopy of a Tag is a new Tag, unconnected to the parse tree.
Its contents are a copy of the old Tag's contents.
F)rÙr½)
Ú copy_selfÚ
_event_streamÚ descendantsr
ÚEND_ELEMENT_EVENTr{rÚrÚSTART_ELEMENT_EVENTr)ryrØrÙÚcloneÚ tag_stackÚeventr…Údescendant_clones rQrÚzTag.__deepcopy__¡s«€ð—‘Ó ˆá ð%* 7ˆIØ"&×"4Ñ"4°T×5EÑ5EÖ"F‘��wØœC×1Ñ1Ñ1ð—M‘M•Oà'.×';Ñ';¸DÈEÐ';Ó'RÐ$à˜b‘M×(Ñ(Ð)9Ô:à¤× 7Ñ 7Ò7ð"×(Ñ(¬¬cÐ3CÓ)DÕEð#Gðˆ rScóp—t|«dd|j|j|j|j|j
|j |j|j|j|j|j|j¬«}dD]}t||t||««Œ|S)a Create a new Tag just like this one, but with no
contents and unattached to any parse tree.
This is the first step in the deepcopy process, but you can
call it on its own to create a copy of a Tag without copying its
contents.
N)rÐrrrrr
r r)rr»)rÇrCrerdr%rÉrrrrr
r rÚsetattrrÑ)ryr'Úattrs rQr"z
Tag.copy_self»sœ€ð”�T“
Ø Ø Ø �I‰IØ �N‰NØ �K‰KØ �J‰JØ—<‘<Ø—‘Ø—n‘nØ!%×!:Ñ!:Ø"&×"<Ñ"<Ø%)×%BÑ%BØ%)×%BÑ%BØ×'Ñ'ô
ˆó 7ˆDÜ �E˜4¤¨¨tÓ!4Õ 5ð7àˆ rScóR—t|j«dk(xr|jduS)a¡Is this tag an empty-element tag? (aka a self-closing tag)
A tag that has contents is never an empty-element tag.
A tag that has no contents may or may not be an empty-element
tag. It depends on the `TreeBuilder` used to create the
tag. If the builder has a designated list of empty-element
tags, then only a tag whose name shows up in that list is
considered an empty-element tag. This is usually the case
for HTML documents.
If the builder has no designated list of empty-element, then
any tag with no contents is an empty-element tag. This is usually
the case for XML documents.
rT)rör¾rrÒs rQÚis_empty_elementzTag.is_empty_element×s(€ô"�4—=‘=Ó! QÑ&ÒL¨4×+DÑ+DÈÐ+LÐLrSr/có—|jS©z: :meta private:)r/rÒs rQÚ
isSelfClosingzTag.isSelfClosingêrqrScó°—t|j«dk7ry|jd}t|t«r|St|t«r |j
Sy)aXConvenience property to get the single string within this
`Tag`, assuming there is just one.
:return: If this `Tag` has a single child that's a
`NavigableString`, the return value is that string. If this
element has one child `Tag`, the return value is that child's
`Tag.string`, recursively. If this `Tag` has no children,
or has more than one child, the return value is ``None``.
If this property is unexpectedly returning ``None`` for you,
it's probably because your `Tag` has more than one thing
inside it.
r¨Nr)rör¾r�r:r
rå)ryÚchilds rQråz
Tag.stringïsL€ô ˆt�}‰}Ó  Ò "ØØ—
‘
˜aÑ ˆÜ �eœ_Ô -؈LÜ
˜œsÔ
#Ø—<‘<Ð ØrScó˜—|j«t|t«r
|j}nt}|j ||««y)z>Replace the `Tag.contents` of this `Tag` with a single string.N)r r�r:r˜r)ryråÚ new_classs rQråz
Tag.strings8€ð
�
‰
Œ Ü �fœoÔ .Ø×(Ñ(‰Iä'ˆIØ � ‰ ‘I˜fÓ%Õ&rSFc#óXK—||jur%|j€
|j}n |j}|jD]d}t |t
«sŒt
|«}t |t «r||urŒ4|�||vrŒ;|r$|j«}t|«dk(rŒ\|–—Œa|–—Œfy­w)aSYield all strings of certain classes, possibly stripping them.
:param strip: If True, all strings will be stripped before being
yielded.
:param types: A tuple of NavigableString subclasses. Any strings of
a subclass not found in this list will be ignored. By
default, the subclasses considered are the ones found in
self.interesting_string_types. If that's not specified,
only NavigableString and CData objects will be
considered. That means no comments, processing
instructions, etc.
Nr) rÞr rÕr$r�r:rÇràrö)ryràráÚ
descendantÚdescendant_typeÚstrippeds rQrâzTag._all_stringss­èø€ð �D—L‘LÑ Ø×,Ñ,Ð4Ø×6Ñ6‘à×5Ñ5�à×*Ô*ˆJܘj¬/Ô:ØÜ" :Ó.ˆOܘ%¤Ô&Ø"¨%Ñ/àØÐ" ¸eÑ'CàÙØ%×+Ñ+Ó-�Ü�x“= AÒ%ØØ“à Ó ñ#+ùs‚B(B*cód—g}|D](}|j|j||««|dz
}Œ*|S)a³Insert one or more new PageElements as a child of this `Tag`.
This works similarly to :py:meth:`list.insert`, except you can insert
multiple elements at once.
:param position: The numeric position that should be occupied
in this Tag's `Tag.children` by the first new `PageElement`.
:param new_children: The PageElements to insert.
:return The newly inserted PageElements.
r¨)rÚ_insert)ryÚpositionÚ new_childrenÚinsertedÚ new_childs rQrûz
Tag.insert?s:€ð')ˆÛ%ˆIØ �O‰O˜DŸL™L¨°9Ó=Ô >Ø ˜‰M‰Hð&ðˆrScóÊ—|€ td«‚||ur td«‚t|t«rt|t«s t|«}ddlm}t||«r&|j |gt|j«¢­ŽSt|t|j««}t|d«rN|j�B|j|ur$|j|«}||kr|dz}n||k(r|gS|j«||_ d}|dk(rd|_||_n@|j|dz
}||_||j_|j%d«|_|j �||j _|j%dd¬ «}t)t*|«}|t|j«k\rAd|_|}d}|€"|� |j"}|j}|�n|€|�Œ |�||_nBd|_n:|j|} | |_|j"�||j"_| |_|j&�||j&_|jj
||«|gS)
NzCannot insert None into a tag.z Cannot insert a tag into itself.rr#r¶r¨FT)rr)rõr�r@r:Úbs4r$rûrr¾ÚminröÚhasattrr¶rørùrºr¸r¹rr·rr±)
ryr=r@r$Ú
current_indexÚprevious_childÚnew_childs_last_elementr¶Úparents_next_siblingÚ
next_childs
rQr<z Tag._insertRs|€Ø Ð ÜÐ=Ó>Ð >Ø ˜Ñ ÜÐ?Ó@Ð @Ü �i¤Ô %¬j¸ÄOÔ.TÜ'¨ Ó2ˆIå%Ü �i Ô /ð�4—;‘;˜xÐC¬$¨y×/AÑ/AÓ*BÒCÐ CÜ�x¤ T§]¡]Ó!3Ó4ˆÜ �9˜hÔ '¨I×,<Ñ,<Ð,Hð×Ñ 4Ñ'Ø $§
¡
¨9Ó 5�
Ø  8Ò+ð
 ‘M‘HØ" hÒ.ð&˜;Ð&Ø × Ñ Ô àˆ ÔØˆØ �qŠ=Ø)-ˆIÔ &Ø)-ˆIÕ &à!Ÿ]™]¨8°a©<Ñ8ˆNØ)7ˆIÔ &Ø6?ˆI× &Ñ &Ô 3Ø)7×)HÑ)HÈÓ)OˆIÔ &Ø × %Ñ %Ð 1Ø6?ˆI× &Ñ &Ô 3à"+×"<Ñ"<Ø ¨dð#=ó#
Ðô#'¤{Ð4KÓ"LÐà ”s˜4Ÿ=™=Ó)Ò )Ø%)ˆIÔ "à$(ˆFØ#'Ð Ø&Ð.°6Ð3EØ'-×':Ñ':Ð$ØŸ™�Ø'Ð3àð 'Ð.°6Ñ3Eð $Ð/Ø7KÐ'Õ4ð8<Ð'Õ4àŸ™ xÑ0ˆJØ%/ˆIÔ "Ø×%Ñ%Ð1Ø:C� ×&Ñ&Ô7Ø3=Ð #Ô 0à "× /Ñ /Ð ;à'ð
$× 0Ñ 0Ô Að
�
‰
×јX yÔ1àˆ{ÐrScóÜ—|j}|€ td«‚|j|«}|j|¬«t |j
dd«D]}|j
||«Œ|S)zqReplace this `PageElement` with its contents.
:return: This object, no longer part of the tree.
NzTCannot replace an element with its contents when that element is not part of a tree.rò)r¶rõrørùÚreversedr¾rû)ryÚ my_parentrþr4s rQÚunwrapz
Tag.unwrap©sp€ð
—K‘Kˆ Ø Ð Üð1óð
ð—?‘? 4Ó(ˆØ � ‰  ˆ Ô*ܘdŸm™m©AÐ.Ö/ˆEØ × Ñ ˜X uÕ -ð0àˆ rSrMcó"—|j«Sr1)rMrÒs rQÚreplaceWithChildrenzTag.replaceWithChildren¼s€ð�{‰{‹}ÐrScóR—|jt|j«|«dS)z¥
Appends the given `PageElement` to the contents of this `Tag`.
:param tag: A PageElement.
:return The newly appended PageElement.
r)rûrör¾)ryÚtags rQrz
Tag.appendÁs#€ð�{‰{œ3˜tŸ}™}Ó-¨sÓ3°AÑ6Ð6rScóœ—t|t«rt|j«}n|t|tt
f«rKt
jdtd¬«t|t
«rt|t«s t|«}|g}nt|t«r t|«}g}D]"}|j|j|««Œ$|S)a—Appends one or more objects to the contents of this
`Tag`.
:param tags: If a list of `PageElement` objects is provided,
they will be appended to this tag's contents, one at a time.
If a single `Tag` is provided, its `Tag.contents` will be
used to extend this object's `Tag.contents`.
:return The list of PageElements that were appended.
zIA single non-Tag item was passed into Tag.extend. Use Tag.append instead.rDrE) r�r
rr¾r±r@rIrJÚ UserWarningr:rr)ryÚtagsÚtag_listrrQs rQrz
Tag.extendËs¨€ô �dœCÔ Ü˜DŸM™MÓ*‰HÜ
˜œ{¬CÐ0Ô
1ô
�M‰MØ[ÜØõ
ô
˜$¤Ô$¬Z¸¼kÔ-JÜ& tÓ,�Ø�v‰HÜ
˜œhÔ
'ô˜D“zˆHà%'ˆÛˆCØ �N‰N˜4Ÿ;™; sÓ+Õ ,ððˆrScór—|jddD]%}|r|j«Œ|j«Œ'y)a Destroy all children of this `Tag` by calling
`PageElement.extract` on them.
:param decompose: If this is True, `PageElement.decompose` (a
more destructive method) will be called instead of
`PageElement.extract`.
N)r¾rrù)ryrr…s rQr z Tag.clearðs0€ð—}‘}¡QÓ'ˆGÙØ×!Ñ!Õ#à—‘Õ!ñ (rScó€—g}t|j«D]¨\}}t|t«r|j «|t |j«dz
k(rŒB|j|dz}t|t «sŒet|t «sŒvt|t«rŒ‡t|t«rŒ˜|j|«Œªt|«D]n}tt |j|«}tt |j|dz«}|j«t
||z«}|j|«Œpy)zÿSmooth out the children of this `Tag` by consolidating consecutive
strings.
If you perform a lot of operations that modify the tree,
calling this method afterwards can make pretty-printed output
look more natural.
r¨N)
rúr¾r�r
Úsmoothrör:rárrKrrùr)ryÚmarkedrŠÚaÚbÚns rQrXz
Tag.smoothþsø€ðˆÜ˜dŸm™mÖ,‰DˆAˆqܘ!œSÔ!à—‘”
Ø”C˜Ÿ
™
Ó&¨Ñ*Ò*ðØ—
‘
˜a !™eÑ$ˆAä˜1œoÕ.ܘq¤/Õ2Ü" 1Ô&8Õ9Ü" 1Ô&8Õ9à—
‘
˜aÕ ð-ô(˜&Ö!ˆAÜ”_ d§m¡m°AÑ&6Ó7ˆAÜ”_ d§m¡m°A¸±EÑ&:Ó;ˆAØ
�I‰IŒKÜ  A¡Ó&ˆAØ
�N‰N˜1Õ ñ "rScób—t|j«D]
\}}||usŒ |cStd«‚)aFind the index of a child of this `Tag` (by identity, not value).
Doing this by identity avoids issues when a `Tag` contains two
children that have string equality.
:param element: Look for this `PageElement` in this object's contents.
zTag.index: element not in tag)rúr¾rõ)ryr…rŠr4s rQrøz Tag.index& s6€ô" $§-¡-Ö0‰HˆAˆuØ˜ÒØ’ð1ôÐ8Ó9Ð9rScó:—|jj||«S)a$Returns the value of the 'key' attribute for the tag, or
the value given for 'default' if it doesn't have that
attribute.
:param key: The attribute to look for.
:param default: Use this value if the attribute is not present
on this `Tag`.
)r%Úget)ryr–rÞs rQr_zTag.get3 s€ð�z‰z�~‰~˜c 7Ó+Ð+rScóÞ—|j||«}|€|j«}|St|t«r|}|St|t«st t|«}|j|g«}|S)a:The same as get(), but always returns a (possibly empty) list.
:param key: The attribute to look for.
:param default: Use this value if the attribute is not present
on this `Tag`.
:return: A list of strings, usually empty or containing only a single
value.
)r_rr�rr@r)ryr–rÞr—Ú
list_values rQÚget_attribute_listzTag.get_attribute_list@ sx€ð—‘˜˜gÓ&ˆØ ˆ=Ø×8Ñ8Ó:ˆJðÐô
˜œtÔ
$؈Jð
Ðô˜e¤SÔ)ÜœS %Ó(�Ø×8Ñ8¸%¸ÓAˆJØÐrScó—||jvS)z6Does this `Tag` have an attribute with the given name?©r%©ryr–s rQÚhas_attrz Tag.has_attrW s€à�d—j‘jÐ Ð rScó4—t|«j«Sr)r@Ú__hash__rÒs rQrhz Tag.__hash__[ s€Ü�4‹y×!Ñ!Ó#Ð#rScó —|j|S)zqtag[key] returns the value of the 'key' attribute for the Tag,
and throws an exception if it's not there.rdres rQrÌzTag.__getitem__^ s€ð�z‰z˜#‰ÐrScó,—t|j«S)z0Iterating over a Tag iterates over its contents.)Úiterr¾rÒs rQÚ__iter__z Tag.__iter__c s€ä�D—M‘MÓ"Ð"rScó,—t|j«S)z:The length of a Tag is the length of its list of contents.)rör¾rÒs rQÚ__len__z Tag.__len__g s€ä�4—=‘=Ó!Ð!rScó—||jvSr©r¾)ryrðs rQÚ __contains__zTag.__contains__k s€Ø�D—M‘MÐ!Ð!rScó—y)z-A tag is non-None even if it has no contents.TrqrÒs rQÚ__bool__z Tag.__bool__n s€àrScó"—||j|<y)zKSetting tag[key] sets the value of the 'key' attribute for the
tag.Nrd)ryr–r—s rQr”zTag.__setitem__r s€ð ˆ�
‰
�3ŠrScó<—|jj|d«y)z;Deleting tag[key] deletes all 'key' attributes for the tag.N)r%r{res rQÚ __delitem__zTag.__delitem__w s€à �
‰
�‰�s˜DÕ!rSc ó—yrrq©ryrCr%rÙrår0r1r&s rQÚ__call__z Tag.__call__{ ó€ð rSc ó—yrrqrxs rQryz Tag.__call__ˆ rzrSc óØ—|�3|€|€|r-ttt|j||||||fi|¤Ž«S|€|j|||d||fi|¤Ž}|S|jdd||||fi|¤Ž} | S)z Calling a Tag like a function is the same as calling its
find_all() method. Eg. tag('a') returns a list of all the A tags
found within this tag.N)rrgr
r‚)
ryrCr%rÙrår0r1r&rTrÙs
rQryz Tag.__call__• s¥€ð Ð  4Ð#3°uÐ7HÉFôœ ¤#™¨
¨¯
©
°d¸EÀ9ÈfÐV[Ð]hÑ(sÐlrÑ(sÓtÐ tà ˆ>à"/ $§-¡-Ø�e˜Y¨¨e°[ñ#ØDJñ#ˆDðˆKð.;¨T¯]©]Ø �$˜  6¨5°+ñ.
ØAGñ.
ˆðˆrScóL—t|«dkDrR|jd«rA|dd}tjdt |¬«zt
d¬«|j
|«}|S|jd «s|d
k(s|j
|«}|Std |j›d |›d �«‚)
zACalling tag.subtag is the same as calling tag.find(name="subtag")r`r
NéýÿÿÿzŒ.%(name)sTag is deprecated, use .find("%(name)s") instead. If you really were looking for a tag called %(name)sTag, use .find("%(name)sTag")rBrDrEÚ__r¾Ú'z' object has no attribute ')
röÚendswithrIrJr}rLÚfindÚ
startswithrNr˜)ryÚsubtagÚtag_namer†s rQrRzTag.__getattr__µ s¨€ô ˆv‹;˜Š?˜vŸ™¨uÔ5à˜c˜r�{ˆHÜ �M‰Mð_ܘHÔ%ñ&ä"Øõ 
ð —Y‘Y˜xÓ(ˆFðˆ
ð
×"Ñ" 4Ô(°¸:Ò1EØ—Y‘Y˜vÓ&ˆFð
ˆ
õ!Ø7;·~³~ÂvÐNóð
rScón—||uryt|t«syt|d«rat|d«rUt|d«rI|j|jk7s0|j|jk7st |«t |«k7ryt
|j«D]\}}||j|k7sŒyy)zyReturns true iff this Tag has the same name, the same attributes,
and the same contents (recursively) as `other`.TFrCr%r¾)r�r
rDrCr%rörúr¾)ryÚotherrŠÚmy_childs rQÚ__eq__z
Tag.__eq__Ì sœ€ð �5‰=ØÜ˜%¤Ô%Øä˜˜vÔ&ܘ5 'Ô*ܘ5 *Ô-Ø�y‰y˜EŸJ™JÒ&Ø�z‰z˜UŸ[™[Ò(Ü�4‹yœC ›JÒ&àÜ$ T§]¡]Ö3‰KˆAˆxؘ5Ÿ>™>¨!Ñ,Ó,Ùð4ðrScó—||k( S)zTReturns true iff this Tag is not identical to `other`,
as defined in __eq__.rq)ryr‡s rQÚ__ne__z
Tag.__ne__á s€ð˜5‘=Ð Ð rScó"—|j«S)zRenders this `Tag` as a string.)ÚdecoderÒs rQÚ__repr__z Tag.__repr__æ s€à�{‰{‹}ÐrSrÝÚxmlcharrefreplacecóL—|j|||«}|j||«S)aRender this `Tag` and its contents as a bytestring.
:param encoding: The encoding to use when converting to
a bytestring. This may also affect the text of the document,
specifically any encoding declarations within the document.
:param indent_level: Each line of the rendering will be
indented this many levels. (The ``formatter`` decides what a
'level' means, in terms of spaces or other characters
output.) This is used internally in recursive calls while
pretty-printing.
:param formatter: Either a `Formatter` object, or a string naming one of
the standard formatters.
:param errors: An error handling strategy such as
'xmlcharrefreplace'. This value is passed along into
:py:meth:`str.encode` and its value should be one of the `error
handling constants defined by Python's codecs module
<https://docs.python.org/3/library/codecs.html#error-handlers>`_.
©r�Úencode)ryÚencodingÚ indent_levelrÄÚerrorsrÅs rQr’z
Tag.encodeì s'€ð6
�K‰K˜  h° Ó :ˆØ�x‰x˜ &Ó)Ð)rScóˆ—g}t|t«s|j|«}|durd}d}|j|«D�]r\}}|tj
tj fvr%tt|«}|j||d¬«} n_|tjur,tt|«}|j||d¬«} |�'|dz}n!tt|«}|j|«} |rdx}
} ndx}
} |tj
ur'|s%tt|«j«sd}
d} |}n|tjur
||urd}
d} d}|�S|
s| r7t|t«r| j«} | r|j| |||
| «} |tj
k(r|dz
}|j| «�Œudj!|«S)aRender this `Tag` and its contents as a Unicode string.
:param indent_level: Each line of the rendering will be
indented this many levels. (The ``formatter`` decides what a
'level' means, in terms of spaces or other characters
output.) This is used internally in recursive calls while
pretty-printing.
:param encoding: The encoding you intend to use when
converting the string to a bytestring. decode() is *not*
responsible for performing that encoding. This information
is needed so that a real encoding can be substituted in if
the document contains an encoding declaration (e.g. in a
<meta> tag).
:param formatter: Either a `Formatter` object, or a string
naming one of the standard formatters.
:param iterator: The iterator to use when navigating over the
parse tree. This is only used by `Tag.decode_contents` and
you probably won't need to use it.
TrN)ÚopeningFr¨r‚)r�r
rÁr#r
r&ÚEMPTY_ELEMENT_EVENTrÚ _format_tagr%r:rÐÚ_should_pretty_printràÚ_indent_stringrrè) ryr”rzrÄrhÚpiecesÚstring_literal_tagr)r…ÚpieceÚ
indent_beforeÚ indent_afters rQr�z
Tag.decode
sá€ð4ˆô˜)¤YÔ/Ø×/Ñ/° Ó:ˆIà ˜4Ñ ØˆLð"Ðà"×0Ñ0°×:‰NˆE�7Øœ×0Ñ0´#×2IÑ2IÐJÑJÜœs GÓ,�Ø×+Ñ+Ð,=¸yÐRVÐ+ÓW‘Øœ#×/Ñ/Ñ/Üœs GÓ,�Ø×+Ñ+Ð,=¸yÐRWÐ+ÓX�ØÐ+Ø  AÑ%‘L䜰Ó8�Ø×,Ñ,¨YÓ7�ñ"Ø/4Ð4�
¡ à/3Ð3�
  ð œ×0Ñ0Ñ0Ù*ÜœS 'Ó*×?Ñ?ÔAð !%�
Ø$� Ø%,Ñ"Øœ#×/Ñ/Ñ/°GÐ?QÑ4Qð!&�
Ø#� Ø%)Ð"ðÐ'Ù ¡LÜ! '¬?Ô;Ø %§ ¡ £
˜ÙØ $× 3Ñ 3Ø! <°¸MÈ<ó!˜ðœC×3Ñ3Ò3Ø  AÑ%�LØ �M‰M˜%Ö ð};ð~�w‰w�v‹ÐrScó—eZdZdZy)úTag._TreeTraversalEventz{An internal class representing an event in the process
of traversing a parse tree.
:meta private:
NrˆrqrSrQÚ_TreeTraversalEventr¢w
s„ò rSr£c#óK—g}|xs |j}|D]º}|rK|j|dk7r9|j«}tj|f–—|r|j|dk7rŒ9t |t«rG|j rtj|f–—Œ�tj|f–—|j|«Œ§tj|f–—Œ¼|r(|j«}tj|f–—|rŒ'yy­w)a]Yield a sequence of events that can be used to reconstruct the DOM
for this element.
This lets us recreate the nested structure of this element
(e.g. when formatting it as a string) without using recursive
method calls.
This is similar in concept to the SAX API, but it's a simpler
interface designed for internal use. The events are different
from SAX and the arguments associated with the events are Tags
and other Beautiful Soup objects.
:param iterator: An alternate iterator to use when traversing
the tree.
r½N) Úself_and_descendantsr¶r{r
r%r�r/r˜r&rÚSTRING_ELEMENT_EVENT)ryrhr(rÍÚnow_closed_tags rQr#zTag._event_stream„
sêèø€ð$ "ˆ àÒ8˜t×8Ñ8ˆãˆAñ §¡¨I°b©MÒ 9Ø!*§¡£�Ü×+Ñ+¨^Ð;Ò;ñ §¡¨I°b©MÓ 9ô˜!œSÔ!Ø×%Ò%Ü×1Ñ1°1Ð4Ó4ä×1Ñ1°1Ð4Ò4Ø×$Ñ$ QÔ'Øä×.Ñ.°Ð1Ó1ð!ñ$Ø&Ÿ]™]›_ˆNÜ×'Ñ'¨Ð7Ò 7ôùs‚A$C?Á'BC?Ã=C?cóH—d}|r|r|j|z}d}|rd}||z|zS)a°Add indentation whitespace before and/or after a string.
:param s: The string to amend with whitespace.
:param indent_level: The indentation level; affects how much
whitespace goes before the string.
:param indent_before: Whether or not to add whitespace
before the string.
:param indent_after: Whether or not to add whitespace
(a newline) after the string.
r‚Ú
)Úindent)ryrÃr”rÄrŸr Ú space_beforeÚ space_afters rQr›zTag._indent_string°
s;€ð$ˆ Ù ™\Ø$×+Ñ+¨lÑ:ˆLàˆ Ù ØˆKà˜aÑ +Ñ-Ð-rScó¸—|jryd}|sd}d}|jr|jdz}d}|rë|j|«}g}|D]½\} }
|
€| } n¢t|
t«st|
t
«rdj
|
«}
n?t|
t«s t|
«}
n#t|
t«r|�|
j|«}
|j|
«} t| «dz|j| «z} |j| «Œ¿|rddj
|«z}d}
|jr|jxsd}
d|z|z|jz|z|
zdzS)Nr‚Ú/rgÚ Ú=Ú<ré)r»rdÚ
attributesr�rr¿rèr@rsr{Úattribute_valueÚquoted_attribute_valuerr/Úvoid_element_close_prefixrC)ryrzrÄr—Ú
closing_slashrdÚattribute_stringr²r%r–ÚvalÚdecodedrvÚvoid_element_closing_slashs rQr™zTag._format_tagÌ
sƒ€ð �;Š;ðð
ˆ
ÙØˆMðˆØ �;Š;Ø—[‘[ 3Ñ&ˆFðÐÙ Ø"×-Ñ-¨dÓ3ˆJ؈EÛ&‘��SØ�;Ø!‘Gä! #¤tÔ,´
¸3ÄÔ0FØ!Ÿh™h s›m™Ü'¨¬SÔ1Ü! #›h™ä" 3Ô(MÔNØ-Ð9à!×5Ñ5Ð6GÓH˜à$×4Ñ4°SÓ9�DÜ! #›h¨™n¨y×/OÑ/OÐPTÓ/UÑU�GØ— ‘ ˜WÕ%ð!'ñ"Ø#&¨¯©°%«Ñ#8Ð ð&(Ð"Ø × Ò Ø)2×)LÑ)LÒ)RÐPRÐ &ð
Øñ
àñ
ð�i‰iñ
ðñ 
ð
)ñ 
)ð ñ

ð
rScó\—|duxr'|j xs|j|jvS)zˆShould this tag be pretty-printed?
Most of them should, but some (such as <pre> in HTML
documents) should not.
N)r
rC)ryr”s rQršzTag._should_pretty_print
s9€ð  4Ð'ò
Ø×-Ñ-Ð -ò
>Ø�y‰y × =Ñ =Ð=ð
rScó—yrrq©ryr“rÄs rQÚprettifyz Tag.prettify ó€ð rScó—yrrqr½s rQr¾z Tag.prettify r¿rScóT—|€|jd|¬«S|j|d|¬«S)acPretty-print this `Tag` as a string or bytestring.