3
™©Þ[  ã               @   sr   d dl Z d dlZd dlZd dlZe jdfe jdfe jdfe jdfe jdfe j	dfe j
dfgZejd	ƒZd
d„ ZdS )é    NÚutf8Úutf16zutf16-bezutf16-leÚutf32zutf32-bezutf32-les   coding[:=]\s*([-\w.]+)c             C   s¢   x0t D ](\}}| j|ƒr| t|ƒd… j|ƒS qW xV| jdƒdd… D ]@}|dd… dkrFtj|ƒrFtj|ƒjƒ d jdƒ}| j|ƒS qFW | jtj	dƒpžt
jƒ ƒS )	zŠCheck a bytes string for a BOM to correctly detect the encoding

    Fallback to locale.getpreferredencoding(False) like open() on Python3Nó   
é   r   é   ó   #ÚasciiF)ÚBOMSÚ
startswithÚlenÚdecodeÚsplitÚENCODING_REÚsearchÚgroupsÚlocaleÚgetpreferredencodingÚsysÚgetdefaultencoding)ÚdataÚbomÚencodingÚline© r   ú=/tmp/pip-install-65viz3iy/pip/pip/_internal/utils/encoding.pyÚauto_decode   s    
r   )Úcodecsr   Úrer   ÚBOM_UTF8Ú	BOM_UTF16ÚBOM_UTF16_BEÚBOM_UTF16_LEÚ	BOM_UTF32ÚBOM_UTF32_BEÚBOM_UTF32_LEr
   Úcompiler   r   r   r   r   r   Ú<module>   s   
