9,jmvUddlmZdZddlZddlZddlZddlmZddlm Z m Z m Z ddl m Z mZmZddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'm(Z(erBdd l)m*Z*dd l+m,Z,dd l-m.Z.dd l m/Z/m0Z0ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>m?Z?m@Z@mAZAmBZBmCZCe#e!dee!dfZDdeEd<e#dZFdeEd<eeFZGdeEd<eHdZIejJdZKdeEd<dXdZLdZMdeEd <ejJd!ZNdeEd"<eOgd#ZPd$eEd%<Gd&d'eQZRGd(d)eQZSGd*d+eSZTGd,d-eeQZUGd.d/eeefZVGd0d1eVZWGd2d3eVZXGd4d5eSZYGd6d7eZZ[Gd8deQe[Z\Gd9d:e\Z]Gd;de]Z_Gd?d@e_Z`GdAdBe]ZaGdCdDe]ZbGdEdFe]ZcGdGdHe\ZdGdIdJe\ZeGdKdLe\ZfGdMdNe\ZgGdOdPe\ZhGdQdRe[Zie"dSe[TZjGdUdVeejeejZkddWl-mlZldS)Y) annotationsMITNCSS) _deprecated_deprecated_alias_deprecated_function_alias) Formatter HTMLFormatter XMLFormatter)!AttributeResemblesVariableWarning)AnyCallableDictGenericIterableIteratorListMappingMutableSequenceOptionalPatternSet TYPE_CHECKINGTupleTypeTypeVarUnioncastoverload)Self TypeAlias BeautifulSoup) TreeBuilder ElementFilter)_EntitySubstitutionFunction_FormatterOrName)_AtMostOneElement_AtMostOneNavigableString _AtMostOneTag_AttributeValue_AttributeValues _Encoding_InsertableElement _OneElement _QueryResults_RawAttributeValue_RawAttributeValues_RawOrProcessedAttributeValues_SomeNavigableStrings _SomeTags_StrainableAttribute_StrainableAttributes_StrainableElement_StrainableStringNavigableStringr"_OneOrMoreStringTypes)r:r'_FindMethodName_OptionalFindMethodNamezYThe {name} attribute was deprecated in version 4.7.0. If you need it, make your own copy.) whitespace_rez\s+ Pattern[str]_deprecated_whitespace_renamestrreturnrc|tvrTt|}tj||tdt d|St dtd|)NrC stacklevel _deprecated_zmodule z has no attribute )_deprecated_nameswarningswarnformatDeprecationWarningglobalsAttributeError__name__)rCmessages ;C:\PYTHON\GemmaClient\venv\Lib\site-packages\bs4/element.py __getattr__rV^sv    #D) gnn$n//1CPQRRRRyy...// I8IIII J JJutf-8DEFAULT_OUTPUT_ENCODINGz\S+nonwhitespace_re) idnambcsoempalmospunycoderaw_unicode_escape undefinedunicode_escapezraw-unicode-escapezunicode-escapez string-escape string_escapezSet[_Encoding]PYTHON_SPECIFIC_ENCODINGSc@eZdZUdZded<ded<ded< d d d ZdS) NamespacedAttributezA 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 namespaceNrEr!c|sd}|st||}n?|st||}n!t||dz|z}||_||_||_|S)N:)rD__new__rhrCri)clsrhrCriobjs rUrlzNamespacedAttribute.__new__s  D 8++c6**CC 8++c4((CC++c6C<$#677C !  rWNN)rhrgrCrgrirgrEr!)rS __module__ __qualname____doc____annotations__rlrWrUrfrfsg  ##' rWrfc&eZdZUdZded<ddZdS) %AttributeValueWithCharsetSubstitutionaAn abstract class standing in for a character encoding specified inside an HTML ```` 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. rDoriginal_valueeventual_encodingrEct)zDo whatever's necessary in this implementation-specific portion an HTML document to substitute in a specific encoding. NotImplementedErrorselfrxs rUsubstitute_encodingz9AttributeValueWithCharsetSubstitution.substitute_encodings"###rWN)rxrDrErD)rSrprqrrrsr~rtrWrUrvrvsB  $$$$$$rWrvc$eZdZdZd dZd dd Zd S)CharsetMetaAttributeValueazA generic stand-in for the value of a ```` tag's ``charset`` attribute. When Beautiful Soup parses the markup ````, 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 ```` tag will mention the new encoding instead of ``utf8``. rwrDrEr!cJt||}||_|SN)rDrlrwrmrwrns rUrlz!CharsetMetaAttributeValue.__new__s$kk#~..+ rWrXrxr/c|tvrdS|S)zWhen an HTML document is being encoded to a given encoding, the value of a ```` tag's ``charset`` becomes the name of the encoding. )rdr|s rUr~z-CharsetMetaAttributeValue.substitute_encodings  9 9 92  rWNrwrDrEr!rXrxr/rErD)rSrprqrrrlr~rtrWrUrrsK!!!!!!!rWrceZdZdZdS)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. NrSrprqrrrtrWrUrrrWrceZdZdZdS) AttributeDictzSuperclass 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. NrrtrWrUrrsrWrc$eZdZdZd fd ZxZS) XMLAttributeDictzyA dictionary for holding a Tag's attributes, which processes incoming values for consistency with the HTML spec. keyrDvaluerrENonec|d}t|trn+t|ttfrt |}t ||dS)zSet 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) isinstanceboolintfloatrDsuper __setitem__r}rr __class__s rUrzXMLAttributeDict.__setitem__si =E eT " "   U| , ,  JJE C'''''rWrrDrrrErrSrprqrrr __classcell__rs@rUrrsG((((((((((rWrc$eZdZdZd fd ZxZS) HTMLAttributeDictaA 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. rrDrrrErc&|dvr ||vr||=dSt|tr t|tr|j}n.|}n+t|tt frt |}t||dS)z\Set an attribute value, possibly modifying it to comply with the HTML spec, )FNN) rrrfrCrrrDrrrs rUrzHTMLAttributeDict.__setitem__s M ! !d{{I F eT " " #233  U| , , JJE C'''''rWrrrs@rUrrsG((((((((((rWrc\eZdZUdZejdejZded<dd Z ddd Z dS)ContentMetaAttributeValueaA generic stand-in for the value of a ```` tag's ``content`` attribute. When Beautiful Soup parses the markup: ```` 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 ```` tag will mention the new encoding instead of ``utf8``. z((^|;)\s*charset=)([^;]*)rA CHARSET_RErwrDrEr!c~|j|t||}||_|Sr)rsearchrDrlrwrs rUrlz!ContentMetaAttributeValue.__new__Ps8 n---kk#~..+ rWrXrxr/ctvr |jd|jSdfd }|j||jS)zWhen an HTML document is being encoded to a given encoding, the value of the ``charset=`` in a ```` tag's ``content`` becomes the name of the encoding. rmatch re.Match[str]rErDc4|dzS)N)group)rrxs rUrewritez>ContentMetaAttributeValue.substitute_encoding..rewrite^s;;q>>$55 5rW)rrrErD)rdrsubrw)r}rxrs ` rUr~z-ContentMetaAttributeValue.substitute_encodingVsg  9 9 9?&&r4+>?? ? 6 6 6 6 6 6""7D,?@@@rWNrrr) rSrprqrrrecompileMrrsrlr~rtrWrUrr>sx   *rz*FMMJMMMM A A A A A A ArWrceZdZUdZdZded<ded<ded<d ed <d ed <d ed <d ed <dZded< dddZddZddZ e ddZ e dd dZ e dd dZddd$Zdd%ZeZd&ed'<defdd+Ze dd,Zd-defdd0ZeZe dd1Zdd4Zed5d6dZdd9Zddd<Zdd=Z dddAZe dBdCdZddEZ ddFZ! dddRZ"dddVZ#e ddXZ$e ddYZ%e& ddd^Z'e& dddbZ' dddeZ'edfdgdZ(e& dddhddkZ)e& dddmZ) dddoZ)edpdqdZ*e& dddrZ+e& dddsZ+ dddtZ+edudvdZ,e& dddhddwZ-e& dddxZ- dddyZ-edzd{dZ.ed|d{d}Z/e& ddd~Z0e& dddZ0 dddZ0eddd}Z1e& dddhddZ2e& dddZ2 dddZ2edddZ3eddd}Z4e& dddZ5e& dddZ5 dddZ5edddZ6e& dddhddZ7e& dddZ7 dddZ7edddZ8eddd}Z9 dddZ:edddZ; dddZ<edddZ=eddd}Z>e ddZ?e ddZ@ddZAe ddZBddZCe ddZDe ddZEe ddZFe ddZGe ddZHe ddZIe ddZJe ddZKe ddZLe ddZMddZNe ddZOePddddZQePddddZRePddddZSePddddZTePddddZUdS) 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`." NOptional[bool] known_xmlr _decomposed Optional[Tag]parentr* next_elementprevious_element next_siblingprevious_siblingFhiddenrErc6||_||_|j ||j_||_|j ||j_||_|j ||j_|%|j|jjr|jjd}||_|j||j_dSdS)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)rrrrrcontents)r}rrrrrs rUsetupzPageElement.setups2 0  ,15D ! .(   (15D  .(   (15D  .  $ ' $( ${3B7  0  ,15D ! . . . - ,rWsrD formatterOptional[_FormatterOrName]c||St|ts||}||}|S)zFormat 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. )rr formatter_for_name substitute)r}rroutputs rU format_stringzPageElement.format_stringsL  H)Y// ;// ::I%%a(( rWformatter_name4Union[_FormatterOrName, _EntitySubstitutionFunction]r ct|tr|S|jrt}tj}nt }t j}t |r ||S||S)aLook 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)rr _is_xmlr REGISTRYr callable)r}rcregistrys rUrzPageElement.formatter_for_namesr ni 0 0 "! ! < .A#,HHA$-H N # # 91888 8''rWcf|j|jS|jt|ddS|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. Nis_xmlF)rrgetattrrr}s rUrzPageElement._is_xmls? > %> ! ; 4511 1{""rW nextSibling4.0.0previousSiblingmemoDict[Any, Any] recursiver!ctrrzr}rrs rU __deepcopy__zPageElement.__deepcopy__s!###rWc,|iS)zA copy of a PageElement can only be a deep copy, because only one PageElement can occupy a given place in a parse tree. )rrs rU__copy__zPageElement.__copy__s  $$$rWIterable[type[NavigableString]]defaultstriptypes Iterator[str]ct)zYield all strings of certain classes, possibly stripping them. This is implemented differently in `Tag` and `NavigableString`. rz)r}rrs rU _all_stringszPageElement._all_stringss"###rWc#BK|dD]}|VdS)zYield all interesting strings in this PageElement, stripping them first. See `Tag` for information on which strings are considered interesting in a given context. TNr)r}strings rUstripped_stringszPageElement.stripped_strings s:''--  FLLLL  rWr separatorIterable[Type[NavigableString]]cj|d|||DS)aGet 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. cg|]}|Srtrt).0rs rU z(PageElement.get_text..-sPPPQqPPPrW)r)joinr)r}rrrs rUget_textzPageElement.get_texts8.~~PP$*;*;E*;*O*OPPPQQQrWc*|Sr)rrs rUtextzPageElement.text1s}}rWargsr0cjtdt|dkr |durStfd|Drtdj}j}|t ||D]\}}|||S) zReplace 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. Nz^Cannot replace one element with another when the element to be replaced is not part of a tree.rrc3*K|] }|juVdSrrrxr}s rU z+PageElement.replace_with..Cs*..AqDK......rWz%Cannot replace a Tag with its parent. _self_index)start)r ValueErrorlenanyindexextract enumerateinsert)r}r old_parentmy_indexidx replace_withs` rUr zPageElement.replace_with5s ; @  t99>>d1gooK ....... . . FDEE E[ ;$$T**  ***!*4x!@!@!@ 1 1 C   c< 0 0 0 0 rW replaceWithr  wrap_insideTagcZ||}|||S)zWrap 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)r}rmes rUwrapzPageElement.wrapNs1   { + +2rWr Optional[int]c |j)||j|}|jj|=|}t t |}|j}|j|j|ur ||j_|||jur |j|_d|_d|_d|_|j|j|j ur|j |j_ |j |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) rrr_last_descendantrrrrrr)r}r last_childrs rUrzPageElement.extractXs ; """k//55  $[1 **,, +z22 !.  ,$L885A%2  # D>>151BD ! .   )!)>>>151FD  .488 1 rWc||}d}|P|j}|jt |t rd|_g|_d|_|}|NdSdS)aRecursively 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. NrT) rr__dict__clearrrrCrr)r}enext_ups rU decomposezPageElement.decomposesv #%)mnG J     !S!!   AMAmmmmmrWTis_initialized accept_selfc|r|j |jj}nG|}t|tr0|jr)|jd}t|tr|j)|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)rrrrr)r}rr rs rUrzPageElement._last_descendants$  5d/;*;JJJZ-- 5*2E 5'04 Z-- 5*2E 5 zT11JrW_lastRecursiveChildrList[PageElement]chj}|tdtfd|Drtdg}|D]i}t|tr||}||||j|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. Nz2Element has no parent, so 'before' has no meaning.c3 K|]}|uV dSrrtrs rUrz,PageElement.insert_before..'''QqDy''''''rWz&Can't insert an element before itself. rrrrrrrextendr )r}rrresults predecessorrs` rU insert_beforezPageElement.insert_befores >QRR R ''''$''' ' ' GEFF F%' > >K+{33 &##%%%LL&&E NN6== << = = = =rWcj}|tdtfd|Drtdd}g}|D]t}t|tr||}|||dz|z||dz }u|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. Nz1Element has no parent, so 'after' has no meaning.c3 K|]}|uV dSrrtrs rUrz+PageElement.insert_after..r&rWz%Can't insert an element after itself.rrr')r}rroffsetr) successorrs` rU insert_afterzPageElement.insert_afters >PQQ Q ''''$''' ' ' FDEE E%'  I)[11 $!!###LL&&E NN6==V);YGG H H H aKFFrWrCrirgnsprefixattrsOptional[_RawAttributeValues] sourceline sourceposrkwattrsr3c Z|j} | td| j|||||||fi|S)zVCreate a new Tag associated with the same BeautifulSoup object as this PageElement is.NzLCannot call new_tag on a PageElement not contained in a BeautifulSoup object) _root_objectrnew_tag) r}rCrir1r2r4r5rr6roots rUr9zPageElement.new_tagsH  <kll lt|D)Xuj)U[gg_fgggrWsubclassOptional[Type[NavigableString]]r<c^|j}|td|||S)zbCreate a new NavigableString associated with the same BeautifulSoup object as this PageElement is.NzOCannot call new_string on a PageElement not contained in a BeautifulSoup object)r8r new_string)r}rr;r:s rUr>zPageElement.new_string s4  <noo oq(+++rWOptional[BeautifulSoup]cj|j}||js|j}||j||Std|S)z\Find the BeautifulSoup object used to create this PageElement, assuming it's still attached.Nr$)r_is_rootr)r}rs rUr8zPageElement._root_objectsH ${  ]F  >MOV,,,rWcdS)z[No, this object is not the root of its parse tree; only a BeautifulSoup object can be that.Frtrs rUrAzPageElement._is_roots urWr;kwargsr8r+c dSrrtr}rCr2rrCs rU find_nextzPageElement.find_next"  rWr?Optional[_StrainableAttributes]r,c dSrrtrEs rUrFzPageElement.find_next.  rWOptional[_StrainableString]BUnion[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement]c .|j|j|||fi|S)aFind 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_nextrEs rUrFzPageElement.find_next8s'$t~d0$vPPPPPrWfindNextrFlimitrRr6c dSrrtr}rCr2rrRrCs rUrOzPageElement.find_all_nextO  rWr7c dSrrtrTs rUrOzPageElement.find_all_next\rGrW6Union[_SomeTags, _SomeNavigableStrings, _QueryResults]c 0|j|||||jfi|S)a4Find 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. :kwargs: Additional filters on attribute values. ) _find_all next_elementsrTs rUrOzPageElement.find_all_nextg;(t~             rW findAllNextrOc dSrrtrEs rUfind_next_siblingzPageElement.find_next_siblingrGrWc dSrrtrEs rUr^zPageElement.find_next_siblingrJrWc .|j|j|||fi|S)aFind 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. )rNfind_next_siblingsrEs rUr^zPageElement.find_next_siblings'$t~d5tUFUUfUUUrWfindNextSiblingr^c dSrrtrTs rUrazPageElement.find_next_siblingsrUrWc dSrrtrTs rUrazPageElement.find_next_siblingsrGrWc 0|j|||||jfi|S)a'Find 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. :kwargs: Additional filters on attribute values. )rY next_siblingsrTs rUrazPageElement.find_next_siblingsr[rWfindNextSiblingsrafetchNextSiblings3.0.0c dSrrtrEs rU find_previouszPageElement.find_previousrGrWc dSrrtrEs rUrkzPageElement.find_previousrJrWc .|j|j|||fi|S)aLook 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. )rNfind_all_previousrEs rUrkzPageElement.find_previous s'$t~d4dE6TTVTTTrW findPreviousrkc dSrrtrTs rUrnzPageElement.find_all_previous rUrWc dSrrtrTs rUrnzPageElement.find_all_previous-rGrWc 0|j|||||jfi|S)a0Look 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. :kwargs: Additional filters on attribute values. )rYprevious_elementsrTs rUrnzPageElement.find_all_previous8;(t~      "       rWfindAllPreviousrnfetchAllPreviousc dSrrtrEs rUfind_previous_siblingz!PageElement.find_previous_sibling]rGrWc dSrrtrEs rUrxz!PageElement.find_previous_siblingirJrWc .|j|j|||fi|S)aReturns 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. )rNfind_previous_siblingsrEs rUrxz!PageElement.find_previous_siblingss3$t~  'uf  @F   rWfindPreviousSiblingrxc dSrrtrTs rUr{z"PageElement.find_previous_siblingsrUrWc dSrrtrTs rUr{z"PageElement.find_previous_siblingsrGrWc 0|j|||||jfi|S)a(Returns 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. :kwargs: Additional filters on attribute values. )rYprevious_siblingsrTs rUr{z"PageElement.find_previous_siblingsrtrWfindPreviousSiblingsr{fetchPreviousSiblingsc >d}|j||dfi|}|r|d}|S)aFind 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. Nrr) find_parents)r}rCr2rCrr)s rU find_parentzPageElement.find_parentsI( #$# %  $     ArW findParentrc p|j}ttt|j||d||fi|S)aFind 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. :kwargs: Additional filters on attribute values. N)parentsr ResultSetrrY)r}rCr2rRrCiterators rUrzPageElement.find_parentssM"<IcNNDN %uh% % 28% %    rW findParentsr fetchParentsc|jS)z?The `PageElement`, if any, that was parsed just after this one.rrs rUnextzPageElement.nexts   rWc|jS)z@The `PageElement`, if any, that was parsed just before this one.rrs rUpreviouszPageElement.previous $$rWmethodrc 6d}||||dfi|}|r|d}|S)Nrrrt)r}rrCr2rrCrr)s rUrNzPageElement._find_ones< $!'eVQ!I!I&!I!I   ArWrcd}tjdD]@}|j2|jj&|jjdddkrn|dz }A|S)zdFind the appropriate stack level to use when issuing a warning relating to one of the find* methods.r)contextNrSrz bs4.elementr)inspectstackframe f_globalsget)r}rJ frameinfos rU_warning_stack_levelz PageElement._warning_stack_level!sn   q111  I+O-9O-11*bAA]RR !OJJrW generatorIterator[PageElement]r2c .|:d|vr6|d}tjdt|jd|vr=tjt jtddzt |jdd lm }t||r|}nt|||fi|}||s|s|s|d us|d |D} t|| St|tr|d d kr|d d \} } nd} |} g} |D]P} t| t s| j|ks| j| kr"| | j| kr| | Qt|| S|||S)z8Iterates over a generator looking for things that match.NrzOThe 'text' argument to find()-type methods is deprecated. Use 'string' instead.rI_classclass_)original autocorrectrr&Tc<g|]}t|t|Srt)rr)relements rUrz)PageElement._find_all..cs(WWWgjRU>V>VW'WWWrWrkr)poprMrNrPrr MESSAGEdict bs4.filterr'r SoupStrainerrrDcountsplitrrCrhrfind_all) r}rCr2rrRrrCr'matcherresultrh local_namers rUrYzPageElement._find_all:s >f..ZZ''F Ma"4     v   M19% ( 24     -,,,,, dM * * BGG"4AA&AAG >%>>f>t||t|WWWWW &111D#&& 2::c??a''*.C););&FJJ!F!%J(//G%gs33! |t++ 22#^w~/G/G g... &111 5111rWc#>K|j}||j}|V|}|dSdS)z1All PageElements that were parsed after this one.Nrr}ir/s rUrZzPageElement.next_elements}s9  mIGGGAmmmmmrWc6||jS)zBThis PageElement, then all PageElements that were parsed after it.) _self_andrZrs rUself_and_next_elementsz"PageElement.self_and_next_elements~~d0111rWc#>K|j}||j}|V|}|dSdS)zVAll PageElements that are siblings of this one but were parsed later. N)rrs rUrfzPageElement.next_siblingss9  mIGGGAmmmmmrWc6||jS)z+This PageElement, then all of its siblings.)rrfrs rUself_and_next_siblingsz"PageElement.self_and_next_siblingsrrWc#>K|j}||j}|V|}|dSdS)zhAll PageElements that were parsed before this one. :yield: A sequence of PageElements. Nrrs rUrszPageElement.previous_elementss:  !m*IGGGAmmmmmrWc6||jS)zEThis PageElement, then all elements that were parsed earlier.)rrsrs rUself_and_previous_elementsz&PageElement.self_and_previous_elements~~d4555rWc#>K|j}||j}|V|}|dSdS)zAll PageElements that are siblings of this one but were parsed earlier. :yield: A sequence of PageElements. N)rrs rUrzPageElement.previous_siblingss:  !m*IGGGAmmmmmrWc6||jS)zLThis PageElement, then all of its siblings that were parsed earlier.)rrrs rUself_and_previous_siblingsz&PageElement.self_and_previous_siblingsrrW Iterator[Tag]c#>K|j}||j}|V|}|dSdS)zAll elements that are parents of this PageElement. :yield: A sequence of Tags, ending with a BeautifulSoup object. Nrrs rUrzPageElement.parentss8 KmIGGGAmmmmmrWc6||jS)zThis element, then all of its parents. :yield: A sequence of PageElements, ending with a BeautifulSoup object. )rrrs rUself_and_parentszPageElement.self_and_parentss ~~dl+++rWother_generatorc#2K|js|V|D]}|VdS)zmModify a generator by yielding this element, then everything yielded by the other generator. N)r)r}rrs rUrzPageElement._self_ands?{ JJJ   AGGGG  rWc(t|ddpdS)z0Check whether a PageElement has been decomposed.rF)rrs rU decomposedzPageElement.decomposedst]E22;e;rWrZc|jSz:meta private:)rZrs rU nextGeneratorzPageElement.nextGenerator !!rWrfc|jSr)rfrs rUnextSiblingGeneratorz PageElement.nextSiblingGeneratorrrWrsc|jSr)rsrs rUpreviousGeneratorzPageElement.previousGenerator %%rWrc|jSr)rrs rUpreviousSiblingGeneratorz$PageElement.previousSiblingGeneratorrrWrc|jSr)rrs rUparentGeneratorzPageElement.parentGenerators |rW)NNNNN) rrrr*rr*rr*rr*rEr)rrDrrrErD)rrrEr rErFrrrrrEr!rEr!)rrrrrErrEr)rrDrrrrrErDrErD)rr0rEr!)rrrErr)rrrEr!rEr)TT)rrr rrEr*)rr0rEr#)NNNNNN)rCrDrirgr1rgr2r3r4rr5rrrgr6r3rEr)rrDr;r<rEr<)rEr?ro) rCrr2rrr;rCr8rEr+)NNN) rCr?r2rHrrrCr8rEr,) rCr?r2rHrrKrCr8rErL) rCrr2rrr;rRrrCr8rEr6)NNNN) rCr?r2rHrrrRrrCr8rEr7) rCr?r2rHrrKrRrrCr8rErW)rCr?r2rHrCr8rEr,) rCr?r2rHrRrrCr8rEr7)rEr*) rrrCr?r2rHrrKrCr8rEr*rEr)rCr?r2rHrrKrRrrrrCr8rEr2rEr)rEr)rrrEr)VrSrprqrrrrsrrrrpropertyrrrrrrtuplerrrrgetTextrr r rrrrrr"r+r0r9r>r8rAr rFrPrOr\r^rbrargrhrkrornrurvrxr|r{rrrrrrrrrrNrrYrZrrfrrsrrrrrrrrrrrrrrtrWrUrrdsV !%I$$$$####''''####''''F!%.2*..2*. 0606060606d    ((((8###X#,$#M>7KKK''(9;MwWWO$$$$$%%%% 05uwwG6666"G$$$$$X18 RRRRR2G X.-,]NGTTK.....`0@D8,+176D$("&/3$(#' $hhhhh",,,,,---X-X     X -159     X )-15.2 QQQQQ(*)*k7KKH  $      X  )-15#     X )-15.2#      :-,]OWUUK    X )-15     X )-15.2 VVVVV(10.O   $      X  )-15#     X )-15.2#      :210'3217     X -159     X )-15.2 UUUUU(.-nowWWL  $      X  )-15#     X )-15.2#      :10.O21/     X )-15     X )-15.2      ,546   $      X  )-15#     X )-15.2#      :65 8'76!97 )-158,+L-QQJ)-15#      0-,]NGTTK--nngVVL !!!X!%%%X% $X0?2?2?2?2FX222X2X222X2   X 666X6    X 666X6    X ,,,X,<<<X<['**"""+*"['**"""+*"[$g..&&&/.&[$g..&&&/.&[G$$%$rWrceZdZUdZdZded<dZded<d%d Zd&d'dZd(dZ d)fd Z e d*dZ d+d,dZ e d-dZejd.dZd ejfd/d#Ze d0d$ZxZS)1r<zA Python string that is part of a parse tree. When Beautiful Soup parses the markup ``penguin``, it will create a `NavigableString` for the string "penguin". rrDPREFIXSUFFIXrUnion[str, bytes]rEr!ct|trt||}n!t||t}d|_||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)rrDrlrYrr)rmrus rUrlzNavigableString.__new__ s[ eS ! ! A C''AA C(?@@A  rWFrrrrc2t||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__. )typers rUrzNavigableString.__deepcopy__stDzz$rW Tuple[str]c"t|fSr)rDrs rU__getnewargs__zNavigableString.__getnewargs__'sD |rWrUnion[int | slice]ct|tr,td|jjt t||S)zRaise an exception zZstring indices must be integers, not '{0}'. Are you treating a NavigableString like a Tag?) rrD TypeErrorrOrrSrr< __getitem__)r}rrs rUrzNavigableString.__getitem__,ss c3   YxADANAWXXYY Y_d++77<<`_.z rNrSrprqrrrrsrrtrWrUr r s:[[FFrWr c0eZdZUdZdZded<dZded<dS)ProcessingInstructionzA SGML processing instruction.rNr rtrWrUr r s:((FFrWr c0eZdZUdZdZded<dZded<dS)XMLProcessingInstructionzIAn `XML processing instruction `_.rrDr?>rNr rtrWrUrrs:SSFFrWrc0eZdZUdZdZded<dZded<dS)CommentzAn `HTML comment `_ or `XML comment `_.zrNr rtrWrUrrs@VVFFrWrc0eZdZUdZdZded<dZded<dS) DeclarationzFAn `XML declaration `_.rrDrrrNr rtrWrUrrs:PPFFrWrc`eZdZUdZeddZedd Zd Zded <d Z ded <dS)DoctypezKA `document type declaration `_.rCrDpub_idrg system_idrEcJt||||S)aGenerate 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)rmrCrrs rUfor_name_and_idszDoctype.for_name_and_idss$s33D&)LLMMMrWcL|pd}||d|zz }||d|zz }n ||d|zz }|S)zGenerate 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. rNz PUBLIC "%s"z "%s"z SYSTEM "%s"rt)rmrCrrrs rUrz Doctype._string_for_name_and_idssR    ^f, ,E$9,,  " ^i/ /E rWz rN)rCrDrrgrrgrEr)rCrDrrgrrgrErD) rSrprqrr classmethodrrrrsrrtrWrUrrs~UU N N N[ N["FFrWrceZdZdZdS) StylesheetzA `NavigableString` representing the contents of a `