
    (phȬ                   h   % S SK Jr  SrS SKrS SKrS SKJr  S SKJrJ	r	J
r
  S SKJrJrJr  S SKJr  S SKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"  S S	K#J$r$J%r%  \(       a6  S S
K&J'r'  S SK(J)r)  S SK*J+r+  S SKJ,r,J-r-  S SK.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:  \!\S   \\S      4   r;S\<S'   \\!S      r=S\<S'   \>" SS9r?\R                  " S5      rAS\<S'   STS jrBSrCS\<S'   \R                  " S5      rDS\<S'   \E" / SQ5      rFS \<S!'    " S" S#\G5      rH " S$ S%\G5      rI " S& S'\I5      rJ " S( S)\\G   5      rK " S* S+\\\4   5      rL " S, S-\L5      rM " S. S/\L5      rN " S0 S1\I5      rO " S2 S3\P5      rQ " S4 S\G\Q5      rR " S5 S6\R5      rS " S7 S8\S5      rT " S9 S:\S5      rU " S; S<\U5      rV " S= S>\S5      rW " S? S@\S5      rX " SA SB\S5      rY " SC SD\R5      rZ " SE SF\R5      r[ " SG SH\R5      r\ " SI SJ\R5      r] " SK SL\R5      r^ " SM SN\Q5      r_\ " SO\QSP9r` " SQ SR\\`   \\`   5      raS SSK*Jbrb  g)U    )annotationsMITNCSS)_deprecated_deprecated_alias_deprecated_function_alias)	FormatterHTMLFormatterXMLFormatter)!AttributeResemblesVariableWarning)AnyCallableDictGenericIterableIteratorListMappingOptionalPatternSetTYPE_CHECKINGTupleTypeTypeVarUnioncast)Self	TypeAliasBeautifulSoup)TreeBuilderElementFilter)_EntitySubstitutionFunction_FormatterOrName)_AtMostOneElement_AttributeValue_AttributeValues	_Encoding_InsertableElement_OneElement_QueryResults_RawOrProcessedAttributeValues_StrainableElement_StrainableAttribute_StrainableAttributes_StrainableStringNavigableStringr    _OneOrMoreStringTypes)r0   r%   _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                    U [         ;   a@  [         U    n[        R                  " UR                  U S9[        SS9  [        5       SU  3   $ [        S[        < SU < 35      e)Nname   
stacklevel_deprecated_zmodule z has no attribute )_deprecated_nameswarningswarnformatDeprecationWarningglobalsAttributeError__name__)r=   messages     >/var/www/html/venv/lib/python3.13/site-packages/bs4/element.py__getattr__rL   T   s_      #D)gnn$n/1CPQRy<v.//
78,.@I
JJ    utf-8DEFAULT_OUTPUT_ENCODINGz\S+nonwhitespace_re)idnambcsoempalmospunycoderaw_unicode_escape	undefinedunicode_escapezraw-unicode-escapezunicode-escapezstring-escapestring_escapezSet[_Encoding]PYTHON_SPECIFIC_ENCODINGSc                  X    \ rS rSr% SrS\S'   S\S'   S\S'     S
       SS jjrS	rg)NamespacedAttribute   zA 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]prefixr=   	namespaceNc                    U(       d  S nU(       d  [         R                  X5      nO8U(       d  [         R                  X5      nO[         R                  XS-   U-   5      nXl        X$l        X4l        U$ )N:)r:   __new__r_   r=   r`   )clsr_   r=   r`   objs        rK   rc   NamespacedAttribute.__new__   s[      D++c*C++c(C++cC<$#67C
!
rM    )NN)r_   r^   r=   r^   r`   r^   returnr   )rI   
__module____qualname____firstlineno____doc____annotations__rc   __static_attributes__rg   rM   rK   r\   r\      sS    
 

 ##'	  !	
 
 rM   r\   c                  .    \ rS rSr% SrS\S'   SS jrSrg)	%AttributeValueWithCharsetSubstitution   a  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                    [        5       e)zwDo whatever's necessary in this implementation-specific
portion an HTML document to substitute in a specific encoding.
NotImplementedErrorselfeventual_encodings     rK   substitute_encoding9AttributeValueWithCharsetSubstitution.substitute_encoding   s     "##rM   rg   N)rx   r:   rh   r:   )rI   ri   rj   rk   rl   rm   ry   rn   rg   rM   rK   rp   rp      s    
 $rM   rp   c                  0    \ rS rSrSrSS jrSS	S jjrSrg)
CharsetMetaAttributeValue   ab  A 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                <    [         R                  X5      nXl        U$ N)r:   rc   rr   rd   rr   re   s      rK   rc   !CharsetMetaAttributeValue.__new__   s     kk#.+
rM   c                    U[         ;   a  gU$ )zWhen an HTML document is being encoded to a given encoding, the
value of a ``<meta>`` tag's ``charset`` becomes the name of
the encoding.
 )rZ   rv   s     rK   ry   -CharsetMetaAttributeValue.substitute_encoding   s    
  99  rM   rg   Nrr   r:   rh   r   rN   rx   r+   rh   r:   )rI   ri   rj   rk   rl   rc   ry   rn   rg   rM   rK   r|   r|      s    ! !rM   r|   c                      \ rS rSrSrSrg)AttributeValueList   a  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.
rg   NrI   ri   rj   rk   rl   rn   rg   rM   rK   r   r          rM   r   c                      \ rS rSrSrSrg)AttributeDict   zSuperclass 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.
rg   Nr   rg   rM   rK   r   r      s    rM   r   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )XMLAttributeDict   zqA dictionary for holding a Tag's attributes, which processes
incoming values for consistency with the HTML spec.
c                   > Uc  Sn[        U[        5      (       a  O&[        U[        [        45      (       a  [	        U5      n[
        TU ]  X5        g)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   )
isinstanceboolintfloatr:   super__setitem__rw   keyvalue	__class__s      rK   r   XMLAttributeDict.__setitem__   sJ     =EeT""
 U|,, JEC'rM   rg   r   r:   r   r   rh   NonerI   ri   rj   rk   rl   r   rn   __classcell__r   s   @rK   r   r      s    ( (rM   r   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )HTMLAttributeDicti	  ar  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                   > US;   a  X;   a  X	 g[        U[        5      (       a%  [        U[        5      (       a  UR                  nO)UnO&[        U[        [
        45      (       a  [        U5      n[        TU ]!  X5        g)zLSet an attribute value, possibly modifying it to comply
with the HTML spec,
)FNN)	r   r   r\   r=   r   r   r:   r   r   r   s      rK   r   HTMLAttributeDict.__setitem__  sp     M! {IeT"" #233U|,, JEC'rM   rg   r   r   r   s   @rK   r   r   	  s    ( (rM   r   c                  v    \ rS rSr% Sr\R                  " S\R                  5      rS\	S'   S
S jr
SSS jjrSrg	)ContentMetaAttributeValuei4  a  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=)([^;]*)r8   
CHARSET_REc                r    U R                   R                  U5        [        R                  X5      nXl        U$ r   )r   searchr:   rc   rr   r   s      rK   rc   !ContentMetaAttributeValue.__new__F  s-    n-kk#.+
rM   c                   ^ T[         ;   a&  U R                  R                  SU R                  5      $ SU4S jjnU R                  R                  X R                  5      $ )zWhen 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                ,   > U R                  S5      T-   $ )N   )group)matchrx   s    rK   rewrite>ContentMetaAttributeValue.substitute_encoding.<locals>.rewriteT  s    ;;q>$555rM   )r   zre.Match[str]rh   r:   )rZ   r   subrr   )rw   rx   r   s    ` rK   ry   -ContentMetaAttributeValue.substitute_encodingL  sM    
  99??&&r4+>+>??	6 ""7,?,?@@rM   rg   Nr   r   r   )rI   ri   rj   rk   rl   recompileMr   rm   rc   ry   rn   rg   rM   rK   r   r   4  s4    
  "zz*FMJMA ArM   r   c                     \ rS rSr% SrSrS\S'   S\S'   S\S	'   S
\S'   S
\S'   S
\S'   S
\S'   SrS\S'        Sj           SkS jjrSlS jr	    SmS jr
\SnS j5       r\" SSS5      r\" SSS5      rSoSpS jjrSqS jr\" 5       rS\S'   S\4     SrS jjr\SsS j5       rSS\4       StS jjr\r\" \5      rSuS  jr\" S!S"S5      rSvS# jrSwSxS$ jjrSyS% jr Sz     S{S& jjr\" S'S(S5      r S|S) jr!S|S* jr"S0 S4         S}S+ jjr#\" S,S-S5      r$S0 SSS.4             S~S/ jjr%\" S0S1S5      r&S0 S4         S}S2 jjr'\" S3S4S5      r(S0 SSS.4             S~S5 jjr)\" S6S7S5      r*\" S8S7S95      r+S0 S4         S}S: jjr,\" S;S<S95      r-S0 SSS.4             S~S= jjr.\" S>S?S5      r/\" S@S?S95      r0S0 S4         S}SA jjr1\" SBSCS5      r2S0 SSS.4             S~SD jjr3\" SESFS5      r4\" SGSFS95      r5S0 4       SSH jjr6\" SISJS5      r7S0 SS.4           SSK jjr8\" SLSMS5      r9\" SNSMS95      r:\SSO j5       r;\SSP j5       r<            SSQ jr= S               SSR jjr>\SSS j5       r?\SST j5       r@\SSU j5       rA\SSV j5       rB\SSW j5       rC\SSX j5       rD\SSY j5       rE\SSZ j5       rF\SS[ j5       rG\SS\ j5       rHSS] jrI\SnS^ j5       rJ\K" S_S5      SS` j5       rL\K" SaS5      SSb j5       rM\K" ScS5      SSd j5       rN\K" SeS5      SSf j5       rO\K" SgS5      SSh j5       rPSirQg)PageElementiZ  ab  An 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                   Xl         X l        U R                  b  X R                  l        X0l        U R                  b  X R                  l        XPl        U R                  b  X R                  l        UcA  U R                   b4  U R                   R
                  (       a  U R                   R
                  S   nX@l        U R                  b  X R                  l        gg)a  Sets 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)rw   r   r   r   r   r   s         rK   setupPageElement.setupx  s    2  0  ,15!!.((15.((15. $'$$#{{33B7 0  ,15!!. -rM   c                ~    Uc  U$ [        U[        5      (       d  U R                  U5      nUR                  U5      nU$ )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.
)r   r
   formatter_for_name
substitute)rw   s	formatteroutputs       rK   format_stringPageElement.format_string  sA     H)Y////	:I%%a(rM   c                    [        U[        5      (       a  U$ U R                  (       a  [        n[        R                  nO[
        n[
        R                  n[        U5      (       a  U" US9$ X1   $ )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)rw   formatter_namecregistrys       rK   r   PageElement.formatter_for_name  s_     ni00!! <<A#,,HA$--HN##88''rM   c                    U R                   b  U R                   $ U R                  c  [        U SS5      $ U R                  R                  $ )zIs 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   rw   s    rK   r   PageElement._is_xml  sG     >>% >>!
 ;; 4511{{"""rM   nextSibling4.0.0previousSiblingc                    [        5       er   rt   rw   memo	recursives      rK   __deepcopy__PageElement.__deepcopy__  s    !##rM   c                $    U R                  0 5      $ )zxA 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    rK   __copy__PageElement.__copy__  s       $$rM   Iterable[type[NavigableString]]defaultc                    [        5       e)zYield all strings of certain classes, possibly stripping them.

This is implemented differently in `Tag` and `NavigableString`.
rt   )rw   striptypess      rK   _all_stringsPageElement._all_strings  s     "##rM   c              #  D   #    U R                  S5       H  nUv   M	     g7f)zYield 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   )rw   strings     rK   stripped_stringsPageElement.stripped_strings  s!      ''-FL .s    r   c                h    UR                  U R                  X#S9 Vs/ s H  oDPM     sn5      $ s  snf )a8  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   )rw   	separatorr   r   r   s        rK   get_textPageElement.get_text  s5    . ~~$*;*;E*;*OP*OQq*OPQQPs   /c                f  ^  T R                   c  [        S5      e[        U5      S:X  a
  US   T L a  T $ [        U 4S jU 5       5      (       a  [        S5      eT R                   nT R                   R	                  T 5      nT R                  US9  [        XS9 H  u  pEUR                  XE5        M     T $ )zReplace this `PageElement` with one or more other `PageElement`,
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   r   c              3  >   >#    U  H  oTR                   L v   M     g 7fr   r   .0xrw   s     rK   	<genexpr>+PageElement.replace_with.<locals>.<genexpr>6  s     .ADKKs   z%Cannot replace a Tag with its parent._self_index)start)r   
ValueErrorlenanyindexextract	enumerateinsert)rw   args
old_parentmy_indexidxreplace_withs   `     rK   r  PageElement.replace_with(  s     ;;@  t9>d1goK....DEE[[
;;$$T**!*4!@Cc0 "ArM   replaceWithr  c                J    U R                  U5      nUR                  U5        U$ )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)rw   wrap_insidemes      rK   wrapPageElement.wrapA  s(     {+2rM   c                   U R                   b5  Uc  U R                   R                  U 5      nU R                   R                  U	 U R                  5       n[	        [
        U5      nUR                  nU R                  b  U R                  ULa  X0R                  l        Ub  X0R                  La  U R                  Ul        SU l        SUl        SU l         U R                  b4  U R                  U R                  La  U R                  U R                  l	        U R                  b4  U R                  U R                  La  U R                  U R                  l        S=U l        U l	        U $ )zDestructively 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_descendantr   r   r   r   r   r   )rw   r  
last_childr   s       rK   r  PageElement.extractK  s<    ;;"""kk//5$$[1
 **,
 +z2
!..  ,$$L85A%%2#<Q<Q(Q,0,A,AL) $"&
!!-%%T->->>151B1BD!!.)!!)>)>>151F1FD.488 1rM   c                    U R                  5         U nSnUbQ  UR                  nUR                  R                  5         [	        U[
        5      (       a  / Ul        SUl        UnUb  MP  gg)am  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.
NT)r  r   __dict__clearr   Tagr   r   )rw   enext_ups      rK   	decomposePageElement.decompose{  s\     	#%)mnnGJJ!S!!
 AMA mrM   c                4   U(       a$  U R                   b  U R                   R                  nO_U n[        U[        5      (       aH  UR                  (       a7  UR                  S   n[        U[        5      (       a  UR                  (       a  M7  U(       d  X0L a  SnU$ )a  Finds 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   )rw   is_initializedaccept_selfr  s       rK   r  PageElement._last_descendant  sz    $ d//;**;;JJZ--*2E2E'004
 Z--*2E2E2Ez1JrM   _lastRecursiveChildr  c                H  ^  T R                   nUc  [        S5      e[        U 4S jU 5       5      (       a  [        S5      e/ nU HY  n[        U[        5      (       a  UR                  5         UR                  T 5      nUR                  UR                  XT5      5        M[     U$ )a&  Makes 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.c              3  *   >#    U  H  oTL v   M
     g 7fr   rg   r  s     rK   r  ,PageElement.insert_before.<locals>.<genexpr>       '$QDy$   z&Can't insert an element before itself.	r   r	  r  r   r   r  r  extendr  )rw   r  r   resultspredecessorr  s   `     rK   insert_beforePageElement.insert_before  s     >QRR'$'''EFF%'K +{33##%LL&ENN6==<=   rM   c                d  ^  T R                   nUc  [        S5      e[        U 4S jU 5       5      (       a  [        S5      eSn/ nU He  n[        U[        5      (       a  UR                  5         UR                  T 5      nUR                  UR                  US-   U-   U5      5        US-  nMg     U$ )a  Makes 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.c              3  *   >#    U  H  oTL v   M
     g 7fr   rg   r  s     rK   r  +PageElement.insert_after.<locals>.<genexpr>  r1  r2  z%Can't insert an element after itself.r   r   r3  )rw   r  r   offsetr5  	successorr  s   `      rK   insert_afterPageElement.insert_after  s     >PQQ'$'''DEE%'I )[11!!#LL&ENN6==V);YGHaKF  rM   c                @    U R                   " U R                  XU40 UD6$ )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_nextrw   r=   attrsr   kwargss        rK   	find_nextPageElement.find_next  s"    $ ~~d00$vPPPrM   findNextrF  r>   c                N    U R                   " UUUUU R                  4SUS-   0UD6$ )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.
_stacklevelr   )	_find_allnext_elementsrw   r=   rD  r   limitrJ  rE  s          rK   rB  PageElement.find_all_next  B    , ~~
 $a
 
 	
rM   findAllNextrB  c                @    U R                   " U R                  XU40 UD6$ )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.
)rA  find_next_siblingsrC  s        rK   find_next_siblingPageElement.find_next_sibling#  s"    $ ~~d55tFUfUUrM   findNextSiblingrT  c                N    U R                   " UUUUU R                  4SUS-   0UD6$ )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.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
rJ  r   )rK  next_siblingsrM  s          rK   rS  PageElement.find_next_siblings;  rP  rM   findNextSiblingsrS  fetchNextSiblings3.0.0c                @    U R                   " U R                  XU40 UD6$ )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.
)rA  find_all_previousrC  s        rK   find_previousPageElement.find_previousb  s"    $ ~~d44d6TVTTrM   findPreviousr_  c                N    U R                   " UUUUU R                  4SUS-   0UD6$ )a)  Look 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.
rJ  r   )rK  previous_elementsrM  s          rK   r^  PageElement.find_all_previousx  B    , ~~""
 $a
 
 	
rM   findAllPreviousr^  fetchAllPreviousc                @    U R                   " U R                  XU40 UD6$ )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.
)rA  find_previous_siblingsrC  s        rK   find_previous_sibling!PageElement.find_previous_sibling  s*    $ ~~''f
@F
 	
rM   findPreviousSiblingrj  c                N    U R                   " UUUUU R                  4SUS-   0UD6$ )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.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
rJ  r   )rK  previous_siblingsrM  s          rK   ri  "PageElement.find_previous_siblings  re  rM   findPreviousSiblingsri  fetchPreviousSiblingsc                N    SnU R                   " XS4SS0UD6nU(       a  US   nU$ )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   rJ     r   )find_parents)rw   r=   rD  rE  rr5  s         rK   find_parentPageElement.find_parent  sA    ( ##
()
-3
 
ArM   
findParentrv  c                N    U R                   nU R                  " XSX64SUS-   0UD6$ )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.
NrJ  r   )parentsrK  )rw   r=   rD  rN  rJ  rE  iterators          rK   rt  PageElement.find_parents  s9    & <<~~u
<G!O
OU
 	
rM   findParentsrt  fetchParentsc                    U R                   $ )z?The `PageElement`, if any, that was parsed just after this one.r   r   s    rK   nextPageElement.next  s        rM   c                    U R                   $ )z@The `PageElement`, if any, that was parsed just before this one.r   r   s    rK   previousPageElement.previous       $$$rM   c                <    S nU" X#US4SS0UD6nU(       a  US   nU$ )Nr   rJ     r   rg   )rw   methodr=   rD  r   rE  ru  r5  s           rK   rA  PageElement._find_one%  s3      $!'VQ!XA!XQW!X
ArM   c                "   Uc1  SU;   a+  UR                  S5      n[        R                  " S[        US9  SU;   a3  [        R                  " [        R
                  [        SSS9-  [        US9  SS	KJn  [        X5      (       a  Un	O[        XU40 UD6n	Uc  U(       d  U(       d  U(       d  US
L d  Uc  S U 5       n
[        X5      $ [        U[        5      (       a  UR                  S5      S:X  a  UR                  SS5      u  pOSnUn/ n
U Hb  n[        U[        5      (       d  M  UR                   U:X  d'  UR                   U:X  d  M<  Ub  UR"                  U:X  d  MQ  U
R%                  U5        Md     [        X5      $ U	R'                  XT5      $ )z8Iterates over a generator looking for things that match.NtextzOThe 'text' argument to find()-type methods is deprecated. Use 'string' instead.r?   _classclass_)originalautocorrectr   r$   Tc              3  T   #    U  H  n[        U[        5      (       d  M  Uv   M      g 7fr   )r   r$  )r  elements     rK   r  (PageElement._find_all.<locals>.<genexpr>a  s     WgjRU>V''s   (	(rb   r   )poprC   rD   rF   r   MESSAGEdict
bs4.filterr%   r   SoupStrainer	ResultSetr:   countsplitr$  r=   r_   r  find_all)rw   r=   rD  r   rN  	generatorrJ  rE  r%   matcherresultr_   
local_namer  s                 rK   rK  PageElement._find_all7  so    >f.ZZ'FMMa"& vMM199% (
 2& 	-d**G"4A&AG >%ft|t|WW 11D#&&::c?a' *.C);&FJ!F!%J(G%gs33 ||t+
2#^w~~/Gg.  ) !11	11rM   c              #  Z   #    U R                   nUb  UR                   nUv   UnUb  M  gg7f)z1All PageElements that were parsed after this one.Nr  rw   ir=  s      rK   rL  PageElement.next_elements{  s1      mIGA m   %++c                8    U R                  U R                  5      $ )zBThis PageElement, then all PageElements that were parsed after it.)	_self_andrL  r   s    rK   self_and_next_elements"PageElement.self_and_next_elements       ~~d0011rM   c              #  Z   #    U R                   nUb  UR                   nUv   UnUb  M  gg7f)zFAll PageElements that are siblings of this one but were parsed
later.
N)r   r  s      rK   rX  PageElement.next_siblings  s1     
 mIGA mr  c                8    U R                  U R                  5      $ )z+This PageElement, then all of its siblings.)r  rX  r   s    rK   self_and_next_siblings"PageElement.self_and_next_siblings  r  rM   c              #  Z   #    U R                   nUb  UR                   nUv   UnUb  M  gg7f)zXAll PageElements that were parsed before this one.

:yield: A sequence of PageElements.
Nr  r  s      rK   rc  PageElement.previous_elements  s3      !!m**IGA mr  c                8    U R                  U R                  5      $ )z=This PageElement, then all elements that were parsed
earlier.)r  rc  r   s    rK   self_and_previous_elements&PageElement.self_and_previous_elements       ~~d4455rM   c              #  Z   #    U R                   nUb  UR                   nUv   UnUb  M  gg7f)zmAll PageElements that are siblings of this one but were parsed
earlier.

:yield: A sequence of PageElements.
N)r   r  s      rK   rn  PageElement.previous_siblings  s3      !!m**IGA mr  c                8    U R                  U R                  5      $ )zDThis PageElement, then all of its siblings that were parsed
earlier.)r  rn  r   s    rK   self_and_previous_siblings&PageElement.self_and_previous_siblings  r  rM   c              #  Z   #    U R                   nUb  UR                   nUv   UnUb  M  gg7f)ztAll elements that are parents of this PageElement.

:yield: A sequence of Tags, ending with a BeautifulSoup object.
Nr   r  s      rK   rz  PageElement.parents  s/      KKmIGA mr  c                8    U R                  U R                  5      $ )zpThis element, then all of its parents.

:yield: A sequence of PageElements, ending with a BeautifulSoup object.
)r  rz  r   s    rK   self_and_parentsPageElement.self_and_parents  s     ~~dll++rM   c              #  P   #    U R                   (       d  U v   U H  nUv   M	     g7f)z]Modify a generator by yielding this element, then everything
yielded by the other generator.
N)r   )rw   other_generatorr  s      rK   r  PageElement._self_and  s"      {{J AG !s   $&c                .    [        U SS5      =(       d    S$ )z0Check whether a PageElement has been decomposed.r   F)r   r   s    rK   
decomposedPageElement.decomposed  s     t]E2;e;rM   rL  c                    U R                   $ z:meta private:)rL  r   s    rK   nextGeneratorPageElement.nextGenerator       !!!rM   rX  c                    U R                   $ r  )rX  r   s    rK   nextSiblingGenerator PageElement.nextSiblingGenerator  r  rM   rc  c                    U R                   $ r  )rc  r   s    rK   previousGeneratorPageElement.previousGenerator       %%%rM   rn  c                    U R                   $ r  )rn  r   s    rK   previousSiblingGenerator$PageElement.previousSiblingGenerator  r  rM   rz  c                    U R                   $ r  )rz  r   s    rK   parentGeneratorPageElement.parentGenerator  s     ||rM   )r   r   r   r   r   )NNNNN)r   r   r   r(   r   r(   r   r(   r   r(   rh   r   )r   r:   r   Optional[_FormatterOrName]rh   r:   )r   z4Union[_FormatterOrName, _EntitySubstitutionFunction]rh   r
   rh   r   Fr   zDict[Any, Any]r   r   rh   r   rh   r   )r   r   r   r   rh   Iterator[str]rh   r  )r   r:   r   r   r   zIterable[Type[NavigableString]]rh   r:   )r  r   rh   r   )r  r$  rh   r$  r   )r  Optional[int]rh   r   rh   r   )TT)r*  r   r+  r   rh   r(   )r  r,   rh   List[PageElement])
