+
     2ir  c                  sJ   ^ RI Ht ^ RIHt ^ RIt^ RIHtHtHtH	t	H
t
HtHtHtHtHtHt ^ RIt^ RIHt ^ RIHtHtHtHtHt ^ RIHtHtHtHtHtH t H!t!H"t"H#t#H$t$H%t%H&t&H't'  ! R R	](4      t) ! R
 R](4      t* ! R R]*4      t+ ! R R]*4      t, ! R R]*4      t- ! R R])4      t.R# )i    )annotations)defaultdictN)AnyCallablecastDictIteratorIterableListOptionalSequenceTypeUnion)_deprecated)AttributeDictNavigableStringPageElement	ResultSetTag)_AtMostOneElement_AttributeValue_NullableStringMatchFunction_OneElement_PageElementMatchFunction_QueryResults_RawAttributeValues_RegularExpressionProtocol_StrainableAttribute_StrainableElement_StrainableString_StringMatchFunction_TagMatchFunctionc                  s    ] tR t^,t$ RtR]R&   RR R llt]R R l4       t]R	 R
 l4       t	RR R llt
R R ltR R ltRR R lltR R ltR R ltRtR# )ElementFiltera  `ElementFilter` encapsulates the logic necessary to decide:

1. whether a `PageElement` (a `Tag` or a `NavigableString`) matches a
user-specified query.

2. whether a given sequence of markup found during initial parsing
should be turned into a `PageElement` at all, or simply discarded.

The base class is the simplest `ElementFilter`. By default, it
matches everything and allows all markup to become `PageElement`
objects. You can make it more selective by passing in a
user-defined match function, or defining a subclass.

Most users of Beautiful Soup will never need to use
`ElementFilter`, or its more capable subclass
`SoupStrainer`. Instead, they will use methods like
:py:meth:`Tag.find`, which will convert their arguments into
`SoupStrainer` objects and run them against the tree.

However, if you find yourself wanting to treat the arguments to
Beautiful Soup's find_*() methods as first-class objects, those
objects will be `SoupStrainer` objects. You can create them
yourself and then make use of functions like
`ElementFilter.filter()`.
#Optional[_PageElementMatchFunction]match_functionNc                   V ^8  d   QhRR/# )   r"   r!    Zformat   "//usr/lib/python3.14/site-packages/bs4/filter.py__annotate__ElementFilter.__annotate__I   s     - -'J -    c                s    Wn         R# )zPass in a match function to easily customize the behavior of
`ElementFilter.match` without needing to subclass.

:param match_function: A function that takes a `PageElement`
  and returns `True` if that `PageElement` matches some criteria.
