+
    Ci1                      a  0 t $ R t^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
HtHtHt ^ RIt^ RIHt ]'       d   ^ RIHt ^ RIHt ^ RIHtHt R	]R
&    ^ RIt ! R R]4      tR#   ] d    Rt]P4                  ! R4        L*i ; i)a,  Integration code for CSS selectors using `Soup Sieve <https://facelessuser.github.io/soupsieve/>`_ (pypi: ``soupsieve``).

Acquire a `CSS` object through the `element.Tag.css` attribute of
the starting point of your CSS selector, or (if you want to run a
selector against the entire document) of the `BeautifulSoup` object
itself.

The main advantage of doing this instead of using ``soupsieve``
functions is that you don't need to keep passing the `element.Tag` to be
selected against, since the `CSS` object is permanently scoped to that
`element.Tag`.

)annotations)
ModuleType)AnycastIterableIteratorMutableSequenceOptionalTYPE_CHECKINGN)_NamespaceMapping)	SoupSieve)element)	ResultSetTagOptional[ModuleType]	soupsievezEThe soupsieve package is not installed. CSS selectors cannot be used.c                      ] tR t^-tRtRR R lltR R ltR R ltR	 R
 ltRR R llt	RR R llt
RR R lltRR R lltRR R lltRR R lltRR R lltRtR# )CSSat  A proxy object against the ``soupsieve`` library, to simplify its
CSS selector API.

You don't need to instantiate this class yourself; instead, use
`element.Tag.css`.

:param tag: All CSS selectors run by this object will use this as
    their starting point.

:param api: An optional drop-in replacement for the ``soupsieve`` module,
    intended for use in unit tests.
Nc                    V ^8  d   QhRRRR/# )   tagzelement.Tagapir    )formats   ")/usr/lib/python3/dist-packages/bs4/css.py__annotate__CSS.__annotate__;   s      K .B     c                	P    Vf   \         pVf   \        R4      hW n        Wn        R # )NzLCannot execute CSS selectors because the soupsieve package is not installed.)r   NotImplementedErrorr   r   )selfr   r   s   &&&r   __init__CSS.__init__;   s-    ;C;%^  r   c                    V ^8  d   QhRRRR/# )r   identstrreturnr   )r   s   "r   r   r   E   s     
1 
1C 
1C 
1r   c                z    \         f   \        R4      h\        \        V P                  P                  V4      4      # )zEscape a CSS identifier.

This is a simple wrapper around `soupsieve.escape() <https://facelessuser.github.io/soupsieve/api/#soupsieveescape>`_. See the
documentation for that function for more information.
zMCannot escape CSS identifiers because the soupsieve package is not installed.)r   r   r   r%   r   escape)r    r$   s   &&r   r(   
CSS.escapeE   s6     %_  C/00r   c               $    V ^8  d   QhRRRRRR/# )r   nsOptional[_NamespaceMapping]selectr%   r&   r   )r   s   "r   r   r   Q   s$     	 	-	7:		$	r   c                    \        W P                  P                  4      '       g   Vf   V P                  P                  pV# )z%Normalize a dictionary of namespaces.)
isinstancer   r   r   _namespaces)r    r+   r-   s   &&&r   _nsCSS._nsQ   s3     &(("4"455"* %%B	r   c                    V ^8  d   QhRRRR/# )r   resultszMutableSequence[Tag]r&   zResultSet[Tag]r   )r   s   "r   r   r   \   s     ( (/ (N (r   c                     ^ RI Hp V! RV4      # )a  Normalize a list of results to a py:class:`ResultSet`.

A py:class:`ResultSet` is more consistent with the rest of
Beautiful Soup's API, and :py:meth:`ResultSet.__getattr__` has
a helpful error message if you try to treat a list of results
as a single result (a common mistake).
)r   N)bs4r   )r    r4   r   s   && r   _rsCSS._rs\   s     	"w''r   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r-   r%   
namespacesr,   flagsintkwargsr   r&   r   r   )r   s   "r   r   r   i   sC     W WW 0W 	W
 W 
Wr   c                \    V P                   P                  ! WP                  W!4      V3/ VB # )a  Pre-compile a selector and return the compiled object.

: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 flags: Flags to be passed into Soup Sieve's
    `soupsieve.compile() <https://facelessuser.github.io/soupsieve/api/#soupsievecompile>`_ method.

:param kwargs: Keyword arguments to be passed into Soup Sieve's
   `soupsieve.compile() <https://facelessuser.github.io/soupsieve/api/#soupsievecompile>`_ method.

:return: A precompiled selector object.
:rtype: soupsieve.SoupSieve
)r   compiler1   r    r-   r:   r;   r=   s   &&&&,r   r?   CSS.compilei   s)    2 xx(DeVvVVr   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r-   r%   r:   r,   r;   r<   r=   r   r&   zelement.Tag | Noner   )r   s   "r   r   r      s<     
 

 0
 	

 
 

r   c                r    V P                   P                  ! WP                  V P                  W!4      V3/ VB # )aY  Perform a CSS selection operation on the current Tag and return the
first result, if any.

This uses the Soup Sieve library. For more information, see
that library's documentation for the `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method.

