PKƨ8VEGG-INFO/top_level.txtgenshi PKƨ8pĆnnEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: Genshi Version: 0.5.1 Summary: A toolkit for generation of output for the web Home-page: http://genshi.edgewall.org/ Author: Edgewall Software Author-email: info@edgewall.org License: BSD Download-URL: http://genshi.edgewall.org/wiki/Download Description: Genshi is a Python library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web. The major feature is a template language, which is heavily inspired by Kid. Keywords: python.templating.engines Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Text Processing :: Markup :: HTML Classifier: Topic :: Text Processing :: Markup :: XML PKƨ8RD//EGG-INFO/requires.txt [i18n] Babel>=0.8 [plugin] setuptools>=0.6a2PKƨ82EGG-INFO/dependency_links.txt PKƨ8OOEGG-INFO/entry_points.txt [babel.extractors] genshi = genshi.filters.i18n:extract[i18n] [python.templating.engines] genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin] PK؝82EGG-INFO/zip-safe PKƨ8̧QEGG-INFO/native_libs.txtgenshi/_speedups.so PKƨ82EGG-INFO/SOURCES.txtCOPYING ChangeLog MANIFEST.in README.txt setup.cfg setup.py Genshi.egg-info/PKG-INFO Genshi.egg-info/SOURCES.txt Genshi.egg-info/dependency_links.txt Genshi.egg-info/entry_points.txt Genshi.egg-info/native_libs.txt Genshi.egg-info/requires.txt Genshi.egg-info/top_level.txt Genshi.egg-info/zip-safe doc/2000ft.png doc/filters.txt doc/i18n.txt doc/index.txt doc/install.txt doc/logo.gif doc/logo.png doc/plugin.txt doc/streams.txt doc/templates.txt doc/text-templates.txt doc/upgrade.txt doc/xml-templates.txt doc/xpath.txt doc/common/COPYING doc/common/README.txt doc/common/doctools.py doc/common/template.html doc/common/conf/docutils.ini doc/common/conf/epydoc.ini doc/common/style/bkgnd_pattern.png doc/common/style/docutils.css doc/common/style/edgewall.css doc/common/style/epydoc.css doc/common/style/pygments.css doc/common/style/shadow.gif doc/common/style/vertbars.png examples/basic/kidrun.py examples/basic/layout.html examples/basic/layout.kid examples/basic/run.py examples/basic/test.html examples/basic/test.kid examples/bench/basic.py examples/bench/bigtable.py examples/bench/cheetah/footer.tmpl examples/bench/cheetah/header.tmpl examples/bench/cheetah/template.tmpl examples/bench/clearsilver/footer.cs examples/bench/clearsilver/header.cs examples/bench/clearsilver/template.cs examples/bench/django/templates/base.html examples/bench/django/templates/template.html examples/bench/django/templatetags/__init__.py examples/bench/django/templatetags/bench.py examples/bench/genshi/base.html examples/bench/genshi/template.html examples/bench/genshi_text/footer.txt examples/bench/genshi_text/header.txt examples/bench/genshi_text/template.txt examples/bench/kid/base.kid examples/bench/kid/template.kid examples/bench/mako/footer.html examples/bench/mako/header.html examples/bench/mako/template.html examples/bench/myghty/base.myt examples/bench/myghty/template.myt examples/bench/simpletal/base.html examples/bench/simpletal/template.html examples/turbogears/README.txt examples/turbogears/dev.cfg examples/turbogears/sample-prod.cfg examples/turbogears/setup.py examples/turbogears/start-genshitest.py examples/turbogears/genshitest/__init__.py examples/turbogears/genshitest/controllers.py examples/turbogears/genshitest/json.py examples/turbogears/genshitest/model.py examples/turbogears/genshitest/release.py examples/turbogears/genshitest/config/__init__.py examples/turbogears/genshitest/config/app.cfg examples/turbogears/genshitest/config/log.cfg examples/turbogears/genshitest/static/images/favicon.ico examples/turbogears/genshitest/static/images/tg_under_the_hood.png examples/turbogears/genshitest/templates/__init__.py examples/turbogears/genshitest/templates/login.html examples/turbogears/genshitest/templates/master.html examples/turbogears/genshitest/templates/plain.txt examples/turbogears/genshitest/templates/sitetemplate.html examples/turbogears/genshitest/templates/welcome.html examples/turbogears/genshitest/tests/__init__.py examples/turbogears/genshitest/tests/test_controllers.py examples/turbogears/genshitest/tests/test_model.py examples/tutorial/geddit/__init__.py examples/tutorial/geddit/controller.py examples/tutorial/geddit/form.py examples/tutorial/geddit/model.py examples/tutorial/geddit/lib/__init__.py examples/tutorial/geddit/lib/ajax.py examples/tutorial/geddit/lib/template.py examples/tutorial/geddit/static/jquery.js examples/tutorial/geddit/static/layout.css examples/tutorial/geddit/static/logo.gif examples/tutorial/geddit/templates/_comment.html examples/tutorial/geddit/templates/_form.html examples/tutorial/geddit/templates/comment.html examples/tutorial/geddit/templates/index.html examples/tutorial/geddit/templates/index.xml examples/tutorial/geddit/templates/info.html examples/tutorial/geddit/templates/info.xml examples/tutorial/geddit/templates/layout.html examples/tutorial/geddit/templates/submit.html examples/webpy/README.txt examples/webpy/hello.html examples/webpy/hello.py genshi/__init__.py genshi/_speedups.c genshi/builder.py genshi/core.py genshi/input.py genshi/output.py genshi/path.py genshi/util.py genshi/filters/__init__.py genshi/filters/html.py genshi/filters/i18n.py genshi/filters/transform.py genshi/filters/tests/__init__.py genshi/filters/tests/html.py genshi/filters/tests/i18n.py genshi/filters/tests/transform.py genshi/template/__init__.py genshi/template/base.py genshi/template/directives.py genshi/template/eval.py genshi/template/interpolation.py genshi/template/loader.py genshi/template/markup.py genshi/template/plugin.py genshi/template/text.py genshi/template/tests/__init__.py genshi/template/tests/base.py genshi/template/tests/directives.py genshi/template/tests/eval.py genshi/template/tests/interpolation.py genshi/template/tests/loader.py genshi/template/tests/markup.py genshi/template/tests/plugin.py genshi/template/tests/text.py genshi/template/tests/templates/__init__.py genshi/template/tests/templates/functions.html genshi/template/tests/templates/functions.txt genshi/template/tests/templates/new_syntax.txt genshi/template/tests/templates/test.html genshi/template/tests/templates/test.txt genshi/template/tests/templates/test_no_doctype.html genshi/tests/__init__.py genshi/tests/builder.py genshi/tests/core.py genshi/tests/input.py genshi/tests/output.py genshi/tests/path.py genshi/tests/util.pyPKƨ8-_~Jgenshi/path.pyc; tHc@s)dZdklZlZdkZdkZdklZlZl Z l Z dkl Z l Z l Z lZlZlZlZlZlZddgZdZdefd YZeiZeiZeiZeiZeiZdefd YZdefd YZd efd YZ dZ!dZ"dZ#dZ$dZ%defdYZ&defdYZ'defdYZ(defdYZ)defdYZ*defdYZ+defd YZ,d!efd"YZ-hd#e*<d$e+<d%e,<d&e-YZ:d?e/fd@YZ;dAe/fdBYZ<dCe/fdDYZ=dEe/fdFYZ>dGe/fdHYZ?dIe/fdJYZ@dKe/fdLYZAdMe/fdNYZBdOe/fdPYZCdQe/fdRYZDhdSe0<dTe1<dUe2<dVe3<dWe4<dXe5<dYe6<dZe7<d[e8<d\e9<d]e;<d^e:<d_e<<d`e=<dae><dbe?<dce@<ddeA<deeB<dfeC<dgeD>> from genshi.input import XML >>> doc = XML(''' ... ... ... Foo ... ... ... Bar ... ... ... Baz ... ... ... Waz ... ... ... ''') >>> print doc.select('items/item[@status="closed" and ' ... '(@resolution="invalid" or not(@resolution))]/summary/text()') BarBaz Because the XPath engine operates on markup streams (as opposed to tree structures), it only implements a subset of the full XPath 1.0 language. (sceilsfloorN(sStreamsAttrss NamespacesQName( sSTARTsENDsTEXTsSTART_NSsEND_NSsCOMMENTsPIs START_CDATAs END_CDATAsPathsPathSyntaxErrorsrestructuredtext ensAxiscBsAtZdZdZdZdZdZdZdZe eZRS(s7Defines constants for the various supported XPath axes.s attributeschilds descendantsdescendant-or-selfsselfcCs&t||iiddtSdS(sdReturn the axis constant for the given name, or `None` if no such axis was defined. s-s_N(sgetattrsclssnamesuppersreplacesNone(sclssname((s)build/bdist.linux-i686/egg/genshi/path.pysforname>s( s__name__s __module__s__doc__s ATTRIBUTEsCHILDs DESCENDANTsDESCENDANT_OR_SELFsSELFsfornames classmethod(((s)build/bdist.linux-i686/egg/genshi/path.pysAxis5s  cBsAtZdZeddZdZeedZedZRS(sImplements basic XPath support on streams. Instances of this class represent a "compiled" XPath expression, and provide methods for testing the path against a stream, as well as extracting a substream matching that path. icCs(||_t|||i|_dS(s)Create the path object from a string. :param text: the path expression :param filename: the name of the file in which the path expression was found (used in error messages) :param lineno: the line on which the expression was found N(stextsselfssources PathParsersfilenameslinenosparsespaths(sselfstextsfilenameslineno((s)build/bdist.linux-i686/egg/genshi/path.pys__init__Us cCsg}x|iD]x}g}xS|D]K\}}}|id||fx"|D]}|dcd|7s|( spathssselfspathsstepssaxissnodetests predicatessappends predicatesjoins __class__s__name__(sselfsnodetestspathss predicatesstepss predicatesspathsaxis((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__`s c srtjo hntjo hntd}t|dtdtSdS(sReturns a substream of the given stream that matches the path. If there are no matches, this method returns an empty stream. >>> from genshi.input import XML >>> xml = XML('Text') >>> print Path('.//child').select(xml) Text >>> print Path('.//child/text()').select(xml) Text :param stream: the stream to select from :param namespaces: (optional) a mapping of namespace prefixes to URIs :param variables: (optional) a mapping of variable names to values :return: the substream matching the path, or an empty stream :rtype: `Stream` c#si}xD]}||}|tjo|V|dtjod}xz|djohi }|dtjo|d7}n |dt jo|d8}n|V||dtqVWqq|o|VqqWdS(Niis updateonly( sselfstestsstreamsevents namespacess variablessresultsTruesSTARTsdepthsnextssubeventsEND(ssubeventsdepthsresultstestsevent(sstreamsselfs namespacess variables(s)build/bdist.linux-i686/egg/genshi/path.pys _generates(     s serializerN(s namespacessNones variablessitersstreams _generatesStreamsgetattr(sselfsstreams namespacess variabless _generate((sselfsstreams namespacess variabless)build/bdist.linux-i686/egg/genshi/path.pysselectks      c sgi}gi}|iD]%}|otgpg|q~D]5}||t|dggdgt|fqG~t d}|SdS(sReturns a function that can be used to track whether the path matches a specific stream event. The function returned expects the positional arguments ``event``, ``namespaces`` and ``variables``. The first is a stream event, while the latter two are a mapping of namespace prefixes to URIs, and a mapping of variable names to values, respectively. In addition, the function accepts an ``updateonly`` keyword argument that default to ``False``. If it is set to ``True``, the function only updates its internal state, but does not perform any tests or return a result. If the path matches the event, the function returns the match (for example, a `START` or `TEXT` event.) Otherwise, it returns ``None``. >>> from genshi.input import XML >>> xml = XML('') >>> test = Path('child').test() >>> for event in xml: ... if test(event, {}, {}): ... print event[0], repr(event[1]) START (QName(u'child'), Attrs([(QName(u'id'), u'2')])) :param ignore_context: if `True`, the path is interpreted like a pattern in XSLT, meaning for example that it will match at any depth :return: a function that can be used to test individual events in a stream against the path :rtype: ``function`` ics|d \}}}t}xyD]q\}} } }}|t jo| o| i q q nl|tjo#| i| o| dpdn<|tjp$|tjp|tjp |tjoq n|p |p| oq n| d}t| }|o|t|tj |djoq n o|tjo |dj} t}xAno9||\} }}| o| tjp | t joPn|d| j}||||||}|o#|ox|D]y}||||||}t&|t'jo5||cd7<||t|jo t(}q8n| o t}PqqWn|o|o=| p$|tj p| t)jp | t*jo |}qn;| p| t*jp | t+jo|d7}|| d=s>s<=sOscCs|i|iS(N(sselfstokensspos(sself((s)build/bdist.linux-i686/egg/genshi/path.pysPscCs!|id7_|i|iSdS(Ni(sselfsposstokens(sself((s)build/bdist.linux-i686/egg/genshi/path.pys next_tokenRscCs)|i o|i|idSntSdS(Ni(sselfsat_endstokensspossNone(sself((s)build/bdist.linux-i686/egg/genshi/path.pys peek_tokenVs cCsz|ig}x2|idjo!|i|i|iqW|i o#td|i|i|i n|SdS(sParses the XPath expression and returns a list of location path tests. For union expressions (such as `*|text()`), this function returns one test for each operand in the union. For patch expressions that don't use the union operator, the function always returns a list of size 1. Each path test in turn is a sequence of tests that correspond to the location steps, each tuples of the form `(axis, testfunc, predicates)` s|s+Unexpected token %r after end of expressionN( sselfs_location_pathspathss cur_tokens next_tokensappendsat_endsPathSyntaxErrorsfilenameslineno(sselfspaths((s)build/bdist.linux-i686/egg/genshi/path.pysparse]s    cCsg}xto|iido_|idjo|ittgfn%| otd|i |i n|i n|i \}}}| o t}n|i|||f|ip|iid oPq q W|SdS(Ns/s//s%Absolute location paths not supported(sstepssTruesselfs cur_tokens startswithsappendsDESCENDANT_OR_SELFsNodeTestsPathSyntaxErrorsfilenameslinenos next_tokens_location_stepsaxissnodetests predicatessCHILDsat_end(sselfsstepssnodetests predicatessaxis((s)build/bdist.linux-i686/egg/genshi/path.pys_location_pathqs$  cCs2|idjot}|in|idjo t}n|idjotd|i|inq|i djoWt i |i}|t jo td||i|in|i|int }|i |pt}g}x(|idjo|i|iqW|||fSdS(Ns@s.s..sUnsupported axis "parent"s::sUnsupport axis "%s"s[(sselfs cur_tokens ATTRIBUTEsaxiss next_tokensSELFsPathSyntaxErrorsfilenameslinenos peek_tokensAxissfornamesNones _node_testsCHILDsnodetests predicatessappends _predicate(sselfsnodetests predicatessaxis((s)build/bdist.linux-i686/egg/genshi/path.pys_location_steps,     cCs t}}|i}|ddfjo|i}n|djoU|i}|i|i}|djot ||}qt |||}nP|idjot |}n0|idjo t }nt||i}|i o|in|SdS(Ns(s()s:s*s.(sNonestestsprefixsselfs peek_tokens next_tokens _node_types cur_tokens localnamesQualifiedPrincipalTypeTestsaxissQualifiedNameTestsPrincipalTypeTestsNodeTests LocalNameTestsat_end(sselfsaxissprefixstests localnames next_token((s)build/bdist.linux-i686/egg/genshi/path.pys _node_tests&         cCs|i}|ig}|idjog|i|idjoI|i}|d|df|ijo|dd!}n|i|qnti |}| o t d||i |i n||SdS(Ns()s)iiis%s() not allowed here(sselfs cur_tokensnames next_tokensargssstrings_QUOTESsappends _nodetest_mapsgetsclssPathSyntaxErrorsfilenameslineno(sselfsnamesargssstringscls((s)build/bdist.linux-i686/egg/genshi/path.pys _node_types    cCs|idjpt|i|i}|idjo#td|i|i|in|i o|in|SdS(Ns[s]s/Expected "]" to close predicate, but found "%s"( sselfs cur_tokensAssertionErrors next_tokens_or_exprsexprsPathSyntaxErrorsfilenameslinenosat_end(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys _predicates    cCsK|i}x4|idjo#|it||i}qW|SdS(Nsor(sselfs _and_exprsexprs cur_tokens next_tokens OrOperator(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys_or_exprs   cCsK|i}x4|idjo#|it||i}qW|SdS(Nsand(sselfs_equality_exprsexprs cur_tokens next_tokens AndOperator(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys _and_exprs   cCs^|i}xG|iddfjo0t|i}|i|||i}qW|SdS(Ns=s!=(sselfs_relational_exprsexprs cur_tokens _operator_mapsops next_token(sselfsexprsop((s)build/bdist.linux-i686/egg/genshi/path.pys_equality_exprs   cCsd|i}xM|iddddfjo0t|i}|i|||i}qW|SdS(Ns>s>=s<(sselfs _sub_exprsexprs cur_tokens _operator_mapsops next_token(sselfsexprsop((s)build/bdist.linux-i686/egg/genshi/path.pys_relational_exprs   cCs|i}|djo|iSn|i|i}|idjo#td|i|i|i n|i|SdS(Ns(s)s4Expected ")" to close sub-expression, but found "%s"( sselfs cur_tokenstokens _primary_exprs next_tokens_or_exprsexprsPathSyntaxErrorsfilenameslineno(sselfsexprstoken((s)build/bdist.linux-i686/egg/genshi/path.pys _sub_exprs      cCs1|i}t|djo|d|df|ijo|it|dd!Sn|dip|ddjo|itt |Sn|djo$|i}|it |Snd|i o|i i do|iSn5t}|djot}|in|i|SdS(Niiis.s$s(s@(sselfs cur_tokenstokenslens_QUOTESs next_tokens StringLiteralsisdigits NumberLiteralsas_floatsVariableReferencesat_ends peek_tokens startswiths_function_callsNonesaxiss ATTRIBUTEs _node_test(sselfstokensaxis((s)build/bdist.linux-i686/egg/genshi/path.pys _primary_exprs$ 1 "    ! cCs|i}|idjo g}n|idjpt|i|ig}x2|idjo!|i|i|iqYW|idj o#td|i|i |i n|it i |}| o td||i |i n||SdS(Ns()s(s,s)s<Expected ")" to close function argument list, but found "%s"sUnsupported function "%s"(sselfs cur_tokensnames next_tokensargssAssertionErrors_or_exprsappendsPathSyntaxErrorsfilenameslinenos _function_mapsgetscls(sselfsnamesargsscls((s)build/bdist.linux-i686/egg/genshi/path.pys_function_calls&       ("s__name__s __module__s__doc__s_QUOTESs_TOKENSsrescompilesjoinsappends_[1]stsescapesfindalls _tokenizesNones__init__spropertysat_ends cur_tokens next_tokens peek_tokensparses_location_paths_location_steps _node_tests _node_types _predicates_or_exprs _and_exprs_equality_exprs_relational_exprs _sub_exprs _primary_exprs_function_call(((s)build/bdist.linux-i686/egg/genshi/path.pys PathParser;s, H             cCsBt|to*t|djpt|ddSn|SdS(sConvert value to a scalar. If a single element Attrs() object is passed the value of the single attribute will be returned.iiN(s isinstancesvaluesAttrsslensAssertionError(svalue((s)build/bdist.linux-i686/egg/genshi/path.pys as_scalar4s cCstt|SdS(N(sfloats as_scalarsvalue(svalue((s)build/bdist.linux-i686/egg/genshi/path.pysas_float=scCstt|SdS(N(slongs as_scalarsvalue(svalue((s)build/bdist.linux-i686/egg/genshi/path.pysas_longBscCs/t|}|tjodSnt|SdS(Nu(s as_scalarsvaluesFalsesunicode(svalue((s)build/bdist.linux-i686/egg/genshi/path.pys as_stringEs  cCstt|SdS(N(sbools as_scalarsvalue(svalue((s)build/bdist.linux-i686/egg/genshi/path.pysas_boolKssPrincipalTypeTestcBs2tZdZdgZdZdZdZRS(s?Node test that matches any event with the given principal type.sprincipal_typecCs ||_dS(N(sprincipal_typesself(sselfsprincipal_type((s)build/bdist.linux-i686/egg/genshi/path.pys__init__TscCs<|tjo+|itjo|dptSq8tSndS(Ni(skindsSTARTsselfsprincipal_types ATTRIBUTEsdatasNonesTrue(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__Vs cCsdSdS(Ns*((sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__\s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysPrincipalTypeTestQs    sQualifiedPrincipalTypeTestcBs5tZdZddgZdZdZdZRS(s[Node test that matches any event with the given principal type in a specific namespace.sprincipal_typesprefixcCs||_||_dS(N(sprincipal_typesselfsprefix(sselfsprincipal_typesprefix((s)build/bdist.linux-i686/egg/genshi/path.pys__init__cs c Cst|i|i}|tjo|it jo|doWt gi } |dD]-\}}||jo| ||fqUqU~ ptSq|d|jSndS(Nii(s Namespaces namespacessgetsselfsprefixs namespaceskindsSTARTsprincipal_types ATTRIBUTEsdatasAttrssappends_[1]snamesvaluesNone( sselfskindsdatasposs namespacess variablessnames namespacesvalues_[1]((s)build/bdist.linux-i686/egg/genshi/path.pys__call__fs  WcCsd|iSdS(Ns%s:*(sselfsprefix(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__ns(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysQualifiedPrincipalTypeTest_s    s LocalNameTestcBs5tZdZddgZdZdZdZRS(sWNode test that matches any event with the given principal type and local name. sprincipal_typesnamecCs||_||_dS(N(sprincipal_typesselfsname(sselfsprincipal_typesname((s)build/bdist.linux-i686/egg/genshi/path.pys__init__vs cCsw|tjof|itjo|i|djo*t|i|di|ifgSqs|di |ijSndS(Nii( skindsSTARTsselfsprincipal_types ATTRIBUTEsnamesdatasAttrssgets localname(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__ys $*cCs |iSdS(N(sselfsname(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys LocalNameTestqs    sQualifiedNameTestcBs8tZdZdddgZdZdZdZRS(s[Node test that matches any event with the given principal type and qualified name. sprincipal_typesprefixsnamecCs||_||_||_dS(N(sprincipal_typesselfsprefixsname(sselfsprincipal_typesprefixsname((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s  cCstd|i|i|if}|tjo]|i t jo||djo*t |i|di|ifgSq|d|jSndS(Ns%s}%sii( sQNames namespacessgetsselfsprefixsnamesqnameskindsSTARTsprincipal_types ATTRIBUTEsdatasAttrs(sselfskindsdatasposs namespacess variablessqname((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s % !*cCsd|i|ifSdS(Ns%s:%s(sselfsprefixsname(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysQualifiedNameTests   sCommentNodeTestcBs&tZdZgZdZdZRS(s*Node test that matches any comment events.cCs|tjSdS(N(skindsCOMMENT(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsdSdS(Ns comment()((sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysCommentNodeTests  sNodeTestcBs&tZdZgZdZdZRS(s Node test that matches any node.cCs&|tjotSn|||fSdS(N(skindsSTARTsTruesdataspos(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s cCsdSdS(Nsnode()((sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysNodeTests  sProcessingInstructionNodeTestcBs5tZdZdgZedZdZdZRS(s8Node test that matches any processing instruction event.stargetcCs ||_dS(N(stargetsself(sselfstarget((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs-|tjo|i p|d|ijSdS(Ni(skindsPIsselfstargetsdata(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCs1d}|iod|id}nd|SdS(Nss"sprocessing-instruction(%s)(sargsselfstarget(sselfsarg((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s (s__name__s __module__s__doc__s __slots__sNones__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysProcessingInstructionNodeTests    s TextNodeTestcBs&tZdZgZdZdZRS(s&Node test that matches any text event.cCs|tjSdS(N(skindsTEXT(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsdSdS(Nstext()((sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys TextNodeTests  scommentsnodesprocessing-instructionstextsFunctioncBstZdZRS(s3Base class for function nodes in XPath expressions.(s__name__s __module__s__doc__(((s)build/bdist.linux-i686/egg/genshi/path.pysFunctions sBooleanFunctioncBs2tZdZdgZdZdZdZRS(sPThe `boolean` function, which converts its argument to a boolean value. sexprcCs ||_dS(N(sexprsself(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs)|i|||||}t|SdS(N( sselfsexprskindsdatasposs namespacess variablessvalsas_bool(sselfskindsdatasposs namespacess variablessval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|iSdS(Ns boolean(%r)(sselfsexpr(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysBooleanFunctions    sCeilingFunctioncBs2tZdZdgZdZdZdZRS(seThe `ceiling` function, which returns the nearest lower integer number for the given number. snumbercCs ||_dS(N(snumbersself(sselfsnumber((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs/|i|||||}tt|SdS(N( sselfsnumberskindsdatasposs namespacess variablessceilsas_float(sselfskindsdatasposs namespacess variablessnumber((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|iSdS(Ns ceiling(%r)(sselfsnumber(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysCeilingFunctions    sConcatFunctioncBs2tZdZdgZdZdZdZRS(soThe `concat` function, which concatenates (joins) the variable number of strings it gets as arguments. sexprscGs ||_dS(N(sexprssself(sselfsexprs((s)build/bdist.linux-i686/egg/genshi/path.pys__init__sc Csqg}xWgi}|iD]"}|||||||q~D]} |it | qCWdi |SdS(Nu(sstringssappends_[1]sselfsexprssexprskindsdatasposs namespacess variablessitems as_stringsjoin( sselfskindsdatasposs namespacess variablessexprsstringss_[1]sitem((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s =cCs?ddigi}|iD]}|t|q~SdS(Ns concat(%s)s, (sjoinsappends_[1]sselfsexprssexprsrepr(sselfs_[1]sexpr((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysConcatFunctions    sContainsFunctioncBs5tZdZddgZdZdZdZRS(s\The `contains` function, which returns whether a string contains a given substring. sstring1sstring2cCs||_||_dS(N(sstring1sselfsstring2(sselfsstring1sstring2((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s cCsP|i|||||}|i|||||}t|t|jSdS(N( sselfsstring1skindsdatasposs namespacess variablessstring2s as_string(sselfskindsdatasposs namespacess variablessstring2sstring1((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|i|ifSdS(Nscontains(%r, %r)(sselfsstring1sstring2(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysContainsFunctions    sMatchesFunctioncBswtZdZddgZhdei<dei<dei<deis  s NotFunctioncBs2tZdZdgZdZdZdZRS(sUThe `not` function, which returns the negated boolean value of its argument. sexprcCs ||_dS(N(sexprsself(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys__init__NscCs$t|i||||| SdS(N(sas_boolsselfsexprskindsdatasposs namespacess variables(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__PscCsd|iSdS(Nsnot(%s)(sselfsexpr(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__Rs(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys NotFunctionIs    sNormalizeSpaceFunctioncBsDtZdZdgZeidiZdZdZ dZ RS(sThe `normalize-space` function, which removes leading and trailing whitespace in the given string, and replaces multiple adjacent whitespace characters inside the string with a single space. sexprs\s{2,}cCs ||_dS(N(sexprsself(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys__init__\scCs;|i|||||}|idt |i SdS(Ns ( sselfsexprskindsdatasposs namespacess variablessstrings _normalizes as_stringsstrip(sselfskindsdatasposs namespacess variablessstring((s)build/bdist.linux-i686/egg/genshi/path.pys__call__^scCsdt|iSdS(Nsnormalize-space(%s)(sreprsselfsexpr(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__as( s__name__s __module__s__doc__s __slots__srescompilessubs _normalizes__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysNormalizeSpaceFunctionUs    sNumberFunctioncBs2tZdZdgZdZdZdZRS(s=The `number` function that converts its argument to a number.sexprcCs ||_dS(N(sexprsself(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys__init__gscCs)|i|||||}t|SdS(N( sselfsexprskindsdatasposs namespacess variablessvalsas_float(sselfskindsdatasposs namespacess variablessval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__iscCsd|iSdS(Ns number(%r)(sselfsexpr(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__ls(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysNumberFunctionds    s RoundFunctioncBs2tZdZdgZdZdZdZRS(s]The `round` function, which returns the nearest integer number for the given number. snumbercCs ||_dS(N(snumbersself(sselfsnumber((s)build/bdist.linux-i686/egg/genshi/path.pys__init__tscCs/|i|||||}tt|SdS(N( sselfsnumberskindsdatasposs namespacess variablessroundsas_float(sselfskindsdatasposs namespacess variablessnumber((s)build/bdist.linux-i686/egg/genshi/path.pys__call__vscCsd|iSdS(Ns round(%r)(sselfsnumber(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__ys(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys RoundFunctionos    sStartsWithFunctioncBs5tZdZddgZdZdZdZRS(sbThe `starts-with` function that returns whether one string starts with a given substring. sstring1sstring2cCs||_||_dS(N(sstring1sselfsstring2(sselfsstring1sstring2((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s cCsS|i|||||}|i|||||}t|i t|SdS(N( sselfsstring1skindsdatasposs namespacess variablessstring2s as_strings startswith(sselfskindsdatasposs namespacess variablessstring2sstring1((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|i|ifSdS(Nsstarts-with(%r, %r)(sselfsstring1sstring2(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysStartsWithFunction|s    sStringLengthFunctioncBs2tZdZdgZdZdZdZRS(sRThe `string-length` function that returns the length of the given string. sexprcCs ||_dS(N(sexprsself(sselfsexpr((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs/|i|||||}tt |SdS(N( sselfsexprskindsdatasposs namespacess variablessstringslens as_string(sselfskindsdatasposs namespacess variablessstring((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|iSdS(Nsstring-length(%r)(sselfsexpr(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysStringLengthFunctions    sSubstringFunctioncBs;tZdZdddgZedZdZdZRS(sThe `substring` function that returns the part of a string that starts at the given offset, and optionally limited to the given length. sstringsstartslengthcCs||_||_||_dS(N(sstringsselfsstartslength(sselfsstringsstartslength((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s  c Cs|i|||||}|i|||||}d}|it j o|i|||||}n|t |t t |t |!SdS(Ni( sselfsstringskindsdatasposs namespacess variablessstartslengthsNonesas_longslens as_string( sselfskindsdatasposs namespacess variablessstringsstartslength((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s cCsF|itj od|i|i|ifSnd|i|ifSdS(Nssubstring(%r, %r, %r)ssubstring(%r, %r)(sselfslengthsNonesstringsstart(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__sNones__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysSubstringFunctions   sSubstringAfterFunctioncBs5tZdZddgZdZdZdZRS(srThe `substring-after` function that returns the part of a string that is found after the given substring. sstring1sstring2cCs||_||_dS(N(sstring1sselfsstring2(sselfsstring1sstring2((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s c Cs|t|i|||||}t|i|||||}|i |}|djo||t |SndSdS(Niu( s as_stringsselfsstring1skindsdatasposs namespacess variablessstring2sfindsindexslen( sselfskindsdatasposs namespacess variablessindexsstring2sstring1((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s !! cCsd|i|ifSdS(Nssubstring-after(%r, %r)(sselfsstring1sstring2(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysSubstringAfterFunctions    sSubstringBeforeFunctioncBs5tZdZddgZdZdZdZRS(stThe `substring-before` function that returns the part of a string that is found before the given substring. sstring1sstring2cCs||_||_dS(N(sstring1sselfsstring2(sselfsstring1sstring2((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s c Csrt|i|||||}t|i|||||}|i |}|djo || SndSdS(Niu( s as_stringsselfsstring1skindsdatasposs namespacess variablessstring2sfindsindex( sselfskindsdatasposs namespacess variablessindexsstring2sstring1((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s !!  cCsd|i|ifSdS(Nssubstring-after(%r, %r)(sselfsstring1sstring2(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysSubstringBeforeFunctions    sTranslateFunctioncBs8tZdZdddgZdZdZdZRS(snThe `translate` function that translates a set of characters in a string to target set of characters. sstrings fromcharsstocharscCs||_||_||_dS(N(sstringsselfs fromcharsstochars(sselfsstrings fromcharsstochars((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s  c Cst|i|||||}t|i|||||}t|i |||||} t t gi } |D]}| t|qw~ gi } | D]}| t|q~ } |i| SdS(N(s as_stringsselfsstringskindsdatasposs namespacess variabless fromcharsstocharssdictszipsappends_[1]scsordstables translate( sselfskindsdatasposs namespacess variablessstrings fromcharsscs_[1]stocharsstable((s)build/bdist.linux-i686/egg/genshi/path.pys__call__s !!!03cCsd|i|i|ifSdS(Nstranslate(%r, %r, %r)(sselfsstrings fromcharsstochars(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysTranslateFunctions   s TrueFunctioncBs&tZdZgZdZdZRS(sCThe `true` function, which always returns the boolean `true` value.cCstSdS(N(sTrue(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsdSdS(Nstrue()((sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys TrueFunctions  sbooleansceilingsconcatscontainssmatchessfalsesfloors local-namesnames namespace-urisnormalize-spacesnotsnumbersrounds starts-withs string-lengths substringssubstring-afterssubstring-befores translatestruesLiteralcBstZdZRS(s&Abstract base class for literal nodes.(s__name__s __module__s__doc__(((s)build/bdist.linux-i686/egg/genshi/path.pysLiterals s StringLiteralcBs2tZdZdgZdZdZdZRS(sA string literal node.stextcCs ||_dS(N(stextsself(sselfstext((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs |iSdS(N(sselfstext(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|iSdS(Ns"%s"(sselfstext(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys StringLiterals    s NumberLiteralcBs2tZdZdgZdZdZdZRS(sA number literal node.snumbercCs ||_dS(N(snumbersself(sselfsnumber((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs |iSdS(N(sselfsnumber(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCst|iSdS(N(sstrsselfsnumber(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys NumberLiteral s    sVariableReferencecBs2tZdZdgZdZdZdZRS(sA variable reference node.snamecCs ||_dS(N(snamesself(sselfsname((s)build/bdist.linux-i686/egg/genshi/path.pys__init__scCs|i|iSdS(N(s variablessgetsselfsname(sselfskindsdatasposs namespacess variables((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCst|iSdS(N(sstrsselfsname(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysVariableReferences    s AndOperatorcBs5tZdZddgZdZdZdZRS(sThe boolean operator `and`.slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__$s cCsZt|i|||||}| otSn|i |||||}t|SdS(N( sas_boolsselfslvalskindsdatasposs namespacess variablessFalsesrval(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__'s !cCsd|i|ifSdS(Ns %s and %s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__-s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys AndOperator!s    sEqualsOperatorcBs5tZdZddgZdZdZdZRS(sThe equality operator `=`.slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__3s cCsPt|i|||||}t|i|||||}||jSdS(N( s as_scalarsselfslvalskindsdatasposs namespacess variablessrval(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__6s!!cCsd|i|ifSdS(Ns%s=%s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__:s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysEqualsOperator0s    sNotEqualsOperatorcBs5tZdZddgZdZdZdZRS(sThe equality operator `!=`.slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__@s cCsPt|i|||||}t|i|||||}||jSdS(N( s as_scalarsselfslvalskindsdatasposs namespacess variablessrval(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__Cs!!cCsd|i|ifSdS(Ns%s!=%s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__Gs(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysNotEqualsOperator=s    s OrOperatorcBs5tZdZddgZdZdZdZRS(sThe boolean operator `or`.slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__Ms cCsYt|i|||||}|otSn|i |||||}t|SdS(N( sas_boolsselfslvalskindsdatasposs namespacess variablessTruesrval(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__Ps !cCsd|i|ifSdS(Ns%s or %s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__Vs(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pys OrOperatorJs    sGreaterThanOperatorcBs5tZdZddgZdZdZdZRS(s+The relational operator `>` (greater than).slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__\s cCsP|i|||||}|i|||||}t|t|jSdS(N( sselfslvalskindsdatasposs namespacess variablessrvalsas_float(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call___scCsd|i|ifSdS(Ns%s>%s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__cs(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysGreaterThanOperatorYs    sGreaterThanOrEqualOperatorcBs5tZdZddgZdZdZdZRS(s5The relational operator `>=` (greater than or equal).slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__is cCsP|i|||||}|i|||||}t|t|jSdS(N( sselfslvalskindsdatasposs namespacess variablessrvalsas_float(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__lscCsd|i|ifSdS(Ns%s>=%s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__ps(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysGreaterThanOrEqualOperatorfs    sLessThanOperatorcBs5tZdZddgZdZdZdZRS(s(The relational operator `<` (less than).slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__vs cCsP|i|||||}|i|||||}t|t|jSdS(N( sselfslvalskindsdatasposs namespacess variablessrvalsas_float(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__yscCsd|i|ifSdS(Ns%s<%s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__}s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysLessThanOperatorss    sLessThanOrEqualOperatorcBs5tZdZddgZdZdZdZRS(s2The relational operator `<=` (less than or equal).slvalsrvalcCs||_||_dS(N(slvalsselfsrval(sselfslvalsrval((s)build/bdist.linux-i686/egg/genshi/path.pys__init__s cCsP|i|||||}|i|||||}t|t|jSdS(N( sselfslvalskindsdatasposs namespacess variablessrvalsas_float(sselfskindsdatasposs namespacess variablessrvalslval((s)build/bdist.linux-i686/egg/genshi/path.pys__call__scCsd|i|ifSdS(Ns%s<=%s(sselfslvalsrval(sself((s)build/bdist.linux-i686/egg/genshi/path.pys__repr__s(s__name__s __module__s__doc__s __slots__s__init__s__call__s__repr__(((s)build/bdist.linux-i686/egg/genshi/path.pysLessThanOrEqualOperators    s=s!=s>s>=s<(Us__doc__smathsceilsfloorsoperatorsres genshi.coresStreamsAttrss NamespacesQNamesSTARTsENDsTEXTsSTART_NSsEND_NSsCOMMENTsPIs START_CDATAs END_CDATAs__all__s __docformat__sobjectsAxiss ATTRIBUTEsCHILDs DESCENDANTsDESCENDANT_OR_SELFsSELFsPaths ExceptionsPathSyntaxErrors PathParsers as_scalarsas_floatsas_longs as_stringsas_boolsPrincipalTypeTestsQualifiedPrincipalTypeTests LocalNameTestsQualifiedNameTestsCommentNodeTestsNodeTestsProcessingInstructionNodeTests TextNodeTests _nodetest_mapsFunctionsBooleanFunctionsCeilingFunctionsConcatFunctionsContainsFunctionsMatchesFunctions FalseFunctions FloorFunctionsLocalNameFunctions NameFunctionsNamespaceUriFunctions NotFunctionsNormalizeSpaceFunctionsNumberFunctions RoundFunctionsStartsWithFunctionsStringLengthFunctionsSubstringFunctionsSubstringAfterFunctionsSubstringBeforeFunctionsTranslateFunctions TrueFunctions _function_mapsLiterals StringLiterals NumberLiteralsVariableReferences AndOperatorsEqualsOperatorsNotEqualsOperators OrOperatorsGreaterThanOperatorsGreaterThanOrEqualOperatorsLessThanOperatorsLessThanOrEqualOperators _operator_mapsNones_DOTSLASHSLASH(OsNodeTestsPathSyntaxErrorsStringLengthFunctionsGreaterThanOrEqualOperators LocalNameTestsTEXTs NamespacesEqualsOperators __docformat__s RoundFunctions NotFunctions FloorFunctionsQualifiedPrincipalTypeTestsoperatorsMatchesFunctionsCeilingFunctions NameFunctionsProcessingInstructionNodeTestsCOMMENTs StringLiteralsConcatFunctionsSubstringBeforeFunctions__all__sfloors OrOperatorsNumberFunctions _operator_maps TextNodeTestsSTART_NSsContainsFunctions as_stringsresDESCENDANT_OR_SELFsLessThanOrEqualOperatorsas_floatsPathsPIsas_longs _nodetest_maps START_CDATAsFunctionsENDs NumberLiteralsSubstringAfterFunctions FalseFunctions TrueFunctionsLessThanOperators_DOTSLASHSLASHs AndOperatorsceilsSTARTsBooleanFunctionsQualifiedNameTestsStartsWithFunctionsNamespaceUriFunctionsLiteralsTranslateFunctions DESCENDANTsCommentNodeTests _function_mapsNotEqualsOperatorsEND_NSsStreamsPrincipalTypeTests ATTRIBUTEsSELFsLocalNameFunctionsQNamesVariableReferencesas_bools PathParsersGreaterThanOperatorsAttrssCHILDsSubstringFunctionsNormalizeSpaceFunctions END_CDATAs as_scalarsAxis((s)build/bdist.linux-i686/egg/genshi/path.pys?'s  =             *                   <PK8AKDDgenshi/util.py# -*- coding: utf-8 -*- # # Copyright (C) 2006-2007 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://genshi.edgewall.org/log/. """Various utility classes and functions.""" import htmlentitydefs import re try: set except NameError: from sets import ImmutableSet as frozenset from sets import Set as set __docformat__ = 'restructuredtext en' class LRUCache(dict): """A dictionary-like object that stores only a certain number of items, and discards its least recently used item when full. >>> cache = LRUCache(3) >>> cache['A'] = 0 >>> cache['B'] = 1 >>> cache['C'] = 2 >>> len(cache) 3 >>> cache['A'] 0 Adding new items to the cache does not increase its size. Instead, the least recently used item is dropped: >>> cache['D'] = 3 >>> len(cache) 3 >>> 'B' in cache False Iterating over the cache returns the keys, starting with the most recently used: >>> for key in cache: ... print key D A C This code is based on the LRUCache class from ``myghtyutils.util``, written by Mike Bayer and released under the MIT license. See: http://svn.myghty.org/myghtyutils/trunk/lib/myghtyutils/util.py """ class _Item(object): def __init__(self, key, value): self.previous = self.next = None self.key = key self.value = value def __repr__(self): return repr(self.value) def __init__(self, capacity): self._dict = dict() self.capacity = capacity self.head = None self.tail = None def __contains__(self, key): return key in self._dict def __iter__(self): cur = self.head while cur: yield cur.key cur = cur.next def __len__(self): return len(self._dict) def __getitem__(self, key): item = self._dict[key] self._update_item(item) return item.value def __setitem__(self, key, value): item = self._dict.get(key) if item is None: item = self._Item(key, value) self._dict[key] = item self._insert_item(item) else: item.value = value self._update_item(item) self._manage_size() def __repr__(self): return repr(self._dict) def _insert_item(self, item): item.previous = None item.next = self.head if self.head is not None: self.head.previous = item else: self.tail = item self.head = item self._manage_size() def _manage_size(self): while len(self._dict) > self.capacity: olditem = self._dict[self.tail.key] del self._dict[self.tail.key] if self.tail != self.head: self.tail = self.tail.previous self.tail.next = None else: self.head = self.tail = None def _update_item(self, item): if self.head == item: return previous = item.previous previous.next = item.next if item.next is not None: item.next.previous = previous else: self.tail = previous item.previous = None item.next = self.head self.head.previous = self.head = item def flatten(items): """Flattens a potentially nested sequence into a flat list. :param items: the sequence to flatten >>> flatten((1, 2)) [1, 2] >>> flatten([1, (2, 3), 4]) [1, 2, 3, 4] >>> flatten([1, (2, [3, 4]), 5]) [1, 2, 3, 4, 5] """ retval = [] for item in items: if isinstance(item, (frozenset, list, set, tuple)): retval += flatten(item) else: retval.append(item) return retval def plaintext(text, keeplinebreaks=True): """Returns the text as a `unicode` string with all entities and tags removed. >>> plaintext('1 < 2') u'1 < 2' The `keeplinebreaks` parameter can be set to ``False`` to replace any line breaks by simple spaces: >>> plaintext('''1 ... < ... 2''', keeplinebreaks=False) u'1 < 2' :param text: the text to convert to plain text :param keeplinebreaks: whether line breaks in the text should be kept intact :return: the text with tags and entities removed """ text = stripentities(striptags(text)) if not keeplinebreaks: text = text.replace(u'\n', u' ') return text _STRIPENTITIES_RE = re.compile(r'&(?:#((?:\d+)|(?:[xX][0-9a-fA-F]+));?|(\w+);)') def stripentities(text, keepxmlentities=False): """Return a copy of the given text with any character or numeric entities replaced by the equivalent UTF-8 characters. >>> stripentities('1 < 2') u'1 < 2' >>> stripentities('more …') u'more \u2026' >>> stripentities('…') u'\u2026' >>> stripentities('…') u'\u2026' If the `keepxmlentities` parameter is provided and is a truth value, the core XML entities (&, ', >, < and ") are left intact. >>> stripentities('1 < 2 …', keepxmlentities=True) u'1 < 2 \u2026' """ def _replace_entity(match): if match.group(1): # numeric entity ref = match.group(1) if ref.startswith('x'): ref = int(ref[1:], 16) else: ref = int(ref, 10) return unichr(ref) else: # character entity ref = match.group(2) if keepxmlentities and ref in ('amp', 'apos', 'gt', 'lt', 'quot'): return u'&%s;' % ref try: return unichr(htmlentitydefs.name2codepoint[ref]) except KeyError: if keepxmlentities: return u'&%s;' % ref else: return ref return _STRIPENTITIES_RE.sub(_replace_entity, text) _STRIPTAGS_RE = re.compile(r'(|<[^>]*>)') def striptags(text): """Return a copy of the text with any XML/HTML tags removed. >>> striptags('Foo bar') 'Foo bar' >>> striptags('Foo') 'Foo' >>> striptags('Foo
') 'Foo' HTML/XML comments are stripped, too: >>> striptags('test') 'test' :param text: the string to remove tags from :return: the text with tags removed """ return _STRIPTAGS_RE.sub('', text) PK8j --genshi/builder.py# -*- coding: utf-8 -*- # # Copyright (C) 2006-2008 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://genshi.edgewall.org/log/. """Support for programmatically generating markup streams from Python code using a very simple syntax. The main entry point to this module is the `tag` object (which is actually an instance of the ``ElementFactory`` class). You should rarely (if ever) need to directly import and use any of the other classes in this module. Elements can be created using the `tag` object using attribute access. For example: >>> doc = tag.p('Some text and ', tag.a('a link', href='http://example.org/'), '.') >>> doc This produces an `Element` instance which can be further modified to add child nodes and attributes. This is done by "calling" the element: positional arguments are added as child nodes (alternatively, the `Element.append` method can be used for that purpose), whereas keywords arguments are added as attributes: >>> doc(tag.br) >>> print doc

