• File: cssselect.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyc
  • Date Modified: 07/17/2016 11:11 AM
  • File size: 4.14 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

qPc@sdZddlZddlmZyedZWnek
rQednXejZejZej	Z	dddd	gZ
d
ejfdYZdeej
fd
YZdZejdZde_eed<d	ejfdYZdS(sCSS 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.
iN(tetreet	cssselectsNcssselect seems not to be installed. See http://packages.python.org/cssselect/tSelectorSyntaxErrortExpressionErrort
SelectorErrortCSSSelectortLxmlTranslatorcBseZdZdZRS(sR
    A custom CSS selector to XPath translator with lxml-specific extensions.
    cCsd|jdgdgfkr4td|jn|jdj}|jd|j|jS(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((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pytxpath_contains_function"s(t__name__t
__module__t__doc__R(((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyRstLxmlHTMLTranslatorcBseZdZRS(s)
    lxml extensions + HTML support.
    (RRR(((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyR/scCs
|jS(N(R(tcontextts((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyt_make_lower_case5sshttp://codespeak.net/lxml/css/t__lxml_internal_csss
lower-casecBs&eZdZdddZdZRS(sA 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((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyR"XscCs0d|jjttt|d|jfS(Ns<%s %s for %r>i(t	__class__RthextabstidR#(R((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyt__repr__cs	N(RRRtNoneR"R*(((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyR=s(RtsystlxmlRt
__import__texternal_cssselecttImportErrorRRRt__all__tGenericTranslatorRtHTMLTranslatorRRtFunctionNamespacetnstprefixR!R(((sA/opt/alt/python27/lib64/python2.7/site-packages/lxml/cssselect.pyt<module>s$