ok
Direktori : /proc/thread-self/root/lib/python2.7/site-packages/pip/_vendor/chardet/ |
Current File : //proc/thread-self/root/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyo |
� ��abc @ s� d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z m Z m Z d d l m Z d d l m Z d d l m Z d d l m Z d e f d � � YZ d S( s Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco i����Ni ( t CharSetGroupProber( t InputStatet LanguageFiltert ProbingState( t EscCharSetProber( t Latin1Prober( t MBCSGroupProber( t SBCSGroupProbert UniversalDetectorc B s� e Z d Z d Z e j d � Z e j d � Z e j d � Z i d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z e j d � Z d � Z d � Z d � Z RS( sq The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result g�������?s [�-�]s (|~{)s [�-�]s Windows-1252s iso-8859-1s Windows-1250s iso-8859-2s Windows-1251s iso-8859-5s Windows-1256s iso-8859-6s Windows-1253s iso-8859-7s Windows-1255s iso-8859-8s Windows-1254s iso-8859-9s Windows-1257s iso-8859-13c C sq d | _ g | _ d | _ d | _ d | _ d | _ d | _ | | _ t j t � | _ d | _ | j � d S( N( t Nonet _esc_charset_probert _charset_proberst resultt donet _got_datat _input_statet _last_chart lang_filtert loggingt getLoggert __name__t loggert _has_win_bytest reset( t selfR ( ( sI /usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyt __init__Q s c C s� i d d 6d d 6d d 6| _ t | _ t | _ t | _ t j | _ d | _ | j rg | j j � n x | j D] } | j � qq Wd S( s� Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. t encodingg t confidencet languaget N( R R t FalseR R R R t PURE_ASCIIR R R R R ( R t prober( ( sI /usr/lib/python2.7/site-packages/pip/_vendor/chardet/universaldetector.pyR ^ s c C sy | j r d St | � s d St | t � s; t | � } n | j s{| j t j � rw i d d 6d d 6d d 6| _ n� | j t j t j f � r� i d d 6d d 6d d 6| _ n� | j d � r� i d d 6d d 6d d 6| _ nl | j d � ri d d 6d d 6d d 6| _ n<