§
    ¥”jÁ  ã                   ó\   — d Z ddlmZ ddlmZ ddlmZ ddlmZ dxZ	Z
 G d„ d	¦  «        Zd
S )záCSS4 selectors for Python.

cssselect2 is a straightforward implementation of CSS4 Selectors for markup
documents (HTML, XML, etc.) that can be read by ElementTree-like parsers
(including cElementTree, lxml, html5lib, etc.)

é    )Úascii_loweré   )Úcompile_selector_list)ÚSelectorError)ÚElementWrapperz0.9.0c                   ó:   — e Zd ZdZd„ Zd„ Zd„ Zed„ ¦   «         ZdS )ÚMatcherz=A CSS selectors storage that can match against HTML elements.c                 óh   — i | _         i | _        i | _        i | _        g | _        g | _        d| _        d S )Nr   )Úid_selectorsÚclass_selectorsÚlower_local_name_selectorsÚnamespace_selectorsÚlang_attr_selectorsÚother_selectorsÚorder)Úselfs    úb/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/cssselect2/__init__.pyÚ__init__zMatcher.__init__   s=   € ØˆÔØ!ˆÔØ*,ˆÔ'Ø#%ˆÔ Ø#%ˆÔ Ø!ˆÔØˆŒ
ˆ
ˆ
ó    c                 óÈ  — | xj         dz  c_         |j        rdS |j        |j        | j         |j        |f}|j        �5| j                             |j        g ¦  «                             |¦  «         dS |j	        �5| j
                             |j	        g ¦  «                             |¦  «         dS |j        �5| j                             |j        g ¦  «                             |¦  «         dS |j        �5| j                             |j        g ¦  «                             |¦  «         dS |j        r| j                             |¦  «         dS | j                             |¦  «         dS )aà  Add a selector and its payload to the matcher.

        :param selector:
            A :class:`compiler.CompiledSelector` object.
        :param payload:
            Some data associated to the selector,
            such as :class:`declarations <tinycss2.ast.Declaration>`
            parsed from the :attr:`tinycss2.ast.QualifiedRule.content`
            of a style rule.
            It can be any Python object,
            and will be returned as-is by :meth:`match`.

        r   N)r   Únever_matchesÚtestÚspecificityÚpseudo_elementÚidr   Ú
setdefaultÚappendÚ
class_namer   Ú
local_namer   Úlower_local_nameÚ	namespacer   Úrequires_lang_attrr   r   )r   ÚselectorÚpayloadÚentrys       r   Úadd_selectorzMatcher.add_selector   sj  € ð 	ˆ
Œ
�a‰ˆ
Œ
àÔ!ð 	ØˆFð ŒM˜8Ô/°´¸XÔ=TØðˆð Œ;Ð"ØÔ×(Ò(¨¬°bÑ9Ô9×@Ò@ÀÑGÔGÐGÐGÐGØÔ Ð,ØÔ ×+Ò+¨HÔ,?ÀÑDÔD×KÒKÈEÑRÔRÐRÐRÐRØÔ Ð,ØÔ+×6Ò6ØÔ)¨2ñ/ô /ß/5ªv°e©}¬}¨}¨}¨}ØÔÐ+ØÔ$×/Ò/°Ô0BÀBÑGÔG×NÒNÈuÑUÔUÐUÐUÐUØÔ(ð 	/ØÔ$×+Ò+¨EÑ2Ô2Ð2Ð2Ð2àÔ ×'Ò'¨Ñ.Ô.Ð.Ð.Ð.r   c                 óˆ  — g }|j         �5|j         | j        v r'|                      || j        |j                  |¦  «         |j        D ]-}|| j        v r"|                      || j        |         |¦  «         Œ.t          |j        ¦  «        }|| j        v r"|                      || j        |         |¦  «         |j        | j	        v r'|                      || j	        |j                 |¦  «         d|j
        j        v r|                      || j        |¦  «         |                      || j        |¦  «         |                     ¦   «          |S )a²  Match selectors against the given element.

        :param element:
            An :class:`ElementWrapper`.
        :returns:
            A list of the payload objects associated to selectors that match
            element, in order of lowest to highest
            :attr:`compiler.CompiledSelector` specificity and in order of
            addition with :meth:`add_selector` among selectors of equal
            specificity.

        NÚlang)r   r   Úadd_relevant_selectorsÚclassesr   r   r   r   Únamespace_urlr   Úetree_elementÚattribr   r   Úsort)r   ÚelementÚrelevant_selectorsr   Ú
lower_names        r   ÚmatchzMatcher.matchB   s’  € ð  ÐàŒ:Ð! g¤j°DÔ4EÐ&EÐ&EØ×'Ò'Ø˜Ô*¨7¬:Ô6Ð8JñLô Lð Lð "œ/ð 	Sð 	SˆJØ˜TÔ1Ð1Ð1Ø×+Ò+Ø˜TÔ1°*Ô=Ð?QñSô Sð Søõ ! Ô!3Ñ4Ô4ˆ
Ø˜Ô8Ð8Ð8Ø×'Ò'Ø˜Ô8¸ÔDØ"ñ$ô $ð $ð Ô  DÔ$<Ð<Ð<Ø×'Ò'Ø˜Ô1°'Ô2GÔHØ"ñ$ô $ð $ð �WÔ*Ô1Ð1Ð1Ø×'Ò'Ø˜Ô1Ð3EñGô Gð Gð 	×#Ò# G¨TÔ-AÐCUÑVÔVÐVà×ÒÑ!Ô!Ð!Ø!Ð!r   c                 ód   — |D ],\  }}}}} || ¦  «        r|                      ||||f¦  «         Œ-d S )N)r   )r/   Ú	selectorsr0   r   r   r   Úpseudor$   s           r   r)   zMatcher.add_relevant_selectorsm   sY   € à9Bð 	Qð 	QÑ5ˆD�+˜u f¨gØˆt�G‰}Œ}ð QØ"×)Ò)¨;¸¸vÀwÐ*OÑPÔPÐPøð	Qð 	Qr   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   r2   Ústaticmethodr)   © r   r   r	   r	      si   € € € € € ØGÐGðð ð ð"/ð "/ð "/ðH)"ð )"ð )"ðV ðQð Qñ „\ðQð Qð Qr   r	   N)r9   Úwebencodingsr   Úcompilerr   Úparserr   Útreer   ÚVERSIONÚ__version__r	   r;   r   r   ú<module>rB      s«   ððð ð %Ð $Ð $Ð $Ð $Ð $ð ,Ð +Ð +Ð +Ð +Ð +Ø !Ð !Ð !Ð !Ð !Ð !Ø  Ð  Ð  Ð  Ð  Ð  àÐ €ˆ+ð^Qð ^Qð ^Qð ^Qð ^Qñ ^Qô ^Qð ^Qð ^Qð ^Qr   