Nr"   )selfr"      &&r(   __init__ZElementFilter.__init__I   s
     -r+   c               r#   r$   returnboolr%   r&   r'   r(   r)   r*   S   s     ' 'T 'r+   c                s$    V P                   '       * # )a  Does this `ElementFilter` obviously include everything? If so,
the filter process can be made much faster.

The `ElementFilter` might turn out to include everything even
if this returns `False`, but it won't include everything in an
obvious way.

The base `ElementFilter` implementation includes things based on
the match function, so includes_everything is only true if
there is no match function.
r,   r-      &r(   includes_everythingZ!ElementFilter.includes_everythingR   s     &&&&r+   c               r#   r0   r%   r&   r'   r(   r)   r*   b   s      T r+   c                    R# )a  Does this `ElementFilter` obviously exclude everything? If
so, Beautiful Soup will issue a warning if you try to use it
when parsing a document.

The `ElementFilter` might turn out to exclude everything even
if this returns `False`, but it won't exclude everything in an
obvious way.

The base `ElementFilter` implementation excludes things based
on a match function we can't inspect, so excludes_everything
is always false.
Fr%   r3   r4   r(   excludes_everythingZ!ElementFilter.excludes_everythinga   s     r+   c               $    V ^8  d   QhRRRRRR/# r$   elementr   _known_rulesr2   r1   r%   r&   r'   r(   r)   r*   q   s!     , ,[ ,t ,d ,r+   c                s    V'       g   V P                   '       d   R# V P                  '       g   R# V P                  V4      # )a=  Does the given PageElement match the rules set down by this
ElementFilter?

The base implementation delegates to the function passed in to
the constructor.

:param _known_rules: Defined for compatibility with
    SoupStrainer._match(). Used more for consistency than because
    we need the performance optimization.
T)r5   r"   r-   r:   r;      &&&r(   matchZElementFilter.matchq   s5      8 8 8"""""7++r+   c                    V ^8  d   QhRRRR/# )r$   	generatorIterator[PageElement]r1   zIterator[_OneElement]r%   r&   r'   r(   r)   r*      s     1 1 5 1:O 1r+   c              #  s   "   V P                   '       d   T Rj  xL
    \        V4      pT'       g   K  T P                  TRR7      '       g   K2  \	        RT4      x  KB   LF  \         d     R# i ; i5i)zThe most generic search method offered by Beautiful Soup.

Acts like Python's built-in `filter`, using
`ElementFilter.match` as the filtering function.
NT)r;   r   )r5   ZnextZStopIterationr>   r   )r-   r@   Zi   && r(   filterZElementFilter.filter   sl      ###   O q::ad:33}a00 ! ! s<   A5A!A5A# A5A5A5#A2.A51A22A5c               r?   )r$   r@   rA   r1   r   r%   r&   r'   r(   r)   r*      s      3 8I r+   c                s:    V P                  V4       F  pVu # 	  R# )a  A lower-level equivalent of :py:meth:`Tag.find`.

You can pass in your own generator for iterating over
`PageElement` objects. The first one that matches this
`ElementFilter` will be returned.

:param generator: A way of iterating over `PageElement`
    objects.
N)rC   )r-   r@   r>   rB   r(   findZElementFilter.find   s     [[+EL ,r+   c               $    V ^8  d   QhRRRRRR/# )r$   r@   rA   limitzOptional[int]r1   r   r%   r&   r'   r(   r)   r*      s$     ( (.(7D(	(r+   c                s    . pV P                  V4       F,  pVP                  V4       Vf   K  \        V4      V8  g   K,   M	  \        W4      # )ac  A lower-level equivalent of :py:meth:`Tag.find_all`.

You can pass in your own generator for iterating over
`PageElement` objects. Only elements that match this
`ElementFilter` will be returned in the :py:class:`ResultSet`.

:param generator: A way of iterating over `PageElement`
    objects.

:param limit: Stop looking after finding this many results.
)rC   appendlenr   )r-   r@   rF   Zresultsr>      &&&  r(   find_allZElementFilter.find_all   sI     [[+ENN5! S\U%: , ''r+   c               (    V ^8  d   QhRRRRRRRR/# 	r$   nsprefixOptional[str]namestrattrsOptional[_RawAttributeValues]r1   r2   r%   r&   r'   r(   r)   r*      s,      %-09V	r+   c                r6   )a*  Based on the name and attributes of a tag, see whether this
`ElementFilter` will allow a `Tag` object to even be created.

By default, all tags are parsed. To change this, subclass
`ElementFilter`.

:param name: The name of the prospective tag.
:param attrs: The attributes of the prospective tag.
Tr%   )r-   rM   rO   rQ   s   &&&&r(   allow_tag_creationZ ElementFilter.allow_tag_creation   s     r+   c               r?   r$   stringrP   r1   r2   r%   r&   r'   r(   r)   r*      s     
 
C 
D 
r+   c                r6   )a;  Based on the content of a string, see whether this
`ElementFilter` will allow a `NavigableString` object based on
this string to be added to the parse tree.

By default, all strings are processed into `NavigableString`
objects. To change this, subclass `ElementFilter`.

:param str: The string under consideration.
Tr%   r-   rU   r.   r(   allow_string_creationZ#ElementFilter.allow_string_creation   s     r+   r,   NF)__name__
__module____qualname____firstlineno____doc____annotations__r/   propertyr5   r7   r>   rC   rD   rJ   rS   rW   __static_attributes__r%   r+   r(   r    r    ,   s_    4 87- ' '  ,"1&(*
 
r+   r    c                  s    ] tR t^t$ RtR]R&   R]R&   R]R&   R]R&   RR
 R lltR R ltR R ltR R lt	R R lt
RtR	# )	MatchRulezuEach MatchRule encapsulates the logic behind a single argument
passed in to one of the Beautiful Soup find* methods.
rN   rU   $Optional[_RegularExpressionProtocol]patternOptional[bool]presentexclude_everythingNc          
     s,    V ^8  d   QhRRRRRRRRR	R/# )
r$   rU   zOptional[Union[str, bytes]]rd   rc   functionzOptional[Callable]rf   re   rg   r%   r&   r'   r(   r)   MatchRule.__annotate__   s<     ! !+! 6! %	!
  ! +!r+   c                	s   \        V\        4      '       d   VP                  R 4      pWn        \        V\        4      '       d,   \        P
                  ! VP                  R 4      4      V n        M8\        V\        4      '       d   \        P
                  ! V4      V n        MW n        W0n        W@n	        WPn
        V P                  V P                  V P                  V P                  V P                  3 Uu. uF  pVf   K	  VNK  	  pp\        V4      ^ 8X  d   \        R4      h\        V4      ^8  d   \        R4      hR# u upi )Zutf8NzREither string, pattern, function, present, or exclude_everything must be provided.z[At most one of string, pattern, function, present, and exclude_everything must be provided.)
isinstancebytesZdecoderU   reZcompilerd   rP   rh   rf   rg   rH   Z
ValueError)r-   rU   rd   rh   rf   rg   xvaluess   &&&&&&  r(   r/   ZMatchRule.__init__   s	    fe$$]]6*Fgu%%::gnnV&<=DL%%::g.DL"L "4 kk4<<dNeNef
f Af 	 

 v;!d  v;?m  
s   4D??D?c               r?   )r$   rU   rN   r1   re   r%   r&   r'   r(   r)   ri     s      - N r+   c                s   V P                   '       d   R# V P                  RJ d   VRJ# V P                  RJ d   VRJ # V P                  e   V P                  V8H  # V P                  e$   Vf   R# V P                  P	                  V4      RJ# R# )zRun the 'cheap' portion of a match, trying to get an answer without
calling a potentially expensive custom function.

:return: True or False if we have a (positive or negative)
match; None if we need to keep trying.
FTN)rg   rf   rU   rd   searchrV   r.   r(   _base_matchZMatchRule._base_match  s     """ <<4%% <<5 T>! ;;";;&(( <<#~<<&&v.d::r+   c               r?   )r$   rU   rN   r1   r2   r%   r&   r'   r(   r)   ri   $  s      ] t r+   c                	s    V P                  V4      pVe   V# V P                  e   V P                  V4      '       g   R# R# )NFT)rp   rh   )r-   rU   Z_base_resultrB   r(   matches_stringZMatchRule.matches_string$  s<    ''/#==$T]]6-B-Br+   c               r#   r$   r1   rP   r%   r&   r'   r(   r)   ri   .  s     v v# vr+   c                	s    \        V 4      P                  pR V RV P                   RV P                   RV P                   RV P
                   R2# )< string=z	 pattern=z
 function=z	 present=>)ZtyperZ   rU   rd   rh   rf   )r-   cls   & r(   __repr__ZMatchRule.__repr__.  sN    4j!!3%x}Idll^:dmm_\efjfrfresstuur+   c               r?   )r$   otherr   r1   r2   r%   r&   r'   r(   r)   ri   2  s     
 
