o ]Lb@sddlmZddlZddlZddlmZddlmZddlm Z mZm Z m Z ddl m Z mZGdd d e jZGd d d e jZGd d d eZGdddeZGdddeZGdddeZGdddeeZGdddeZGdddeeZGdddeZGdddeZGdddeZGd d!d!eZGd"d#d#eeZGd$d%d%eZGd&d'd'eZ dzd*d+Z!d{d,d-Z" ( )   .d|d/d0Z#    .d}d1d2Z$d3d4Z%d5d6Z& .d~d7d8Z'd9d:Z(d;d<Z)d=d>Z*d?d@Z+dAdBZ,dCdDZ-dEdFZ.dGdHZ/dIdJZ0dKdLZ1dMdNZ2ddOdPZ3ddQdRZ4ddSdTZ5ddUdVZ6dWdXZ7dYdZZ8de1e9e)ee4e:e6iZ;d[d\ZdadbZ?ddddeZ@dfdgZAdhdiZBdjdkZCdldmZDdndoZEdpdqZFdrdsZGdtduZHdvdwZIdxdyZJdS))absolute_importN)_)getattr)errorpycompatsmartsetutil)dateutil stringutilc@ eZdZdS)ResourceUnavailableN__name__ __module__ __qualname__rr8/usr/lib/python3/dist-packages/mercurial/templateutil.pyr r c@r )TemplateNotFoundNrrrrrrrrc@seZdZdZejZejddZejddZ ejddZ ejdd Z ejd d Z ejd d Z ejddZejddZejddZejddZdS)wrappedzObject requiring extra conversion prior to displaying or processing as value Use unwrapvalue() or unwrapastype() to obtain the inner object. cCdS)zbTest if the specified item is in self The item argument may be a wrapped object. Nrselfcontextmappingitemrrrcontains,zwrapped.containscCr)zReturn a member item for the specified key The key argument may be a wrapped object. A returned object may be either a wrapped object or a pure value depending on the self type. Nrrrrkeyrrr getmember3rzwrapped.getmembercCr)zjReturn the smallest item, which may be either a wrapped or a pure value depending on the self typeNrrrrrrrgetmin<rzwrapped.getmincCr)ziReturn the largest item, which may be either a wrapped or a pure value depending on the self typeNrr"rrrgetmaxArzwrapped.getmaxcCr)zReturn new container of the same type which includes only the selected elements select() takes each item as a wrapped object and returns True/False. NrrrrselectrrrfilterFrzwrapped.filtercCr)zYield each template mappingNrrrrrritermapsNrzwrapped.itermapscCr)zJoin items with the separator; Returns a bytes or (possibly nested) generator of bytes A pre-configured template may be rendered per item if this container holds unprintable items. NrrrrseprrrjoinRrz wrapped.joincCr)zReturn a bytes or (possibly nested) generator of bytes representing the underlying object A pre-configured template may be rendered if the underlying object is not printable. Nrr"rrrshow[rz wrapped.showcCr)z2Return a boolean representation of the inner valueNrr"rrrtobooldrzwrapped.toboolcCr)zMove the inner value object out or create a value representation A returned value must be serializable by templaterfilters.json(). Nrr"rrrtovaluehrzwrapped.tovalueN)rrr__doc__abcABCMeta __metaclass__abstractmethodrr!r#r$r'r)r,r-r.r/rrrrr#s.         rc@s,eZdZdZejZddZejddZ dS)mappablez:Object which can be converted to a single template mappingccs||VdSN)tomapr(rrrr)uszmappable.itermapscCr)z2Create a single template mapping representing thisNrr(rrrr7xrzmappable.tomapN) rrrr0r1r2r3r)r4r7rrrrr5ps r5c@speZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZddZdS) wrappedbyteszWrapper for byte stringcC ||_dSr6_valuervaluerrr__init__ zwrappedbytes.__init__cCst|||}||jvSr6) stringifyr;rrrrr  zwrappedbytes.containscCttdt|jNs%r is not a dictionaryr ParseErrorrrbytestrr;rrrrr!zwrappedbytes.getmembercC|||tSr6_getbyminr"rrrr#zwrappedbytes.getmincCrHr6rJmaxr"rrrr$rLzwrappedbytes.getmaxcCs$|js ttd|t|jS)Ns empty string)r;rrErr iterbytestr)rrrfuncrrrrJszwrappedbytes._getbycCrB)Ns%r is not filterablerDr%rrrr'rGzwrappedbytes.filtercCrBNs%r is not iterable of mappingsrDr(rrrr)rGzwrappedbytes.itermapscCstt|j|Sr6) joinitemsrrOr;r*rrrr,zwrappedbytes.joincC|jSr6r:r"rrrr-zwrappedbytes.showcC t|jSr6)boolr;r"rrrr.r?zwrappedbytes.toboolcCrTr6r:r"rrrr/rUzwrappedbytes.tovalueN)rrrr0r>rr!r#r$rJr'r)r,r-r.r/rrrrr8}s r8c@heZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS) wrappedvaluez2Generic wrapper for pure non-list/dict/bytes valuecCr9r6r:r<rrrr>r?zwrappedvalue.__init__cCttd|jNs%r is not iterablerrErr;rrrrrzwrappedvalue.containscCrZrCr\rrrrr!r]zwrappedvalue.getmembercCrZr[r\r"rrrr#r]zwrappedvalue.getmincCrZr[r\r"rrrr$r]zwrappedvalue.getmaxcCrZr[r\r%rrrr'r]zwrappedvalue.filtercCrZrQr\r(rrrr)s zwrappedvalue.itermapscCrZr[r\r*rrrr,r]zwrappedvalue.joincCs|jdurdSt|jSN)r;rrFr"rrrr-s  zwrappedvalue.showcCs0|jdurdSt|jtr|jStt|jS)NF)r; isinstancerWrrFr"rrrr.s  zwrappedvalue.toboolcCrTr6r:r"rrrr/rUzwrappedvalue.tovalueN)rrrr0r>rr!r#r$r'r)r,r-r.r/rrrrrYs rYc@sjeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)datezWrapper for date tuple%d %dcCstt|\|_|_||_dSr6)mapint _unixtime _tzoffset_showfmt)rr=showfmtrrrr>s z date.__init__cCttdNsdate is not iterablerrErrrrrrrLz date.containscCri)Nsdate is not a dictionaryrkrrrrr!rLzdate.getmembercCrirjrkr"rrrr#rLz date.getmincCrirjrkr"rrrr$rLz date.getmaxcCrirjrkr%rrrr'rLz date.filtercCrirjrkr*rrrr,rLz date.joincCs|j|j|jfSr6)rgrerfr"rrrr-rSz date.showcCs|j|jdS)N)sunixtimestzoffsetrerfr(rrrr7rLz date.tomapcCrNTrr"rrrr.z date.toboolcCs |j|jfSr6rlr"rrrr/ z date.tovalueN)rb)rrrr0r>rr!r#r$r'r,r-r7r.r/rrrrras  rac@zeZdZdZdddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)hybridaWrapper for list or dict to support legacy template This class allows us to handle both: - "{files}" (legacy command-line-specific list hack) and - "{files % '{file} '}" (hgweb-style with inlining and function support) and to access raw values: - "{ifcontains(file, files, ...)}", "{ifcontains(key, extras, ...)}" - "{get(extras, key)}" - "{files|json}" NcCs"||_||_||_||_||_dSr6)_gen_values_makemap_joinfmt_keytype)rgenvaluesmakemapjoinfmtkeytyperrrr>s  zhybrid.__init__cCst||||j}||jvSr6) unwrapastypervrsrrrrrs zhybrid.containscCs@t|jdsttdt||||j}|||j |S)Ngetnot a dictionary) r safehasattrrsrrErr|rv _wrapvaluegetrrrrr!szhybrid.getmembercCrHr6rIr"rrrr#"rLz hybrid.getmincCrHr6rMr"rrrr$%rLz hybrid.getmaxcCs*|js ttd||j}|||SNsempty sequence)rsrrErr)rrrrPvalrrrrJ(s  z hybrid._getbycCs,|durdSt|dr|Std|||jS)Ns_makemap)r r hybriditemrt)rr rrrrr.s  zhybrid._wrapvaluecsXtjdrfddtjD}n fddjD}td|jjjS)Nr}cs&i|]\}}||r||qSrr.0kvr&rrr 8s z!hybrid.filter..cs g|] }||r|qSrr)rrrrr >s z!hybrid.filter..) r rrsr iteritemsrqrtrurv)rrrr&rxrrrr'6s   z hybrid.filterccs"|j}|jD]}||VqdSr6)rtrs)rrryxrrrr)As   zhybrid.itermapscstfddjD|S)Nc3s|]}|VqdSr6)rurrrrr Hszhybrid.join..)rRrsr*rrrr,Fsz hybrid.joincCs.|j}|dur|||dSt|r|S|SN )rrr,callablerrrrwrrrr-Js z hybrid.showcCrVr6)rWrsr"rrrr.Sr?z hybrid.toboolcs@|j}t|drfddt|DSfdd|DS)Nr}csi|] \}}|t|qSr unwrapvaluerrrrrrZs z"hybrid.tovalue..cg|]}t|qSrrrrrrr^z"hybrid.tovalue..)rsr rrr)rrrxsrrrr/Vs   zhybrid.tovaluer6)rrrr0r>rr!r#r$rJrr'r)r,r-r.r/rrrrrqs   rqc@rX)rzWrapper for non-list/dict object to support map operation This class allows us to handle both: - "{manifest}" - "{manifest % '{rev}:{node}'}" - "{manifest.rev}" cCs||_||_||_||_dSr6)rr_keyr;rt)rrwr r=ryrrrr>js zhybriditem.__init__cCs ||jSr6)rtrr(rrrr7prozhybriditem.tomapcCt|||j}||||Sr6) makewrappedr;r)rrrrwrrrrszhybriditem.containscCrr6)rr;r!)rrrr rrrrr!wrzhybriditem.getmembercCt|||j}|||Sr6)rr;r#rrrrrrrr#{ zhybriditem.getmincCrr6)rr;r$rrrrr$rzhybriditem.getmaxcCrr6)rr;r')rrrr&rrrrr'rzhybriditem.filtercCrr6)rr;r,)rrrr+rrrrr,rzhybriditem.joincCs,|j}|dur t|jSt|r|S|Sr6)rrrrFr;rrrrrr-s  zhybriditem.showcCrr6)rr;r.rrrrr.rzhybriditem.toboolcCst|||jSr6)_unthunkr;r"rrrr/rLzhybriditem.tovalueN)rrrr0r>r7rr!r#r$r'r,r-r.r/rrrrras rc@rp)revslistaZWrapper for a smartset (a list/set of revision numbers) If name specified, the revs will be rendered with the old-style list template of the given name by default. The cachekey provides a hint to cache further computation on this smartset. If the underlying smartset is dynamically created, the cachekey should be None. NcCs,t|tjsJ||_||_||_||_dSr6)r`rabstractsmartset_repo_revs_namecachekey)rreporevsnamerrrrr>s  zrevslist.__init__cCst|||}||jvSr6) unwrapintegerr)rrrrrevrrrrrAzrevslist.containscCriNr~rkrrrrr!rLzrevslist.getmembercC|}||jSr6)_makehybriditemfuncrrKrrrmakehybriditemrrrr#zrevslist.getmincCrr6)rrrNrrrrr$rzrevslist.getmaxcs.||jfdd}t|j|ddS)Ncs |Sr6rrrr&rr z!revslist.filter..r)rrr'rr)rrrr&frevsrrrr'szrevslist.filterccs$|}|jD]}||VqdSr6) _makemapfuncr)rrryrrrrr)s   zrevslist.itermapscs|fddS)Ncstd||Sr6)rrryrrrsz.revslist._makehybriditemfunc..)rrrrrrs zrevslist._makehybriditemfunccs*|j|jrfddSfddS)Ncs|d|iSNsctxrrrrrrrz'revslist._makemapfunc..cs d|iSrrr)rrrrr)rrrrrrrs  zrevslist._makemapfunccCs t|j|Sr6)rRrr*rrrr,roz revslist.joincCs4|jrdd|jD}t|||j|S|||dS)NcSsg|]}d|qS)s%dr)rrrrrrsz!revslist.show..r)rr_showcompatlistr,)rrrsrevsrrrr-sz revslist.showcCrVr6)rWrr"rrrr.r?zrevslist.toboolcCrTr6)rr"rrrr/rUzrevslist.tovalueNN)rrrr0r>rr!r#r$r'r)rrr,r-r.r/rrrrrs  rc@sZeZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ dS)_mappingsequencezWrapper for sequence of template mappings This represents an inner template structure (i.e. a list of dicts), which can also be rendered by the specified named/literal template. Template mappings may be nested. Nr_cCs0|dur |dur td||_||_||_dS)Ns$name and tmpl are mutually exclusive)rProgrammingErrorr_tmpl _defaultsep)rrtmplr+rrrr>s z_mappingsequence.__init__cCriNsnot comparablerkrrrrrrLz_mappingsequence.containscCrirrkrrrrr!rLz_mappingsequence.getmembercCrirrkr"rrrr#rLz_mappingsequence.getmincCrirrkr"rrrr$rLz_mappingsequence.getmaxcCri)Nsnot filterable without templaterkr%rrrr'sz_mappingsequence.filtercsbt|}jrfdd|D}njr%fdd|D}nttdt||S)Nc3|] }j|VqdSr6)processrrmrrrrr z(_mappingsequence.join..c3rr6)expandrrrrrr rs not displayable without template)_iteroverlaymapsr)rrrrErrR)rrrr+mapsiteritemiterrrrr,s z_mappingsequence.joincCs||||jSr6)r,rr"rrrr-z_mappingsequence.showcsNg}|D]}|||fddt|Dq |S)Ncs&i|]\}}|vr|t|qSrrrrknownreslmrrrs  z,_mappingsequence.tovalue..)knownresourcekeysr) overlaymapappendrr)rrritemsnmrrrr/s z_mappingsequence.tovalueNNr_) rrrr0r>rr!r#r$r'r,r-r/rrrrrs   rcs2eZdZdZd fdd ZddZd d ZZS) mappinggeneratorzWrapper for generator of template mappings The function ``make(context, *args)`` should return a generator of mapping dicts. rNr_cs$tt||||||_||_dSr6)superrr>_make_args)rmakeargsrrr+ __class__rrr>+s zmappinggenerator.__init__cC|j|g|jRSr6rrr(rrrr)0r]zmappinggenerator.itermapscCt||Sr6) _nonemptyr)r"rrrr.3rLzmappinggenerator.tobool)rNNr_rrrr0r>r)r. __classcell__rrrrr$s rcs2eZdZdZd fdd ZddZdd ZZS) mappinglistz%Wrapper for list of template mappingsNr_cstt||||||_dSr6)rrr> _mappings)rmappingsrrr+rrrr>:s zmappinglist.__init__cCrVr6)iterrr(rrrr)>r?zmappinglist.itermapscCrVr6)rWrr"rrrr.Ar?zmappinglist.toboolrrrrrrr7s rcs>eZdZdZd fdd ZddZddZfd d ZZS) mappingdictzWrapper for a single template mapping This isn't a sequence in a way that the underlying dict won't be iterated as a dict, but shares most of the _mappingsequence functions. Ncstt|||||_dSr6)rrr>_mapping)rrrrrrrr>Ls zmappingdict.__init__cCrTr6)rr(rrrr7PrUzmappingdict.tomapcCrrmrr"rrrr.Sszmappingdict.toboolcstt|||dS)Nr)rrr/r"rrrr/Yszmappingdict.tovaluer) rrrr0r>r7r.r/rrrrrrEs rcs(eZdZdZfddZddZZS) mappingnonezWrapper for None, but supports map operation This represents None of Optional[mappable]. It's similar to mapplinglist([]), but the underlying value is not [], but None. cstt|ddSr6)rrr>rrrrr>dr]zmappingnone.__init__cCstgSr6)rr(rrrr)gzmappingnone.itermaps)rrrr0r>r)rrrrrr]s rc@seZdZdZd ddZddZddZd d Zd d Zd dZ ddZ e ddZ ddZ ddZddZddZddZddZdS)!mappedgeneratoraWrapper for generator of strings which acts as a list The function ``make(context, *args)`` should return a generator of byte strings, or a generator of (possibly nested) generators of byte strings (i.e. a generator for a list of byte strings.) rcCs||_||_dSr6r)rrrrrrr>ss zmappedgenerator.__init__cCst|||}||||vSr6)r@r/rrrrrws zmappedgenerator.containscCrr6rr(rrrrr{r]zmappedgenerator._gencCrirrkrrrrr!~rLzmappedgenerator.getmembercCrHr6rIr"rrrr#rLzmappedgenerator.getmincCrHr6rMr"rrrr$rLzmappedgenerator.getmaxcCs&|||}|sttd||Sr)r/rrEr)rrrrPrrrrrJs zmappedgenerator._getbyccs:||g|RD]}t|||}|t|r|Vq dSr6)r@r8)rrrrr&rsrrr _filteredgens  zmappedgenerator._filteredgencCs||j|j|f}t|j|Sr6)rrrr)rrrr&rrrrr's zmappedgenerator.filtercCri)Nslist of strings is not mappablerkr(rrrr)rLzmappedgenerator.itermapscCst|||Sr6)rRrrr*rrrr,rzmappedgenerator.joincCs|||dSr^)r,r"rrrr-rLzmappedgenerator.showcCrr6)rrrr"rrrr.rLzmappedgenerator.toboolcsfdd|DS)Ncrr)r@rrrrrrz+mappedgenerator.tovalue..)rrr"rrrr/szmappedgenerator.tovalueN)r)rrrr0r>rrrr!r#r$rJ staticmethodrr'r)r,r-r.r/rrrrrks"   rkeyvaluecs>tjdur dtjt|fddfddS)z>Wrap data to support both dict-like and string-like operationsNs%s=%scs||iSr6rr)datar r=rrrrzhybriddict..cs||fSr6rr)rfmtprefmtrrrrridentityrFrq)rr r=rrwr)rrr rr=r hybriddictsrcs8tjdur dtjt||fddfddS)z>Wrap data to support both list-like and string-like operationsNs%scs|iSr6rrrrrrszhybridlist..cs |Sr6rr)rrrrrrr)rrrrwr)rrrr hybridlists  rrc s>fddt|D} t|||| ||} t||| dS)zWrap data like hybriddict(), but also supports old-style list template This exists for backward compatibility with the old-style template. Use hybriddict() for new template keywords. csg|] \}}||iqSrrrr r=rrrszcompatdict..)r r=rrw)rrrr) rrrrr r=rplural separatorcfrrr compatdictsr c Cs&t||||||}t||p|||dS)zWrap data like hybridlist(), but also supports old-style list template This exists for backward compatibility with the old-style template. Use hybridlist() for new template keywords. )rrrw)rr) rrrrelementrrrrrrr compatlistsr csHddD}t||||dd}tt|fddfddS)zWrap list of (dest, source) file names to support old-style list template and field names This exists for backward compatibility. Use hybriddict for new template keywords. cSsg|] \}}||dqS))namesourcerrrrrrsz(compatfilecopiesdict..s file_copies)rcs|||dS)N)r pathr rrcopiesrrrrz&compatfilecopiesdict..csd||fS)Ns%s (%s)rrrrrrr)rr sortdictrq)rrrrrrrrrcompatfilecopiesdicts   rcCs"t||||}t||ddtjS)zWrap list of file names to support old-style list template and field names This exists for backward compatibility. Use hybridlist for new template keywords. cSs ||dS)N)sfilerrrrrrrs z!compatfileslist..)rrqrr)rrrfilesrrrrcompatfileslistsrc#s*|sd}|sd|}|r|VdSsBt|dtr/||VdS|D]}t|}||Vq1dSd|} | rR| Vffdd } d} | rj|} nd} |D]}| |Vqn| dur| | | d Vd |} | r| VdSdS) aNReturn a generator that renders old-style list template name is name of key in template map. values is list of strings or dicts. plural is plural of name, if not simply name + 's'. separator is used to join values as a string expansion works like this, given name 'foo'. if values is empty, expand 'no_foos'. if 'foo' not in template map, return values as a string, joined by 'separator'. expand 'start_foos'. for each value, expand 'foo'. if 'last_foo' in template map, expand it instead of 'foo' for last key. expand 'end_foos'. ssno_Nrsstart_c s~i}z||Wn)tttfy2z |D]\}}|||<qWnttfy/||<YnwYnw|}||Sr6)updateAttributeError TypeError ValueErrorrr)rtagvmappingabrrrrrone3s     z_showcompatlist..oneslast_)rsend_)preloadrr`bytesr,dictrpop)rrrrxrrnonamerr startnamerlastnamelastendnamerrrrsB         rccst|tr |||}t|tr|VdSt|tr"td||dur(dSt|ds6t |VdS|D]4}t|trE|||}t|trN|Vq8|durSq8t|ds`t |Vq8t |||D]}|Vqfq8dS)z=Yield a single stream from a possibly nested set of iteratorssHMercurial IO including templates is done with bytes, not strings, got %rNs__iter__) r`rr-r!strrrr rrrFflatten)rrthingijrrrr*Rs8          r*cCs t|tr|Sdt|||S)zETurn values into bytes by converting into text and concatenating themr_)r`r!r,r*rrr+rrrr@rs r@cCs. |\}}|tur |S|tur|d}ndSq)z`Find symbolic name for the given compiled expression; returns None if nothing found reliablyTrN) runsymbol runfilter)argrPrrrrfindsymbolicnameys r2cCs$zt|WdStyYdSw)NTF)next StopIteration)xiterrrrrs  rcCst|tjs|St|||S)z&Evaluate a lazy byte string into value)r`types GeneratorTyper@r.rrrrs  rcCs|\}}||||S)zEvaluate given argument as a bare template object which may require further processing (such as folding generator of strings)r)rrr1rPrrrr evalrawexps r8cCst|||}t|||S)z)Evaluate given argument to wrapped object)r8r)rrr1r+rrr evalwrappeds  r9cCs4t|tr|St|||}t|trt|St|S)zLift object to a wrapped type)r`rrr!r8rYr.rrrrs   rcCt||t|||S)z%Evaluate given argument as value type)rr8rrr1rrr evalfuncargsr<cCs"t|tr |||St|||S)z.Move the inner value object out of the wrapper)r`rr/rr.rrrrs   rcCsT|\}}|tur||||dd}|durt|}n||||}t|||||S)zCEvaluate given argument as boolean, but also takes boolean literalsNdefault)r/r parseboolrr.rrr1rPrr+rrr evalbooleans  rAcCt|||}t||||S)z`Evaluate given argument as a date tuple or a date string; returns a (unixtime, offset) tuple)r8 unwrapdaterrr1errr+rrrevaldates rFcCsnt|tr |||St|||}zt|WSty't|p%t dtjy6|s1t|w)Nsnot a date tuple nor a string) r`rar/rr parsedaterrrErrrr+rErrrrCs      rCcCrBr6)r8rrDrrr evalintegers rIc Cs<t|||}zt|WSttfyt|ptdw)Nsnot an integer)rrdrrrrErrHrrrrs  rcCr:r6)r@r8r;rrr evalstringr]rJcCs:|\}}|tur|||||d}n||||}t|||S)zXEvaluate given argument as string template, but returns symbol name if it is unknownr=)r/r@r@rrrevalstringliterals   rKcCs6zt|}Wntytd|w||||S)zBMove the inner value object out of the wrapper and coerce its typesinvalid type specified: %r)_unwrapfuncbytypeKeyErrorrr)rrr+typrrrrr|s    r|cCst|Sr6)rdrrrrrr runinteger rrPcCs|Sr6rrOrrr runstringrnrQcsfdd}|S)Ncsttd)Ns$recursive reference '%s' in template)rAbortrrr rr showrecursionrSz._recursivesymbolblocker..showrecursionr)r rTrrSr_recursivesymbolblockers rUr_cCs~|||}|dur(|}t|||<z|||}Wn ty'|}Ynwt|r=z|||WSty<YdSw|Sr6)symbolcopyrUrrrr )rrr r>r safemappingrrrr/s     r/ccs|D] }t|||VqdSr6)r8)rrtemplater1rrr runtemplate.srZc Csl|\}}t|||}t|dd}z t||||}||WStjy5}z tjt|t||dd}~ww)N_intypehint)r8rr|rrEr!_formatfiltererror)rrrr1filtr+intypeerrrr03s   r0cCs4t|j}t|}|std|Std||fS)Ns(incompatible use of template filter '%s's8template filter '%s' is not compatible with keyword '%s')rsysbytesrr2r)r1r_fnsymrrrr^>s  r^ccs2t|D]\}}|||}||d<|VqdS)zuGenerate combined mappings from the original mapping and an iterable of partial mappings to override the originalsindexN) enumerater)r origmapping newmappingsr,rrrrrrIs  rc cs|z||}Wn#tjy+}zt|}|std|}tjt||dd}~wwt|||D] } t|| |Vq2dS)Ns+keyword '%s' does not support map operationr\)r)rrEr2rr!rr8) rrddargtargditerrErdr]rrrr _applymapRs rlcCs(|\}}t|||}tt||||fdS)N)r)r9rrl)rrrrirjrhrrrrunmap_s rmc Cs|\}}t|||}t|tr||||}t|||Sz||||WStjyI}zt |}|s6t d|} tjt || dd}~ww)Ns.keyword '%s' does not support member operationr\) r9r`r5rr7r/r!rrEr2rr!) rrrrimembrhrrErdr]rrr runmemberes    rocCst|||td}| S)Ns"negation needs an integer argument)rIrrOrrr runnegateus rpcCsX|\}}}t|||td}t|||td}z|||WSty+ttdw)Ns#arithmetic only defined on integerssdivision by zero is not defined)rIrZeroDivisionErrorrrR)rrrrPleftrightrrr runarithmetic|s     rtccs.d}|D]}|r d}n|r|V|VqdS)z9Join items with the separator; Returns generator of bytesTFNr)rr+firstrrrrrRsrR)rrNNr)rrNNr)NNNrrr6)r_)K __future__rr1r6i18nrrrrrr utilsr r rRr robjectrr5r8rYrarqrrrrrrrrrrr r rrrr*r@r2rrr8r9rr<rrArFrCrIrrJrKr!rdrLr|rPrQrUr/rZr0r^rrlrmrorprtrRrrrrs   M 1.(];I? =    K