ó
ÆÔL]c           @   sk   d  Z  d d l m Z d d l m Z m Z d d l m Z d d „ Z d „  Z	 e
 d k rg e	 ƒ  n  d	 S(
   s  
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   open(   t   argvt   stdin(   t   UniversalDetectorR   c         C   si   t  ƒ  } x |  D] } | j | ƒ q W| j ƒ  | j } | d r] d | | d | d f Sd | Sd S(   s;   Return a string describing the probable encoding of a file.t   encodings   %s: %s with confidence %st
   confidences   %s: no resultN(   R   t   feedt   closet   result(   t   filet   namet   ut   lineR   (    (    s6   /usr/lib/python2.7/site-packages/chardet/chardetect.pyt   description_of   s    	
	
c          C   s_   t  t ƒ d k r  t t ƒ GHn; x8 t d D], }  t |  d ƒ  } t | |  ƒ GHWd  QXq+ Wd  S(   Ni   t   rb(   t   lenR   R   R   R    (   t   patht   f(    (    s6   /usr/lib/python2.7/site-packages/chardet/chardetect.pyt   main#   s
    t   __main__N(   t   __doc__t   ioR    t   sysR   R   t   chardet.universaldetectorR   R   R   t   __name__(    (    (    s6   /usr/lib/python2.7/site-packages/chardet/chardetect.pyt   <module>   s   		