⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.24
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3.9
/
site-packages
/
chardet
/
__pycache__
/
View File Name :
universaldetector.cpython-39.pyc
a =b0 @ s d Z ddlZddlZddlZddlmZ ddlmZmZm Z ddl mZ ddlm Z ddlmZ dd lmZ G d d deZdS )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) InputStateLanguageFilterProbingState)EscCharSetProber)Latin1Prober)MBCSGroupProber)SBCSGroupProberc @ sn e Zd ZdZdZedZedZedZ dddd d ddd dZ ejfddZ 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 [-]zWindows-1252zWindows-1250zWindows-1251zWindows-1256zWindows-1253zWindows-1255zWindows-1254zWindows-1257)z iso-8859-1z iso-8859-2z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8z iso-8859-9ziso-8859-13c C sN d | _ g | _d | _d | _d | _d | _d | _|| _t t | _d | _| d S )N)_esc_charset_prober_charset_probersresultdone _got_data_input_state _last_charlang_filterloggingZ getLogger__name__logger_has_win_bytesreset)selfr r =/usr/lib/python3.9/site-packages/chardet/universaldetector.py__init__Q s zUniversalDetector.__init__c C sV dddd| _ d| _d| _d| _tj| _d| _| jr>| j | j D ]}| qDdS )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. N encoding confidencelanguageF )r r r r r PURE_ASCIIr r r r r )r proberr r r r ^ s zUniversalDetector.resetc C s> | j r dS t|sdS t|ts(t|}| js|tjrJdddd| _nv|tj tj frldddd| _nT|drdddd| _n:|d rd ddd| _n |tjtjfrdddd| _d| _| jd durd| _ dS | j tjkr.| j|rtj| _ n*| j tjkr.| j| j| r.tj| _ |dd | _| j tjkr| js^t| j| _| j|tjkr:| jj| j | jjd| _d| _ n| j tjkr:| jst | jg| _| jt!j"@ r| j#t$ | j#t% | jD ]:}||tjkr|j| |jd| _d| _ q&q| j&|r:d| _'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``. Nz UTF-8-SIG ? r zUTF-32s zX-ISO-10646-UCS-4-3412s zX-ISO-10646-UCS-4-2143zUTF-16Tr )(r len isinstance bytearrayr startswithcodecsBOM_UTF8r BOM_UTF32_LEBOM_UTF32_BEBOM_LEBOM_BEr r r# HIGH_BYTE_DETECTORsearch HIGH_BYTEESC_DETECTORr Z ESC_ASCIIr r r feedr ZFOUND_ITcharset_nameget_confidencer! r r r ZNON_CJKappendr r WIN_BYTE_DETECTORr )r Zbyte_strr$ r r r r6 o s zUniversalDetector.feedc C st | j r| jS d| _ | js&| jd n| jtjkrBdddd| _n| jtjkrd}d}d}| j D ]"}|sjq`| }||kr`|}|}q`|r|| jkr|j}|j }| }|d r| jr| j||}|||jd| _| j tjkrn| jd du rn| jd | j D ]`}|sqt|trP|jD ] }| jd|j|j| q,n| jd|j|j| q| 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!asciir% r&