r=   r6   rD  r2   r   Optional[_StrainableString]rE  r1   rh   r(   )r=   r6   rD  r2   r   r  rN  r  rJ  r   rE  r1   rh   r.   )r=   r6   rD  r2   rE  r1   rh   r(   )r=   r6   rD  r2   rN  r  rJ  r   rE  r1   rh   r.   )rh   r(   )r  r   r=   r6   rD  r2   r   r  rE  r1   rh   r(   )rs  )r=   r6   rD  r2   r   r  rN  r  r  Iterator[PageElement]rJ  r   rE  r1   rh   r.   rh   r  )rh   zIterator[Tag])r  r  rh   r  )RrI   ri   rj   rk   rl   r   rm   r   r   r   r   propertyr   r   r   r   r   r   tupler   r   r   r   getTextr  r  r	   r  r  r  r'  r  r-  r7  r>  rF  rH  rB  rQ  rT  rV  rS  rZ  r[  r_  ra  r^  rf  rg  rj  rl  ri  rp  rq  rv  rx  rt  r}  r~  r  r  rA  rK  rL  r  rX  r  rc  r  rn  r  rz  r  r  r  r   r  r  r  r  r  rn   rg   rM   rK   r   r   Z  s    !%I~$ ##''##'' FD !%.2*..2*.0606 ,06 (	06
 ,06 (06 
06d(R(	(8 # #, $M>7KK'(9;MwWO$% 05wG,6 "G$$*I$	$   18	RR R /	R
 
R2 GHD. -]NGTK.`. @D"8<	8 ,176B !%').2	QQ %Q ,	Q
 'Q 
Q( **k7KH !%').2#

 %
 ,	

 
 
 '
 

@ -]OWUK !%').2	VV %V ,	V
 'V 
V( 1.O !%').2#

 %
 ,	

 
 
 '
 

@ 20' 317 !%').2	UU %U ,	U
 'U 
U( .nowWL !%').2#

 %
 ,	

 
 
 '
 

@ 1.O 2/ !%').2	

 %
 ,	

 '
 

, 56 !%').2#

 %
 ,	

 
 
 '
 

@ 6 8' 7!97 !%') % '	
 
8 ,L-QJ !%')#

 %
 	

 
 '
 

0 -]NGTK-nngVL! ! % %   % , ' 
2 @2@2 %@2 ,	@2
 @2 )@2 @2 '@2 
@2H   2 2   2 2 	 	 6 6
 
 
 6 6
 	 	 , , < < '*" +" '*" +" $g.& /& $g.& /& G$ %rM   r   c                    ^  \ rS rSr% SrSrS\S'   SrS\S'   SS jrSSS	 jjr	SS
 jr
SU 4S jjr\SS j5       rSSS jjr\SS j5       r\R                   SS j5       rS\R$                  4     SS jjr\SS j5       rSrU =r$ )r4   i  zA 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                    [        U[        5      (       a  [        R                  X5      nO[        R                  X[        5      nSUl        UR                  5         U$ )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:   rc   rO   r   r   )rd   r   us      rK   rc   NavigableString.__new__  sE     eS!!C'AC(?@A		rM   Fc                $    [        U 5      " U 5      $ )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      rK   r   NavigableString.__deepcopy__  s     Dz$rM   c                    [        U 5      4$ r   )r:   r   s    rK   __getnewargs__NavigableString.__getnewargs__%  s    D	|rM   c                   > [        U[        5      (       a.  [        SR                  UR                  R
                  5      5      e[        [        U ]#  U5      $ )zRaise an exception zZstring indices must be integers, not '{0}'. Are you treating a NavigableString like a Tag?)	r   r:   	TypeErrorrE   r   rI   r   r4   __getitem__)rw   r   r   s     rK   r  NavigableString.__getitem__*  sc    c3x  AD  AN  AN  AW  AW  X  Y  Y_d7<<rM   c                    U $ )zConvenience property defined to match `Tag.string`.

:return: This property always returns the `NavigableString` it was
   called on.

:meta private:
rg   r   s    rK   r   NavigableString.string0  s	     rM   c                \    U R                  X5      nU R                  U-   U R                  -   $ )zRun 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  )rw   r   r   s      rK   output_readyNavigableString.output_ready;  s,     ##D4{{V#dkk11rM   c                    g)zSince 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:
Nrg   r   s    rK   r=   NavigableString.nameE  s     rM   c                    [        S5      e)zBPrevent NavigableString.name from ever being set.

:meta private:
z)A NavigableString cannot be given a name.rH   )rw   r=   s     rK   r=   r  Q  s     HIIrM   c              #    #    X R                   L a  [        R                  n[        U 5      nUb!  [	        U[        5      (       a  X2La  gOX2;  a  gU nU(       a  UR                  5       nOU n[        U5      S:  a  Uv   gg7f)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
  )rw   r   r   my_typer   final_values         rK   r   NavigableString._all_stringsY  s     ( LL  11E t*%&&' (%++-KK{a  s   A?Bc                "    U R                  5       $ )a	  Yield 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    rK   stringsNavigableString.strings  s       ""rM   rg   )r   Union[str, bytes]rh   r   r  r  )rh   z
Tuple[str])r   zUnion[int | slice]rh   r:   rh   r:   )minimal)r   r'   rh   r:   r  )r=   r:   rh   r   r   r   r   r5   rh   r  r  )rI   ri   rj   rk   rl   r  rm   r  rc   r   r  r  r  r   r  r=   setterr   r   r   r
  rn   r   r   s   @rK   r4   r4     s     FC
 FC  
=  2 	 	 
[[J J "+BUBU00*?0	0d 	# 	#rM   c                  D    \ rS rSr% SrSrS\S'   SrS\S'   S
SS jjrS	r	g)PreformattedStringi  zA `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    Ub  U R                  X5        U R                  U -   U R                  -   $ )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  )rw   r   s     rK   r  PreformattedString.output_ready  s0      t/{{T!DKK//rM   rg   r   )r   r  rh   r:   )
rI   ri   rj   rk   rl   r  rm   r  r  rn   rg   rM   rK   r  r    s'     FCFC0 0rM   r  c                  6    \ rS rSr% SrSrS\S'   SrS\S'   Srg	)
CDatai  zQA `CDATA section <https://dev.w3.org/html5/spec-LC/syntax.html#cdata-sections>`_.z	<![CDATA[r:   r  z]]>r  rg   N	rI   ri   rj   rk   rl   r  rm   r  rn   rg   rM   rK   r  r    s    [FCFCrM   r  c                  6    \ rS rSr% SrSrS\S'   SrS\S'   Srg	)
ProcessingInstructioni  zA SGML processing instruction.<?r:   r  >r  rg   Nr  rg   rM   rK   r  r    s    (FCFCrM   r  c                  6    \ rS rSr% SrSrS\S'   SrS\S'   Srg	)
XMLProcessingInstructioni  zIAn `XML processing instruction <https://www.w3.org/TR/REC-xml/#sec-pi>`_.r  r:   r  ?>r  rg   Nr  rg   rM   rK   r  r    s    SFCFCrM   r  c                  6    \ rS rSr% SrSrS\S'   SrS\S'   Srg	)
Commenti  zAn `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  rg   Nr  rg   rM   rK   r   r     s     VFCFCrM   r   c                  6    \ rS rSr% SrSrS\S'   SrS\S'   Srg	)
Declarationi  zFAn `XML declaration <https://www.w3.org/TR/REC-xml/#sec-prolog-dtd>`_.r  r:   r  r  r  rg   Nr  rg   rM   rK   r"  r"    s    PFCFCrM   r"  c                  ~    \ rS rSr% Sr\        SS j5       r\        SS j5       rSrS\	S'   Sr
S\	S	'   S
rg)Doctypei  zKA `document type declaration <https://www.w3.org/TR/REC-xml/#dt-doctype>`_.r:   c                8    [        U R                  XU5      5      $ )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)rd   r=   pub_id	system_ids       rK   for_name_and_idsDoctype.for_name_and_ids  s     s33D)LMMrM   c                b    U=(       d    SnUb  USU-  -  nUb  USU-  -  nU$ Ub  USU-  -  nU$ )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.
r   z PUBLIC "%s"z "%s"z SYSTEM "%s"rg   )rw   r=   r'  r(  r   s        rK   r&   Doctype._string_for_name_and_ids  sZ     
^f,,E$9,,  "^i//ErM   z
<!DOCTYPE r  z>
r  rg   N)r=   r:   r'  r^   r(  r^   rh   r$  )r=   r:   r'  r^   r(  r^   rh   r:   )rI   ri   rj   rk   rl   classmethodr)  r&  r  rm   r  rn   rg   rM   rK   r$  r$    s    UNN -N:GN	N N !.;H	 " FCFCrM   r$  c                      \ rS rSrSrSrg)
Stylesheeti  zA `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.
rg   Nr   rg   rM   rK   r/  r/    r   rM   r/  c                      \ rS rSrSrSrg)Scripti  zA `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.
rg   Nr   rg   rM   rK   r1  r1    s    rM   r1  c                      \ rS rSrSrSrg)TemplateStringi  a  A `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.
rg   Nr   rg   rM   rK   r3  r3    r   rM   r3  c                      \ rS rSrSrSrg)RubyTextStringi  zA 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.
rg   Nr   rg   rM   rK   r5  r5    r   rM   r5  c                      \ rS rSrSrSrg)RubyParenthesisStringi#  zA NavigableString representing the contents of an `<rp> HTML
tag <https://dev.w3.org/html5/spec-LC/text-level-semantics.html#the-rp-element>`_.
rg   Nr   rg   rM   rK   r7  r7  #  s    rM   r7  c                     \ rS rSr% Sr                Sj                               SkS jjrS\S'   S\S'   S\S'   S\S'   S\S'   S\S
'   S\S'   S	\S'   S\S'   S\S'   S\S'   S	\S'   S\S'   S\S'   \" SSS5      rSlSmS! jjr	SnS" jr
\SoS# j5       r\" S$S5      SoS% j5       r\SpS& j5       r\R                   SqS' j5       r\\1rS(\R*                  4     SrS) jjr\" \5      rSsS* jrStS+ jrSnS, jr\r\" S-S5      SuS. j5       rSvS/ jrSwS0 jrSxSyS1 jjrSzS2 jr S{S3 jr! S|     S}S4 jjr" S|     S~S5 jjr#SS6 jr$SS7 jr%SS8 jr&SS9 jr'SS: jr(SS; jr)SoS< jr*SS= jr+SS> jr,S0 S SSS?4               SS@ jjr-SSA jr.SSB jr/SSC jr0SSD jr1\1=r2r3\4SSESF4         SSG jjr5S\4SES4         SSH jjr6 " SI SJ\75      r8\8" 5       r9\8" 5       r:\8" 5       r;\8" 5       r< S|   SSK jjr=            SSL jr>        SSM jr?SSSN jjr@  S     SSO jjrAS\4SE4       SSP jjrBS\4SE4       SSQ jjrC\" SRS5      \4S(SS4       SST jj5       rDS0 S S4           SSU jjrE\F" SVSWSX5      rGS0 S SSS?4               SSY jjrH\F" SZS[S5      rI\F" S\S[SX5      rJ\SS] j5       rK\SS^ j5       rL\SS_ j5       rM S|       SS` jjrN  S         SSa jjrO\SSb j5       rP\" ScS5      SSd j5       rQ\" SeS5      SSf j5       rR\" SgS5      SSh j5       rSSirTg)r$  i)  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.

