ó
3‡êWc           @@ sœ   d  Z  d d l m Z m Z m Z d d l Z d d l Z d d l m Z d d l	 m
 Z
 d d l m Z d d „ Z d d	 „ Z e d
 k r˜ e ƒ  n  d S(   u  
Script which takes one or more file paths and reports on their detected
encodings

Example::

    % chardetect somefile someotherfile
    somefile: windows-1252 with confidence 0.5
    someotherfile: ascii with confidence 1.0

If no paths are provided, it takes its input from stdin.

i    (   t   absolute_importt   print_functiont   unicode_literalsN(   t   open(   t   __version__(   t   UniversalDetectoru   stdinc         C@ sp   t  ƒ  } x |  D] } | j | ƒ q W| j ƒ  | j } | d r_ d j | | d | d ƒ Sd j | ƒ Sd S(   uý   
    Return a string describing the probable encoding of a file or
    list of strings.

    :param lines: The lines to get the encoding of.
    :type lines: Iterable of bytes
    :param name: Name of file or collection of lines
    :type name: str
    u   encodingu   {0}: {1} with confidence {2}u
   confidenceu   {0}: no resultN(   R   t   feedt   closet   resultt   format(   t   linest   namet   ut   lineR   (    (    sz   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-G70mN4/requests/requests/packages/chardet/chardetect.pyt   description_of   s    
	
	
c      
   C@ sâ   t  j d d d t  j d d ƒ } | j d d d d	 t  j d
 ƒ d d d t j g ƒ| j d d d d d j t ƒ ƒ| j	 |  ƒ } xU | j
 D]J } | j ƒ  rÄ t d d d d d t j ƒn  t t | | j ƒ ƒ q Wd S(   uã   
    Handles command line arguments and gets things started.

    :param argv: List of arguments, as if specified on the command-line.
                 If None, ``sys.argv[1:]`` is used instead.
    :type argv: list of str
    t   descriptionuV   Takes one or more file paths and reports their detected                      encodingst   formatter_classt   conflict_handleru   resolveu   inputt   helpu/   File whose encoding we would like to determine.t   typeu   rbt   nargsu   *t   defaultu	   --versiont   actionu   versiont   versionu   %(prog)s {0}u0   You are running chardetect interactively. Press u8   CTRL-D twice at the start of a blank line to signal the u4   end of your input. If you want help, run chardetect u   --help
t   fileN(   t   argparset   ArgumentParsert   ArgumentDefaultsHelpFormattert   add_argumentt   FileTypet   syst   stdinR	   R   t
   parse_argst   inputt   isattyt   printt   stderrR   R   (   t   argvt   parsert   argst   f(    (    sz   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-G70mN4/requests/requests/packages/chardet/chardetect.pyt   main0   s"    				u   __main__(   t   __doc__t
   __future__R    R   R   R   R   t   ioR   t   chardetR   t   chardet.universaldetectorR   R   t   NoneR)   t   __name__(    (    (    sz   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-G70mN4/requests/requests/packages/chardet/chardetect.pyt   <module>   s   