C 
D 
r+   c                	s*   \        V\        4      ;'       d}    V P                  VP                  8H  ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P
                  VP
                  8H  # rX   )rj   rb   rU   rd   rh   rf   )r-   ry   r.   r(   __eq__ZMatchRule.__eq__2  s}    ui( . .u||+. .-. . /. . -	
r+   )rg   rh   rd   rf   rU   )NNNNN)rZ   r[   r\   r]   r^   r_   r/   rp   rq   rx   rz   ra   r%   r+   r(   rb   rb      sB     11&&
!FBv
 
r+   rb   c                  s2    ] tR tRt$ RtR]R&   R R ltRtR# )	TagNameMatchRulei<  z@A MatchRule implementing the rules for matches against tag name.zOptional[_TagMatchFunction]rh   c               r?   r$   tagr   r1   r2   r%   r&   r'   r(   r)   ZTagNameMatchRule.__annotate__A  s     
 
s 
t 
r+   c                	s    V P                  VP                  4      pVe   V# \        \        V P                  4      pV! V4      '       d   R# R# )NTF)rp   rO   r   r   rh   )r-   r}   Z
base_valuerh   s   &&  r(   matches_tagZTagNameMatchRule.matches_tagA  sD    %%chh/
! )4==9C==r+   r%   N)rZ   r[   r\   r]   r^   r_   r~   ra   r%   r+   r(   r{   r{   <  s    J))
 
r+   r{   c                  &    ] tR tRt$ RtR]R&   RtR# )AttributeValueMatchRuleiN  zGA MatchRule implementing the rules for matches against attribute value.z&Optional[_NullableStringMatchFunction]rh   r%   NrZ   r[   r\   r]   r^   r_   ra   r%   r+   r(   r   r   N  s    Q44r+   r   c                  r   )StringMatchRuleiT  zIA MatchRule implementing the rules for matches against a NavigableString.zOptional[_StringMatchFunction]rh   r%   Nr   r%   r+   r(   r   r   T  s    S,,r+   r   c                  sX   ] tR tRt$ RtR]R&   R]R&   R]R&   R,R
 R llt]R R l4       t]R R l4       t	]R R l4       t
]R R l4       tR R lt]R R l4       tR R ltR R ltR R ltR R ltR  R! ltR-R" R# llt]! R$R%4      R& R' l4       t]! R(R%4      R) R* l4       tR+tR	# ).SoupStraineriZ  a  The `ElementFilter` subclass used internally by Beautiful Soup.