Nr=   r^   r`   r_   rD  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                   Uc  S U l         OUR                  U l         Uc  [        S5      eX0l        X@l        U=(       d    0 U l        XPl        U(       a  UR                  (       a  U
c  Ub  Xl        Xl	        OXl        Xl	        Uc  U	(       a  [        nO[        n[        nOUR                  nUR                  nUU l        Uc  U" 5       U l        OUb3  UR                   (       a"  UR#                  U R                  U5      U l        O[U" 5       U l        UR%                  5        H;  u  nn['        U[(        5      (       a  UR                  U5      nUU R                  U'   M=     U(       a  UR*                  U l        OXl        / U l        U R1                  Xx5        SU l        Uc  Xl        Xl        Xl        Xl        g UR                  U l        UR;                  U 5        UR5                  U5      U l        UR                   U l        UR6                  U l        U R                  UR<                  ;   a   UR<                  U R                     1U l        g U R>                  U l        g )Nz%No value provided for new tag's name.F) parser_classr   r	  r=   r`   _namespacesr_   store_line_numbersr9  r:  r   r   r   attribute_dict_classattribute_value_list_classrD  r<  $_replace_cdata_list_attribute_valuesitemsr   listr   r   r   r   r   r;  r>  r@  set_up_substitutionsstring_containersr  )rw   parserbuilderr=   r`   r_   rD  r   r  r   r9  r:  r;  r<  r>  r@  
namespacesattr_dict_classrG  kvs                        rK   __init__Tag.__init__Z  s   , > $D !' 0 0D<DEE	"%+755"i&;(O&N(O&N ?"2"3);&%::O)0)K)K&*D'=(*DJ"w'D'D$IIIIu
 -.
 "KKMDAq!!T**KKN$%DJJqM * $^^DN#N+-

6$? )=%)>&,D),D) /6.P.PD+((. )0(D(DT(JD% *1)F)FD& -4,L,LD)yyG555 291J1J4991U0V-040N0N-rM   zOptional[type[BeautifulSoup]]rC  r:   r*   r   r  r   r   r   parserClassr   Tc                |   U R                  5       nU(       a  U/nU R                  U R                  5       H  u  pVU[        R                  L a  UR                  5         M*  UR                  USS9nUS   R                  U5        U[        R                  L d  Mc  UR                  [        [        U5      5        M     U$ )ztA 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   )rw   r   r   clone	tag_stackeventr  descendant_clones           rK   r   Tag.__deepcopy__  s       %*7I"&"4"4T5E5E"FC111 MMO'.';';DE';'R$bM(()9: 7 77 "((c3C)DE #G rM   c                j   [        U 5      " SSU R                  U R                  U R                  U R                  U R
                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  S9nS H  n[        X[        X5      5        M     U$ )zCreate 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   r9  r:  r;  r<  r>  r@  rO  )r;  r   )r  r=   r`   r_   rD  r   r9  r:  r;  r<  r>  r@  rD  setattrr   )rw   r\  attrs      rK   rW  Tag.copy_self   s     T
