σ β\e[c @`sgdZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z yddl Z Wn]e k rγyddlm Z Wqδe k rίddlZ e je _e je _qδXnXdddd d d d d dg ZejeƒZe jd$kr<eZddlmZn?ddlZy ejZWnek rndZnXedk Ze jd%kr“dZ nd„Z!ej"de!ƒdZ d„Z#e jd&krΩe$d„Z%n e$d„Z%d„Z&d„Z'dddhZ(e j)j*dƒp3e j)dko3ej+d kZ,d!„Z-e.edƒrZd"„Z/n d#„Z/dS('sKStuff that differs in different Python versions and platform distributions.i(tabsolute_importtdivisionN(t text_type(t ipaddressRt uses_pycachetconsole_to_strt native_strt get_path_uidt stdlib_pkgstWINDOWStsamefiletget_terminal_sizeii(tcache_from_sourceitbackslashreplacec`sk‡fd†tˆjˆjƒDƒ}tjddkrKd„|Dƒ}ndjd„|DƒƒˆjfS(Nc3`s|]}ˆj|VqdS(N(tobject(t.0ti(terr(s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pys 9siics`s|]}t|ƒVqdS(N(tord(Rtb((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pys <sucs`s|]}d|VqdS(u\x%xN((Rtc((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pys =s(trangetstarttendtsyst version_infotjoin(Rt raw_bytes((Rs3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pytbackslashreplace_decode_fn8s%tbackslashreplace_decodecC`sΟtjƒ}| s+tj|ƒjdkr4d}ny|j|ƒ}Wn6tk rtjd|ƒ|j|dt ƒ}nXt t t ddƒddƒ}|rΛ|j |ddƒ}|j|ƒ}n|S( s4Return a string, safe for output, of subprocess output. We assume the data is in the locale preferred encoding. If it won't decode properly, we warn the user but decode as best we can. We also ensure that the output can be safely written to standard output without encoding errors. tasciisutf-8s5Subprocess output does not appear to be encoded as %sterrorst __stderr__tencodingR N(tlocaletgetpreferredencodingtcodecstlookuptnametdecodetUnicodeDecodeErrortloggertwarningRtgetattrRtNonetencode(tdataR!tstoutput_encoding((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyREs     cC`s/t|tƒr+|jd|r$dndƒS|S(Nsutf-8treplacetstrict(t isinstancetbytesR'(R/R1((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyRyscC`s t|tƒr|jdƒS|S(Nsutf-8(R3RR-(R/R1((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyRs cC`sˆttdƒrMtj|tjtjBƒ}tj|ƒj}tj|ƒn7tjj |ƒsttj |ƒj}nt d|ƒ‚|S(s) Return path's uid. Does not follow symlinks: https://github.com/pypa/pip/pull/935#discussion_r5307003 Placed this function in compat due to differences on AIX and Jython, that should eventually go away. :raises OSError: When path is a symlink or can't be read. t O_NOFOLLOWs1%s is a symlink; Will not return uid for symlinks( thasattrtostopentO_RDONLYR5tfstattst_uidtclosetpathtislinktstattOSError(R=tfdtfile_uid((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyR†s  cC`sAtjj|ƒ}|jdƒr=|jdƒr=|d}n|S(sm Expand ~ and ~user constructions. Includes a workaround for https://bugs.python.org/issue14768 s~/s//i(R7R=t expandusert startswith(R=texpanded((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyRC£s tpythontwsgireftargparsetwintclitntcC`sottjdƒr%tjj||ƒStjjtjj|ƒƒ}tjjtjj|ƒƒ}||kSdS(s>Provide an alternative for os.path.samefile on Windows/Python2R N(R6R7R=R tnormcasetabspath(tfile1tfile2tpath1tpath2((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyR Όs cC`sttjƒƒS(s‚ Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. (ttupletshutilR (((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyR ΗscC`sΣd„}|dƒp*|dƒp*|dƒ}|s‚y8tjtjƒtjƒ}||ƒ}tj|ƒWq‚tk r~q‚Xn|s΅tjjddƒtjjddƒf}nt|dƒt|dƒfS( s‚ Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. cS`suyLddl}ddl}ddl}|jd|j||jdƒƒ}Wntk r`dSX|dkrqdS|S(Nithht12345678(ii(tfcntlttermioststructt unpack_fromtioctlt TIOCGWINSZt ExceptionR,(RARVRWRXtcr((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyt ioctl_GWINSZΣs     iiitLINESitCOLUMNSiP( R7R8tctermidR9R<R\tenvirontgettint(R^R]RA((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pyR Ξs $  -(ii(ii(i(0t__doc__t __future__RRR$R"tloggingR7RSRtpip._vendor.sixRRt ImportErrort pip._vendortipaddrt IPAddresst ip_addresst IPNetworkt ip_networkt__all__t getLoggert__name__R)RtTrueRtimportlib.utilR timptAttributeErrorR,RRtregister_errorRtFalseRRRCRtplatformRDR&R R R6R (((s3/tmp/pip-install-0xiv62/pip/pip/_internal/compat.pytsb                   3