§ <ˆj : ã óÐ — d Z ddlZddlZddlZddlmZmZmZ ddlm Z ddl mZ ddlm Z mZmZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ G d„ d¦ « 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)ÚListÚOptionalÚUnioné )ÚCharSetGroupProber)Ú CharSetProber)Ú InputStateÚLanguageFilterÚProbingState)ÚEscCharSetProber)ÚLatin1Prober)ÚMacRomanProber)ÚMBCSGroupProber)Ú ResultDict)ÚSBCSGroupProber)Ú UTF1632Proberc óX — e Zd ZdZdZ ej d¦ « Z ej d¦ « Z ej d¦ « Z dddd d ddd dœZ ddddddddœZej dfdededdfd„Zedefd„¦ « Zedefd„¦ « Zedee fd„¦ « Zd!d„Zdeeef ddfd„Zdefd „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)ú iso-8859-1z iso-8859-2z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8ú iso-8859-9ziso-8859-13zISO-8859-11ÚGB18030ÚCP949úUTF-16)Úasciir ztis-620r Úgb2312zeuc-krzutf-16leFÚlang_filterÚshould_rename_legacyÚreturnNc ó — d | _ d | _ g | _ d dd dœ| _ d| _ d| _ t j | _ d| _ || _ t j t ¦ « | _ d| _ || _ | ¦ « d S )Nç ©ÚencodingÚ confidenceÚlanguageFó )Ú_esc_charset_proberÚ_utf1632_proberÚ_charset_probersÚresultÚdoneÚ _got_datar Ú PURE_ASCIIÚ_input_stateÚ _last_charr ÚloggingÚ getLoggerÚ__name__ÚloggerÚ_has_win_bytesr Úreset)Úselfr r s úP/opt/cloudlinux/venv/lib64/python3.11/site-packages/chardet/universaldetector.pyÚ__init__zUniversalDetector.__init__d s’ € ð @DˆÔ Ø8<ˆÔØ57ˆÔàØØð# ð # ˆŒð ˆŒ ؈ŒÝ&Ô1ˆÔ؈ŒØ&ˆÔÝÔ'Ñ1Ô1ˆŒØ#ˆÔØ$8ˆÔ!Ø� Š ‰Œˆˆˆr% c ó — | j S ©N)r- ©r5 s r6 Úinput_statezUniversalDetector.input_state{ s € àÔ Ð r% c ó — | j S r9 )r3 r: s r6 Ú has_win_byteszUniversalDetector.has_win_bytes s € àÔ"Ð"r% c ó — | j S r9 )r( r: s r6 Úcharset_probersz!UniversalDetector.charset_probersƒ s € àÔ$Ð$r% c ó2 — ddddœ| _ d| _ d| _ d| _ t j | _ d| _ | j r| j ¦ « | j r| j ¦ « | j D ]}| ¦ « ŒdS )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. Nr r! Fr% )r) r* r+ r3 r r, r- r. r&