403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/cssselect/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/cssselect/__pycache__/xpath.cpython-312.pyc
�

E�Zc�����dZddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZej.dd��ZGd�de
e�ZGd�d	�Zej8d
�j:Zej8d�j>Z ej8d�j>Z!Gd
�d�Z"Gd�de"�Z#y)a
    cssselect.xpath
    ===============

    Translation of parsed CSS selectors to XPath expressions.


    :copyright: (c) 2007-2012 Ian Bicking and contributors.
                See AUTHORS for more details.
    :license: BSD, see LICENSE for more details.

�N)�Optional)�parse�parse_series�
PseudoElement�Selector�
SelectorError�Tree�Element�Hash�Class�Function�Pseudo�Attrib�Negation�Relation�Matching�SpecificityAdjustment�CombinedSelectorc�T�tjdtd��t|||�S)Nzb_unicode_safe_getattr is deprecated and will be removed in the next release, use getattr() instead�)�
stacklevel)�warnings�warn�DeprecationWarning�getattr)�obj�name�defaults   �1/usr/lib/python3/dist-packages/cssselect/xpath.py�_unicode_safe_getattrr )s*���M�M�	/���	��3��g�&�&�c��eZdZdZy)�ExpressionErrorz3Unknown or unsupported selector (eg. pseudo-class).N)�__name__�
__module__�__qualname__�__doc__�r!rr#r#4s��=r!r#c��eZdZ	ddededededdf
d�Zdefd�Zdefd	�Zdded
eddfd�Zdd�Z	dd
�Z
		ddedddeededdf
d�Zy)�	XPathExpr�path�element�	condition�star_prefix�returnNc�.�||_||_||_y�N)r+r,r-)�selfr+r,r-r.s     r�__init__zXPathExpr.__init__<s����	����"��r!c��t|j�t|j�z}|jr|d|jzz
}|S)Nz[%s]��strr+r,r-)r2r+s  r�__str__zXPathExpr.__str__Cs<���4�9�9�~��D�L�L� 1�1���>�>��F�T�^�^�+�+�D��r!c�:�|jj�d|�d�S)N�[�])�	__class__r$�r2s r�__repr__zXPathExpr.__repr__Is���>�>�2�2�D�9�9r!�
conjuctionc�f�|jrd|j�d|�d|�d�|_|S||_|S)N�(z) z (�))r-)r2r-r>s   r�
add_conditionzXPathExpr.add_conditionLs0���>�>�/3�~�~�z�9�U�D�N���'�D�N��r!c��|jdk(ry|jdtj|j�z�d|_y)N�*zname() = %s)r,rB�GenericTranslator�
xpath_literalr<s r�
add_name_testzXPathExpr.add_name_testSs;���<�<�3������=�+<�+J�+J�4�<�<�+X�X�Y���r!c�.�|xjdz
c_y)ze
        Append '*/' to the path to keep the context constrained
        to a single parent.
        �*/N)r+r<s r�add_star_prefixzXPathExpr.add_star_prefixZs��
	
