U ÀÒ.e]%ã @s~dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z m Z ddl mZddlmZerˆddlmZmZmZmZz ddlZWnek r¬dZYnXeZz ddlZWnVek �rzddlmZWn.ek �rddlZeje_eje_YnXYnXd d d d d dddddg Z e !e"¡Z#edk �pDeZ$e �r„ddl%Z%z e%j&Z&Wne'k �rxdZ&YnXe&dk Z(ndZ(ddl)m&Z&e �r´dd„Z*e +de*¡dZ,ndZ,d/dd„Z-dd „Z.e �rÜd0dd „Z/n d1dd „Z/dd „Z0e �r dd l%m1Z1d!d„Z2ndd"l3m4Z4d#d„Z2d$d%„Z5d&d'd(hZ6e j7 8d)¡�pRe j7d*k�oRej9d+kZ:d,d„Z;e/usr/lib/python3.8/site-packages/pip/_internal/utils/compat.pyÚ Lsz-backslashreplace_decode_fn..css|]}t|ƒVqdSr)Úord)rÚbrrrrNsÚcss|]}d|VqdS)z\x%xNr)rÚcrrrrOs)ÚrangeÚstartÚendÚjoin)rZ raw_bytesrrrÚbackslashreplace_decode_fnKsr(Úbackslashreplace_decodeÚbackslashreplacecCs¶t|tƒr|St ¡}|r*t |¡jdkr.d}z| |¡}WnDtk r€|dkrXd}d  |¡}t   ||¡|j|t d�}YnXt t tddƒddƒ}|r²|j|d d�}| |¡}|S) aµ 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. Úasciiúutf-8Nz Bytes objectz&{} does not appear to be encoded as %s)ÚerrorsÚ __stderr__Úencodingr*)Ú isinstancerÚlocaleZgetpreferredencodingÚcodecsÚlookupÚnameÚdecodeÚUnicodeDecodeErrorÚformatÚloggerZwarningr)ÚgetattrÚsysÚencode)ÚdataÚdescr/Z decoded_dataZ msg_formatZoutput_encodingZoutput_encodedrrrÚstr_to_displayYs0    ÿþ r>cCs t|dd�S)z)r<rrrr›sFcCst|tƒr| d¡S|S)Nr,)r0rr;©ÚsÚreplacerrrr£s  cCs"t|tƒr| d|rdnd¡S|S)Nr,rAÚstrict)r0Úbytesr5r?rrrr«s cCs`ttdƒr6t |tjtjB¡}t |¡j}t |¡n&tj  |¡sPt  |¡j}n t d|ƒ‚|S)a) 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. Ú O_NOFOLLOWz1%s is a symlink; Will not return uid for symlinks) ÚhasattrÚosÚopenÚO_RDONLYrDÚfstatÚst_uidÚcloseÚpathÚislinkÚstatÚOSError)rLÚfdZfile_uidrrrr²s    ÿ©Ú get_suffixescCsdd„tƒDƒS)NcSsg|] }|d‘qS)rr)rÚsuffixrrrÚ Ôsz*get_extension_suffixes..rQrrrrrÓs©ÚEXTENSION_SUFFIXEScCstSrrUrrrrrÙscCs0tj |¡}| d¡r,| d¡r,|dd…}|S)zm Expand ~ and ~user constructions. Includes a workaround for https://bugs.python.org/issue14768 z~/z//éN)rFrLÚ expanduserÚ startswith)rLZexpandedrrrrXÝs  rXÚpythonZwsgirefÚargparseÚwinZcliÚntcCsNttjdƒrtj ||¡Stj tj |¡¡}tj tj |¡¡}||kSdS)z>Provide an alternative for os.path.samefile on Windows/Python2rN)rErFrLrÚnormcaseÚabspath)Zfile1Zfile2Zpath1Zpath2rrrr÷s  cCs tt ¡ƒS)ú‚ Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. )ÚtupleÚshutilrrrrrrscCsšdd„}|dƒp|dƒp|dƒ}|sbz(t t ¡tj¡}||ƒ}t |¡Wntk r`YnX|s‚tj dd¡tj dd ¡f}t|dƒt|dƒfS) r`cSs\z4ddl}ddl}ddl}| d| ||jd¡¡}Wntk rJYdSX|dkrXdS|S)NrZhhZ12345678)rr)ÚfcntlÚtermiosÚstructÚ unpack_fromZioctlZ TIOCGWINSZÚ Exception)rPrcrdreÚcrrrrÚ ioctl_GWINSZsþz'get_terminal_size..ioctl_GWINSZrrWéZLINESéZCOLUMNSéP) rFrGÚctermidrHrKrgÚenvironÚgetÚint)rirhrPrrrr s)N)F)F)>Ú__doc__Z __future__rrr2r1ZloggingrFrbr:Zpip._vendor.sixrrZpip._vendor.urllib3.utilrZpip._internal.utils.typingrÚtypingrr r r Z_sslÚ ImportErrorZsslr Z pip._vendorZipaddrZ IPAddressZ ip_addressZ IPNetworkZ ip_networkÚ__all__Z getLoggerÚ__name__r8ZHAS_TLSZimprÚAttributeErrorr Úimportlib.utilr(Úregister_errorr)r>rrrrRrZimportlib.machineryrVrXrÚplatformrYr4rrrErrrrrÚs˜     ý     þ B      ÿ