ok
Direktori : /lib/python2.7/site-packages/pip/_vendor/chardet/cli/ |
Current File : //lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pyo |
� ��abc @@ 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 __version__( t PY2( t UniversalDetectoru stdinc C@ s� t � } x4 | D], } t | � } | j | � | j r Pq q W| j � | j } t rt | j t j � d � } n | 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 ignoreu encodingu {0}: {1} with confidence {2}u confidenceu {0}: no resultN( R t bytearrayt feedt donet closet resultR t decodet syst getfilesystemencodingt format( t linest namet ut lineR ( ( sF /usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pyt description_of s c C@ s� t j d d � } | j d d d d t j d � d d d t rH t j n t j 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 encodingsu inputt helpu^ File whose encoding we would like to determine. (default: stdin)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 add_argumentt FileTypeR R t stdint bufferR R t parse_argst inputt isattyt printt stderrR R ( t argvt parsert argst f( ( sF /usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pyt main6 s u __main__( t __doc__t __future__R R R R R t chardetR t chardet.compatR t chardet.universaldetectorR R t NoneR+ t __name__( ( ( sF /usr/lib/python2.7/site-packages/pip/_vendor/chardet/cli/chardetect.pyt <module> s