U v_% @s4dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z ddlmZerddlmZmZmZmZmZmZmZedZGdd d eZz ddlZWnVek r zdd lmZWn.ek rddlZeje_ej e_!YnXYnXd d d dddddgZ"e#e$Z%e rhddl&Z&z e&j'Z'Wne(k r\dZ'YnXe'dk Z)ndZ)ddl*m'Z'e rddZ+e,de+dZ-ndZ-ddZ.d-ddZ/dd Z0ddZ1dd Z2d!d"d#hZ3e j45d$pe j4d%koej6d&kZ7d'dZ8e9e drd(dZ:nd)dZ:d.d*d+Z;eIsz-backslashreplace_decode_fn..css|]}t|VqdSr)ord)r$brrrr(Ksz\x{:x})rangestartendjoinmapformat)r'Z raw_bytesrr&rbackslashreplace_decode_fnHsr2backslashreplace_decodebackslashreplacecCs4zddl}WdStk r"YnXddlm}|S)NrT) IS_PYOPENSSL)_ssl ImportErrorpip._vendor.urllib3.utilr5)r6r5rrrhas_tlsVs r9cCst|tr|St}|r*t|jdkr.d}z||}Wn4tk rpt d|pXd||j|t d}YnXt t t dddd}|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. asciizutf-8z&%s does not appear to be encoded as %sz Bytes object)errors __stderr__Nencodingr4) isinstancerlocalegetpreferredencodingcodecslookupnamedecodeUnicodeDecodeErrorloggerwarningr3getattrsysencode)datadescr= decoded_dataoutput_encodingoutput_encodedrrrstr_to_displaybs2   rPcCs t|ddS)zProvide an alternative for os.path.samefile on Windows/Python2r N)rRrSrYr normcaseabspath)file1file2path1path2rrrr s  cCs ttS) Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. )tupleshutilr!rrrrr!scCsdd}|dp|dp|d}|sltjdkrlz(tttj}||}t|Wntk rjYnX|stj ddtj d d f}t |dt |dfS) rocSs\z4ddl}ddl}ddl}|d|||jd}Wntk rJYdSX|dkrXdS|S)NrhhZ12345678)rr)fcntltermiosstruct unpack_fromZioctl TIOCGWINSZ Exception)r]rsrtrucrrrr ioctl_GWINSZsz'get_terminal_size..ioctl_GWINSZrr_win32LINESCOLUMNSP) rIplatformrSrTctermidrUrXrxenvirongetint)rzryr]rrrr!s cCs dd}|S)NcSs|Srr)frrr_wrappersz noop_lru_cache.._wrapperr)rrrrrnoop_lru_cachesr lru_cache)N)N)>__doc__ __future__rrrA functoolsr?loggingrSrqrIZpip._vendor.sixrrpip._internal.utils.typingrtypingrrr r r r r rrrr7 pip._vendoripaddrZ IPAddress ip_addressZ IPNetwork ip_network__all__ getLoggerrrFimpr"AttributeErrorrimportlib.utilr2register_errorr3r9rPrrr`rrrarCrr rRr!rrHrrrrrs $       C   $