B š•Re%ã @s4dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z ddlmZer¨ddlmZmZmZmZmZmZmZedƒZGdd „d eƒZy 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 �r˜dd„Z+e ,de+¡dZ-ndZ-dd„Z.d-dd„Z/dd „Z0dd„Z1dd „Z2d!d"d#hZ3e j4 5d$¡�pòe j4d%k�oòej6d&kZ7d'd„Z8e9e dƒ�rd(d„Z:nd)d„Z:d.d*d+„Z;eIsz-backslashreplace_decode_fn..css|]}t|ƒVqdS)N)Úord)r#Úbrrrr&KsÚz\x{:x})ÚrangeÚstartÚendÚjoinÚmapÚformat)r%Z raw_bytesr)r%rÚbackslashreplace_decode_fnHsr0Úbackslashreplace_decodeÚbackslashreplacecCs2y ddl}dStk r YnXddlm}|S)NrT)Ú IS_PYOPENSSL)Ú_sslÚ ImportErrorÚpip._vendor.urllib3.utilr3)r4r3rrrÚhas_tlsVs r7cCs¦t|tƒr|St ¡}|r*t |¡jdkr.d}y| |¡}Wn4tk rpt   d|pXd|¡|j|t d�}YnXt t t ddƒ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. Úasciizutf-8z&%s does not appear to be encoded as %sz Bytes object)ÚerrorsÚ __stderr__NÚencodingr2)Ú isinstancerÚlocaleÚgetpreferredencodingÚcodecsÚlookupÚnameÚdecodeÚUnicodeDecodeErrorÚloggerÚwarningr1ÚgetattrÚsysÚencode)ÚdataÚdescr;Ú decoded_dataÚoutput_encodingÚoutput_encodedrrrÚstr_to_displaybs*   rNcCs t|dd�S)zProvide an alternative for os.path.samefile on Windows/Python2rN)rPrQrWrÚnormcaseÚabspath)Úfile1Úfile2Úpath1Úpath2rrrrås  cCs tt ¡ƒS)z‚ Returns a tuple (x, y) representing the width(x) and the height(y) in characters of the terminal window. )ÚtupleÚshutilr rrrrr ñscCs¤dd„}|dƒp|dƒp|dƒ}|sltjdkrly(t t ¡tj¡}||ƒ}t |¡Wntk rjYnX|sŒtj  dd¡tj  d d ¡f}t |dƒt |dƒfS) 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)NrÚhhZ12345678)rr)ÚfcntlÚtermiosÚstructÚ unpack_fromZioctlÚ TIOCGWINSZÚ Exception)r[rprqrrÚcrrrrÚ ioctl_GWINSZÿsz'get_terminal_size..ioctl_GWINSZrr]éÚwin32ÚLINESéÚCOLUMNSéP) rGÚplatformrQrRÚctermidrSrVruÚenvironÚgetÚint)rwrvr[rrrr ùs cCs dd„}|S)NcSs|S)Nr)ÚfrrrÚ_wrappersz noop_lru_cache.._wrapperr)rr„rrrÚnoop_lru_cachesr…Ú lru_cache)N)N)>Ú__doc__Ú __future__rrr?Ú functoolsr=ÚloggingrQrnrGZpip._vendor.sixrrÚpip._internal.utils.typingrÚtypingrrr r r r r rrrr5Ú pip._vendorÚipaddrZ IPAddressÚ ip_addressZ IPNetworkÚ ip_networkÚ__all__Ú getLoggerrrDÚimpr!ÚAttributeErrorrÚimportlib.utilr0Úregister_errorr1r7rNrrr^rr~r_rArrrPr r…rFr†rrrrÚsp $       C   $