: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 flags: Flags to be passed into Soup Sieve's
    `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method.

:param kwargs: Keyword arguments to be passed into Soup Sieve's
   `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method.
)r   
select_oner   r1   r@   s   &&&&,r   rD   CSS.select_one   s7    4 xx""HHdhhz:E
EK
 	
r   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   r-   r%   r:   r,   limitr<   r;   r=   r   r&   ResultSet[element.Tag]r   )r   s   "r   r   r      sF     #
 #
#
 0#
 	#

 #
 #
 
 #
r   c           
         Vf   ^ pV P                  V P                  P                  ! WP                  V P	                  W!4      W43/ VB 4      # )aq  Perform a CSS selection operation on the current `element.Tag`.

This uses the Soup Sieve library. For more information, see
that library's documentation for the `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method.

: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 pass in the prefixes it encountered while
    parsing the document.

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

:param flags: Flags to be passed into Soup Sieve's
    `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method.

:param kwargs: Keyword arguments to be passed into Soup Sieve's
   `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method.
)r7   r   r-   r   r1   r    r-   r:   rG   r;   r=   s   &&&&&,r   r-   
CSS.select   sK    8 =ExxHHOO$((:">PV
 	
r   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   r-   r%   r:   r,   rG   r<   r;   r=   r   r&   zIterator[element.Tag]r   )r   s   "r   r   r      sF     !
 !
!
 0!
 	!

 !
 !
 
!
r   c                r    V P                   P                  ! WP                  V P                  W!4      W43/ VB # )a  Perform a CSS selection operation on the current `element.Tag`.

This uses the Soup Sieve library. For more information, see
that library's documentation for the `soupsieve.iselect()
<https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_
method. It is the same as select(), but it returns a generator
instead of a list.

: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 pass in the prefixes it encountered while
    parsing the document.

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

:param flags: Flags to be passed into Soup Sieve's
    `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method.

:param kwargs: Keyword arguments to be passed into Soup Sieve's
   `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method.
)r   iselectr   r1   rJ   s   &&&&&,r   rN   CSS.iselect   s7    > xxHHdhhz:E
LR
 	
r   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r-   r%   r:   r,   r;   r<   r=   r   r&   zOptional[element.Tag]r   )r   s   "r   r   r      s<     
 

 0
 	

 
 

r   c                r    V P                   P                  ! WP                  V P                  W!4      V3/ VB # )aU  Find the `element.Tag` closest to this one that matches the given selector.

This uses the Soup Sieve library. For more information, see
that library's documentation for the `soupsieve.closest()
<https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_
method.

: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 pass in the prefixes it encountered while
    parsing the document.

:param flags: Flags to be passed into Soup Sieve's
    `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method.

:param kwargs: Keyword arguments to be passed into Soup Sieve's
   `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method.

)r   closestr   r1   r@   s   &&&&,r   rR   CSS.closest   s7    8 xxHHdhhz:E
EK
 	
r   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r-   r%   r:   r,   r;   r<   r=   r   r&   boolr   )r   s   "r   r   r   
  s<     $
 $
$
 0$
 	$

 $
 
$
r   c                    \        \        V P                  P                  ! WP                  V P                  W!4      V3/ VB 4      # )a7  Check whether or not this `element.Tag` matches the given CSS selector.

This uses the Soup Sieve library. For more information, see
that library's documentation for the `soupsieve.match()
<https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_
method.

:param: a CSS selector.

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

:param flags: Flags to be passed into Soup Sieve's
    `soupsieve.match()
    <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_
    method.

:param kwargs: Keyword arguments to be passed into SoupSieve's
    `soupsieve.match()
    <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_
    method.
)r   rU   r   matchr   r1   r@   s   &&&&,r   rW   	CSS.match
  s@    > HHNN$((:">IO
 	
r   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r-   r%   r:   r,   r;   r<   r=   r   r&   rH   r   )r   s   "r   r   r   0  s<     #
 #
#
 0#
 	#

 #
 
 #
r   c           
         V P                  V P                  P                  ! WP                  V P	                  W!4      V3/ VB 4      # )a  Filter this `element.Tag`'s direct children based on the given CSS selector.

This uses the Soup Sieve library. It works the same way as
passing a `element.Tag` into that library's `soupsieve.filter()
<https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_
method. For more information, see the documentation for
`soupsieve.filter()
<https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_.

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

:param flags: Flags to be passed into Soup Sieve's
    `soupsieve.filter()
    <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_
    method.

:param kwargs: Keyword arguments to be passed into SoupSieve's
    `soupsieve.filter()
    <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_
    method.
)r7   r   filterr   r1   r@   s   &&&&,r   r[   
CSS.filter0  sA    > xxHHOO$((:">IO
 	
r   )r   r   )N)N    )Nr]   r]   )__name__
__module____qualname____firstlineno____doc__r!   r(   r1   r7   r?   rD   r-   rN   rR   rW   r[   __static_attributes__r   r   r   r   r   -   sH    
1	(W6
<#
J!
F
@$
L#
 #
r   r   )__conditional_annotations__rb   
__future__r   typesr   typingr   r   r   r   r   r	   r
   warningsbs4._typingr   r   r   r6   r   bs4.elementr   r   __annotations__ImportErrorwarnobjectr   )rd   s   @r   <module>ro      sw    #     )#* f
& f
  IMMOs   A" "B ?B 