-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/templater.pyc


l\c@sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZi	ddYdZfd6d	dd[fd6ddd\fd
6ddd]fd6d^d6dd_dfd6dd`dfd6ddadfd6dbd6ZdZddZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Z d'Z!d(Z"d)Z#d*Z$d+Z%d,Z&d-Z'd.Z(d/Z)d0Z*d1Z+d2Z,d3Z-d4Z.d5Z/id6d6d7d6d8d6d9d6ed
6ed6ed6Z0ied:6e d;6e"d<6e$d=6e%d>6e&d?6e'd@6e(dA6e!dB6e)dC6e*dD6e+dE6e.dF6e,dG6e-dH6e/dI6Z1dJdKdLgZ2ej3Z3dMZ4e5dNZ6dOe7fdPYZ8ie8dQ6Z9dRZ:dSej;fdTYZ<dUe7fdVYZ=ddWZ>ddXZ?dS(ci(t_Nitgroupit)tfunct(itlistt,it|it%itsymboltstringt	rawstringtendc
csU|\}}}|}x+||krB||}|jr=n|dkrZ|d|fVn|dks|dkrp|||d!dkrp|dkr|d7}||}t}nt}|d7}|}xj||krT||}|r|dkr|d7}qn||krG|s.d	|||!|fVPnd
|||!|fVPn|d7}qWtjtd|n|js|dkr|}|d7}x@||kr||}|jp|dksPn|d7}qW|||!}	d
|	|fV|d8}n2|dkr|d7}Pntjtd||d7}qWdd|fVdS(Ns(,)%|s"'trisr'sr"is\RR
sunterminated stringRR	t}ssyntax errorR(sr'sr"(tisspacetNonetFalsetTrueterrort
ParseErrorRtisalnum(
tdatatprogramtstartRtpostctdecodetstdtsym((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt	tokenizers^


	







cCsGg}dt|}}tjtt}x||kr&|jd|}|dkrs|j|||fPn|dkr||ddkr|j||||d!df|d}q.n||kr|j||||!fn||d|g}|j|\}	}|j|	q.Wg|D]}
t|
|^q.S(Nit{is\(tlentparserRtelementstfindtappendtparset
compileexp(ttmpltcontexttstrtokentparsedRtstoptptntpdtparsereste((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytcompiletemplatePs$ "
cCsD|d}|tkr't|||Stjtd|dS(Nisunknown method '%s'(tmethodsRRR(texpR)tt((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyR'gs
cCs9|ddkr|dStjtd|ddS(NiR	isexpected a symbol, got '%s'(RRR(R4((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt	getsymboloscCs:|s
gS|ddkr3t|d|dgS|gS(NiRii(tgetlist(tx((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyR7ts
cCsBt|}||jkr7tjtd|n|j|S(Nsunknown function '%s'(R6t_filtersRRR(R4R)tf((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt	getfilter{scCsu|ddks |ddkr;t|d|d|dS|ddkr\|j|dStjtddS(NiR
RiR*R	sexpected template specifier(R2t_loadRRR(R4R)((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytgettemplates
 cCs
|jdS(Ns
string-escape(R(R)tmappingR((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt	runstringscCs|S(N((R)R>R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytrunrawstringscCs|j|}|dkr0|jj|}n|dkroy|j||}Wqotk
rkd}qoXnt|r||St|tjrt	|}|||<|S|S(Nt(
tgetRt	_defaultstprocesstTemplateNotFoundtcallablet
isinstancettypest
GeneratorTypeR(R)R>tkeytv((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt	runsymbols



cCs?t|d|\}}t|d|}t|||ffS(Nii(R'R;t	runfilter(R4R)RRtfilt((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytbuildfilterscCs|\}}}y|||||SWn^tttfk
rt|tr^|d}n|}tjtd|j|fnXdS(Nis8template filter '%s' is not compatible with keyword '%s'(	t
ValueErrortAttributeErrort	TypeErrorRGttupletutiltAbortRt	func_name(R)R>RRRNtdt((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRMs
cCs?t|d|\}}t|d|}t|||ffS(Nii(R'R=trunmap(R4R)RRtctmpl((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytbuildmapsccs,x%|D]\}}||||VqWdS(N((R)R>ttemplateRR((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytruntemplatesccs|\}}}||||}t|r9|}n|j}xV|D]N}t|tr|j||jd|d<t|||VqL|VqLWdS(Ntnodetoriginalnode(RFtcopyRGtdicttupdateRBR\(R)R>RRRYRtlmti((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRXs

cCst|d}gt|dD]}t||^q!}|tkr\t|}||fS||jkrt|dkrtjtd|n|j|}t	|dd|dd|ffStjtd|dS(Niisfilter %s expects one argumentisunknown function '%s'(
R6R7R'tfuncsR9R!RRRRM(R4R)R.R8targsR:((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt	buildfuncs,


#cCsdt|kodkns:tjtdn|dd|||dd}t|dkrt|dd|||dd}tj||Stj|S(Niis!date expects one or two argumentsi(R!RRRt	stringifyRTtdatestr(R)R>Retdatetfmt((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRis""(cCsZdt|kodkns:tjtdnt|dd|||dd}d}d}d}dt|kodknrDy2tt|dd|||dd}Wn&tk
rtjtdnXy<tt|d||}tt|d	||}WqDtk
r@qDXnt	j
||||S(
Niis"fill expects one to four argumentsiiLRAisfill expects an integer widthi(R!RRRRgtintRPt_evalifliteralt
IndexErrorttemplatefilterstfill(R)R>Rettexttwidtht
initindentt
hangindent((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRos""("2
 
cCsMdt|kodkns:tjtdnt|dd}t|dd|||dd}|ddtkrtt||t||}nt	}d}t|dkrt|dd|||dd}nt|dkr#t
j|dd}n|r9|j||S|j
||SdS(	s7usage: pad(text, width, fillchar=' ', right=False)
    iis#pad() expects two to four argumentsiit iN(R!RRRRkRgR?R\R2RRTt	parsebooltrjusttljust(R)R>ReRqRptrighttfillchar((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytpads "(+ccst|dkr*tjtdn|dd|||dd}tj|dsvtjtdn|dd|||dd}|j|VdS(Nisget() expects two argumentsiiRBs&get() expects a dict as first argument(R!RRRRTtsafehasattrRB(R)R>RetdictargRJ((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRBs""ccslt|d|||d}|dtks@|dtkrct||t||ddVn|VdS(NiiR*R(RgR?R@R\R2(targR)R>R5((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRls
  	ccsdt|kodkns:tjtdnt|dd|||dd}|rt|d||Vn*t|dkrt|d||VndS(Niis!if expects two or three argumentsii(R!RRRRgRl(R)R>Rettest((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytif_&s"(ccsdt|kodkns:tjtdnt|dd|||dd}|dd|||dd}|g|D]}|jd^qkrt|d||Vn*t|dkrt|d||VndS(Niis*ifcontains expects three or four argumentsiii(R!RRRRgtvaluesRl(R)R>RetitemtitemsRc((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt
ifcontains1s"(",ccsdt|kodkns:tjtdnt|dd|||dd}t|dd|||dd}||krt|d||Vn*t|dkrt|d||VndS(Niis$ifeq expects three or four argumentsiii(R!RRRRgRl(R)R>ReR~tmatch((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytifeq@s"((ccs
dt|kodkns:tjtdn|dd|||dd}t|r|j}g|D]}||^q{}nd}t|dkrt|dd|||dd}nt}x'|D]}|rt}n|V|VqWdS(Niis!join expects one or two argumentsiRt(	R!RRRRFtjoinfmtRgRR(R)R>RetjoinsettjfR8tjoinertfirst((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytjoinLs""	%+
	ccsCt|dkr*tjtdnt|d||VdS(Nislabel expects two argumentsi(R!RRRRl(R)R>Re((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytlabelbscCsNt|dks*tjtdn|dd}|d}|j}t|dkrtg|dD] }|d|||d^qk}|j||}tg|D]}	t|	^q}nm|djdi}
||
kr|
|}n>|j|}tg|D]}	t|	^q}||
|<t	j
d||S(s*usage: revset(query[, formatargs...])
    is$revset expects one or more argumentsitctxtcachetrevsetcachetrevision(R!RRRt_repoRtrevststrt
setdefaultt
templatekwtshowlist(R)R>RetrawRtrepotat
formatargsRR
R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytrevsetjs 
	7(
%
cCst|dkr*tjtdnt|dd|||dd}t|dd|||dd}tj|d|ddgS(Nisrstdoc expects two argumentsiitstyletkeeptverbose(R!RRRRgtminirsttformat(R)R>ReRpR((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytrstdocs
((c
sAdt|kodkns:tjtdnt|dd|||dd}d}t|dkrt|dd}n|djjfd}|}td|}|}xot	r<|| }	||	r|	}||ks||kr|S|d8}q|d7}t||kr|SqWd	S(
s'usage: shortest(node, minlength=4)
    iis'shortest() expects one or two argumentsiiRcsyyjj|Wn*tk
rCj|dkrDtSnXy:t|}|ddksu|tkrytStSWnt	k
rtSXWnt
jk
rtSXdS(Nit0(tindextpartialmatchRQt
_partialmatchRRRkR!RRPRtRevlogError(R~Rc(tcl(s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytisvalids
"
	iN(
R!RRRRgRkRt	changelogtmaxR(
R)R>ReR]t	minlengthRtshortesttstartlengthtlengthR~((Rs7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRs*"(	


cCsdt|kodkns:tjtdnt|dd|||dd}t|dkrt|dd|||dd}|j|S|jS(Niis"strip expects one or two argumentsi(R!RRRRgtstrip(R)R>ReRptchars((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRs"((
ccst|dkr*tjtdnt|dd|||dd}t|dd|||dd}tt|d||}tj|||VdS(Nissub expects three argumentsiii(R!RRRRgRltretsub(R)R>Retpattrpltsrc((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRs((cCst|dkr*tjtdnt|dd|||dd}t|dd|||dd}|j|r|SdS(Nis startswith expects two argumentsiiRA(R!RRRRgt
startswith(R)R>RetpatnRp((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRs((cCsdt|kodknsDtjtdt|ntt|dd|||dd}t|dd|||dd}t|dkrt|dd|||dd}nd}|j|}|t|krdS||SdS(sreturn nth word from a stringiis+word expects two or three arguments, got %diiRAN(R!RRRRkRgRtsplit(R)R>RetnumRptsplitterttokens((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytwords".(+cCst|dfS(Ni(R?(R1R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt<lambda>scCst|dfS(Ni(R@(R1R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRscCst|dfS(Ni(RL(R1R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRscCst|d|S(Ni(R'(R1R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRsRiRoRBtifRRRRRzRRRRRRRt	templatess../templatess/usr/share/mercurial/templatesccst|tr|Vntj|dsF|dk	rt|Vqnx|D]w}t|trj|VqMtj|ds|dk	rt|VqqM|dk	rMxt|D]}|VqWqMqMWdS(s=yield a single stream from a possibly nested set of iteratorst__iter__N(RGRRTR{Rt_flatten(tthingRctj((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRs
cCsb|rUt|dks,|d|dkrAttdn|dd!jdS|jdS(sZparse a string using simple c-like syntax.
    string must be in quotes if quoted is True.iiisunmatched quotesit
string_escape(R!tSyntaxErrorRR(Rtquoted((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytparsestring*s
&tenginecBs/eZdZiidZdZdZRS(stemplate expansion engine.

    template expansion works like this. a map file contains key=value
    pairs. if value is quoted, it is treated as string. otherwise, it
    is treated as name of template file.

    templater is asked to expand a key in map. it looks up key, and
    looks for strings like this: {foo}. it expands {foo} by looking up
    foo in map, and substituting it. expansion is recursive: it stops
    when there is no more {foo} to replace.

    expansion also allows formatting and filtering.

    format uses key to expand each item in list. syntax is
    {key%format}.

    filter uses function to transform value. syntax is
    {key|filter1|filter2|...}.cCs(||_||_||_i|_dS(N(t_loaderR9RCt_cache(tselftloadertfilterstdefaults((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt__init__Hs			cCs<||jkr1t|j|||j|<n|j|S(s!load, parse, and cache a template(RR2R(RR5((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyR<Ns"cCstt|||j|S(sPerform expansion. t is name of map element to expand.
        mapping contains added elements for use during expansion. Is a
        generator.(RR\R<(RR5R>((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRDTs(t__name__t
__module__t__doc__RR<RD(((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyR4s	tdefaultcCst}|stdStj|d}g}xA|D]9}|jd}|ddkr9|j|dq9q9Wdjt|S(Ns7no templates found, try `hg debuginstall` for more infoit.smap-cmdlineis, (ttemplatepathRtostlistdirRR%Rtsorted(tpathstdirlistt	stylelisttfileR((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyR\s	

REcBseZRS((RR(((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyREhst	templatercBs;eZiiidddZdZdZdZRS(iicCs|p	d|_|j|_i|_|r?tjj|pBd|_tj	j|_	|j	j
|||_|||_|_
i|_|sdStjj|stjtd|dtdtntj}|j|x|djD]\}}	|	s;ttd|jd|n|	dd	kryt|	|j|<Wqtk
r}
td
|jd||
jdfqXqd|	f}	d|	d
kr|	d
jdd
}	n|	dtjj|j|	d
f|j|<qWdS(sset up template engine.
        mapfile is name of file to read map definitions from.
        filters is dict of functions. each transforms a value into another.
        defaults is dict of default map definitions.R[RANsstyle '%s' not foundthintsavailable styles: %ss%s: missing valueis'"s%s: %sRt:i(tmapfileR_RtmapRtpathtdirnametbaseRnRRaRtminchunktmaxchunktecachetexistsRTRURRtconfigtreadRRtsourceRReRR(RRRRRRRtconfRJtvaltinst((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRms:	!		
%*cCs||jkp||jkS(N(RR(RRJ((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt__contains__scCs||jkry%tj|j|d|j|<Wqtk
rf}ttd|jdqtk
r}t|jdtd|j|d|jdfqXn|j|S(s@Get the template for the given template name. Use a local cache.is"%s" not in template mapistemplate file %s: %s(	RRTtreadfileRtKeyErrorRERRetIOError(RR5R((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytloads%)cKs||jkr |j|dp#d}||jkr^t||j|j|j|j|<n|j|}|j||}|jrtj	|d|jd|j
}n|S(NiRtminR(RRtenginesRRRRDRRTtincreasingchunksR(RR5R>tttypetproctstream((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt__call__s&

	(RRRRRR(((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRks
	'		
cCsg}tjrtj}nt}xtD]}|jdrI|}n0|jd}tjj	tjj
||}|rtjj	||}n|rtjj|rtjj|Stjj
|r+|jtjj|q+q+W|S(sZreturn location of template file or directory (if no name).
    returns None if not found.t/(RTt
mainfrozentsyst
executablet__file__RRRRRRRtnormpathtisdirR%(tnamet	normpathstmoduleR:R-tfl((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyRs 
	! cCs|dkrt}nt|tr3|g}nt|trN|g}nx|D]}|sgqUntjj|dd|g}|jdxP|D]H}x?|D]7}tjj||}tjj|r||fSqWqWqUWt	d|dS(sReturn path to mapfile for a given style.

    Searches mapfile in the following locations:
    1. templatepath/style/map
    2. templatepath/map-style
    3. templatepath/map
    Rsmap-sNo hgweb templates found in %rN(
RRRGRRRRR%tisfiletRuntimeError(tstylesRRt	locationsRtlocationR((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pytstylemaps"	



(sgroupiR(sfunciR(slisti(Ri(Ri(iNN(ssymbol(sstring(s	rawstring(iNN(@ti18nRRRRRTRRnRR"RRHRRR#RR2R'R6R7R;R=R?R@RLRORMRZR\RXRfRiRoRzRBRlRRRRRRRRRRRRR3RdRRgRRRtobjectRRRRURERRR(((s7/usr/lib/python2.7/dist-packages/mercurial/templater.pyt<module>s$H
	4														
	
			
								
	3	
	
		





		
&
	G

Copyright © 2017 || Recoded By Mr.Bumblebee