
    Q?h              
           S SK JrJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJrJr  / S	Qr SS
\\\4   S\S\
4S jjr  SS
\\\4   S\S\S\\
   4S jjrg)    )ListUnion   )CharSetGroupProber)CharSetProber)
InputState)
ResultDict)UniversalDetector)VERSION__version__)r
   detect
detect_allr   r   byte_strshould_rename_legacyreturnc                     [        U [        5      (       d7  [        U [        5      (       d  [        S[	        U 5       35      e[        U 5      n [        US9nUR                  U 5        UR                  5       $ )a:  
Detect the encoding of the given byte string.

:param byte_str:     The byte sequence to examine.
:type byte_str:      ``bytes`` or ``bytearray``
:param should_rename_legacy:  Should we rename legacy encodings
                              to their more modern equivalents?
:type should_rename_legacy:   ``bool``
1Expected object of type bytes or bytearray, got: r   )
isinstance	bytearraybytes	TypeErrortyper
   feedclose)r   r   detectors      B/var/www/html/env/lib/python3.13/site-packages/chardet/__init__.pyr   r      sj     h	**(E**CDNCST  X& 6JKHMM(>>    ignore_thresholdc                 &   [        U [        5      (       d7  [        U [        5      (       d  [        S[	        U 5       35      e[        U 5      n [        US9nUR                  U 5        UR                  5         UR                  [        R                  :X  Gap  / n/ nUR                   HM  n[        U[        5      (       a$  UR                  S UR                   5       5        M<  UR                  U5        MO     U H  nU(       d   UR!                  5       UR"                  :  d  M*  UR$                  =(       d    SnUR'                  5       nUR)                  S5      (       a,  UR*                  (       a  UR,                  R/                  X5      nU(       a*  UR0                  R/                  UR'                  5       U5      nUR                  UUR!                  5       UR2                  S.5        M     [5        U5      S:  a  [7        US S	9$ UR8                  /$ )
a  
Detect all the possible encodings of the given byte string.

:param byte_str:          The byte sequence to examine.
:type byte_str:           ``bytes`` or ``bytearray``
:param ignore_threshold:  Include encodings that are below
                          ``UniversalDetector.MINIMUM_THRESHOLD``
                          in results.
:type ignore_threshold:   ``bool``
:param should_rename_legacy:  Should we rename legacy encodings
                              to their more modern equivalents?
:type should_rename_legacy:   ``bool``
r   r   c              3   $   #    U  H  ov   M     g 7f)N ).0ps     r   	<genexpr>detect_all.<locals>.<genexpr>W   s     9.Qq.s    ziso-8859)encoding
confidencelanguager   c                     U S   * $ )Nr)   r"   )results    r   <lambda>detect_all.<locals>.<lambda>q   s    vl7K6Kr   )key)r   r   r   r   r   r
   r   r   input_stater   	HIGH_BYTEcharset_probersr   extendprobersappendget_confidenceMINIMUM_THRESHOLDcharset_namelower
startswithhas_win_bytesISO_WIN_MAPget
LEGACY_MAPr*   lensortedr,   )	r   r   r   r   resultsr4   proberr8   lower_charset_names	            r   r   r   5   s   $ h	**(E**CDNCST  X& 6JKHMM(NNz333$&')..F&"4559&..99v&	 /
 F6#8#8#:X=W=W#W%228b%1%7%7%9" &00<<AWAW#+#7#7#;#;*$L (#+#6#6#:#:$**,l$L $0&,&;&;&=$*OO , w<!''KLLOOr   N)F)FF)typingr   r   charsetgroupproberr   charsetproberr   enumsr   
resultdictr	   universaldetectorr
   versionr   r   __all__r   r   boolr   r   r"   r   r   <module>rM      s   $  2 (  " 0 )
Q EJE9$%=A2 #!&>E9$%>> > 
*	>r   