U
    ‰d8  ã                   @   s¸   d dl Z d dlmZmZmZ ddlmZmZmZm	Z	 ddl
mZ ddlmZmZ eeeeeeef  f dœdd	„ZG d
d„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS )é    N)ÚDictÚOptionalÚUnioné   )Ú
from_bytesÚfrom_fpÚ	from_pathÚ	normalize)ÚCHARDET_CORRESPONDENCE)ÚCharsetMatchÚCharsetMatches)Úbyte_strÚreturnc                 C   s¼   t | ttfƒs td t| ƒ¡ƒ‚t | tƒr2t| ƒ} t| ƒ ¡ }|dk	rL|jnd}|dk	rh|j	dkrh|j	nd}|dk	r~d|j
 nd}|dk	r |dkr |jr |d7 }|tkr¬|nt| ||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   Úbestr   r   ZchaosÚbomr
   )r   Úrr   r   r   © r   ú=/tmp/pip-unpacked-wheel-b4wixufl/charset_normalizer/legacy.pyÚdetect	   s(    
ÿÿ
ÿûr    c                   @   s   e Zd ZdS )ÚCharsetNormalizerMatchN©Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r!   0   s   r!   c                   @   s<   e Zd Zedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZd	S )
ÚCharsetNormalizerMatchesc                  O   s   t  dt¡ 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Úkwargsr   r   r   r   5   s
    ýz CharsetNormalizerMatches.from_fpc                  O   s   t  dt¡ t| |ŽS r'   )r(   r)   r*   r   r+   r   r   r   r   >   s
    ýz#CharsetNormalizerMatches.from_bytesc                  O   s   t  dt¡ t| |ŽS r'   )r(   r)   r*   r   r+   r   r   r   r   G   s
    ýz"CharsetNormalizerMatches.from_pathc                  O   s   t  dt¡ t| |ŽS r'   )r(   r)   r*   r	   r+   r   r   r   r	   P   s
    ýz"CharsetNormalizerMatches.normalizeN)r#   r$   r%   Ústaticmethodr   r   r   r	   r   r   r   r   r&   4   s   


r&   c                   @   s   e Zd ZdS )ÚCharsetDetectorNr"   r   r   r   r   r/   Z   s   r/   c                   @   s   e Zd ZdS )ÚCharsetDoctorNr"   r   r   r   r   r0   ^   s   r0   )r(   Útypingr   r   r   Úapir   r   r   r	   Zconstantr
   Úmodelsr   r   r   ÚstrÚfloatr    r!   r&   r/   r0   r   r   r   r   Ú<module>   s   $'&