Some text and a link.

If an attribute name collides with a Python keyword, simply append an underscore to the name: >>> doc(class_='intro') >>> print doc

Some text and a link.

As shown above, an `Element` can easily be directly rendered to XML text by printing it or using the Python ``str()`` function. This is basically a shortcut for converting the `Element` to a stream and serializing that stream: >>> stream = doc.generate() >>> stream #doctest: +ELLIPSIS >>> print stream

Some text and a link.

The `tag` object also allows creating "fragments", which are basically lists of nodes (elements or text) that don't have a parent element. This can be useful for creating snippets of markup that are attached to a parent element later (for example in a template). Fragments are created by calling the `tag` object, which returns an object of type `Fragment`: >>> fragment = tag('Hello, ', tag.em('world'), '!') >>> fragment >>> print fragment Hello, world! """ try: set except NameError: from sets import Set as set from genshi.core import Attrs, Markup, Namespace, QName, Stream, \ START, END, TEXT __all__ = ['Fragment', 'Element', 'ElementFactory', 'tag'] __docformat__ = 'restructuredtext en' class Fragment(object): """Represents a markup fragment, which is basically just a list of element or text nodes. """ __slots__ = ['children'] def __init__(self): """Create a new fragment.""" self.children = [] def __add__(self, other): return Fragment()(self, other) def __call__(self, *args): """Append any positional arguments as child nodes. :see: `append` """ map(self.append, args) return self def __iter__(self): return self._generate() def __repr__(self): return '<%s>' % self.__class__.__name__ def __str__(self): return str(self.generate()) def __unicode__(self): return unicode(self.generate()) def __html__(self): return Markup(self.generate()) def append(self, node): """Append an element or string as child node. :param node: the node to append; can be an `Element`, `Fragment`, or a `Stream`, or a Python string or number """ if isinstance(node, (Stream, Element, basestring, int, float, long)): # For objects of a known/primitive type, we avoid the check for # whether it is iterable for better performance self.children.append(node) elif isinstance(node, Fragment): self.children.extend(node.children) elif node is not None: try: map(self.append, iter(node)) except TypeError: self.children.append(node) def _generate(self): for child in self.children: if isinstance(child, Fragment): for event in child._generate(): yield event elif isinstance(child, Stream): for event in child: yield event else: if not isinstance(child, basestring): child = unicode(child) yield TEXT, child, (None, -1, -1) def generate(self): """Return a markup event stream for the fragment. :rtype: `Stream` """ return Stream(self._generate()) def _kwargs_to_attrs(kwargs): attrs = [] names = set() for name, value in kwargs.items(): name = name.rstrip('_').replace('_', '-') if value is not None and name not in names: attrs.append((QName(name), unicode(value))) names.add(name) return Attrs(attrs) class Element(Fragment): """Simple XML output generator based on the builder pattern. Construct XML elements by passing the tag name to the constructor: >>> print Element('strong') Attributes can be specified using keyword arguments. The values of the arguments will be converted to strings and any special XML characters escaped: >>> print Element('textarea', rows=10, cols=60)