A `SoupStrainer` encapsulates the logic necessary to perform the
kind of matches supported by methods such as
:py:meth:`Tag.find`. `SoupStrainer` objects are primarily created
internally, but you can create one yourself and pass it in as
``parse_only`` to the `BeautifulSoup` constructor, to parse a
subset of a large document.

Internally, `SoupStrainer` objects work by converting the
constructor arguments into `MatchRule` objects. Incoming
tags/markup are matched against those rules.

:param name: One or more restrictions on the tags found in a document.

:param attrs: A dictionary that maps attribute names to
  restrictions on tags that use those attributes.

:param string: One or more restrictions on the strings found in a
  document.

:param kwargs: A dictionary that maps attribute names to restrictions
  on tags that use those attributes. These restrictions are additive to
  any specified in ``attrs``.

zList[TagNameMatchRule]
name_rulesz(Dict[str, List[AttributeValueMatchRule]]attribute_ruleszList[StringMatchRule]string_rulesNc               rK   )	r$   rO   zOptional[_StrainableElement]rQ   z)Optional[Dict[str, _StrainableAttribute]]rU   Optional[_StrainableString]kwargsr   r%   r&   r'   r(   r)   SoupStrainer.__annotate__z  s2     ; ;*; 9; ,	;
 ';r+   c           	     	sx   VfO   RV9   dH   \        \        \        ,          VP                  R4      4      p\        P
                  ! R\        ^R7       Vf,   V'       g$   V'       g   V'       g   \        RR7      .V n        M=\        \        \        ,          \        V P                  V\        4      4      4      V n        \        \        4      V n        Vf   / p\        V\        4      '       g   RV/pW$3 F}  pVP!                  4        Ff  w  rgVR8X  d   WTJ d   RpVf   RpV P                  V\"        4       F3  pV P                  V,          P%                  \        \"        V4      4       K5  	  Kh  	  K  	  \        \        \&        ,          \        V P                  V\&        4      4      4      V n        W0n        R # )	NtextznAs of version 4.11.0, the 'text' argument to the SoupStrainer constructor is deprecated. Use 'string' instead.Z
