ok

Mini Shell

Direktori : /lib64/python2.7/site-packages/lxml/
Upload File :
Current File : //lib64/python2.7/site-packages/lxml/cssselect.pyc

�
�qPc@s�dZddlZddlmZyed�ZWnek
rQed��nXejZejZej	Z	dddd	gZ
d
ejfd��YZdeej
fd
��YZd�Zejd�Zde_eed<d	ejfd��YZdS(s�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.
i����N(tetreet	cssselectsNcssselect seems not to be installed. See http://packages.python.org/cssselect/tSelectorSyntaxErrortExpressionErrort
SelectorErrortCSSSelectortLxmlTranslatorcBseZdZd�ZRS(sR
    A custom CSS selector to XPath translator with lxml-specific extensions.
    cCsd|j�dgdgfkr4td|j��n|jdj}|jd|j|j���S(NtSTRINGtIDENTs9Expected a single string or ident for :contains(), got %ris7contains(__lxml_internal_css:lower-case(string(.)), %s)(targument_typesRt	argumentstvaluet
add_conditiont
xpath_literaltlower(tselftxpathtfunctionR((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pytxpath_contains_function"s(t__name__t
__module__t__doc__R(((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyRstLxmlHTMLTranslatorcBseZdZRS(s)
    lxml extensions + HTML support.
    (RRR(((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyR/scCs
|j�S(N(R(tcontextts((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyt_make_lower_case5sshttp://codespeak.net/lxml/css/t__lxml_internal_csss
lower-casecBs&eZdZddd�Zd�ZRS(s�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')]

    txmlcCs�|dkrt�}n6|dkr0t�}n|dkrNtdt�}n|j|�}tjj||d|�||_dS(NRthtmltxhtmlt
namespaces(RRtTruetcss_to_xpathRtXPatht__init__tcss(RR#Rt
translatortpath((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyR"XscCs0d|jjttt|���d|jfS(Ns<%s %s for %r>i(t	__class__RthextabstidR#(R((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyt__repr__cs	N(RRRtNoneR"R*(((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyR=s(RtsystlxmlRt
__import__texternal_cssselecttImportErrorRRRt__all__tGenericTranslatorRtHTMLTranslatorRRtFunctionNamespacetnstprefixR!R(((s4/usr/lib64/python2.7/site-packages/lxml/cssselect.pyt<module>s$
							


Zerion Mini Shell 1.0