a *Na @sddlZddlmZmZmZddlmZmZmZm Z ddl m Z ddl m Z mZeeeeeeeffddd ZGd d d e ZGd d d eZGdddeZGdddeZdS)N)DictOptionalUnion) from_bytesfrom_fp from_path normalize)CHARDET_CORRESPONDENCE) CharsetMatchCharsetMatches)byte_strreturncCst|ttfs tdt|t|tr2t|}t|}|durL|jnd}|durh|j dkrh|j nd}|dur~d|j nd}|dur|dkr|j r|d7}|t vr|nt |||dS) 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}NUnknowng?utf_8_sig)encodinglanguage confidence) isinstance bytearraybytes TypeErrorformattyperbestrrZchaosbomr )r rrrrrt/private/var/folders/js/6pj4vh5d4zd0k6bxv74qrbhr0000gr/T/pip-target-22xwyzbs/lib/python/charset_normalizer/legacy.pydetect s(   r!c@s eZdZdS)CharsetNormalizerMatchN__name__ __module__ __qualname__rrrr r"0sr"c@s<eZdZeddZeddZeddZeddZd S) CharsetNormalizerMatchescOstdtt|i|SNzkstaticmethod from_fp, from_bytes, from_path and normalize are deprecated and scheduled to be removed in 3.0)warningswarnDeprecationWarningrargskwargsrrr r5s z CharsetNormalizerMatches.from_fpcOstdtt|i|Sr()r)r*r+rr,rrr r>s z#CharsetNormalizerMatches.from_bytescOstdtt|i|Sr()r)r*r+rr,rrr rGs z"CharsetNormalizerMatches.from_pathcOstdtt|i|Sr()r)r*r+r r,rrr r Ps z"CharsetNormalizerMatches.normalizeN)r$r%r& staticmethodrrrr rrrr r'4s   r'c@s eZdZdS)CharsetDetectorNr#rrrr r0Zsr0c@s eZdZdS) CharsetDoctorNr#rrrr r1^sr1)r)typingrrrapirrrr Zconstantr modelsr r rstrfloatr!r"r'r0r1rrrr s $'&