Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyo

ó
“tÆ_c@`sÜdZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZm
Z
ddlmZerõddlmZmZmZmZmZmZmZedƒZdefd	„ƒYZnyddlZWn]ek
rdydd
lmZWqeek
r`ddlZeje_ej e_!qeXnXddd
dddddgZ"ej#e$ƒZ%erÚddl&Z&y
e&j'Z'Wne(k
rÊdZ'nXe'dk	Z*ne+Z*ddl,m'Z'erd„Z-ej.de-ƒdZ/ndZ/d„Z0dd„Z1d„Z2d„Z3d„Z4dddhZ5e
j6j7dƒpŠe
j6d koŠej8d!kZ9d"„Z:e;e	dƒr±d#„Z<n	d$„Z<dd%„Z=e>ed&e=ƒZ?dS('sKStuff that differs in different Python versions and platform
distributions.i(tabsolute_importtdivisionN(tPY2t	text_type(tMYPY_CHECK_RUNNING(tCallabletOptionaltProtocoltTexttTupletTypeVartUniontFtLruCachecB`seZdd„ZRS(cC`s
t‚dS(N(tNotImplementedError(tselftmaxsize((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyt__call__sN(t__name__t
__module__tNoneR(((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyR
s(t	ipaddressRtuses_pycachetconsole_to_strtget_path_uidtstdlib_pkgstWINDOWStsamefiletget_terminal_size(tcache_from_sourcec`sW‡fd†tˆjˆjƒDƒ}d„|Dƒ}djtdj|ƒƒˆjfS(Nc3`s|]}ˆj|VqdS(N(tobject(t.0ti(terr(sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pys	<genexpr>Iscs`s|]}t|ƒVqdS(N(tord(Rtb((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pys	<genexpr>Ksuu\x{:x}(trangetstarttendtjointmaptformat(R!t	raw_bytes((R!sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pytbackslashreplace_decode_fnHs%tbackslashreplace_decodetbackslashreplacecC`s<yddl}tSWntk
r'nXddlm}|S(Ni(tIS_PYOPENSSL(t_ssltTruetImportErrortpip._vendor.urllib3.utilR.(R/R.((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pythas_tlsVs
cC`sët|tƒr|Stjƒ}|s>tj|ƒjdkrGd}ny|j|ƒ}Wn?tk
r›t	j
d|p|d|ƒ|j|dtƒ}nXttt
dd	ƒdd	ƒ}|rç|j|ddƒ}|j|ƒ}n|S(
sµ
    For display or logging purposes, convert a bytes object (or text) to
    text (e.g. unicode in Python 2) safe for output.

    :param desc: An optional phrase describing the input data, for use in
        the log message if a warning is logged. Defaults to "Bytes object".

    This function should never error out and so can take a best effort
    approach. It is okay to be lossy if needed since the return value is
    just for display.

    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-8s&%s does not appear to be encoded as %ssBytes objectterrorst
__stderr__tencodingR-N(t
isinstanceRtlocaletgetpreferredencodingtcodecstlookuptnametdecodetUnicodeDecodeErrortloggertwarningR,tgetattrtsysRtencode(tdatatdescR7tdecoded_datatoutput_encodingtoutput_encoded((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pytstr_to_displaybs*	
		cC`st|ddƒS(s<Return a string, safe for output, of subprocess output.
    RFsSubprocess output(RJ(RE((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyR¥scC`sttdƒrMtj|tjtjBƒ}tj|ƒj}tj|ƒn<tjj	|ƒsttj
|ƒj}ntdj|ƒƒ‚|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{} is a symlink; Will not return uid for symlinks(
thasattrtostopentO_RDONLYRKtfstattst_uidtclosetpathtislinktstattOSErrorR)(RStfdtfile_uid((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/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(RMRSt
expandusert
startswith(RStexpanded((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyRYËs
tpythontwsgireftargparsetwintclitntcC`sottjdƒr%tjj||ƒStjjtjj|ƒƒ}tjjtjj|ƒƒ}||kSdS(s>Provide an alternative for os.path.samefile on Windows/Python2RN(RLRMRSRtnormcasetabspath(tfile1tfile2tpath1tpath2((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/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(((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyRñscC`såd„}|dƒp*|dƒp*|dƒ}|s”tjdkr”y8tjtjƒtjƒ}||ƒ}tj|ƒWq‘tk
rq‘Xq”n|sÇtjj	ddƒtjj	dd	ƒ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(tfcntlttermioststructtunpack_fromtioctlt
TIOCGWINSZt	ExceptionR(RWRlRmRntcr((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pytioctl_GWINSZÿs
iiitwin32tLINESitCOLUMNSiP(RCtplatformRMRNtctermidRORRRrtenvirontgettint(RtRsRW((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyRùs	$

-cC`s
d„}|S(NcS`s|S(N((tf((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyt_wrappers((RR~((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pytnoop_lru_caches	t	lru_cache(@t__doc__t
__future__RRR;t	functoolsR9tloggingRMRiRCtpip._vendor.sixRRtpip._internal.utils.typingRttypingRRRRR	R
RRR
RR1tpip._vendortipaddrt	IPAddresst
ip_addresst	IPNetworkt
ip_networkt__all__t	getLoggerRR@timpRtAttributeErrorRRR0timportlib.utilR+tregister_errorR,R3RJRRRYRRxRZR=RRRLRRRBR€(((sK/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/utils/compat.pyt<module>sp4

	


			C					$
Back to Directory File Manager