B Re% @s4dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z ddlmZerddlmZmZmZmZmZmZmZedZGdd d eZy ddlZWnVek r ydd lmZWn.ek rddlZeje_ej e_!YnXYnXd d d dddddgZ"e#e$Z%e rhddl&Z&y 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|VqdS)N)ord)r#brrrr&Ksz\x{:x})rangestartendjoinmapformat)r%Z raw_bytesr)r%rbackslashreplace_decode_fnHsr0backslashreplace_decodebackslashreplacecCs2y ddl}dStk r YnXddlm}|S)NrT) IS_PYOPENSSL)_ssl ImportErrorpip._vendor.urllib3.utilr3)r4r3rrrhas_tlsVs r7cCst|tr|St}|r*t|jdkr.d}y||}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__Nencodingr2) isinstancerlocalegetpreferredencodingcodecslookupnamedecodeUnicodeDecodeErrorloggerwarningr1getattrsysencode)datadescr; decoded_dataoutput_encodingoutput_encodedrrrstr_to_displaybs*   rNcCs t|ddS)zProvide an alternative for os.path.samefile on Windows/Python2rN)rPrQrWrnormcaseabspath)file1file2path1path2rrrrs  cCs ttS)z 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}|sltjdkrly(tttj}||}t|Wntk rjYnX|stj ddtj d d f}t |dt |dfS) z Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. cSsZy4ddl}ddl}ddl}|d|||jd}Wntk rHdSX|dkrVdS|S)NrhhZ12345678)rr)fcntltermiosstruct unpack_fromZioctl TIOCGWINSZ Exception)r[rprqrrcrrrr ioctl_GWINSZsz'get_terminal_size..ioctl_GWINSZrr]win32LINESCOLUMNSP) rGplatformrQrRctermidrSrVruenvirongetint)rwrvr[rrrr s cCs dd}|S)NcSs|S)Nr)frrr_wrappersz noop_lru_cache.._wrapperr)rrrrrnoop_lru_cachesr lru_cache)N)N)>__doc__ __future__rrr? functoolsr=loggingrQrnrGZpip._vendor.sixrrpip._internal.utils.typingrtypingrrr r r r r rrrr5 pip._vendoripaddrZ IPAddress ip_addressZ IPNetwork ip_network__all__ getLoggerrrDimpr!AttributeErrorrimportlib.utilr0register_errorr1r7rNrrr^rr~r_rArrrPr rrFrrrrrsp $       C   $