stacklevelTrf   ZclassZclass_F)r   r	   r   ZpopwarningswarnDeprecationWarningr{   r   r   list_make_match_rulesr   r   rj   Zdictitemsr   rG   r   r   _SoupStrainer__string)	r-   rO   rQ   rU   r   ZattrdictattrZvalueZrule_objs	   &&&&,    r(   r/   ZSoupStrainer.__init__z  si    >f.(#45vzz&7IJFMM A" <fV  0=>DO"%&T-C-CDJZ-[(\DO  +40=E%&& e$EH'~~/8#(: #D=!E $ 6 6u>U VH((.554h? !W  0 &" !!4(>(>v(W#X
 r+   c               r#   r0   r%   r&   r'   r(   r)   r     s     Z ZT Zr+   c                s    V P                   '       * ;'       d+    V P                  '       * ;'       d    V P                  '       * # )zCheck whether the provided rules will obviously include
everything. (They might include everything even if this returns `False`,
but not in an obvious way.)
)r   r   r   r3   r4   r(   r5   Z SoupStrainer.includes_everything  s3     ??"YY4+<+<'<YYTEYEYAYYr+   c               r#   r0   r%   r&   r'   r(   r)   r     s      T r+   c                sr   V P                   '       d'   V P                  '       g   V P                  '       d   R# \        ;QJ d&    R V P                    4       F  '       g   K   RM	  RM! R V P                    4       4      '       d   R# \        ;QJ d&    R V P                   4       F  '       g   K   RM	  RM! R V P                   4       4      '       d   R# V P                  P	                  4        F@  p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   K?   R# 	  R# )zCheck whether the provided rules will obviously exclude
everything. (They might exclude everything even if this returns `False`,
but not in an obvious way.)
Tc              3  8   "   T F  qP                   x  K  	  R # 5irX   rg   Z.0rm   rw   r(   	<genexpr>3SoupStrainer.excludes_everything.<locals>.<genexpr>  s     ?->##->   Fc              3  r   rX   r   r   rw   r(   r   r     s     =_##_r   c              3  r   rX   r   r   rw   r(   r   r     s     9A''r   )r   r   r   Zanyrn   )r-   Zrulesetrw   r(   r7   Z SoupStrainer.excludes_everything  s     4???d6J6J6J
 3?T->->?333?T->->???3=T__=333=T__===++224Gs99sss9999 5 r+   c               r#   r$   r1   r   r%   r&   r'   r(   r)   r     s      3 r+   c                T    \         P                  ! R\        ^R7       V P                  # ):meta private:ziAccess to deprecated property string. (Look at .string_rules instead) -- Deprecated since version 4.13.0.r   r   r   r   r   r3   r4   r(   rU   ZSoupStrainer.string  s%     	w	

 }}r+   c               r#   r   r%   r&   r'   r(   r)   r     s      1 r+   c                r   )r   zgAccess to deprecated property text. (Look at .string_rules instead) -- Deprecated since version 4.13.0.r   r   r3   r4   r(   r   ZSoupStrainer.text  s%     	u	

 }}r+   c               r#   rr   r%   r&   r'   r(   r)   r     s     } }# }r+   c           	     	s    R V P                   P                   RV P                   RV P                   RV P                   R2	# )rs   z name=z attrs=rt   ru   )Z	__class__rZ   r   r   r   r3   r4   r(   rx   ZSoupStrainer.__repr__  sD    4>>**+6$//1B'$J^J^I__ghlhyhygzz{||r+   c               rE   )r$   objz9Optional[Union[_StrainableElement, _StrainableAttribute]]
rule_classzType[MatchRule]r1   zIterator[MatchRule]r%   r&   r'   r(   r)   r     s(     -. -.F-. $-. 
	-.r+   c              #  s  "   Vf   R# \        V\        \        34      '       d   V! VR7      x  R# \        V\        4      '       d   V! VR7      x  R# \	        V4      '       d   V! VR7      x  R# \        V\
        4      '       d   V! VR7      x  R# \        VR4      '       d   V'       g   V! RR7      x  V Fv  p\        V\        \        34      '       g<   \        VR4      '       d*   \        P                  ! R	V R
2^R7       V! RR7      x  KZ  V P                  W24       F  pVx  K	  	  Kx  	  R# V! \        V4      R7      x  R# 5i)zConvert a vaguely-specific 'object' into one or more well-defined
`MatchRule` objects.

:param obj: Some kind of object that corresponds to one or more
   matching rules.