IINNKKJJ<<nn!%!:!:"&"<"<%)%B%B%)%B%B''
  7DE!45 7rM   c                \    [        U R                  5      S:H  =(       a    U R                  SL $ )aI  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.
r   T)r
  r   r;  r   s    rK   is_empty_elementTag.is_empty_element  s(    " 4==!Q&L4+D+D+LLrM   rf  c                    U R                   $ z: :meta private:)rf  r   s    rK   isSelfClosingTag.isSelfClosing/  r  rM   c                    [        U R                  5      S:w  a  gU R                  S   n[        U[        5      (       a  U$ [        U[        5      (       a  UR
                  $ g)a  Convenience 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   r4   r$  r   )rw   childs     rK   r   
Tag.string4  sR     t}}"a e_--Ls##<<rM   c                    U R                  5         [        U[        5      (       a  UR                  nO[        nU R	                  U" U5      5        g)z>Replace the `Tag.contents` of this `Tag` with a single string.N)r#  r   r4   r   r  )rw   r   	new_classs      rK   r   rn  L  s;     	

fo..((I'IIf%&rM   Fc              #    #    X R                   L a&  U R                  c  U R                  nOU R                  nU R                   H}  n[	        U[
        5      (       d  M  [        U5      n[	        U[        5      (       a  XBLa  M@  O
Ub  XB;  a  MK  U(       a'  UR                  5       n[        U5      S:X  a  Ms  Uv   My  Uv   M     g7f)a  Yield 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  rY  r   r4   r  r   r
  )rw   r   r   
descendantdescendant_typestrippeds         rK   r   Tag._all_stringsY  s       LL ,,46655**Jj/::":.O%&&"/ 0 "'C%++-x=A%  # +s   CCc                f    / nU H(  nUR                  U R                  X5      5        US-  nM*     U$ )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   )r4  _insert)rw   positionnew_childreninserted	new_childs        rK   r  
Tag.insert  s8     ')%IOODLL=>MH & rM   c                   Uc  [        S5      eX L a  [        S5      e[        U[        5      (       a   [        U[        5      (       d  [        U5      nSSKJn  [        X#5      (       a&  U R                  " U/[        UR                  5      Q76 $ [        U[        U R                  5      5      n[        US5      (       aP  UR                  bC  UR                  U L a$  U R                  U5      nXA:  a  US-  nOXA:X  a  U/$ UR                  5         Xl        S nUS:X  a  S Ul        Xl        O>U R                  US-
     nXRl        X"R                  l        UR%                  S5      Ul        UR                   b  X"R                   l        UR%                  SSS	9n[)        [*        U5      nU[        U R                  5      :  aG  S Ul        U nS nUc'  Ub$  UR"                  nUR                  nUb  OUc  Ub  M$  Ub  Xl        O@S Ul        O8U R                  U   n	Xl        UR"                  b  X"R"                  l        Xl        UR&                  b  UUR&                  l        U R                  R                  X5        U/$ )
NzCannot insert None into a tag.z Cannot insert a tag into itself.r   r!   r   r   FT)r*  r+  )r	  r   r:   r4   bs4r"   r  rJ  r   minr
  hasattrr   r  r  r   r   r   r  r   r   r   )
rw   rx  r{  r"   current_indexprevious_childnew_childs_last_elementr   parents_next_sibling
next_childs
             rK   rw  Tag._insert  sh   =>>?@@i%%jO.T.T'	2I%i// ;;xC$y/A/A*BCCxT]]!349h''I,<,<,H 4' $

9 5 +
 MH". &;&q=)-I&)-&!]]8a<8N)7&6?&&3)7)H)H)OI&%%16?&&3"+"<"< d #= #
 #'{4K"Ls4==))%)I"$(F#' &.63E'-':':$'3 '.63E $/7K4 8<'4x0J%/"%%1:C&&73=0"//;' $00A 	X1{rM   c                    U R                   nUc  [        S5      eUR                  U 5      nU R                  US9  [	        U R
                  SS 5       H  nUR                  X#5        M     U $ )zaReplace 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  )rw   	my_parentr  rm  s       rK   unwrap
Tag.unwrap  sn    
 KK	1  ??4(*dmmA./EX- 0rM   r  c                "    U R                  5       $ ri  )r  r   s    rK   replaceWithChildrenTag.replaceWithChildren  s     {{}rM   c                R    U R                  [        U R                  5      U5      S   $ )z
Appends the given `PageElement` to the contents of this `Tag`.

:param tag: A PageElement.

:return The newly appended PageElement.
r   )r  r
  r   )rw   tags     rK   r  
Tag.append  s#     {{3t}}-s3A66rM   c                   [        U[        5      (       a  [        UR                  5      nO[        U[        [
        45      (       aS  [        R                  " S[        SS9  [        U[
        5      (       a   [        U[        5      (       d  [        U5      nU/nO [        U[        5      (       a  [        U5      n/ nW H#  nUR                  U R                  U5      5        M%     U$ )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.r>   r?   )r   r$  rJ  r   r   r:   rC   rD   UserWarningr4   r   r  )rw   tagstag_listr5  r  s        rK   r4  
Tag.extend  s     dC  DMM*H{C011 MM[
 $$$Zk-J-J&t,vHh'' DzH%'CNN4;;s+,  rM   c                    U R                   SS  H,  nU(       a  UR                  5         M  UR                  5         M.     g)zDestroy 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   r'  r  )rw   r'  r  s      rK   r#  	Tag.clear5  s0     }}Q'G!!#!	 (rM   c                   / n[        U R                  5       H  u  p#[        U[        5      (       a  UR	                  5         U[        U R                  5      S-
  :X  a  MH  U R                  US-      n[        U[        5      (       d  Mq  [        U[        5      (       d  M  [        U[        5      (       a  M  [        U[        5      (       a  M  UR                  U5        M     [        U5       Hn  n[        [        U R                  U   5      n[        [        U R                  US-      5      nUR                  5         [        X4-   5      nUR                  U5        Mp     g)zSmooth 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
  r4   r  r  r  r   r  r  )rw   markedr  abns         rK   r  
Tag.smoothC  s    dmm,DA!S!!
C&** a!e$A1o..q/22"1&899"1&899a  -( &!A_dmmA&67A_dmmAE&:;AIIK&ANN1 "rM   c                d    [        U R                  5       H  u  p#X1L d  M  Us  $    [        S5      e)zFind 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.
zTag.index: element not in tag)r  r   r	  )rw   r  r  rm  s       rK   r  	Tag.indexk  s2     "$--0HA 1 899rM   c                8    U R                   R                  X5      $ )zReturns 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`.
)rD  get)rw   r   r   s      rK   r  Tag.getx  s     zz~~c++rM   c                    U R                  X5      nUc  U R                  5       nU$ [        U[        5      (       a  UnU$ [        U[        5      (       d  [        [        U5      nU R                  U/5      nU$ )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  rG  r   rJ  r:   r   )rw   r   r   r   
list_values        rK   get_attribute_listTag.get_attribute_list  s|     &=88:J  t$$J
  eS))S%(88%AJrM   c                    XR                   ;   $ )z6Does this `Tag` have an attribute with the given name?rD  rw   r   s     rK   has_attrTag.has_attr  s    jj  rM   c                4    [        U 5      R                  5       $ r   )r:   __hash__r   s    rK   r  Tag.__hash__  s    4y!!##rM   c                     U R                   U   $ )zitag[key] returns the value of the 'key' attribute for the Tag,
and throws an exception if it's not there.r  r  s     rK   r  Tag.__getitem__  s     zz#rM   c                ,    [        U R                  5      $ )z0Iterating over a Tag iterates over its contents.)iterr   r   s    rK   __iter__Tag.__iter__  s    DMM""rM   c                ,    [        U R                  5      $ )z:The length of a Tag is the length of its list of contents.)r
  r   r   s    rK   __len__Tag.__len__  s    4==!!rM   c                    XR                   ;   $ r   r   )rw   r  s     rK   __contains__Tag.__contains__  s    MM!!rM   c                    g)z-A tag is non-None even if it has no contents.Trg   r   s    rK   __bool__Tag.__bool__  s    rM   c                     X R                   U'   g)zCSetting tag[key] sets the value of the 'key' attribute for the
tag.Nr  )rw   r   r   s      rK   r   Tag.__setitem__  s      

3rM   c                <    U R                   R                  US5        g)z;Deleting tag[key] deletes all 'key' attributes for the tag.N)rD  r  r  s     rK   __delitem__Tag.__delitem__  s    

sD!rM   r>   c                ,    U R                   " XX4XV40 UD6$ )zCalling 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.r  )rw   r=   rD  r   r   rN  rJ  rE  s           rK   __call__Tag.__call__  s$     }}E
BH
 	
rM   c                   [        U5      S:  aQ  UR                  S5      (       a;  USS n[        R                  " S[	        US9-  [
        SS9  U R                  U5      nOLUR                  S	5      (       d  US
:X  d  U R                  U5      nO[        SU R                  < SU< S35      e[        [        [           U5      $ )zACalling tag.subtag is the same as calling tag.find(name="subtag")rs  r$  Nz.%(name)sTag is deprecated, use .find("%(name)s") instead. If you really were looking for a tag called %(name)sTag, use .find("%(name)sTag")r<   r>   r?   __r   'z' object has no attribute ')r
  endswithrC   rD   r  rF   find
startswithrH   r   r   r   r$  )rw   subtagtag_namer  s       rK   rL   Tag.__getattr__  s     v;?vu55cr{HMM _H%&"	 YYx(F""4((:1EYYv&F 7;~~vN  HSM6**rM   c                   XL a  g[        U[        5      (       d  g[        US5      (       an  [        US5      (       a]  [        US5      (       aL  U R                  UR                  :w  d2  U R                  UR                  :w  d  [        U 5      [        U5      :w  a  g[        U R                  5       H  u  p#X1R                  U   :w  d  M    g   g)zqReturns true iff this Tag has the same name, the same attributes,
and the same contents (recursively) as `other`.TFr=   rD  r   )r   r$  r  r=   rD  r
  r  r   )rw   otherr  my_childs       rK   __eq__
Tag.__eq__  s     =%%%v&&5'**5*--yyEJJ&zzU[[(4yCJ&$T]]3KA>>!,, 4 rM   c                    X:X  + $ )zLReturns true iff this Tag is not identical to `other`,
as defined in __eq__.rg   )rw   r  s     rK   __ne__
Tag.__ne__  s       rM   c                "    U R                  5       $ )zRenders this `Tag` as a string.)decoder   s    rK   __repr__Tag.__repr__	  s    {{}rM   r  xmlcharrefreplacec                H    U R                  X!U5      nUR                  X5      $ )a  Render 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)rw   encodingindent_levelr   errorsr  s         rK   r  
Tag.encode	  s#    6 KK	:xx))rM   c                   / n[        U[        5      (       d  U R                  U5      nUSL a  SnSnU R                  U5       GH  u  pxU[        R
                  [        R                  4;   a!  [        [        U5      nUR                  X#SS9n	O]U[        R                  L a)  [        [        U5      nUR                  X#SS9n	Ub  US-  nO![        [        U5      nUR                  U5      n	U(       a  S=pOS=pU[        R
                  L a1  U(       d*  [        [        U5      R                  5       (       d  Sn
SnUnOU[        R                  L a
  XL a  Sn
SnSnUbf  U
(       d  U(       a?  [        U[        5      (       a  U	R                  5       n	U	(       a  U R                  XX:U5      n	U[        R
                  :X  a  US-  nUR                  U	5        GM     SR!                  U5      $ )a~  Render 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.
Tr   N)openingFr   r   )r   r
   r   rX  r$  r[  EMPTY_ELEMENT_EVENTr   _format_tagrZ  r4   r  _should_pretty_printr   _indent_stringr  r   )rw   r  rx   r   r{  piecesstring_literal_tagr^  r  pieceindent_beforeindent_afters               rK   r  
Tag.decode&	  s   4  )Y////	:I4L ""00:NE00#2I2IJJsG,++,=RV+W#///sG,++,=RW+X+ A%L8,,Y7 "/44/33 000*S'*??AA !%$%,"#///G4Q !&#%)" ' L!'?;; % $ 3 3!<! C333 A%LMM% } ;~ wwvrM   c                      \ rS rSrSrSrg)Tag._TreeTraversalEventi	  zcAn internal class representing an event in the process
of traversing a parse tree.

:meta private:
rg   Nr   rg   rM   rK   _TreeTraversalEventr  	  s    	rM   r  c              #  X  #    / nU=(       d    U R                   nU H  nU(       aS  UR                  US   :w  a@  UR                  5       n[        R                  U4v   U(       a  UR                  US   :w  a  M@  [        U[        5      (       aN  UR                  (       a  [        R                  U4v   M  [        R                  U4v   UR                  U5        M  [        R                  U4v   M     U(       a.  UR                  5       n[        R                  U4v   U(       a  M-  gg7f)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$  rZ  r   rf  r  r[  r  STRING_ELEMENT_EVENT)rw   r{  r]  r   now_closed_tags        rK   rX  Tag._event_stream	  s     $  "	8t88A IbM 9!*++^;; IbM 9 !S!!%%1114411144$$Q'..11! $ &]]_N''77 is   A5D*9B-D*(D*c                d    SnU(       a  U(       a  UR                   U-  nSnU(       a  SnXa-   U-   $ )ap  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)rw   r   r  r   r  r  space_beforespace_afters           rK   r  Tag._indent_string	  s9    $ \$++l:LK+--rM   c                .   U R                   (       a  gSnU(       d  SnSnU R                  (       a  U R                  S-   nSnU(       Ga  UR                  U 5      n/ nU H  u  pU
c  U	nO[        U
[        5      (       d  [        U
[
        5      (       a  SR                  U
5      n
OJ[        U
[        5      (       d  [        U
5      n
O)[        U
[        5      (       a  Ub  U
R                  U5      n
UR                  U
5      n[        U	5      S-   UR                  U5      -   nUR                  U5        M     U(       a  SSR                  U5      -   nSnU R                  (       a  UR                  =(       d    SnSU-   U-   U R                  -   U-   U-   S-   $ )Nr   /rb    =<r  )r   r_   
attributesr   rJ  r  r   r:   rp   ry   attribute_valuequoted_attribute_valuer  rf  void_element_close_prefixr=   )rw   rx   r   r  closing_slashr_   attribute_stringr  rD  r   valdecodedr  void_element_closing_slashs                 rK   r  Tag._format_tag	  s    ;; 
 M ;;[[3&F "--d3JE&;!G!#t,,
30F0F!hhsm'S11!#h"3(MNN-9!556GH$44S9D!#hny/O/OPT/UUGW%! '" #&%#8  &("  )2)L)L)RPR&  ii 	
 )) 	
rM   c                z    USL=(       a1    U R                   (       + =(       d    U R                  U R                   ;  $ )zpShould this tag be pretty-printed?

Most of them should, but some (such as <pre> in HTML
documents) should not.
N)r>  r=   )rw   r  s     rK   r  Tag._should_pretty_print&
  s9     4' 
--- >yy = ==	
rM   c                J    Uc  U R                  SUS9$ U R                  USUS9$ )a3  Pretty-print this `Tag` as a string or bytestring.

:param encoding: The encoding of the bytestring, or None if you want Unicode.
:param formatter: A Formatter object, or a string naming one of
    the standard formatters.
:return: A string (if no ``encoding`` is provided) or a bytestring
    (otherwise).
r   )r  r   )r  r  r   r  )rw   r  r   s      rK   prettifyTag.prettify1
  s2     ;;A;CC;;qI;VVrM   c                6    U R                  XX0R                  S9$ )a  Renders the contents of this tag 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.) Used internally in recursive calls while
   pretty-printing.

:param eventual_encoding: The tag is destined to be
   encoded into this encoding. decode_contents() 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: A `Formatter` object, or a string naming one of
    the standard Formatters.
)r{  )r  rY  )rw   r  rx   r   s       rK   decode_contentsTag.decode_contentsC
  s%    0 {{YAQAQ  
 	
rM   c                H    U R                  XU5      nUR                  U5      $ )a  Renders the contents of this PageElement as a bytestring.

: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 encoding: The bytestring will be in this encoding.
)r  r  )rw   r  r  r   r   s        rK   encode_contentsTag.encode_contents_
  s%    " ''	Jx((rM   r  r   c                2    U(       d  SnU R                  X1S9$ )z9Deprecated method for BS3 compatibility.

:meta private:
N)r  r  )r  )rw   r  prettyPrintindentLevels       rK   renderContentsTag.renderContentss
  s      K###PPrM   c                P    SnU R                   " XX4S4SS0UD6nU(       a  US   nU$ )au  Look in the children of 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 recursive: If this is True, find() will perform a
    recursive search of this Tag's children. Otherwise,
    only the direct children will be considered.
:param string: A filter on the `Tag.string` attribute.
:param limit: Stop looking after finding this many results.
:kwargs: Additional filters on attribute values.
Nr   rJ  rs  r   r  )rw   r=   rD  r   r   rE  ru  r5  s           rK   r  Tag.find
  s7    . --Y[q[TZ[
ArM   	findChildr  r\  c                t    U R                   nU(       d  U R                  nU R                  " XXEU4SUS-   0UD6$ )a  Look in the children of this `PageElement` and find all
`PageElement` objects 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 recursive: If this is True, find_all() will perform a
    recursive search of this PageElement's children. Otherwise,
    only the direct children will be considered.
:param limit: Stop looking after finding this many results.
:param _stacklevel: Used internally to improve warning messages.
:kwargs: Additional filters on attribute values.
rJ  r   )rY  childrenrK  )	rw   r=   rD  r   r   rN  rJ  rE  r  s	            rK   r  Tag.find_all
  sG    2 $$	I~~	
?JQ
RX
 	
rM   findAllr  findChildrenc                (    S U R                    5       $ )z7Iterate over all direct children of this `PageElement`.c              3  $   #    U  H  ov   M     g 7fr   rg   )r  r  s     rK   r  Tag.children.<locals>.<genexpr>
  s     )=a=s   r  r   s    rK   r%  Tag.children
  s     *4==))rM   c                8    U R                  U R                  5      $ )zFIterate over this `Tag` and its children in a
breadth-first sequence.
)r  rY  r   s    rK   r  Tag.self_and_descendants
  s    
 ~~d..//rM   c              #     #    [        U R                  5      (       d  g[        [        U R	                  SS95      nUR
                  nU R                  S   nX2La!  Ub  UR
                  nUv   UnX2La  Ub  M  gggg7f)zEIterate over all children of this `Tag` in a
breadth-first sequence.
NT)r+  r   )r
  r   r   r   r  r   )rw   last_descendantstopNodecurrentr=  s        rK   rY  Tag.descendants
  s     
 4==!! {D,A,Ad,A,ST"//%)]]1%5%'*=,,IMG %'*=%*=%s   A4A<8A<c                <    U R                   R                  " X40 UD6$ )a  Perform a CSS selection operation on the current element.

:param selector: A CSS selector.

:param namespaces: A dictionary mapping namespace prefixes
   used in the CSS selector to namespace URIs. By default,
   Beautiful Soup will use the prefixes it encountered while
   parsing the document.

:param kwargs: Keyword arguments to be passed into Soup Sieve's
   soupsieve.select() method.
)css
select_one)rw   selectorrO  rE  s       rK   r6  Tag.select_one
  s     xx""8B6BBrM   c                >    U R                   R                  " XU40 UD6$ )a   Perform a CSS selection operation on the current element.

This uses the SoupSieve library.

:param selector: A string containing a CSS selector.

:param namespaces: A dictionary mapping namespace prefixes
   used in the CSS selector to namespace URIs. By default,
   Beautiful Soup will use the prefixes it encountered while
   parsing the document.

:param limit: After finding this number of results, stop looking.

:param kwargs: Keyword arguments to be passed into SoupSieve's
   soupsieve.select() method.
)r5  select)rw   r7  rO  rN  rE  s        rK   r:  
Tag.select
  s    . xxxUEfEErM   c                    [        U 5      $ )z,Return an interface to the CSS selector API.r   r   s    rK   r5  Tag.css  s     4yrM   r%  c                    U R                   $ z&Deprecated generator.

:meta private:
)r%  r   s    rK   childGeneratorTag.childGenerator  s     }}rM   rY  c                    U R                   $ r?  )rY  r   s    rK   recursiveChildGeneratorTag.recursiveChildGenerator  s     rM   r  c                $    U R                  U5      $ )zDeprecated method. This was kind of misleading because has_key()
(attributes) was different from __in__ (contents).

has_key() is gone in Python 3, anyway.

:meta private:
)r  r  s     rK   has_keyTag.has_key&  s     }}S!!rM   )rD  rG  rD  r;  r<  r   r   r@  r   r=   r`   rC  r_   r>  r9  r:  )NNNNNNNNNNNNNNNN) rM  zOptional[BeautifulSoup]rN  zOptional[TreeBuilder]r=   r^   r`   r^   r_   r^   rD  z(Optional[_RawOrProcessedAttributeValues]r   z#Optional[Union[BeautifulSoup, Tag]]r  r(   r   r   r9  r  r:  r  r;  r   r<  r=  r>  r?  r@  rA  rO  Optional[Dict[str, str]])Tr  r  r  )rh   r^   )r   r:   rh   r   r  )rx  r   ry  r,   rh   r  )rx  r   r{  r,   rh   r  )rh   r-   )r  r,   rh   r   )r  z(Union[Iterable[_InsertableElement], Tag]rh   r  r  )r'  r   rh   r   r  )r  r   rh   r   r   )r   r:   r   Optional[_AttributeValue]rh   rI  )r   r:   r   zOptional[AttributeValueList]rh   r   )r   r:   rh   r   )rh   r   )r   r:   rh   r)   r  )r  r   rh   r   )r   r:   r   r)   rh   r   r   r:   rh   r   )r=   zOptional[_StrainableElement]rD  r2   r   r   r   r  rN  r  rJ  r   rE  r1   rh   r.   )r  r:   rh   r   )r  r   rh   r   r  )
r  r+   r  r  r   r'   r  r:   rh   bytes)
r  r  rx   r+   r   r'   r{  Optional[Iterator[PageElement]]rh   r:   )r{  rL  rh   z1Iterator[Tuple[_TreeTraversalEvent, PageElement]])r   r:   r  r   r   r
   r  r   r  r   rh   r:   )rx   r:   r   r
   r  r   rh   r:   )r   )r  r   rh   r   )Nr  )r  zOptional[_Encoding]r   r'   rh   r  )r  r  rx   r+   r   r'   rh   r:   )r  r  r  r+   r   r'   rh   rK  )r  r+   r  r   r  r  rh   rK  )r=   r6   rD  r2   r   r   r   r  rE  r1   rh   r(   )r=   r6   rD  r2   r   r   r   r  rN  r  rJ  r   rE  r1   rh   r.   )r7  r:   rO  rH  rE  r   rh   r   )Nr   )
r7  r:   rO  rH  rN  r   rE  r   rh   zResultSet[Tag])rh   r   )UrI   ri   rj   rk   rl   rS  rm   r   rU  r   rW  r  rf  r   rj  r   r  r4   r  r  r   r   r   r
  r  rw  r  replace_with_childrenr  r  r4  r#  r  r  r  r  r  r  r  r  r  r  r  r   r  r  rL   r  r  r  __str____unicode__rO   r  r  objectr  r[  rZ  r  r  rX  r  r  r  r  r  r  r  r  r	   r#  r  r'  r(  r%  r  rY  r6  r:  r5  r@  rC  rF  rn   rg   rM   rK   r$  r$  )  s   .d +/)-"#' $:>6:&*!%$(#'/3?C7;IM/3#wO'wO 'wO 	wO
 !wO wO 8wO 4wO $wO wO "wO !wO -wO  =wO #5wO  #G!wO" -#wOr 0/
ILBB((8800 $M>7KK48 M M$ #W-% .%  . ]]' ' "1% 8 "+BUBU'!'!*?'!	'!R |$G&Un" #7# $7#J"&P: >B,,!:,	", AE!=	.!$
#"" 
" .2').2#
*
 %
 	

 ,
 
 
 '
 

"+.*!
 %$Gk 6&*&/)** $* $	*
 * 
*@ '+'>&/48k#k %k $	k
 2k 
kZf  ./+--/.0 ;?*87*8	:*8X.. . 	.
 . . 
.8<
!$<
1:<
EI<
	<
|	
 )-&/W%W $W 
	W( '+'>&/	
#
 %
 $	

 

< '+5&/	)#) ) $	)
 
)( "G, 6!%&	QQ Q #	Q
 
Q -Q$ !%').2 % 	
 , ' 
: +;HI !%').2#

 %
 	

 ,
 
 
 '
 

@ )JHG-nj'RL * * 0 0    & EICC)ACTWC	C( 04	FF -F 	F
 F 
F2  
 W% & (  )  W%" &"rM   r$  _PageElementT)boundc                  V   ^  \ rS rSr% SrS\S'    S     S	U 4S jjjrS
S jrSrU =r	$ )r  i5  zA ResultSet is a list of `PageElement` objects, gathered as the result
of matching an :py:class:`ElementFilter` against a parse tree. Basically, a list of
search results.
Optional[ElementFilter]sourcec                8   > [         [        U ]  U5        Xl        g r   )r   r  rS  rU  )rw   rU  r  r   s      rK   rS  ResultSet.__init__=  s     	i'/rM   c                     [        SU S35      e)z7Raise a helpful exception to explain a common code fix.z#ResultSet object has no attribute "z|". You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?r  r  s     rK   rL   ResultSet.__getattr__C  s"    3C5  9u  x
 	
rM   )rU  )rg   )rU  rT  r  zIterable[_PageElementT]rh   r   rJ  )
rI   ri   rj   rk   rl   rm   rS  rL   rn   r   r   s   @rK   r  r  5  sC    
 $# RT-7N	 
 
rM   r  )r  )r=   r:   rh   r   )c
__future__r   __license__r   rC   bs4.cssr   bs4._deprecationr   r   r	   bs4.formatterr
   r   r   bs4._warningsr   typingr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   typing_extensionsr   r    r~  r"   bs4.builderr#   r  r%   r&   r'   bs4._typingr(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r5   rm   r6   r  rB   r   r9   rL   rO   rP   setrZ   r:   r\   rp   r|   r   r   r   r   r   rP  r   r4   r  r  r  r  r   r"  r$  r/  r1  r3  r5  r7  r$  rQ  r  r  rg   rM   rK   <module>re     s   "  	   
 
 <    &
 !'(    $)	Xd+<&=>>$ y  &e,Q&RS S m  +-**V*< < <K  '  & "$F!3 , 3 -0- > $# D$C $0! E !8c DSM (} (@(( ((V#A E #AL]& ]@[#c; [#|0 06 . 4   $ %  %P _ _ _ O F"+ F"R( {;
]#W]%; 
2 $rM   