AlkantarClanX12

Your IP : 18.191.165.192


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/lxml/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/lxml/__pycache__/cssselect.cpython-37.pyc

B

U�*W&
�@s�dZddlmZddlmZyddlZWnek
rDed��YnXejZej	Z	ej
Z
ddd	d
gZGdd�dej�Z
Gd
d�de
ej�Zdd�Ze�d�Zde_eed<Gdd
�d
ej�ZdS)z�CSS Selectors based on XPath.

This module supports selecting XML/HTML tags based on CSS selectors.
See the `CSSSelector` class for details.

This is a thin wrapper around cssselect 0.7 or later.
�)�absolute_import�)�etreeNzRcssselect does not seem to be installed. See http://packages.python.org/cssselect/�SelectorSyntaxError�ExpressionError�
SelectorError�CSSSelectorc@seZdZdZdd�ZdS)�LxmlTranslatorzR
    A custom CSS selector to XPath translator with lxml-specific extensions.
    cCsF|��dgdgfkr"td|j��|jdj}|�d|�|����S)N�STRINGZIDENTz9Expected a single string or ident for :contains(), got %rrz7contains(__lxml_internal_css:lower-case(string(.)), %s))Zargument_typesr�	arguments�valueZ
add_conditionZ
xpath_literal�lower)�selfZxpath�functionr�r�A/opt/alt/python37/lib64/python3.7/site-packages/lxml/cssselect.py�xpath_contains_function!s
z&LxmlTranslator.xpath_contains_functionN)�__name__�
__module__�__qualname__�__doc__rrrrrr	sr	c@seZdZdZdS)�LxmlHTMLTranslatorz)
    lxml extensions + HTML support.
    N)rrrrrrrrr.srcCs|��S)N)r
)�context�srrr�_make_lower_case4srzhttp://codespeak.net/lxml/css/Z__lxml_internal_cssz
lower-casec@s"eZdZdZddd�Zdd�ZdS)	ra�A CSS selector.

    Usage::

        >>> from lxml import etree, cssselect
        >>> select = cssselect.CSSSelector("a tag > child")

        >>> root = etree.XML("<a><b><c/><tag><child>TEXT</child></tag></b></a>")
        >>> [ el.tag for el in select(root) ]
        ['child']

    To use CSS namespaces, you need to pass a prefix-to-namespace
    mapping as ``namespaces`` keyword argument::

        >>> rdfns = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
        >>> select_ns = cssselect.CSSSelector('root > rdf|Description',
        ...                                   namespaces={'rdf': rdfns})

        >>> rdf = etree.XML((
        ...     '<root xmlns:rdf="%s">'
        ...       '<rdf:Description>blah</rdf:Description>'
        ...     '</root>') % rdfns)
        >>> [(el.tag, el.text) for el in select_ns(rdf)]
        [('{http://www.w3.org/1999/02/22-rdf-syntax-ns#}Description', 'blah')]

    N�xmlcCsX|dkrt�}n"|dkr t�}n|dkr2tdd�}|�|�}tjj|||d�||_dS)Nr�html�xhtmlT)r)�
namespaces)r	rZcss_to_xpathr�XPath�__init__�css)rr!rZ
translator�pathrrrr Ws

zCSSSelector.__init__cCs(d|jjttt|���dd�|jfS)Nz<%s %s for %r>�)�	__class__r�hex�abs�idr!)rrrr�__repr__bszCSSSelector.__repr__)Nr)rrrrr r(rrrrr<s
)r�
__future__r�r�	cssselectZexternal_cssselect�ImportErrorrrr�__all__ZGenericTranslatorr	ZHTMLTranslatorrrZFunctionNamespace�ns�prefixrrrrrr�<module>s&