:param rule_class: Create instances of this `MatchRule` subclass.
N)rU   r   )rh   )rd   Z__iter__Tr   zIgnoring nested list z0 to avoid the possibility of infinite recursion.r   )
rj   rP   rk   r2   Zcallabler   Zhasattrr   r   r   )rv   r   r   Zorm   rI   r(   r   ZSoupStrainer._make_match_rules  s     ;cC<((C((T""S))c]]c**788S))S*%% !D99!!eS\22wq*7M7M MM/s2bc#$ %==..q=AG > $ CH--s   B-E0BEc               r?   r|   r%   r&   r'   r(   r)   r     s     L Ls Lt Lr+   c                s   V P                   '       g   V P                  '       g   R# VP                  '       gh   \        V P                   4      ^8X  dN   V P                   ^ ,          P                  e/   VP
                  V P                   ^ ,          P                  8w  d   R# RpVP                  '       d   VP                   RVP
                   2pV P                   '       dl   RpV P                    FO  pVP                  V4      '       g4   VP                  '       d   K.  Vf   K4  VP                  V4      '       g   KM  Rp M	  V'       g   R# V P                  P                  4        F3  w  rVVP                  VR4      pV P                  Wv4      pV'       d   K2   R# 	  V P                  '       d,   VP                  p	V	f   R# V P                  V	4      '       g   R# R# )a  Do the rules of this `SoupStrainer` trigger a match against the
given `Tag`?

If the `SoupStrainer` has any `TagNameMatchRule`, at least one
must match the `Tag` or its `Tag.name`.

If there are any `AttributeValueMatchRule` for a given
attribute, at least one of them must match the attribute
value.

If there are any `StringMatchRule`, at least one must match,
but a `SoupStrainer` that *only* contains `StringMatchRule`
cannot match a `Tag`, only a `NavigableString`.
FN:T)r   r   ZprefixrH   rU   rO   r~   rh   rq   r   get_attribute_matchr   matches_any_string_rule)
r-   r}   prefixed_nameZname_matchesruler   rules
attr_valuethis_attr_matchZ_strs
   &&        r(   r~   ZSoupStrainer.matches_tag  sk   ( t';';'; 


DOO$)"))5DOOA.555
 :::"zzl!CHH:6M??? L ##C(( MMMm.GDL_L_`mLnLn#'L (  
  //557KDt,J"33JFO"?	 8 ::D|//55r+   c               rE   )r$   r   zOptional[_AttributeValue]r   z!Iterable[AttributeValueMatchRule]r1   r2   r%   r&   r'   r(   r)   r   j  s(     $ $-$ 1$ 
	$r+   c                	s  a \        V\        4      '       d   TpM\        \        V4      .pR  V3R llpV! V4      pV'       gF   \	        V4      ^8w  d6   \        \
        \        ,          V4      pRP                  V4      pV! V.4      pV# )c               r?   )r$   attr_valueszSequence[Optional[str]]r1   r2   r%   r&   r'   r(   r)   Z3SoupStrainer._attribute_match.<locals>.__annotate__u  s     	 	7N 	SW 	r+   c                sb   < S F'  pV  F  pVP                  V4      '       g   K    R # 	  K)  	  R# )TF)rq   )r   r   r   r   s   &  r(   _match_attribute_value_helperZDSoupStrainer._attribute_match.<locals>._match_attribute_value_helperu  s0    "-J**:66# #.  r+   Z )rj   r   r   rP   rH   r
   Zjoin)r-   r   r   r   r   r   Zjoined_attr_values   &&f    r(   r   ZSoupStrainer._attribute_matchj  s     j$''$KZ01K	 	 8D3{#3q#8 x}k:K # 5;=N<OPOr+   c               rK   rL   r%   r&   r'   r(   r)   r     s,     ' '%'-0'9V'	'r+   c                s   V P                   '       d   R# RpV'       d   V RV 2pV P                  '       dL   RpV P                   F/  pW$3 F%  pVf   K	  VP                  V4      '       g   K"  Rp K-  	  K1  	  V'       g   R# Vf   \        4       pV P                  P                  4        F0  w  rVP                  V4      p
V P                  W4      '       d   K/   R# 	  R# )zBased on the name and attributes of a tag, see whether this
`SoupStrainer` will allow a `Tag` object to even be created.

:param name: The name of the prospective tag.
:param attrs: The attributes of the prospective tag.
FNr   T)r   r   rq   r   r   r   r   r   )r-   rM   rO   rQ   r   Z
name_matchr   rm   r   r   r   s   &&&&       r(   rS   ZSoupStrainer.allow_tag_creation  s     
 'j$0M???J,A}..q11)-J!	 - (  =!OE//557KD4J((;; 8
 r+   c               r?   rT   r%   r&   r'   r(   r)   r     s      C D r+   c                s    V P                   '       g   V P                  '       d   R# V P                  '       g   R# V P                  V4      '       g   R# R# )zBased on the content of a markup string, see whether this
`SoupStrainer` will allow it to be instantiated as a
`NavigableString` object, or whether it should be ignored.
FT)r   r   r   r   rV   r.   r(   rW   Z"SoupStrainer.allow_string_creation  sE    
 ???d222     ++F33r+   c               r?   rT   r%   r&   r'   r(   r)   r     s     	 	c 	d 	r+   c                s    V P                   '       g   R# V P                    F  pVP                  V4      '       g   K   R# 	  R# )zWSee whether the content of a string matches any of
this `SoupStrainer`'s string rules.
TF)r   rq   )r-   rU   Zstring_rulerB   r(   r   Z$SoupStrainer.matches_any_string_rule  s<        ,,K))&11 - r+   c               r8   r9   r%   r&   r'   r(   r)   r     s!      [  t r+   c                s&   V'       g   V P                   '       d   R# \        V\        4      '       d   V P                  V4      # \        V\        4      '       g   Q hV P
                  '       g$   V P                  '       g   V P                  V4      # R# )a  Does the given `PageElement` match the rules set down by this
