[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.217.70.106: ~ $


<_9Y�0�@s�dZddlZddlZddlZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZdd	lmZGd
d�de�ZdS)a
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
�N�)�CharSetGroupProber)�
InputState�LanguageFilter�ProbingState)�EscCharSetProber)�Latin1Prober)�MBCSGroupProber)�SBCSGroupProberc@s�eZdZdZdZejd�Zejd�Zejd�Z	dddd	d
ddd
ddddddddiZ
ejdd�Z
dd�Zdd�Zdd�ZdS)�UniversalDetectoraq
    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[�-�]z
iso-8859-1zWindows-1252z
iso-8859-2zWindows-1250z
iso-8859-5zWindows-1251z
iso-8859-6zWindows-1256z
iso-8859-7zWindows-1253z
iso-8859-8zWindows-1255z
iso-8859-9zWindows-1254ziso-8859-13zWindows-1257cCsqd|_g|_d|_d|_d|_d|_d|_||_tj	t
�|_d|_|j
�dS)N)�_esc_charset_prober�_charset_probers�result�done�	_got_data�_input_state�
_last_char�lang_filter�logging�	getLogger�__name__�logger�_has_win_bytes�reset)�selfr�r�/universaldetector.py�__init__Qs									zUniversalDetector.__init__cCs�ddddddi|_d|_d|_d|_tj|_d|_|jra|jj	�x|j
D]}|j	�qkWdS)z�
        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.
        �encodingN�
confidenceg�languageF�)rrrrr�
PURE_ASCIIrrrrr
)r�proberrrrr^s					
zUniversalDetector.resetcCsF|jr
dSt|�sdSt|t�s8t|�}|jsc|jtj�rqddddddi|_n�|jtj	tj
f�r�ddddddi|_n�|jd	�r�dd
ddddi|_nc|jd�rddddddi|_n6|jtjtjf�r:dd
ddddi|_d|_|jddk	rcd|_dS|j
tjkr�|jj|�r�tj|_
n7|j
tjkr�|jj|j|�r�tj|_
|dd�|_|j
tjkrd|js
t|j�|_|jj|�tjkrBd|jjd|jj�d|jji|_d|_n�|j
tjkrB|js�t |j�g|_|jt!j"@r�|jj#t$��|jj#t%��xZ|jD]O}|j|�tjkr�d|jd|j�d|ji|_d|_Pq�W|j&j|�rBd|_'dS)a�
        Takes a chunk of a document and feeds it through all of the relevant
        charset probers.

        After calling ``feed``, you can check the value of the ``done``
        attribute to see if you need to continue feeding the
        ``UniversalDetector`` more data, or if it has made a prediction
        (in the ``result`` attribute).

        .. note::
           You should always call ``close`` when you're done feeding in your
           document if ``done`` is not already ``True``.
        Nrz	UTF-8-SIGrg�?r �zUTF-32s��zX-ISO-10646-UCS-4-3412s��zX-ISO-10646-UCS-4-2143zUTF-16Tr���)(r�len�
isinstance�	bytearrayr�
startswith�codecs�BOM_UTF8r�BOM_UTF32_LE�BOM_UTF32_BE�BOM_LE�BOM_BErrr"�HIGH_BYTE_DETECTOR�search�	HIGH_BYTE�ESC_DETECTORrZ	ESC_ASCIIrrr�feedrZFOUND_IT�charset_name�get_confidencer r
r	rZNON_CJK�appendr
r�WIN_BYTE_DETECTORr)rZbyte_strr#rrrr4os�									zUniversalDetector.feedc	Cs|jr|jSd|_|js5|jjd�n|jtjkreddddddi|_n�|jtjkrNd	}d
}d	}x>|j	D]3}|s�q�|j
�}||kr�|}|}q�W|rN||jkrN|j}|jj
�}|j
�}|jd�r0|jr0|jj||�}d|d|d|ji|_|jj�tjkr|jdd	kr|jjd�x�|j	D]}|s�q�t|t�r�x^|jD]+}|jjd
|j|j|j
��q�Wq�|jjd
|j|j|j
��q�W|jS)z�
        Stop analyzing the current document and come up with a final
        prediction.

        :returns:  The ``result`` attribute, a ``dict`` with the keys
                   `encoding`, `confidence`, and `language`.
        Tzno data received!r�asciirg�?r r$Ngziso-8859z no probers hit minimum thresholdz%s %s confidence = %s)rrrr�debugrrr"r2r
r6�MINIMUM_THRESHOLDr5�lowerr)r�ISO_WIN_MAP�getr �getEffectiveLevelr�DEBUGr'rZprobers)	rZprober_confidenceZmax_prober_confidenceZ
max_proberr#r5Zlower_charset_namerZgroup_proberrrr�close�s`				
			zUniversalDetector.closeN)r�
__module__�__qualname__�__doc__r;�re�compiler0r3r8r=rZALLrrr4rArrrrr3s"
mr)rDr*rrEZcharsetgroupproberrZenumsrrrZ	escproberrZlatin1proberrZmbcsgroupproberr	Zsbcsgroupproberr
�objectrrrrr�<module>$s

Filemanager

