B _oa8 ã@s¸ddlZddlmZmZmZddlmZmZmZm Z ddl m Z ddl m Z mZeeeeeeeffdœdd „ZGd d „d e ƒZGd d „d eƒZGdd„deƒZGdd„deƒZdS)éN)ÚDictÚOptionalÚUnioné)Ú from_bytesÚfrom_fpÚ from_pathÚ normalize)ÚCHARDET_CORRESPONDENCE)Ú CharsetMatchÚCharsetMatches)Úbyte_strÚreturncCs¼t|ttfƒs td t|ƒ¡ƒ‚t|tƒr2t|ƒ}t|ƒ ¡}|dk rL|jnd}|dk rh|j dkrh|j nd}|dk r~d|j nd}|dk r |dkr |j r |d7}|t kr¬|nt |||dœS) a chardet legacy method Detect the encoding of the given byte string. It should be mostly backward-compatible. Encoding name will match Chardet own writing whenever possible. (Not on encoding name unsupported by it) This function is deprecated and should be used to migrate your project easily, consult the documentation for further information. Not planned for removal. :param byte_str: The byte sequence to examine. z4Expected object of type bytes or bytearray, got: {0}NÚUnknownÚgð?Úutf_8Z_sig)ÚencodingÚlanguageÚ confidence) Ú isinstanceÚ bytearrayÚbytesÚ TypeErrorÚformatÚtyperÚbestrrZchaosÚbomr )r Úrrrr©rú@/tmp/pip-target-avibdbtm/lib/python/charset_normalizer/legacy.pyÚdetect s     r c@s eZdZdS)ÚCharsetNormalizerMatchN)Ú__name__Ú __module__Ú __qualname__rrrrr!0sr!c@s<eZdZedd„ƒZedd„ƒZedd„ƒZedd„ƒZd S) ÚCharsetNormalizerMatchescOst dt¡t||ŽS)Nzkstaticmethod from_fp, from_bytes, from_path and normalize are deprecated and scheduled to be removed in 3.0)ÚwarningsÚwarnÚDeprecationWarningr)ÚargsÚkwargsrrrr5sz CharsetNormalizerMatches.from_fpcOst dt¡t||ŽS)Nzkstaticmethod from_fp, from_bytes, from_path and normalize are deprecated and scheduled to be removed in 3.0)r&r'r(r)r)r*rrrr>sz#CharsetNormalizerMatches.from_bytescOst dt¡t||ŽS)Nzkstaticmethod from_fp, from_bytes, from_path and normalize are deprecated and scheduled to be removed in 3.0)r&r'r(r)r)r*rrrrGsz"CharsetNormalizerMatches.from_pathcOst dt¡t||ŽS)Nzkstaticmethod from_fp, from_bytes, from_path and normalize are deprecated and scheduled to be removed in 3.0)r&r'r(r )r)r*rrrr Psz"CharsetNormalizerMatches.normalizeN)r"r#r$Ú staticmethodrrrr rrrrr%4s r%c@s eZdZdS)ÚCharsetDetectorN)r"r#r$rrrrr,Zsr,c@s eZdZdS)Ú CharsetDoctorN)r"r#r$rrrrr-^sr-)r&ÚtypingrrrÚapirrrr Zconstantr Úmodelsr r rÚstrÚfloatr r!r%r,r-rrrrÚs $'&