`SoupStrainer`?

The find_* methods rely heavily on this method to find matches.

:param element: A `PageElement`.
:param _known_rules: Set to true in the common case where
   we already checked and found at least one rule in this SoupStrainer
   that might exclude a PageElement. Without this, we need
   to check .includes_everything every time, just to be safe.
:return: `True` if the element matches this `SoupStrainer`'s rules; `False` otherwise.
TF)r5   rj   r   r~   r   r   r   r   r<   r=   r(   r>   ZSoupStrainer.match  sp      8 8 8gs####G,,'?33334#7#7#7 //88r+   rS   z4.13.0c               rE   )r$   rO   rP   rQ   rR   r1   r2   r%   r&   r'   r(   r)   r     s"     : :s :+H :T :r+   c                s(     V P                  RW4      # )zGA less elegant version of `allow_tag_creation`. Deprecated as of 4.13.0N)rS   )r-   rO   rQ   r=   r(   
search_tagZSoupStrainer.search_tag  s     	&&tT99r+   r>   c               r?   )r$   r:   r   r1   zOptional[PageElement]r%   r&   r'   r(   r)   r     s     8 8k 8.C 8r+   c                s8    V P                  V4      '       d   V# R# )zLA less elegant version of match(). Deprecated as of 4.13.0.

:meta private:
N)r>   )r-   r:   r.   r(   ro   ZSoupStrainer.search  s     **W--w747r+   )Z__stringr   r   r   )NNNrY   )rZ   r[   r\   r]   r^   r_   r/   r`   r5   r7   rU   r   rx   Zclassmethodr   r~   r   rS   rW   r   r>   r   r   ro   ra   r%   r+   r(   r   r   Z  s    6 '&=='';z Z Z  *    } -. -.^L\$L'R$	4 %x0: 1:
 (#8 $8r+   r   )/Z
__future__r    Zcollectionsr   rl   Ztypingr   r   r   r   r   r   r   r	   r
   r   r   r   Zbs4._deprecationr   Zbs4.elementr   r   r   r   r   Zbs4._typingr   r   r   r   r   r   r   r   r   r   r   r   r   Zobjectr    rb   r{   r   r   r   r%   r+   r(   <module>r      s    " # 	     (    "dF dNf
 f
Ry $5i 5-i -b8= b8r+   