�	�	�T��	r!�combiner�other�closing_combiner�has_inner_conditionc��t|�|z}|jdk7r||jz
}||_|s5|r|j|zn|j|_|j|_|S|j|_|jr%|xjd|jzdzz
c_|r|xj|z
c_|S)NrIr9r:r5)r2rKrLrMrNr+s      r�joinzXPathExpr.joinas����4�y�8�#���:�:����E�J�J��D���	�"�?O�5�=�=�+;�;�UZ�Ub�Ub�D�L�"�_�_�D�N���!�=�=�D�L��������e�o�o� 5�� ;�;������ 0�0���r!)�rDrQF)�and)r/N)NF)
r$r%r&r6�boolr3r7r=rBrGrJrrPr(r!rr*r*;s���[`�#��#�'*�#�=@�#�TX�#�	
�#����:�#�:��s��������+/�$)������#�3�-�	�
"��
�
r!r*z('+)z^[a-zA-Z_][a-zA-Z0-9_.-]*$z^[^ \t\r\n\f]+$c�F�eZdZdZddddd�Zddd	d
ddd
dd�ZdZdZdZdZ	dZ
eZd[de
de
de
fd�Z		d\dede
dede
fd�Zdededefd�Zede
de
fd��Zdedefd �Zd!edefd"�Zd#edefd$�Zd%edefd&�Zd'edefd(�Zd'e defd)�Z!d*e"defd+�Z#d,e$defd-�Z%de&defd.�Z'd/e(defd0�Z)d1e*defd2�Z+de,defd3�Z-d4ed5edefd6�Z.d4ed5edefd7�Z/d4ed5edefd8�Z0d4ed5edefd9�Z1d4ed5edefd:�Z2d4ed5edefd;�Z3d4ed5edefd<�Z4d4ed5edefd=�Z5	d]ded*e"d>ed?edef
d@�Z6ded*e"defdA�Z7ded*e"defdB�Z8ded*e"defdC�Z9ded*e"defdD�Z:ded*e"defdE�Z;dedefdF�Z<dedefdG�Z=dedefdH�Z>dedefdI�Z?dedefdJ�Z@dedefdK�ZAdedefdL�ZBdedefdM�ZCdedefdN�ZDdedefdO�ZEeEZFeEZGeEZHeEZIeEZJeEZKeEZLeEZMeEZNdedPe
dQeOe
defdR�ZPdedPe
dQeOe
defdS�ZQdedPe
dQeOe
defdT�ZRdedPe
dQeOe
defdU�ZSdedPe
dQeOe
defdV�ZTdedPe
dQeOe
defdW�ZUdedPe
dQeOe
defdX�ZVdedPe
dQeOe
defdY�ZWyZ)^rEz�
    Translator for "generic" XML documents.

    Everything is case-sensitive, no assumption is made on the meaning
    of element names and attribute names.

    �
descendant�child�direct_adjacent�indirect_adjacent)� �>�+�~�exists�equals�includes�	dashmatch�prefixmatch�suffixmatch�substringmatch�	different)r]�=z~=z|=z^=z$=z*=z!=�idzxml:langF�css�prefixr/c�N���dj��fd�t|�D��S)u�Translate a *group of selectors* to XPath.

        Pseudo-elements are not supported here since XPath only knows
        about "real" elements.

        :param css:
            A *group of selectors* as a string.
        :param prefix:
            This string is prepended to the XPath expression for each selector.
            The default makes selectors scoped to the context node’s subtree.
        :raises:
            :class:`~cssselect.SelectorSyntaxError` on invalid selectors,
            :class:`ExpressionError` on unknown/unsupported selectors,
            including pseudo-elements.
        :returns:
            The equivalent XPath 1.0 expression as a string.

        z | c3�F�K�|]}�j|�d�����y�w)T)�translate_pseudo_elementsN)�selector_to_xpath)�.0�selectorrhr2s  ��r�	<genexpr>z1GenericTranslator.css_to_xpath.<locals>.<genexpr>�s+�����
��
�"�"�8�V�t�"�T�
�s�!)rPr)r2rgrhs` `r�css_to_xpathzGenericTranslator.css_to_xpath�s'���&�z�z�
�!�#�J�
�
�	
r!rnrkc��t|dd�}|std|����|j|�}t||j�sJ�|r(|j
r|j
||j
�}|xsdt|�zS)u+Translate a parsed selector to XPath.


        :param selector:
            A parsed :class:`Selector` object.
        :param prefix:
            This string is prepended to the resulting XPath expression.
            The default makes selectors scoped to the context node’s subtree.
        :param translate_pseudo_elements:
            Unless this is set to ``True`` (as :meth:`css_to_xpath` does),
            the :attr:`~Selector.pseudo_element` attribute of the selector
            is ignored.
            It is the caller's responsibility to reject selectors
            with pseudo-elements, or to account for them somehow.
        :raises:
            :class:`ExpressionError` on unknown/unsupported selectors.
        :returns:
            The equivalent XPath 1.0 expression as a string.

        �parsed_treeNz Expected a parsed selector, got rQ)r�	TypeError�xpath�
isinstance�
xpathexpr_cls�pseudo_element�xpath_pseudo_elementr6)r2rnrhrk�treerts      rrlz#GenericTranslator.selector_to_xpath�s}��4�x���5����H�N�O�O��
�
�4� ���%��!3�!3�4�4�4�$��)@�)@��-�-�e�X�5L�5L�M�E���"��E�
�*�*r!rtrwc��td��)z�Translate a pseudo-element.

        Defaults to not supporting pseudo-elements at all,
        but can be overridden by sub-classes.

        z"Pseudo-elements are not supported.)r#)r2rtrws   rrxz&GenericTranslator.xpath_pseudo_elements���B�C�Cr!�sc���t|�}d|vrd|z}|Sd|vrd|z}|Sddjt|�D�cgc]}|rd|vxrdxsd|z��c}�z}|Scc}w)N�'z'%s'�"z"%s"z
concat(%s)�,)r6rP�split_at_single_quotes)r{�parts  rrFzGenericTranslator.xpath_literals�����F���a�<���
�A�����\���
�A����s�x�x�!7�q� 9�����T�k�-�v�7��4�?�� ��A����
s�A
�parsed_selectorc���t|�j}t|d|j�zd�}|�t	d|z��tjt||��S)z%Translate any parsed selector object.zxpath_%sNz%s is not supported.)�typer$r�lowerr#�typing�castr*)r2r��	type_name�methods    rrtzGenericTranslator.xpath sX����)�2�2�	���z�I�O�O�,=�=�t�D���>�!�"8�9�"D�E�E��{�{�9�f�_�&=�>�>r!�combinedc	��|j|j}t|d|z�}tjt
||j
|j�|j
|j���S)zTranslate a combined selector.zxpath_%s_combinator)	�combinator_mapping�
combinatorrr�r�r*rtrn�subselector)r2r�r�r�s    r�xpath_combinedselectorz(GenericTranslator.xpath_combinedselector*se���,�,�X�-@�-@�A�
���4�z�A�B���{�{��v�d�j�j��):�):�;�T�Z�Z��H\�H\�=]�^�
�	
r!�negationc��|j|j�}|j|j�}|j�|jr|jd|jz�S|jd�S)Nznot(%s)�0)rtrnr�rGr-rB)r2r�rt�	sub_xpaths    r�xpath_negationz GenericTranslator.xpath_negation2sl���
�
�8�,�,�-���J�J�x�3�3�4�	����!�����&�&�y�9�3F�3F�'F�G�G��&�&�s�+�+r!�relationc	�\�|j|j�}|j}|j}|j|j�}t|d|jtjt|j�z�}tjt|||��S)Nzxpath_relation_%s_combinator)rtrnr�r�rrrr�r�r�r6�valuer*)r2r�rtr�r��rightr�s       r�xpath_relationz GenericTranslator.xpath_relation;s����
�
�8�,�,�-���(�(�
��*�*���
�
�;�2�2�3����*��%�%�f�k�k�#�z�7G�7G�&H�I�
J�
��
�{�{�9�f�U�E�&:�;�;r!�matchingc��|j|j�}|jD�cgc]}|j|���}}|D];}|j�|js� |j|jd��=|Scc}w�N�or�rtrn�
selector_listrGr-rB�r2r�rtrn�exprs�es      r�xpath_matchingz GenericTranslator.xpath_matchingG�y���
�
�8�,�,�-��6>�6L�6L�M�(����H�%�M��M��	7�A�
�O�O���{�{��#�#�A�K�K��6�	7����N��Bc��|j|j�}|jD�cgc]}|j|���}}|D];}|j�|js� |j|jd��=|Scc}wr�r�r�s      r�xpath_specificityadjustmentz-GenericTranslator.xpath_specificityadjustmentPr�r��functionc��d|jjdd�z}t||d�}|std|jz��t	j
t||j|j�|��S)z$Translate a functional pseudo-class.zxpath_%s_function�-�_Nz!The pseudo-class :%s() is unknown)	r�replacerr#r�r�r*rtrn)r2r��method_namer�s    r�xpath_functionz GenericTranslator.xpath_functionYsj��)�H�M�M�,A�,A�#�s�,K�K����{�D�1���!�"E��
�
�"U�V�V��{�{�9�f�T�Z�Z��8I�8I�-J�H�&U�V�Vr!�pseudoc��d|jjdd�z}t||d�}|std|jz��t	j
t||j|j���S)zTranslate a pseudo-class.zxpath_%s_pseudor�r�NzThe pseudo-class :%s is unknown)	�identr�rr#r�r�r*rtrn)r2r�r�r�s    r�xpath_pseudozGenericTranslator.xpath_pseudoasf��'�&�,�,�*>�*>�s�C�*H�H����{�D�1���!�"C�f�l�l�"R�S�S��{�{�9�f�T�Z�Z����-H�&I�J�Jr!c���|j|j}t|d|z�}|jr|jj�}n|j}t
|�}|jr*|j�d|��}|xrt
|j�}|rd|z}nd|j|�z}|j�d}n_|jr=tjt|jj�j�}n|jj}tjt||j|j �||��S)z Translate an attribute selector.zxpath_attrib_%s�:�@zattribute::*[name() = %s]N)�attribute_operator_mapping�operatorr�lower_case_attribute_names�attribr��is_safe_name�	namespacerFr��lower_case_attribute_valuesr�r�r6r*rtrn)r2rnr�r�r�safer�r�s        r�xpath_attribzGenericTranslator.xpath_attribjs���2�2�8�3D�3D�E����0�8�;�<���*�*��?�?�(�(�*�D��?�?�D��D�!�����&�0�0�$�7�D��<�L��);�);�<�D���4�Z�F�0�4�3E�3E�d�3K�K�F��>�>�!��E�
�
-�
-��K�K��X�^�^�%9�%9�:�@�@�B�E��N�N�(�(�E��{�{�9�f�T�Z�Z��8I�8I�-J�F�TY�&Z�[�[r!�class_selectorc�r�|j|j�}|j|d|j�S)zTranslate a class selector.z@class)rtrn�xpath_attrib_includes�
class_name)r2r�rts   r�xpath_classzGenericTranslator.xpath_class�s3���
�
�>�2�2�3���)�)�%��>�;T�;T�U�Ur!�id_selectorc�r�|j|j�}|j|d|j�S)zTranslate an ID selector.z@id)rtrn�xpath_attrib_equalsrf)r2r�rts   r�
xpath_hashzGenericTranslator.xpath_hash�s/���
�
�;�/�/�0���'�'��u�k�n�n�E�Er!c�R�|j}|sd}d}n0tt|��}|jr|j	�}|j
r3|j
�d|��}|xrtt|j
��}|j
|��}|s|j�|S)z'Translate a type or universal selector.rDTr�)r,)r,rSr��lower_case_element_namesr�r�rvrG)r2rnr,r�rts     r�
xpath_elementzGenericTranslator.xpath_element�s����"�"����G��D���W�-�.�D��,�,�!�-�-�/�����"*�!3�!3�W�=�G��B�D��h�.@�.@�!A�B�D��"�"�7�"�3������!��r!�leftr�c�&�|jd|�S)z;right is a child, grand-child or further descendant of leftz/descendant-or-self::*/�rP�r2r�r�s   r�xpath_descendant_combinatorz-GenericTranslator.xpath_descendant_combinator�s���y�y�2�E�:�:r!c�&�|jd|�S)z#right is an immediate child of left�/r�r�s   r�xpath_child_combinatorz(GenericTranslator.xpath_child_combinator�s���y�y��e�$�$r!c�h�|jd|�}|j�|jd�S)z)right is a sibling immediately after left�/following-sibling::zposition() = 1)rPrGrB�r2r�r�rts    r� xpath_direct_adjacent_combinatorz2GenericTranslator.xpath_direct_adjacent_combinator�s1���	�	�0�%�8��
�����"�"�#3�4�4r!c�&�|jd|�S)z1right is a sibling after left, immediately or notr�r�r�s   r�"xpath_indirect_adjacent_combinatorz4GenericTranslator.xpath_indirect_adjacent_combinator�s���y�y�/��7�7r!c�,�|jd|dd��S)zHright is a child, grand-child or further descendant of left; select leftz
[descendant::r:T)rMrNr�r�s   r�$xpath_relation_descendant_combinatorz6GenericTranslator.xpath_relation_descendant_combinator�s���y�y��%�#�[_�y�`�`r!c�*�|jd|d��S)z0right is an immediate child of left; select leftz[./r:�rMr�r�s   r�xpath_relation_child_combinatorz1GenericTranslator.xpath_relation_child_combinator�s���y�y����y�<�<r!c�Z�|jdj|j��}|S)z6right is a sibling immediately after left; select leftz:following-sibling::*[(name() = '{}') and (position() = 1)])rB�formatr,r�s    r�)xpath_relation_direct_adjacent_combinatorz;GenericTranslator.xpath_relation_direct_adjacent_combinator�s0���"�"�H�O�O�PU�P]�P]�^�
���r!c�*�|jd|d��S)z>right is a sibling after left, immediately or not; select leftz[following-sibling::r:r�r�r�s   r�+xpath_relation_indirect_adjacent_combinatorz=GenericTranslator.xpath_relation_indirect_adjacent_combinator�s���y�y�/���y�M�Mr!�lastrGc����	t|j�\}}|dz
}|dk(r|dkr|S|dkr|dkr|j	d�S|rd}nd|j
z}|sd|z}	nd|z}	|dk(r|j	|	�d	|���Sg}
|dkDr|dkDr-|
j
|	�d
|���n|
j
|	�d|���t|�dk7r;|	}|t|�z}|dk7rd|z}
d
|�d|
�d�}|
j
|�d|�d��t|
�dkDrd�nd�|j	dj�fd�|
D���|S#t$rtd|jz��wxYw)NzInvalid series: '%r'�rr�rDz%szcount(preceding-sibling::%s)zcount(following-sibling::%s)� = z >= z <= z+%sr@rYrAz mod z = 0z(%s)z and c3�(�K�|]	}�|z���y�wr1r()rm�
expression�templates  �rroz=GenericTranslator.xpath_nth_child_function.<locals>.<genexpr>Ps�����(]�:��J�)>�(]�s�)
r�	arguments�
ValueErrorr#rBr,�append�abs�lenrP)r2rtr�r�rG�a�b�b_min_1�nodetest�siblings_count�expressionsr��b_neg�b_neg_as_strr�s              @r�xpath_nth_child_functionz*GenericTranslator.xpath_nth_child_function�s����	O��� 2� 2�3�D�A�q�Z�a�%��
��6�g��l��L�

�q�5�W�q�[��&�&�s�+�+�
��H��e�m�m�+�H��;�h�F�N�;�h�F�N�
��6��&�&�N�G�'L�M�M����q�5���{��"�"���#I�J�

���^�W�E�F��q�6�Q�;�!�D�
�X��Q��'�E���z�$�u�}��$(�,�7�����$��:�;��{��a���H��H�
���G�L�L�(]�Q\�(]�]�^����}�	O�!�"8�8�;M�;M�"M�N�N�	O�s�E�"E%c�*�|j||d��S)NT)r�)r��r2rtr�s   r�xpath_nth_last_child_functionz/GenericTranslator.xpath_nth_last_child_functionSs���,�,�U�H�4�,�H�Hr!c�^�|jdk(rtd��|j||d��S)NrD�"*:nth-of-type() is not implementedF)rG�r,r#r�r�s   r�xpath_nth_of_type_functionz,GenericTranslator.xpath_nth_of_type_functionVs2���=�=�C��!�"F�G�G��,�,�U�H�E�,�R�Rr!c�`�|jdk(rtd��|j||dd��S)NrDr�TF)r�rGr�r�s   r�xpath_nth_last_of_type_functionz1GenericTranslator.xpath_nth_last_of_type_function[s5���=�=�C��!�"F�G�G��,�,�U�H�4�W\�,�]�]r!c��|j�dgdgfvrtd|jz��tjt
|jdj�}|jd|j|�z�S)N�STRING�IDENTz9Expected a single string or ident for :contains(), got %rrzcontains(., %s)�	�argument_typesr#r�r�r�r6r�rBrF�r2rtr�r�s    r�xpath_contains_functionz)GenericTranslator.xpath_contains_function`s~���"�"�$�h�Z�'��,C�C�!�K�h�N`�N`�`��
����C��!3�!3�A�!6�!<�!<�=���"�"�#4�t�7I�7I�%�7P�#P�Q�Qr!c��|j�dgdgfvrtd|jz��tjt
|jdj�}|jd|j|�z�S)Nrr�5Expected a single string or ident for :lang(), got %rrzlang(%s)rrs    r�xpath_lang_functionz%GenericTranslator.xpath_lang_functionjs{���"�"�$�h�Z�'��,C�C�!�G�(�J\�J\�\��
����C��!3�!3�A�!6�!<�!<�=���"�"�:��1C�1C�E�1J�#K�L�Lr!c�$�|jd�S)Nznot(parent::*)�rB�r2rts  r�xpath_root_pseudoz#GenericTranslator.xpath_root_pseudots���"�"�#3�4�4r!c�$�|jd�S)N�1rr
s  r�xpath_scope_pseudoz$GenericTranslator.xpath_scope_pseudo|s���"�"�3�'�'r!c�$�|jd�S)Nzcount(preceding-sibling::*) = 0rr
s  r�xpath_first_child_pseudoz*GenericTranslator.xpath_first_child_pseudo����"�"�#D�E�Er!c�$�|jd�S)Nzcount(following-sibling::*) = 0rr
s  r�xpath_last_child_pseudoz)GenericTranslator.xpath_last_child_pseudo�rr!c�r�|jdk(rtd��|jd|jz�S)NrDz"*:first-of-type is not implementedz count(preceding-sibling::%s) = 0�r,r#rBr
s  r�xpath_first_of_type_pseudoz,GenericTranslator.xpath_first_of_type_pseudo�s5���=�=�C��!�"F�G�G��"�"�#E��
�
�#U�V�Vr!c�r�|jdk(rtd��|jd|jz�S)NrDz!*:last-of-type is not implementedz count(following-sibling::%s) = 0rr
s  r�xpath_last_of_type_pseudoz+GenericTranslator.xpath_last_of_type_pseudo�s5���=�=�C��!�"E�F�F��"�"�#E��
�
�#U�V�Vr!c�$�|jd�S)Nzcount(parent::*/child::*) = 1rr
s  r�xpath_only_child_pseudoz)GenericTranslator.xpath_only_child_pseudo�s���"�"�#B�C�Cr!c�r�|jdk(rtd��|jd|jz�S)NrDz!*:only-of-type is not implementedzcount(parent::*/child::%s) = 1rr
s  r�xpath_only_of_type_pseudoz+GenericTranslator.xpath_only_of_type_pseudo�s5���=�=�C��!�"E�F�F��"�"�#C�e�m�m�#S�T�Tr!c�$�|jd�S)Nznot(*) and not(string-length())rr
s  r�xpath_empty_pseudoz$GenericTranslator.xpath_empty_pseudo�rr!c�$�|jd�S)z:Common implementation for pseudo-classes that never match.r�rr
s  r�pseudo_never_matchesz&GenericTranslator.pseudo_never_matches�s���"�"�3�'�'r!rr�c�0�|rJ�|j|�|Sr1r�r2rtrr�s    r�xpath_attrib_existsz%GenericTranslator.xpath_attrib_exists�s����y�
���D�!��r!c�X�|�J�|j|�d|j|����|S)Nr��rBrFr%s    rr�z%GenericTranslator.xpath_attrib_equals�s1��� � � �
����t�/A�/A�%�/H�I�J��r!c
��|�J�|r+|jd|�d|�d|j|����|S|j|�d|j|����|S)Nznot(z) or z != r(r%s    r�xpath_attrib_differentz(GenericTranslator.xpath_attrib_different�s`��� � � ������t�T�EW�EW�X]�E^� _�`���
���d�D�4F�4F�u�4M� N�O��r!c
��|r<t|�r1|j|�d|�d|jd|zdz��d��|S|jd�|S)Nz* and contains(concat(' ', normalize-space(z	), ' '), rYrAr�)�is_non_whitespacerBrFr%s    rr�z'GenericTranslator.xpath_attrib_includes�sZ���&�u�-������t�1�1�#��+��2C�D�F�
���
����$��r!c��|�J�|j|�d|�d|j|��d|�d|j|dz��d�
�|S)Nz and (r�z or starts-with(�, r�z))r(r%s    r�xpath_attrib_dashmatchz(GenericTranslator.xpath_attrib_dashmatch�sQ��� � � �
����T�4�-�-�e�4�d�D�<N�<N�u�WZ�{�<[�
]�	
��r!c	��|r+|j|�d|�d|j|��d��|S|jd�|S)Nz and starts-with(r.rAr�r(r%s    r�xpath_attrib_prefixmatchz*GenericTranslator.xpath_attrib_prefixmatch�sF������04�d�D�<N�<N�u�<U�V�
�
��
����$��r!c
��|r<|j|�d|�d|�dt|�dz
�d|j|���	�|S|jd�|S)Nz and substring(z, string-length(z)-r�z) = r�)rBr�rFr%s    r�xpath_attrib_suffixmatchz*GenericTranslator.xpath_attrib_suffixmatch�sU��������t�S��Z�!�^�T�5G�5G��5N�P�
���
����$��r!c	��|r+|j|�d|�d|j|��d��|S|jd�|S)Nz and contains(r.rAr�r(r%s    r�xpath_attrib_substringmatchz-GenericTranslator.xpath_attrib_substringmatch�sF������-1�4��9K�9K�E�9R�S�
�
��
����$��r!N)�descendant-or-self::)r6F)FT)Xr$r%r&r'r�r��id_attribute�lang_attributer�r�r�r*rvr6rprrSrlrrx�staticmethodrFr	rtrr�rr�rr�rr�rr�r
r�rr�rr�rr�rr�r
r�r�r�r�r�r�r�r�r�r�r�r�rrr
rrrrrrrrr!r#�xpath_link_pseudo�xpath_visited_pseudo�xpath_hover_pseudo�xpath_active_pseudo�xpath_focus_pseudo�xpath_target_pseudo�xpath_enabled_pseudo�xpath_disabled_pseudo�xpath_checked_pseudorr&r�r*r�r/r1r3r5r(r!rrErE�s����*�
�
�
 �	���
�������	"���L� �N�  %��!&��"'���M�
��
�S�
�c�
�6-�*/�	!+��!+��!+�$(�	!+�


�!+�FD�)�D�]�D�W`�D��������� ?�T�?�i�?�
�/?�
�I�
�,�x�,�I�,�
<�x�
<�I�
<��x��I���4I��i��W�x�W�I�W�K�6�K�i�K�\�V�\�	�\�0V�%�V�I�V�F�d�F�y�F�
�g��)��,;�	�;�)�;�PY�;�%�9�%�Y�%�9�%�5�Y�5�y�5�U^�5�8�y�8��8�W`�8�a��a�9�a�Yb�a�=�I�=�i�=�T]�=����&/��	��N��N�&/�N�	�N�_c�C��C�*2�C�:>�C�W[�C�	�C�JI�9�I��I�U^�I�S�	�S�X�S�R[�S�
^�Y�^�(�^�W`�^�
R�Y�R�(�R�y�R�M��M�h�M�9�M�5�y�5�Y�5�(�	�(�i�(�F�i�F�I�F�F�Y�F�9�F�W�	�W�i�W�
W�y�W�Y�W�
D�Y�D�9�D�U�y�U�Y�U�
F�	�F�i�F�(�)�(�	�(�-��/��-��.��-��.��/��0��/�����#��h�s�m��Xa��
���#��h�s�m��Xa��
	��	�&)�	�2:�3�-�	�	�	�
��
�&)�
�2:�3�-�
�	�
�	��	�&)�	�2:�3�-�	�	�	�	��	�&)�	�2:�3�-�	�	�	����&)��2:�3�-��	��
��
�&)�
�2:�3�-�
�	�
r!rEc�z�eZdZdZdZddeddfd�Zdedefd�Zded	e	defd
�Z
dedefd�Zdedefd�Zdedefd
�Z
y)�HTMLTranslatora�
    Translator for (X)HTML documents.

    Has a more useful implementation of some pseudo-classes based on
    HTML-specific element names and attribute names, as described in
    the `HTML5 specification`_. It assumes no-quirks mode.
    The API is the same as :class:`GenericTranslator`.

    .. _HTML5 specification: http://www.w3.org/TR/html5/links.html#selectors

    :param xhtml:
        If false (the default), element names and attribute names
        are case-insensitive.

    �lang�xhtmlr/Nc�4�||_|sd|_d|_yy)NT)rFr�r�)r2rFs  rr3zHTMLTranslator.__init__s!����
��,0�D�)�.2�D�+�r!rtc�$�|jd�S)Nz�(@selected and name(.) = 'option') or (@checked and (name(.) = 'input' or name(.) = 'command')and (@type = 'checkbox' or @type = 'radio'))rr
s  rrBz#HTMLTranslator.xpath_checked_pseudos���"�"�
;�
�	
r!r�c	��|j�dgdgfvrtd|jz��|jdj}|sJ�|j	d|j
�d|j
|j�dz��d��S)	Nrrr	rz<ancestor-or-self::*[@lang][1][starts-with(concat(translate(@zE, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '-'), r�z)])rr#r�r�rBr8rFr�rs    rr
z"HTMLTranslator.xpath_lang_functions����"�"�$�h�Z�'��,C�C�!�G�(�J\�J\�\��
��"�"�1�%�+�+����u��"�"�
!�/�/��1C�1C�E�K�K�M�TW�DW�1X�	
Z�
�	
r!c�$�|jd�S)NzA@href and (name(.) = 'a' or name(.) = 'link' or name(.) = 'area')rr
s  rr:z HTMLTranslator.xpath_link_pseudo-s���"�"�O�
�	
r!c�$�|jd�S)Na�
        (
            @disabled and
            (
                (name(.) = 'input' and @type != 'hidden') or
                name(.) = 'button' or
                name(.) = 'select' or
                name(.) = 'textarea' or
                name(.) = 'command' or
                name(.) = 'fieldset' or
                name(.) = 'optgroup' or
                name(.) = 'option'
            )
        ) or (
            (
                (name(.) = 'input' and @type != 'hidden') or
                name(.) = 'button' or
                name(.) = 'select' or
                name(.) = 'textarea'
            )
            and ancestor::fieldset[@disabled]
        )
        rr
s  rrAz$HTMLTranslator.xpath_disabled_pseudo5s���"�"�
�
�	
r!c�$�|jd�S)Na'
        (
            @href and (
                name(.) = 'a' or
                name(.) = 'link' or
                name(.) = 'area'
            )
        ) or (
            (
                name(.) = 'command' or
                name(.) = 'fieldset' or
                name(.) = 'optgroup'
            )
            and not(@disabled)
        ) or (
            (
                (name(.) = 'input' and @type != 'hidden') or
                name(.) = 'button' or
                name(.) = 'select' or
                name(.) = 'textarea' or
                name(.) = 'keygen'
            )
            and not (@disabled or ancestor::fieldset[@disabled])
        ) or (
            name(.) = 'option' and not(
                @disabled or ancestor::optgroup[@disabled]
            )
        )
        rr
s  rr@z#HTMLTranslator.xpath_enabled_pseudoSs���"�"�
�
�	
r!)F)r$r%r&r'r8rSr3r*rBr
r
r:rAr@r(r!rrDrD�s���� �N�3�d�3�t�3�
�)�
�	�
�

��

�h�

�9�

�
�y�
�Y�
�
�9�
��
�< 
�)� 
�	� 
r!rDr1)$r'�rer�rr�cssselect.parserrrrrrr	r
rrr
rrrrrrr�
no_type_checkr �RuntimeErrorr#r*�compile�splitr��matchr�r,rErDr(r!r�<module>rTs����
�
��������*���'��'�>�m�\�>�;�;�|$����F�+�1�1��
�r�z�z�6�7�=�=���B�J�J�1�2�8�8��q	�q	�hx
�&�x
r!

Youez - 2016 - github.com/yon3zu
LinuXploit