[L iUddlmZdZddlZddlZddlmZddlmZm 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;mZ>m?Z?m@Z@e"e dee dfZAdeBd<ee"dZCdeBd<eDdZEejdZGdeBd<dTdZHdZIdeBd<ejdZJdeBd<eKgdZLd eBd!<Gd"d#eMZNGd$d%eMZOGd&d'eOZPGd(d)eeMZQGd*d+eeefZRGd,d-eRZSGd.d/eRZTGd0d1eOZUGd2d3eVZWGd4deMeWZXGd5d6eXZYGd7d8eYZZGd9d:eYZ[Gd;deYZ]Gd?d@eYZ^GdAdBeYZ_GdCdDeXZ`GdEdFeXZaGdGdHeXZbGdIdJeXZcGdKdLeXZdGdMdNeWZee!dOeWPZfGdQdReefeefZgddSl,mhZhy)U) annotationsMITNCSS) _deprecated_deprecated_alias_deprecated_function_alias) Formatter HTMLFormatter XMLFormatter)!AttributeResemblesVariableWarning)AnyCallableDictGenericIterableIteratorListMappingMutableSequenceOptionalPatternSet TYPE_CHECKINGTupleTypeTypeVarUnioncastoverload)Self TypeAlias BeautifulSoup) TreeBuilder ElementFilter)_EntitySubstitutionFunction_FormatterOrName)_AtMostOneElement _AtMostOneTag_AtMostOneNavigableString_AttributeValue_AttributeValues _Encoding_InsertableElement _OneElement _QueryResults_RawOrProcessedAttributeValues_StrainableElement_StrainableAttribute_StrainableAttributes_StrainableString_SomeNavigableStrings _SomeTagsNavigableStringr"_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_restrc|tvrEt|}tj|j|tdt d|St dtd|)Nname stacklevel _deprecated_zmodule z has no attribute )_deprecated_nameswarningswarnformatDeprecationWarningglobalsAttributeError__name__)rCmessages Q/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/bs4/element.py __getattr__rRZs_   #D) gnn$n/1CPQRy<v.// 78,.@I JJutf-8DEFAULT_OUTPUT_ENCODINGz\S+nonwhitespace_re) idnambcsoempalmospunycoderaw_unicode_escape undefinedunicode_escapezraw-unicode-escapezunicode-escapez string-escape string_escapezSet[_Encoding]PYTHON_SPECIFIC_ENCODINGScLeZdZUdZded<ded<ded< d d dZy) 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 namespaceNc|sd}|stj||}n5|stj||}ntj||dz|z}||_||_||_|S)N:)r@__new__rdrCre)clsrdrCreobjs rQrhzNamespacedAttribute.__new__sg D++c6*C++c4(C++c6C<$#67C !  rSNN)rdrcrCrcrercreturnr!)rO __module__ __qualname____doc____annotations__rhrSrQrbrbsN   ##' !   rSrbc$eZdZUdZded<ddZy)%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. r@original_valuect)zDo whatever's necessary in this implementation-specific portion an HTML document to substitute in a specific encoding. NotImplementedErrorselfeventual_encodings rQsubstitute_encodingz9AttributeValueWithCharsetSubstitution.substitute_encodings "##rSN)rzr@rlr@)rOrmrnrorpr{rqrSrQrsrss $rSrsc"eZdZdZddZdddZy)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``. c@tj||}||_|SN)r@rhrtrirtrjs rQrhz!CharsetMetaAttributeValue.__new__s!kk#~.+ rSc|tvry|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. )r`rxs rQr{z-CharsetMetaAttributeValue.substitute_encodings  9 9  rSNrtr@rlr!rTrzr/rlr@)rOrmrnrorhr{rqrSrQr}r}s!rSr}ceZdZdZy)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. NrOrmrnrorqrSrQrrrSrceZdZdZy) 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. NrrqrSrQrrsrSrc$eZdZdZdfd ZxZS)XMLAttributeDictzyA dictionary for holding a Tag's attributes, which processes incoming values for consistency with the HTML spec. c|d}t|trn!t|ttfr t |}t |||y)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) isinstanceboolintfloatr@super __setitem__rykeyvalue __class__s rQrzXMLAttributeDict.__setitem__sF =E eT "  U| , JE C'rSrr@rrrlNonerOrmrnror __classcell__rs@rQrrs((rSrc$eZdZdZdfd 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. c|dvr||vr||=yt|tr t|tr |j}n$|}n!t|tt fr t |}t|!||y)z\Set an attribute value, possibly modifying it to comply with the HTML spec, )FNN) rrrbrCrrr@rrrs rQrzHTMLAttributeDict.__setitem__sm M !d{I  eT "#23 U| ,JE C'rSrrrs@rQrrs((rSrcheZdZUdZej dej Zded<ddZ d d dZ y) 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=)([^;]*)r> CHARSET_REcv|jj|tj||}||_|Sr)rsearchr@rhrtrs rQrhz!ContentMetaAttributeValue.__new__Ls1 n-kk#~.+ rSctvr&|jjd|jSdfd }|jj||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. rc,|jdzS)N)group)matchrzs rQrewritez>ContentMetaAttributeValue.substitute_encoding..rewriteZs;;q>$55 5rS)rz re.Match[str]rlr@)r`rsubrt)ryrzrs ` rQr{z-ContentMetaAttributeValue.substitute_encodingRsO  9 9??&&r4+>+>? ? 6""7D,?,?@@rSNrrr) rOrmrnrorecompileMrrprhr{rqrSrQrr:s0  *rzz*FMJ M ArSrct eZdZUdZdZded<ded<ded<d ed <d ed <d ed <d ed <dZded< dw dxdZdydZ dzdZ e d{dZ e dd dZ e dd dZd|d}dZd~dZeZded<def ddZe ddZddef ddZeZe eZddZed d!dZdd"Zddd#Zdd$Z d dd%Ze d&d'dZdd(Z dd)Z!e" d dd*Z#e" d dd+Z# d dd,Z#ed-d.dZ$e" d dd/Z%e" d dd0Z% d dd1Z%ed2d3dZ&e" d dd4Z'e" d dd5Z' d dd6Z'ed7d8dZ(e" d dd9Z)e" d dd:Z) d dd;Z)edd=d?Z+e" d dd@Z,e" d ddAZ, d ddBZ,edCdDd?Z-e" d ddEZ.e" d ddFZ. d ddGZ.edHdIdZ/edJdId?Z0e" d ddKZ1e" d ddLZ1 d ddMZ1edNdOdZ2e" d ddPZ3e" d ddQZ3 d ddRZ3edSdTdZ4edUdTd?Z5 d ddVZ6edWdXdZ7 d ddYZ8edZd[dZ9ed\d[d?Z:e dd]Z;e dd^Z< dd_Z= d dd`Z>e ddaZ?e ddbZ@e ddcZAe dddZBe ddeZCe ddfZDe ddgZEe ddhZFe ddiZGe ddjZHddkZIe d{dlZJeKdmdddnZLeKdodddpZMeKdqdddrZNeKdsdddtZOeKdudddvZPy) 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_siblingFhiddenc||_||_|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)rrrrrcontents)ryrrrrrs rQsetupzPageElement.setup~s2 0  ,15D ! ! .(    (15D   .(    (15D   .  $ ' $$#{{33B7  0  ,15D ! ! . -rScr||St|ts|j|}|j|}|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)rys formatteroutputs rQ format_stringzPageElement.format_strings>  H)Y/// :I%%a( rSct|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)ryformatter_namecregistrys rQrzPageElement.formatter_for_names[ ni 0! ! <<A#,,HA$--H N #8 8''rSc|j |jS|j t|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. is_xmlF)rrgetattrrrys rQrzPageElement._is_xmlsG >> %>> ! ;; 451 1{{"""rS nextSibling4.0.0previousSiblingctrrvrymemo recursives rQ __deepcopy__zPageElement.__deepcopy__s !##rSc$|jiS)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 rQ__copy__zPageElement.__copy__s  $$rSIterable[type[NavigableString]]defaultct)zYield all strings of certain classes, possibly stripping them. This is implemented differently in `Tag` and `NavigableString`. rv)rystriptypess rQ _all_stringszPageElement._all_stringss "##rSc#@K|jdD]}|yw)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)rystrings rQstripped_stringszPageElement.stripped_stringss'''- FL srcl|j|j||Dcgc]}|c}Scc}w)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. )r)joinr)ry separatorrrrs rQget_textzPageElement.get_texts1.~~$*;*;E*;*OPQqPQQPs 1cbj tdt|dk(r |durStfd|Dr tdj}jj }j |t ||D]\}}|j||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. z^Cannot replace one element with another when the element to be replaced is not part of a tree.rrc3:K|]}|juywrr.0xrys rQ z+PageElement.replace_with..<s.AqDKK.sz%Cannot replace a Tag with its parent. _self_index)start)r ValueErrorlenanyindexextract enumerateinsert)ryargs old_parentmy_indexidx replace_withs` rQrzPageElement.replace_with.s ;; @  t9>d1goK .. .DE E[[ ;;$$T*  *!*4x!@ 1 C   c< 0 1 rS replaceWithrcJ|j|}|j||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. )rappend)ry wrap_insidemes rQwrapzPageElement.wrapGs(   { +2rSc|j4||jj|}|jj|=|j}t t |}|j }|j|j|ur||j_|||jur|j|_d|_d|_d|_|j3|j|jur|j|j_ |j3|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)ryr last_childrs rQrzPageElement.extractQs@ ;; """kk//5  $$[1 **, +z2 !..  ,$$L85A%%2  # D->>151B1BD ! ! .    )!!)>)>>151F1FD   .488 1 rSc|j|}d}|Q|j}|jjt |t rd|_g|_d|_|}|Pyy)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__clearrTagrCrr)ryenext_ups rQ decomposezPageElement.decomposes` #%)mnnG JJ   !S!  AMAmrSc|r#|j|jj}nJ|}t|tr8|jr,|jd}t|tr |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)rrrr r)ryis_initialized accept_selfr s rQrzPageElement._last_descendantss$ d//;**;;JJZ-*2E2E'004 Z-*2E2EzT1JrS_lastRecursiveChildrc.j}| tdtfd|Dr tdg}|D]T}t|tr|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 ywrrqrs rQrz,PageElement.insert_before..'QqDy'z&Can't insert an element before itself. rrrrrrrextendr)ryrrresults predecessorrs` rQ insert_beforezPageElement.insert_befores >QR R '$' 'EF F%' >K+{3##%LL&E NN6== < =  >rScHj}| tdtfd|Dr tdd}g}|D]_}t|tr|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 ywrrqrs rQrz+PageElement.insert_after..rrz%Can't insert an element after itself.rrr)ryrroffsetr successorrs` rQ insert_afterzPageElement.insert_afters >PQ Q '$' 'DE E%' I)[1!!#LL&E NN6==V);YG H aKF rSc yrrqryrCattrsrkwargss rQ find_nextzPageElement.find_next rSc yrrqr$s rQr'zPageElement.find_nextr(rSc B|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_nextr$s rQr'zPageElement.find_nexts&$t~~d00$vPPPrSfindNextr'c yrrqryrCr%rlimit _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_next6D,t~~         $a    rS findAllNextr,c yrrqr$s rQfind_next_siblingzPageElement.find_next_siblingXr(rSc yrrqr$s rQr:zPageElement.find_next_siblingbr(rSc B|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. )r+find_next_siblingsr$s rQr:zPageElement.find_next_siblingls&$t~~d55tUFUfUUrSfindNextSiblingr:c yrrqr/s rQr=zPageElement.find_next_siblingsr2rSc yrrqr/s rQr=zPageElement.find_next_siblingsr2rSc 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_siblingsr7rSfindNextSiblingsr=fetchNextSiblings3.0.0c yrrqr$s rQ find_previouszPageElement.find_previousr(rSc yrrqr$s rQrGzPageElement.find_previousr(rSc B|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. )r+find_all_previousr$s rQrGzPageElement.find_previouss&$t~~d44dE6TVTTrS findPreviousrGc yrrqr/s rQrJzPageElement.find_all_previousr2rSc yrrqr/s rQrJzPageElement.find_all_previousr2rSc 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)r5previous_elementsr/s rQrJzPageElement.find_all_previousD,t~~      " "  $a    rSfindAllPreviousrJfetchAllPreviousc yrrqr$s rQfind_previous_siblingz!PageElement.find_previous_sibling,r(rSc yrrqr$s rQrTz!PageElement.find_previous_sibling6r(rSc B|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. )r+find_previous_siblingsr$s rQrTz!PageElement.find_previous_sibling@s.$t~~  ' 'uf @F  rSfindPreviousSiblingrTc 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)r5previous_siblingsr/s rQrWz"PageElement.find_previous_siblingsrrPrSfindPreviousSiblingsrWfetchPreviousSiblingsc Fd}|j||dfddi|}|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. Nrr1r) find_parents)ryrCr%r&rrs rQ find_parentzPageElement.find_parentsE( #$## % () -3   ArS findParentrcc ||j}ttt|j||d||fd|dzi|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. :param _stacklevel: Used internally to improve warning messages. :kwargs: Additional filters on attribute values. Nr1r)parentsr ResultSetr r5)ryrCr%r0r1r&iterators rQrazPageElement.find_parentssN&<<IcNNDNN %uh% f.ZZ'F MMa"&  v  MM199% ( 2&  - dM *G"4A&AG >%ft|t|1:WgjRU>V'WW &11D#&::c?a'*.C);&FJ!F!%J(/G%gs3 ||t+ 2#^w~~/G g./!&11 511-Xs %F;Fc#TK|j}||j}||}|yyw)z1All PageElements that were parsed after this one.Nrlryir!s rQr6zPageElement.next_elements6s2   mIGAm#((c8|j|jS)zBThis PageElement, then all PageElements that were parsed after it.) _self_andr6rs rQself_and_next_elementsz"PageElement.self_and_next_elements?~~d0011rSc#TK|j}||j}||}|yyw)zVAll PageElements that are siblings of this one but were parsed later. N)rrs rQrBzPageElement.next_siblingsDs2   mIGAmrc8|j|jS)z+This PageElement, then all of its siblings.)rrBrs rQself_and_next_siblingsz"PageElement.self_and_next_siblingsOrrSc#TK|j}||j}||}|yyw)zhAll PageElements that were parsed before this one. :yield: A sequence of PageElements. Nrors rQrOzPageElement.previous_elementsTs4  ! !m**IGAmrc8|j|jS)zEThis PageElement, then all elements that were parsed earlier.)rrOrs rQself_and_previous_elementsz&PageElement.self_and_previous_elements`~~d4455rSc#TK|j}||j}||}|yyw)zAll PageElements that are siblings of this one but were parsed earlier. :yield: A sequence of PageElements. N)rrs rQr\zPageElement.previous_siblingsfs4  ! !m**IGAmrc8|j|jS)zLThis PageElement, then all of its siblings that were parsed earlier.)rr\rs rQself_and_previous_siblingsz&PageElement.self_and_previous_siblingssrrSc#TK|j}||j}||}|yyw)zAll elements that are parents of this PageElement. :yield: A sequence of Tags, ending with a BeautifulSoup object. Nrrs rQrfzPageElement.parentsys0 KKmIGAmrc8|j|jS)zThis element, then all of its parents. :yield: A sequence of PageElements, ending with a BeautifulSoup object. )rrfrs rQself_and_parentszPageElement.self_and_parentss ~~dll++rSc#BK|js||D]}|yw)zmModify a generator by yielding this element, then everything yielded by the other generator. N)r)ryother_generatorrs rQrzPageElement._self_ands({{J  AG sc$t|ddxsdS)z0Check whether a PageElement has been decomposed.rF)rrs rQ decomposedzPageElement.decomposedst]E2;e;rSr6c|jSz:meta private:)r6rs rQ nextGeneratorzPageElement.nextGenerator!!!rSrBc|jSr)rBrs rQnextSiblingGeneratorz PageElement.nextSiblingGeneratorrrSrOc|jSr)rOrs rQpreviousGeneratorzPageElement.previousGenerator%%%rSr\c|jSr)r\rs rQpreviousSiblingGeneratorz$PageElement.previousSiblingGeneratorrrSrfc|jSr)rfrs rQparentGeneratorzPageElement.parentGenerators||rS)NNNNN) rrrr*rr*rr*rr*rlr)rr@rOptional[_FormatterOrName]rlr@)rz4Union[_FormatterOrName, _EntitySubstitutionFunction]rlr rlrFrzDict[Any, Any]rrrlr!rlr!)rrrrrl Iterator[str]rlr)rr@rrrzIterable[Type[NavigableString]]rlr@)rr0rlr!)rr rlr r)r Optional[int]rlr!rlr)TT)rrrrrlr*)rr0rlList[PageElement])NNN) rCr<r%Optional[_StrainableAttributes]rrr&r5rlr+)NNr) rCrr%rrr7r&r5rlr,) rCr<r%rrOptional[_StrainableString]r&r5rlBUnion[_AtMostOneTag, _AtMostOneNavigableString, _AtMostOneElement])NNNNrD)rCr<r%rrrr0rr1rr&r5rlr9)NNrNrD)rCrr%rrr7r0rr1rr&r5rlr8)rCr<r%rrrr0rr1rr&r5rl6Union[_SomeTags, _SomeNavigableStrings, _QueryResults]rk)rCr<r%rr&r5rlr+)NNNrD) rCr<r%rr0rr1rr&r5rlr9)rlr*) rtrrCr<r%rrrr&r5rlr*)r`)rCr<r%rrrr0rrIterator[PageElement]r1rr&r5rlr2rlr)rlz Iterator[Tag])rrrlr)QrOrmrnrorrprrrrpropertyrrrrrrtuplerrrrgetTextrvrr rrrrrrrr"r r'r-r,r8r:r>r=rCrDrGrKrJrQrRrTrXrWr]r^rcrdrarirjrmrpr+r5r6rrBrrOrr\rrfrrrrrrrrrrqrSrQrr`s !%I~$ ##''##''FD!%.2*..2*. 0606,06( 06 , 06 ( 06 06d (R( (8##,$M>7KK'(9;MwWO$% 05wG ,6"G$$*I$ $18 RRR/ R R2G H D.-]NGTK.`0@D"8< 8,176B%)59  ! 3   +     &(    &  +  #   !%15.2 QQ/Q, Q ' Q J Q(**k7KH !%15#    /        '       $&#      "      '       !%15.2#   / ,      '  > @-]OWUK %)59  ! 3   +     &(    &  +  #   !%15.2 VV/V, V ' V J V(1.O!%15#    /        '       $&#      "      '       !%15.2#   / ,      '  > @20'317%)59  ! 3   +     &(    &  *  #   !%15.2 UU/U, U ' U J U(.nowWL !%15#    /        '       $&#      "      '       !%15.2#   / ,      '  > @1.O2/%)59  ! 3   +     &(    &  *  #   !%15.2   / ,  '  J  ,56!%15#    /        '       $&#      "      '       !%15.2#   / ,      '  > @6 8'7!97 !%15/'   8,L-QJ!%15#   /     '    4-]NGTK-nngVL !!%%   /,' 2@2@2/@2, @2  @2 ) @2@2'@2 @2H2222  66   66   ,,<<'*"+"'*"+"$g.&/&$g.&/&G$%rSrceZdZUdZdZded<dZded<ddZdddZdd Z dfd Z e dd Z ddd Z e dd ZejddZdej"f ddZe ddZxZS)r: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". rr@PREFIXSUFFIXct|trtj||}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)rr@rhrUrr)rirus rQrhzNavigableString.__new__sF eS ! 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__. )typers rQrzNavigableString.__deepcopy__stDz$rSct|fSr)r@rs rQ__getnewargs__zNavigableString.__getnewargs__sD |rSct|tr.tdj|jj t t|#|S)zRaise an exception zZstring indices must be integers, not '{0}'. Are you treating a NavigableString like a Tag?) rr@ TypeErrorrKrrOrr: __getitem__)ryrrs rQrzNavigableString.__getitem__s` c3 xADANANAWAWXY Y_d7<`_.z rNrOrmrnrorrprrqrSrQrrns[FCFCrSrc.eZdZUdZdZded<dZded<y)ProcessingInstructionzA SGML processing instruction.rNrrqrSrQrrus(FCFCrSrc.eZdZUdZdZded<dZded<y)XMLProcessingInstructionzIAn `XML processing instruction `_.rr@r?>rNrrqrSrQrr|sSFCFCrSrc.eZdZUdZdZded<dZded<y)CommentzAn `HTML comment `_ or `XML comment `_.zrNrrqrSrQrrsVFCFCrSrc.eZdZUdZdZded<dZded<y) DeclarationzFAn `XML declaration `_.rr@rrrNrrqrSrQrrsPFCFCrSrcreZdZUdZe d dZe d dZdZded<dZ ded<y ) DoctypezKA `document type declaration `_.r@c:t|j|||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)rirCpub_id system_ids rQfor_name_and_idszDoctype.for_name_and_idsss33D&)LMMrScR|xsd}||d|zz }||d|zz }|S||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. rz PUBLIC "%s"z "%s"z SYSTEM "%s"rq)rirCrrrs rQrz Doctype._string_for_name_and_idssZ    ^f, ,E$9,,  " ^i/ /E rSz rN)rCr@rrcrrcrlr)rCr@rrcrrcrlr@) rOrmrnro classmethodrrrrprrqrSrQrrsU N N - N:G N  N N -:G "FCFCrSrceZdZdZy) StylesheetzA `NavigableString` representing the contents of a `