Name Type Size Permission Actions
__init__.cpython-35.opt-1.pyc File 799 B 0644
__init__.cpython-35.pyc File 799 B 0644
big5freq.cpython-35.opt-1.pyc File 53.36 KB 0644
big5freq.cpython-35.pyc File 53.36 KB 0644
big5prober.cpython-35.opt-1.pyc File 1.04 KB 0644
big5prober.cpython-35.pyc File 1.04 KB 0644
chardistribution.cpython-35.opt-1.pyc File 6.45 KB 0644
chardistribution.cpython-35.pyc File 6.45 KB 0644
charsetgroupprober.cpython-35.opt-1.pyc File 2.27 KB 0644
charsetgroupprober.cpython-35.pyc File 2.27 KB 0644
charsetprober.cpython-35.opt-1.pyc File 3.46 KB 0644
charsetprober.cpython-35.pyc File 3.46 KB 0644
codingstatemachine.cpython-35.opt-1.pyc File 2.82 KB 0644
codingstatemachine.cpython-35.pyc File 2.82 KB 0644
compat.cpython-35.opt-1.pyc File 293 B 0644
compat.cpython-35.pyc File 293 B 0644
cp949prober.cpython-35.opt-1.pyc File 1.05 KB 0644
cp949prober.cpython-35.pyc File 1.05 KB 0644
enums.cpython-35.opt-1.pyc File 2.59 KB 0644
enums.cpython-35.pyc File 2.59 KB 0644
escprober.cpython-35.opt-1.pyc File 2.65 KB 0644
escprober.cpython-35.pyc File 2.65 KB 0644
escsm.cpython-35.opt-1.pyc File 7.63 KB 0644
escsm.cpython-35.pyc File 7.63 KB 0644
eucjpprober.cpython-35.opt-1.pyc File 2.45 KB 0644
eucjpprober.cpython-35.pyc File 2.45 KB 0644
euckrfreq.cpython-35.opt-1.pyc File 23.46 KB 0644
euckrfreq.cpython-35.pyc File 23.46 KB 0644
euckrprober.cpython-35.opt-1.pyc File 1.05 KB 0644
euckrprober.cpython-35.pyc File 1.05 KB 0644
euctwfreq.cpython-35.opt-1.pyc File 53.36 KB 0644
euctwfreq.cpython-35.pyc File 53.36 KB 0644
euctwprober.cpython-35.opt-1.pyc File 1.05 KB 0644
euctwprober.cpython-35.pyc File 1.05 KB 0644
gb2312freq.cpython-35.opt-1.pyc File 37.39 KB 0644
gb2312freq.cpython-35.pyc File 37.39 KB 0644
gb2312prober.cpython-35.opt-1.pyc File 1.05 KB 0644
gb2312prober.cpython-35.pyc File 1.05 KB 0644
hebrewprober.cpython-35.opt-1.pyc File 3.06 KB 0644
hebrewprober.cpython-35.pyc File 3.06 KB 0644
jisfreq.cpython-35.opt-1.pyc File 43.39 KB 0644
jisfreq.cpython-35.pyc File 43.39 KB 0644
jpcntx.cpython-35.opt-1.pyc File 24.15 KB 0644
jpcntx.cpython-35.pyc File 24.15 KB 0644
langbulgarianmodel.cpython-35.opt-1.pyc File 24.25 KB 0644
langbulgarianmodel.cpython-35.pyc File 24.25 KB 0644
langcyrillicmodel.cpython-35.opt-1.pyc File 29.78 KB 0644
langcyrillicmodel.cpython-35.pyc File 29.78 KB 0644
langgreekmodel.cpython-35.opt-1.pyc File 23.94 KB 0644
langgreekmodel.cpython-35.pyc File 23.94 KB 0644
langhebrewmodel.cpython-35.opt-1.pyc File 22.79 KB 0644
langhebrewmodel.cpython-35.pyc File 22.79 KB 0644
langhungarianmodel.cpython-35.opt-1.pyc File 24.23 KB 0644
langhungarianmodel.cpython-35.pyc File 24.23 KB 0644
langthaimodel.cpython-35.opt-1.pyc File 22.77 KB 0644
langthaimodel.cpython-35.pyc File 22.77 KB 0644
langturkishmodel.cpython-35.opt-1.pyc File 22.79 KB 0644
langturkishmodel.cpython-35.pyc File 22.79 KB 0644
latin1prober.cpython-35.opt-1.pyc File 3.15 KB 0644
latin1prober.cpython-35.pyc File 3.15 KB 0644
mbcharsetprober.cpython-35.opt-1.pyc File 2.26 KB 0644
mbcharsetprober.cpython-35.pyc File 2.26 KB 0644
mbcsgroupprober.cpython-35.opt-1.pyc File 1.06 KB 0644
mbcsgroupprober.cpython-35.pyc File 1.06 KB 0644
mbcssm.cpython-35.opt-1.pyc File 18.36 KB 0644
mbcssm.cpython-35.pyc File 18.36 KB 0644
sbcharsetprober.cpython-35.opt-1.pyc File 3.06 KB 0644
sbcharsetprober.cpython-35.pyc File 3.06 KB 0644
sbcsgroupprober.cpython-35.opt-1.pyc File 1.6 KB 0644
sbcsgroupprober.cpython-35.pyc File 1.6 KB 0644
sjisprober.cpython-35.opt-1.pyc File 2.48 KB 0644
sjisprober.cpython-35.pyc File 2.48 KB 0644
universaldetector.cpython-35.opt-1.pyc File 6.19 KB 0644
universaldetector.cpython-35.pyc File 6.19 KB 0644
utf8prober.cpython-35.opt-1.pyc File 1.96 KB 0644
utf8prober.cpython-35.pyc File 1.96 KB 0644
version.cpython-35.opt-1.pyc File 351 B 0644
version.cpython-35.pyc File 351 B 0644