tHc@sdZddklZlZddkZddkZddklZlZl Z l Z ddkl Z l Z l Z lZlZlZlZlZlZddgZdZd efd YZeiZeiZeiZeiZeiZdefd YZdefd YZd efdYZ dZ!dZ"dZ#dZ$dZ%defdYZ&defdYZ'defdYZ(defdYZ)defdYZ*defdYZ+d efd!YZ,d"efd#YZ-he*d$6e+d%6e,d&6e-d'6Z.d(efd)YZ/d*e/fd+YZ0d,e/fd-YZ1d.e/fd/YZ2d0e/fd1YZ3d2e/fd3YZ4d4e/fd5YZ5d6e/fd7YZ6d8e/fd9YZ7d:e/fd;YZ8d<e/fd=YZ9d>e/fd?YZ:d@e/fdAYZ;dBe/fdCYZ<dDe/fdEYZ=dFe/fdGYZ>dHe/fdIYZ?dJe/fdKYZ@dLe/fdMYZAdNe/fdOYZBdPe/fdQYZCdRe/fdSYZDhe0dT6e1dU6e2dV6e3dW6e4dX6e5dY6e6dZ6e7d[6e8d\6e9d]6e;d^6e:d_6e<d`6e=da6e>db6e?dc6e@dd6eAde6eBdf6eCdg6eDdh6ZEdiefdjYZFdkeFfdlYZGdmeFfdnYZHdoeFfdpYZIdqefdrYZJdsefdtYZKduefdvYZLdwefdxYZMdyefdzYZNd{efd|YZOd}efd~YZPdefdYZQheKd6eLd6eNd6eOd6ePd6eQd6ZRee&ddfZTdS(sCBasic support for evaluating XPath expressions against streams. >>> 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. i(tceiltfloorN(tStreamtAttrst NamespacetQName( tSTARTtENDtTEXTtSTART_NStEND_NStCOMMENTtPIt START_CDATAt END_CDATAtPathtPathSyntaxErrorsrestructuredtext entAxiscBsAeZdZdZdZdZdZdZdZe eZRS(s7Defines constants for the various supported XPath axes.t attributetchildt descendantsdescendant-or-selftselfcCs"t||iidddS(sdReturn the axis constant for the given name, or `None` if no such axis was defined. t-t_N(tgetattrtuppertreplacetNone(tclstname((s1/usr/lib64/python2.6/site-packages/genshi/path.pytforname>s( t__name__t __module__t__doc__t ATTRIBUTEtCHILDt DESCENDANTtDESCENDANT_OR_SELFtSELFRt classmethod(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR5s cBsAeZdZdddZdZdddZedZRS(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(tsourcet PathParsertparsetpaths(Rttexttfilenametlineno((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt__init__Us cCsg}x|iD]x}g}xS|D]K\}}}|id||fx"|D]}|dcd|7t|(R+tappendtjoint __class__R(RR+tpathtstepstaxistnodetestt predicatest predicate((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt__repr__`s csqdjo hndjo hntfd}t|dtddS(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` c3si}xD]}||}|tjo|V|dtjod}x{|djoii}|dtjo|d7}n |dtjo|d8}n|V||dtqWWqq|o |VqqWdS(Niit updateonly(ttesttTrueRtnextR(R=teventtresulttdepthtsubevent(tstreamRt namespacest variables(s1/usr/lib64/python2.6/site-packages/genshi/path.pyt _generates(    t serializerN(RtiterRR(RRDRERFRG((RDRFRERs1/usr/lib64/python2.6/site-packages/genshi/path.pytselectks      c sg}g}|iD]"}|o tgpg|q~D]2}||t|dggdgt|fq>~tfd}|S(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`` ic s|d \}}}d}xiD]a\}} } } } |tjo| o| iq 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}d}x7|| \}}}|o|t jp |t joPn| d| j}||||||}|o"|ox|D]x}||||||}t |tjo5| | cd7<| | t |jo t}q1n|p d}PqqWn|o|o=| p'|tj p|tjp |tjo |}qn;| p|tjp |tjo| d7} | | d=t>s<=tOscCs|i|iS((RRU(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRPscCs|id7_|i|iS(Ni(RUR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt next_tokenRscCs!|ip|i|idSdS(Ni(tat_endRRUR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt peek_tokenVs cCsu|ig}x2|idjo!|i|i|iqW|ip#td|i|i|in|S(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)` R1s+Unexpected token %r after end of expression(t_location_patht cur_tokenRR2RRR-R.(RR+((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR*]s   cCsg}xto|iido^|idjo|ittgfn$|ptd|i|in|i n|i \}}}|p t }n|i|||f|i p|iid oPq q W|S(NR0s//s%Absolute location paths not supported( R>Rt startswithR2R%tNodeTestRR-R.Rt_location_stepR#R(RR6R7R8R9((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRqs$  cCs.|idjot}|in|idjo t}n|idjotd|i|inq|idjoWti |i}|djo td||i|in|i|ind}|i |pt }g}x(|idjo|i |iqW|||fS(NRuRps..sUnsupported axis "parent"s::sUnsupport axis "%s"Rq(RR"RR&RR-R.RRRRt _node_testR#R2t _predicate(RR7R8R9((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs,     cCsd}}|i}|djo|i}n|djoU|i}|i|i}|djot||}qt|||}nP|idjot|}n0|idjo t}nt ||i}|i p|in|S(NRss()Rot*Rp(Rss()( RRt _node_typeRRtQualifiedPrincipalTypeTesttQualifiedNameTesttPrincipalTypeTestRt LocalNameTestR(RR7R=tprefixRt localname((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs&          cCs|i}|ig}|idjog|i|idjoI|i}|d|df|ijo|dd!}n|i|qnti|}|p td||i|in||S(Ns()Rtiiis%s() not allowed here( RRt_QUOTESR2t _nodetest_maptgetRR-R.(RRtargststringR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    cCse|i|i}|idjo#td|i|i|in|ip|in|S(NRrs/Expected "]" to close predicate, but found "%s"(Rt_or_exprRRR-R.R(Rtexpr((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   cCsG|i}x4|idjo#|it||i}qW|S(Ntor(t _and_exprRRt OrOperator(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   cCsG|i}x4|idjo#|it||i}qW|S(Ntand(t_equality_exprRRt AndOperator(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   cCsT|i}xA|idjo0t|i}|i|||i}qW|S(NRvs!=(Rvs!=(t_relational_exprRt _operator_mapR(RRtop((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   cCsT|i}xA|idjo0t|i}|i|||i}qW|S(NRys>=Rz(Rys>=Rzs>=(t _sub_exprRRR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   cCsx|i}|djo |iS|i|i}|idjo#td|i|i|in|i|S(NRsRts4Expected ")" to close sub-expression, but found "%s"(Rt _primary_exprRRRR-R.(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs      cCs%|i}t|djo:|d|df|ijo|it|dd!S|dip|ddjo|itt|S|djo!|i}|it|S|i o!|i i do |i Sd}|djot}|in|i|SdS(NiiiRpR{RsRu(RRLRRt StringLiteraltisdigitt NumberLiteraltas_floattVariableReferenceRRRt_function_callRR"R(RRR7((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs$ 1 "     !  cCs|i}|idjo g}n|i|ig}x2|idjo!|i|i|iqBW|idjp#td|i|i|in|iti|}|p td||i|in||S(Ns()RxRts<Expected ")" to close function argument list, but found "%s"sUnsupported function "%s"( RRRR2RR-R.t _function_mapR(RRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs&      (RmRm(RnRn(s::Ros..Rps//R0RqRrs()RsRtRuRvs!=RwR1Rxs>=Rys<=RzR{N("RR R!Rt_TOKENStretcompileR3R`tttescapeRitfindallR~RR/tpropertyRRRRR*RRRRRRRRRRRR(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR);s2  0A             cCs%t|to |ddS|SdS(sConvert value to a scalar. If a single element Attrs() object is passed the value of the single attribute will be returned.iiN(t isinstanceR(tvalue((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt as_scalar4s cCstt|S(N(ROR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR=scCstt|S(N(tlongR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pytas_longBscCs(t|}|tjodSt|S(Nu(RRPtunicode(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt as_stringEs  cCstt|S(N(tboolR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pytas_boolKsRcBs2eZdZdgZdZdZdZRS(s?Node test that matches any event with the given principal type.tprincipal_typecCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/TscCs9|tjo(|itjo|dpdStSndS(Ni(RRR"RR>(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt__call__Vs cCsdS(NR((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;\s(RR R!t __slots__R/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRQs    RcBs5eZdZddgZdZdZdZRS(s[Node test that matches any event with the given principal type in a specific namespace.RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/cs c Cst|i|i}|tjo{|itjoY|doNtg}|dD]*\}} ||jo||| fqRqR~pdS|d|jSndS(Nii(RRRRRR"RR( RRSRTRURERFt namespaceR`RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRfs  0cCs d|iS(Ns%s:*(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;ns(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR_s    RcBs5eZdZddgZdZdZdZRS(sWNode test that matches any event with the given principal type and local name. RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/vs cCst|tjoc|itjo;|i|djo't|i|di|ifgS|di|ijSndS(Nii(RRR"RRRR(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRys $'cCs|iS(N(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRqs    RcBs8eZdZdddgZdZdZdZRS(s[Node test that matches any event with the given principal type and qualified name. RRRcCs||_||_||_dS(N(RRR(RRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s  cCstd|i|i|if}|tjoZ|itjo8||djo't|i|di|ifgS|d|jSndS(Ns%s}%sii(RRRRRRR"R(RRSRTRURERFtqname((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs % !'cCsd|i|ifS(Ns%s:%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   tCommentNodeTestcBs&eZdZgZdZdZRS(s*Node test that matches any comment events.cCs |tjS(N(R (RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsdS(Ns comment()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs RcBs&eZdZgZdZdZRS(s Node test that matches any node.cCs|tjotS|||fS(N(RR>(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs cCsdS(Nsnode()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs tProcessingInstructionNodeTestcBs5eZdZdgZddZdZdZRS(s8Node test that matches any processing instruction event.ttargetcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs)|tjo|i p|d|ijS(Ni(R R(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs-d}|iod|id}nd|S(NR|Rnsprocessing-instruction(%s)(R(Rtarg((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s N(RR R!RRR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    t TextNodeTestcBs&eZdZgZdZdZRS(s&Node test that matches any text event.cCs |tjS(N(R(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsdS(Nstext()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs tcommenttnodesprocessing-instructionR,tFunctioncBseZdZRS(s3Base class for function nodes in XPath expressions.(RR R!(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRstBooleanFunctioncBs2eZdZdgZdZdZdZRS(sPThe `boolean` function, which converts its argument to a boolean value. RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs%|i|||||}t|S(N(RR(RRSRTRURERFtval((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs d|iS(Ns boolean(%r)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tCeilingFunctioncBs2eZdZdgZdZdZdZRS(seThe `ceiling` function, which returns the nearest lower integer number for the given number. RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs+|i|||||}tt|S(N(RRR(RRSRTRURERFR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs d|iS(Ns ceiling(%r)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tConcatFunctioncBs2eZdZdgZdZdZdZRS(soThe `concat` function, which concatenates (joins) the variable number of strings it gets as arguments. texprscGs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/sc Csgg}xQg}|iD]}|||||||q~D]} |it| q=Wdi|S(Nu(RR2RR3( RRSRTRURERFtstringsR`Rtitem((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs  -cCs5ddig}|iD]}|t|q~S(Ns concat(%s)s, (R3Rtrepr(RR`R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tContainsFunctioncBs5eZdZddgZdZdZdZRS(s\The `contains` function, which returns whether a string contains a given substring. tstring1tstring2cCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s cCsL|i|||||}|i|||||}t|t|jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsd|i|ifS(Nscontains(%r, %r)(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tMatchesFunctioncBsoeZdZddgZheid6eid6eid6eid6Z ddZ d Z d Z d Z RS( s]The `matches` function, which returns whether a string matches a regular expression. RRtstmRatxR|cCs(||_||_|i||_dS(N(RRt _map_flagstflags(RRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s  cCsXt|i|||||}t|i|||||}ti|||iS(N(RRRRtsearchR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR s!!cCs8ttig}|D]}||i|q~tiS(N(treducetoperatortor_tflag_mapRtU(RRR`tflag((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR s cCsd|i|ifS(Nscontains(%r, %r)(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RRtStMtItXt flag_mappingR/RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs .   t FalseFunctioncBs&eZdZgZdZdZRS(sEThe `false` function, which always returns the boolean `false` value.cCstS(N(RP(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsdS(Nsfalse()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs t FloorFunctioncBs2eZdZdgZdZdZdZRS(sfThe `ceiling` function, which returns the nearest higher integer number for the given number. RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/ scCs+|i|||||}tt|S(N(RRR(RRSRTRURERFR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR"scCs d|iS(Ns floor(%r)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;%s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tLocalNameFunctioncBs&eZdZgZdZdZRS(sXThe `local-name` function, which returns the local name of the current element. cCs|tjo |diSdS(Ni(RR(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR-s cCsdS(Ns local-name()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;0s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR(s t NameFunctioncBs&eZdZgZdZdZRS(sVThe `name` function, which returns the qualified name of the current element. cCs|tjo |dSdS(Ni(R(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR8s cCsdS(Nsname()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;;s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR3s tNamespaceUriFunctioncBs&eZdZgZdZdZRS(s^The `namespace-uri` function, which returns the namespace URI of the current element. cCs|tjo |diSdS(Ni(RR(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRCs cCsdS(Nsnamespace-uri()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;Fs(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR>s t NotFunctioncBs2eZdZdgZdZdZdZRS(sUThe `not` function, which returns the negated boolean value of its argument. RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/NscCs t|i||||| S(N(RR(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRPscCs d|iS(Nsnot(%s)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;Rs(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRIs    tNormalizeSpaceFunctioncBsDeZdZdgZeidiZdZdZ 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. Rs\s{2,}cCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/\scCs7|i|||||}|idt|iS(Nt (Rt _normalizeRtstrip(RRSRTRURERFR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR^scCsdt|iS(Nsnormalize-space(%s)(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;as( RR R!RRRtsubRR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRUs    tNumberFunctioncBs2eZdZdgZdZdZdZRS(s=The `number` function that converts its argument to a number.RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/gscCs%|i|||||}t|S(N(RR(RRSRTRURERFR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRiscCs d|iS(Ns number(%r)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;ls(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRds    t RoundFunctioncBs2eZdZdgZdZdZdZRS(s]The `round` function, which returns the nearest integer number for the given number. RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/tscCs+|i|||||}tt|S(N(RtroundR(RRSRTRURERFR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRvscCs d|iS(Ns round(%r)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;ys(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRos    tStartsWithFunctioncBs5eZdZddgZdZdZdZRS(sbThe `starts-with` function that returns whether one string starts with a given substring. RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s cCsO|i|||||}|i|||||}t|it|S(N(RRRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsd|i|ifS(Nsstarts-with(%r, %r)(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR|s    tStringLengthFunctioncBs2eZdZdgZdZdZdZRS(sRThe `string-length` function that returns the length of the given string. RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs+|i|||||}tt|S(N(RRLR(RRSRTRURERFR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs d|iS(Nsstring-length(%r)(R(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tSubstringFunctioncBs;eZdZdddgZddZdZdZRS(sThe `substring` function that returns the part of a string that starts at the given offset, and optionally limited to the given length. RtstarttlengthcCs||_||_||_dS(N(RRR(RRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s  c Cs|i|||||}|i|||||}d}|idj o|i|||||}n|t|tt|t|!S(Ni(RRRRRRLR( RRSRTRURERFRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs cCsC|idj od|i|i|ifSd|i|ifSdS(Nssubstring(%r, %r, %r)ssubstring(%r, %r)(RRRR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s N(RR R!RRR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   tSubstringAfterFunctioncBs5eZdZddgZdZdZdZRS(srThe `substring-after` function that returns the part of a string that is found after the given substring. RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s c Csut|i|||||}t|i|||||}|i|}|djo||t|SdS(Niu(RRRtfindRL( RRSRTRURERFRRtindex((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs !! cCsd|i|ifS(Nssubstring-after(%r, %r)(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tSubstringBeforeFunctioncBs5eZdZddgZdZdZdZRS(stThe `substring-before` function that returns the part of a string that is found before the given substring. RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s c Cskt|i|||||}t|i|||||}|i|}|djo || SdS(Niu(RRRR( RRSRTRURERFRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs !!  cCsd|i|ifS(Nssubstring-after(%r, %r)(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    tTranslateFunctioncBs8eZdZdddgZdZdZdZRS(snThe `translate` function that translates a set of characters in a string to target set of characters. Rt fromcharsttocharscCs||_||_||_dS(N(RRR(RRRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s  c Cst|i|||||}t|i|||||}t|i|||||}ttg} |D]} | t| qt~ g} |D]} | t| q~ } |i| S(N(RRRRtdicttziptordt translate( RRSRTRURERFRRRR`tcRittable((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs !!!*-cCsd|i|i|ifS(Nstranslate(%r, %r, %r)(RRR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs   t TrueFunctioncBs&eZdZgZdZdZRS(sCThe `true` function, which always returns the boolean `true` value.cCstS(N(R>(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsdS(Nstrue()((R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RRR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR s tbooleantceilingtconcattcontainstmatchestfalseRs local-nameRs namespace-urisnormalize-spacetnotRRs starts-withs string-lengtht substringssubstring-afterssubstring-beforeRttruetLiteralcBseZdZRS(s&Abstract base class for literal nodes.(RR R!(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRsRcBs2eZdZdgZdZdZdZRS(sA string literal node.R,cCs ||_dS(N(R,(RR,((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs|iS(N(R,(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs d|iS(Ns"%s"(R,(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    RcBs2eZdZdgZdZdZdZRS(sA number literal node.RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs|iS(N(R(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs t|iS(N(tstrR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR s    RcBs2eZdZdgZdZdZdZRS(sA variable reference node.RcCs ||_dS(N(R(RR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/scCs|i|iS(N(RR(RRSRTRURERF((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCs t|iS(N(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    RcBs5eZdZddgZdZdZdZRS(sThe boolean operator `and`.tlvaltrvalcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/$s cCsRt|i|||||}|ptS|i|||||}t|S(N(RRRPR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR's !cCsd|i|ifS(Ns %s and %s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;-s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR!s    tEqualsOperatorcBs5eZdZddgZdZdZdZRS(sThe equality operator `=`.RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/3s cCsLt|i|||||}t|i|||||}||jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR6s!!cCsd|i|ifS(Ns%s=%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;:s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR0s    tNotEqualsOperatorcBs5eZdZddgZdZdZdZRS(sThe equality operator `!=`.RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/@s cCsLt|i|||||}t|i|||||}||jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRCs!!cCsd|i|ifS(Ns%s!=%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;Gs(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR=s    RcBs5eZdZddgZdZdZdZRS(sThe boolean operator `or`.RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/Ms cCsRt|i|||||}|otS|i|||||}t|S(N(RRR>R(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRPs !cCsd|i|ifS(Ns%s or %s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;Vs(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRJs    tGreaterThanOperatorcBs5eZdZddgZdZdZdZRS(s+The relational operator `>` (greater than).RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/\s cCsL|i|||||}|i|||||}t|t|jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR_scCsd|i|ifS(Ns%s>%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;cs(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRYs    tGreaterThanOrEqualOperatorcBs5eZdZddgZdZdZdZRS(s5The relational operator `>=` (greater than or equal).RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/is cCsL|i|||||}|i|||||}t|t|jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRlscCsd|i|ifS(Ns%s>=%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;ps(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRfs    tLessThanOperatorcBs5eZdZddgZdZdZdZRS(s(The relational operator `<` (less than).RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/vs cCsL|i|||||}|i|||||}t|t|jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRyscCsd|i|ifS(Ns%s<%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;}s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRss    tLessThanOrEqualOperatorcBs5eZdZddgZdZdZdZRS(s2The relational operator `<=` (less than or equal).RRcCs||_||_dS(N(RR(RRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR/s cCsL|i|||||}|i|||||}t|t|jS(N(RRR(RRSRTRURERFRR((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRscCsd|i|ifS(Ns%s<=%s(RR(R((s1/usr/lib64/python2.6/site-packages/genshi/path.pyR;s(RR R!RR/RR;(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyRs    Rvs!=Rys>=Rz((UR!tmathRRRRt genshi.coreRRRRRRRR R R R R Rt__all__t __docformat__tobjectRR"R#R$R%R&RRjRR)RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRRRRh(((s1/usr/lib64/python2.6/site-packages/genshi/path.pyt's  "@