????

Your IP : 216.73.216.152


Current Path : /proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_internal/utils/
Upload File :
Current File : //proc/self/root/proc/self/root/lib/python2.7/site-packages/pip/_internal/utils/compat.pyc

�
}�\]c
@`sGdZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZer�ddlmZmZmZmZnyddlZWnek
r�dZnXeZyddlZWn]ek
r^yddlmZWq_ek
rZddlZeje_eje_q_XnXd	d
ddd
dddddg
Z ej!e"�Z#edk	p�e
Z$e	j%d-kr�e&Z'ddl(m)Z)n?ddl*Z*y
e*j)Z)Wne+k
r�dZ)nXe)dk	Z'e	j%d.kr#dZ,nd�Z-ej.de-�dZ,dd�Z/d�Z0e	j%d/krue1d�Z2ne1d�Z2d�Z3e	j%d0kr�ddl4m5Z5d �Z6ndd!l*m7Z7d"�Z6d#�Z8d$d%d&hZ9e	j:j;d'�pe	j:d(koej<d)kZ=d*�Z>e?ed�r:d+�Z@n	d,�Z@dS(1sKStuff that differs in different Python versions and platform
distributions.i(tabsolute_importtdivisionN(t	text_type(tIS_PYOPENSSL(tMYPY_CHECK_RUNNING(tOptionaltTexttTupletUnion(t	ipaddressR	tuses_pycachetconsole_to_strt
native_strtget_path_uidtstdlib_pkgstWINDOWStsamefiletget_terminal_sizetget_extension_suffixesii(tcache_from_sourceitbackslashreplacec`sk�fd�t�j�j�D�}tjddkrKd�|D�}ndjd�|D���jfS(Nc3`s|]}�j|VqdS(N(tobject(t.0ti(terr(s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pys	<genexpr>Jsiics`s|]}t|�VqdS(N(tord(Rtb((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pys	<genexpr>Msucs`s|]}d|VqdS(u\x%xN((Rtc((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pys	<genexpr>Ns(trangetstarttendtsystversion_infotjoin(Rt	raw_bytes((Rs9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pytbackslashreplace_decode_fnIs%tbackslashreplace_decodecC`st|t�r|Stj�}|s>tj|�jdkrGd}ny|j|�}WnZtk
r�|d	krd}ndj
|�}tj||�|j|dt
�}nXtttdd	�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Bytes objects&{} does not appear to be encoded as %sterrorst
__stderr__tencodingRN(t
isinstanceRtlocaletgetpreferredencodingtcodecstlookuptnametdecodetUnicodeDecodeErrortNonetformattloggertwarningR$tgetattrRtencode(tdatatdescR(tdecoded_datat
msg_formattoutput_encodingtoutput_encoded((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pytstr_to_displayVs*	
		cC`st|dd�S(s<Return a string, safe for output, of subprocess output.
    R8sSubprocess output(R=(R7((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyR�scC`s/t|t�r+|jd|r$dnd�S|S(Nsutf-8treplacetstrict(R)tbytesR/(tsR>((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyR�scC`s t|t�r|jd�S|S(Nsutf-8(R)RR6(RAR>((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyR�s
cC`s�ttd�rMtj|tjtjB�}tj|�j}tj|�n7tjj	|�sttj
|�j}ntd|��|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_RDONLYRBtfstattst_uidtclosetpathtislinktstattOSError(RJtfdtfile_uid((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyR
�s

(tEXTENSION_SUFFIXEScC`stS(N(RP(((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyR�s(tget_suffixescC`sgt�D]}|d^q
S(Ni(RQ(tsuffix((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyR�scC`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(RDRJt
expandusert
startswith(RJtexpanded((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyRS�s
tpythontwsgireftargparsetwintclitntcC`sottjd�r%tjj||�Stjjtjj|��}tjjtjj|��}||kSdS(s>Provide an alternative for os.path.samefile on Windows/Python2RN(RCRDRJRtnormcasetabspath(tfile1tfile2tpath1tpath2((s9/tmp/pip-install-ewDPok/pip/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(((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/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(tfcntlttermioststructtunpack_fromtioctlt
TIOCGWINSZt	ExceptionR1(RNRfRgRhtcr((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pytioctl_GWINSZ
s
iiitLINESitCOLUMNSiP(	RDREtctermidRFRIRltenvirontgettint(RnRmRN((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyRs	$
-(ii(ii(i(ii(At__doc__t
__future__RRR,R*tloggingRDRcRtpip._vendor.sixRtpip._vendor.urllib3.utilRtpip._internal.utils.typingRttypingRRRRt_ssltImportErrorR1tsslR	tpip._vendortipaddrt	IPAddresst
ip_addresst	IPNetworkt
ip_networkt__all__t	getLoggert__name__R3tHAS_TLSR tTrueR
timportlib.utilRtimptAttributeErrorR$R#tregister_errorR=RtFalseRR
timportlib.machineryRPRRQRSRtplatformRTR.RRRCR(((s9/tmp/pip-install-ewDPok/pip/pip/_internal/utils/compat.pyt<module>s�%



	


		B