U .e]% @s~dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z m Z ddl mZddlmZerddlmZmZmZmZz ddlZWnek rdZYnXeZz ddlZWnVek rzddlmZWn.ek rddlZeje_eje_YnXYnXd d d d d dddddg Z e!e"Z#edk pDeZ$e rddl%Z%z e%j&Z&Wne'k rxdZ&YnXe&dk Z(ndZ(ddl)m&Z&e rddZ*e+de*dZ,ndZ,d/ddZ-dd Z.e rd0dd Z/n d1dd Z/dd Z0e r dd l%m1Z1d!dZ2ndd"l3m4Z4d#dZ2d$d%Z5d&d'd(hZ6e j78d)pRe j7d*koRej9d+kZ:d,dZ;e/usr/lib/python3.8/site-packages/pip/_internal/utils/compat.py Lsz-backslashreplace_decode_fn..css|]}t|VqdSr)ord)rbrrrrNscss|]}d|VqdS)z\x%xNr)rcrrrrOs)rangestartendjoin)rZ raw_bytesrrrbackslashreplace_decode_fnKsr(backslashreplace_decodebackslashreplacecCst|tr|St}|r*t|jdkr.d}z||}WnDtk r|dkrXd}d |}t |||j|t d}YnXt t tdddd}|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. asciiutf-8Nz Bytes objectz&{} does not appear to be encoded as %s)errors __stderr__encodingr*) isinstancerlocaleZgetpreferredencodingcodecslookupnamedecodeUnicodeDecodeErrorformatloggerZwarningr)getattrsysencode)datadescr/Z decoded_dataZ msg_formatZoutput_encodingZoutput_encodedrrrstr_to_displayYs0     r>cCs t|ddS)z)r<rrrrsFcCst|tr|dS|S)Nr,)r0rr;sreplacerrrrs  cCs"t|tr|d|rdndS|S)Nr,rAstrict)r0bytesr5r?rrrrs cCs`ttdr6t|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) hasattrosopenO_RDONLYrDfstatst_uidclosepathislinkstatOSError)rLfdZfile_uidrrrrs     get_suffixescCsddtDS)NcSsg|] }|dqS)rr)rsuffixrrr sz*get_extension_suffixes..rQrrrrrsEXTENSION_SUFFIXEScCstSrrUrrrrrscCs0tj|}|dr,|dr,|dd}|S)zm Expand ~ and ~user constructions. Includes a workaround for https://bugs.python.org/issue14768 z~/z//N)rFrL expanduser startswith)rLZexpandedrrrrXs  rXpythonZwsgirefargparsewinZclintcCsNttjdrtj||Stjtj|}tjtj|}||kSdS)z>Provide an alternative for os.path.samefile on Windows/Python2rN)rErFrLrnormcaseabspath)Zfile1Zfile2Zpath1Zpath2rrrrs  cCs ttS) Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. )tupleshutilrrrrrrscCsdd}|dp|dp|d}|sbz(tttj}||}t|Wntk r`YnX|stjddtjdd f}t|dt|dfS) r`cSs\z4ddl}ddl}ddl}|d|||jd}Wntk rJYdSX|dkrXdS|S)NrZhhZ12345678)rr)fcntltermiosstruct unpack_fromZioctlZ TIOCGWINSZ Exception)rPrcrdrecrrrr ioctl_GWINSZsz'get_terminal_size..ioctl_GWINSZrrWZLINESZCOLUMNSP) rFrGctermidrHrKrgenvirongetint)rirhrPrrrr s)N)F)F)>__doc__Z __future__rrr2r1ZloggingrFrbr:Zpip._vendor.sixrrZpip._vendor.urllib3.utilrZpip._internal.utils.typingrtypingrr r r Z_ssl ImportErrorZsslr Z pip._vendorZipaddrZ IPAddressZ ip_addressZ IPNetworkZ ip_network__all__Z getLogger__name__r8ZHAS_TLSZimprAttributeErrorr importlib.utilr(register_errorr)r>rrrrRrZimportlib.machineryrVrXrplatformrYr4rrrErrrrrs           B