\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sdZddlmZddlZddlZddlZddlZddlZddlZej ddkZ dej kZ e sddl Z ddlZddlZddlZddlZddlZddlmZdZniddljZddljZ ddljZddlZddlZddlZddljZd Zd Zd Z d Z!e r*ddl"Z"ddl#Z#ddl$Z$ddl%Z%ej&Z&ej'Z'ej(j)d Z*ej+j)d Z,ej-j)d Z.ej/j)d Z0ej1j)d Z2ej3j)d Z4ej5Z6e6rCe6j)d Z6nej7j)d Z8ej9Z:e:rvej&e:Z:ne$j;Z<e<Z=dZ>dZ?dZ@eAZBejCZDeEZFejGjHZGejIjHZIejJjHZJeKedddk reMeNej&ejOZPne%jQdjRZSdjTZUdeVfdYZWdZXdZYdZZdZ[dZ\dZ]dZ^dZ_dZ`e`e"jaZae`e"jKZKe`e"jbZbe`e"jcZce"jdZeefZgdd dd!Zhe`e"jbZid"Zjd#Zkd$Zlemend%ZondddlpZpeeZeegZgeqZSerZUefZWesZXeZYeZZeZ[eZ\eZ]d&dUd'Z&eZ'd(Z_etZud)Zid*ZjeZkeZlej(Z*ej+Z,ej-Z.ej/Z0ej1Z2ej3Z4ej5Z6eFZFejGZGejIZIejJZJeKedddk rCejOZPnej7Z8ej9Z:ejvZoepjwZ<e<Z=eNZ>edZ?exZ@eyZBejDZDe8jzd+Z{e8d,kZ|e.d-kZ}e.d.kZ~d/Zd0Zd1d2dd3Zd1d2dd4Zd5d d1d2dend6ZdS(7swMercurial portability shim for python 3. This contains aliases to hide python version-specific details from the core. i(tabsolute_importNit__pypy__i(tfuturescC@s|j|dS(N(tset_exception_info(tftexc_info((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytfuture_set_exception_info!scC@s|j|ddS(Ni(t set_exception(RR((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR,scC@s|S(N((ta((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytidentity/sc@s|dkr|St|tttfrHt|fd|DSt|tr}t|fd|jDS|S(Nc3@s|]}t|VqdS(N(t_rapply(t.0tx(R(s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pys 7sc3@s3|])\}}t|t|fVqdS(N(R (R tktv(R(s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pys 9s(tNonet isinstancetlisttsetttuplettypetdicttitems(Rtxs((Rs8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR 2s  &cC@s|tkr|St||S(sApply function recursively to every item preserving the data structure >>> def f(x): ... return 'f(%s)' % x >>> rapply(f, None) is None True >>> rapply(f, 'a') 'f(a)' >>> rapply(f, {'a'}) == {'f(a)'} True >>> rapply(f, ['a', 'b', None, {'c': 'd'}, []]) ['f(a)', 'f(b)', None, {'f(c)': 'f(d)'}, []] >>> xs = [object()] >>> rapply(identity, xs) is xs True (R R (RR((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytrapply<s tasciicG@stt|S(N(Rtmap(targs((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytmaplistmscG@stt|S(N(Rtrange(R((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt rangelistpscG@stt|S(N(Rtzip(R((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytziplistsstargvs>Bs%rtbytestrcB@s5eZdZddZdZdZdZRS(sA bytes which mostly acts as a Python 2 str >>> bytestr(), bytestr(bytearray(b'foo')), bytestr(u'ascii'), bytestr(1) ('', 'foo', 'ascii', '1') >>> s = bytestr(b'foo') >>> assert s is bytestr(s) __bytes__() should be called if provided: >>> class bytesable(object): ... def __bytes__(self): ... return b'bytes' >>> bytestr(bytesable()) 'bytes' There's no implicit conversion from non-ascii str as its encoding is unknown: >>> bytestr(chr(0x80)) # doctest: +ELLIPSIS Traceback (most recent call last): ... UnicodeEncodeError: ... Comparison between bytestr and bytes should work: >>> assert bytestr(b'foo') == b'foo' >>> assert b'foo' == bytestr(b'foo') >>> assert b'f' in bytestr(b'foo') >>> assert bytestr(b'f') in b'foo' Sliced elements should be bytes, not integer: >>> s[1], s[:2] (b'o', b'fo') >>> list(s), list(reversed(s)) ([b'f', b'o', b'o'], [b'o', b'o', b'f']) As bytestr type isn't propagated across operations, you need to cast bytes to bytestr explicitly: >>> s = bytestr(b'foo').upper() >>> t = bytestr(s) >>> s[0], t[0] (70, b'F') Be careful to not pass a bytestr object to a function which expects bytearray-like behavior. >>> t = bytes(t) # cast to bytes >>> assert type(t) is bytes tcC@sat|tr|St|ttf rQt|d rQt|jd}ntj||S(Nu __bytes__uascii(RR"tbytest bytearraythasattrtstrtencodet__new__(tclsts((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR)s cC@s4tj||}t|ts0t|}n|S(N(R$t __getitem__Rtbytechr(tselftkeyR+((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR,scC@sttj|S(N(t iterbytestrR$t__iter__(R.((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR1scC@stj|dS(Ni(R$t__repr__(R.((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR2s(t__name__t __module__t__doc__R)R,R1R2(((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR"s 3   cC@s tt|S(s4Iterate bytes as if it were a str object of Python 2(RR-(R+((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyR0scC@st|trt|S|S(sPromote bytes to bytestr(RR$R"(R+((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt maybebytestrs cC@s |jdS(sConvert an internal str (e.g. keyword, __doc__) back to bytes This never raises UnicodeEncodeError, but only ASCII characters can be round-trip by sysstr(sysbytes(s)). uutf-8(R((R+((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytsysbytesscC@s#t|tjr|S|jdS(s8Return a keyword str to be passed to Python functions such as getattr() and str.encode() This never raises UnicodeDecodeError. Non-ascii characters are considered invalid and mapped to arbitrary but unique code points such that 'sysstr(a) != sysstr(b)' for all 'a != b'. ulatin-1(RtbuiltinsR'tdecode(R+((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytsysstrscC@s t|tr|jdS|S(s Converts a bytes url back to struascii(RR$R9(turl((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytstrurls cC@s t|tr|jdS|S(s0Converts a str url to bytes by encoding in asciiuascii(RR'R((R;((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytbytesurls cC@s|j|dS(s(Raise exception with the given tracebackN(twith_traceback(texcttb((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt raisewithtbscC@s,t|dd}|dkr"|St|S(sTGet docstring as bytes; may be None so gettext() won't confuse it with _('')u__doc__N(tgetattrRR7(tobjtdoc((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytgetdocs c@s"tjfd}|S(Nc@s|t||S(N(R:(tobjecttnameR(R(s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytws(t functoolstwraps(RRH((Rs8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt _wrapattrfunc stricC@stj|t|||S(N(R8topenR:(RGtmodet bufferingtencoding((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyRMscC@sg|D]}|jd^q}|jd}g|D]}|jd^q8}||||\}}g|D],}|djd|djdf^qr}g|D]}|jd^q}||fS(s Takes bytes arguments, converts them to unicode, pass them to getopt.getopt(), convert the returned values back to bytes and then return them for Python 3 compatibility as getopt.getopt() don't accepts bytes on Python 3. slatin-1ii(R9R((torigRt shortlisttnamelistRtopts((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt_getoptbwrapper s""6"cC@s td|jD}|S(s Converts the keys of a python dictonary to str i.e. unicodes so that they can be passed as keyword arguments as dictonaries with bytes keys can't be passed as keyword arguments to functions on Python 3. cs@s*|] \}}|jd|fVqdS(slatin-1N(R9(R R R((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pys 6s(Rt iteritems(tdic((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt strkwargs0scC@s td|jD}|S(s Converts keys of python dictonaries to bytes as they were converted to str to pass that dictonary as a keyword argument on Python 3. cs@s*|] \}}|jd|fVqdS(slatin-1N(R((R R R((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pys >s(RRV(RW((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt byteskwargs9scC@s>tj|jd||}g|D]}|jd^q%S(s Takes bytes argument, convert it to str i.e. unicodes, pass that into shlex.split(), convert the returned value to bytes and return that for Python 3 compatibility as shelx.split() don't accept bytes on Python 3. slatin-1(tshlextsplitR9R((R+tcommentstposixtretR((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt shlexsplitBss2def raisewithtb(exc, tb): raise exc, None, tb cC@s0t|tr|Stdt|jdS(s Partial backport from os.py in Python 3, which only accepts bytes. In Python 2, our paths should only ever be bytes, a unicode path indicates a bug. sexpect str, not %sN(RR't TypeErrorRR3(tfilename((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytfsencode^scC@st|ddS(NR5(RBR(RC((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyREnscC@st||ttk S(N(RBt_notset(tthingtattr((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt safehasattrsscC@s||||S(N((RQRRRRS((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyRUvstjavatdarwinR]tntcC@sttj|||S(N(RUtgetopt(RRRRS((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pytgetoptbscC@sttj|||S(N(RURjt gnu_getopt(RRRRS((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt gnugetoptbsR#ttmpcC@stj|||S(N(ttempfiletmkdtemp(tsuffixtprefixtdir((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyRpscC@stj|||S(N(Rotmkstemp(RqRrRs((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyRtssw+bc C@sFt|}d|ksttj||d|d|d|d|S(NtbRqRrRstdelete(R:tAssertionErrorRotNamedTemporaryFile(RNtbufsizeRqRrRsRv((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt namedtempfiles (R5t __future__RRjtinspecttosRZtsysRot version_infotispy3tbuiltin_module_namestispypyt cookielibtcPickletpicklethttplibtQueuetqueuet SocketServert socketservert xmlrpclibtthirdparty.concurrentRRtconcurrent.futuresthttp.cookiejart cookiejart http.clienttclientt xmlrpc.clientR R RR8RItiotstructRbtfsdecodetcurdirR(toscurdirtlinesept oslinesepRGtosnametpathsept ospathseptpardirtospardirtseptosseptaltseptosaltseptplatformt sysplatformt executablet sysexecutabletBytesIOtbytesiotstringioRRR tinputtrawinputtgetfullargspect getargspectinttlongtstdintbuffertstdouttstderrRBRRRR!tsysargvtStructtpackR-t__mod__tbytereprR$R"R0R6R7R:R<R=RARERKtdelattrR&tsetattrRtxrangeR'tunicodeRMRfRURXRYtFalsetTrueR_t cStringIOtchrtreprtiterRFRcR[tStringIORt raw_inputt startswithtisjythontisdarwintisposixt iswindowsRkRmRpRtRz(((s8/usr/lib64/python2.7/site-packages/mercurial/pycompat.pyt s                                    I