
}_                 @   s   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   x@ t  D]8 \ } } |  j |  r |  t |  d  j |  Sq Wxu |  j d  d d  D]Z } | d d  d k r] t j |  r] t j |  j   d j d  } |  j |  Sq] W|  j t j	 d   S)	zCheck a bytes string for a BOM to correctly detect the encoding

    Fallback to locale.getpreferredencoding(False) like open() on Python3Ns   
   r         #asciiF)
BOMS
startswithlendecodesplitENCODING_REsearchgroupslocalegetpreferredencoding)databomencodingline r   1/tmp/pip-build-3_sjtvrs/pip/pip/utils/encoding.pyauto_decode   s    ! %"r   )codecsr   re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   