Ë
    Dü´jL  ã                  óz  — d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZ ddlmZ ddlmZ ddlmZmZ ddlmZmZ dd	lmZmZ dd
lmZ ddlmZmZ g d¢Zdej>                  eefdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z ddej>                  eefdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z!y)u@   Universal character encoding detector â€” 0BSD-licensed rewrite.é    )Úannotations)ÚIterable)Ú_DEFAULT_CHUNK_SIZEÚDEFAULT_MAX_BYTESÚMINIMUM_THRESHOLDÚ_resolve_prefer_supersetÚ_validate_max_bytesÚ_warn_deprecated_chunk_size)Ú__version__)ÚUniversalDetector)ÚEncodingEraÚLanguageFilter)Úapply_compat_namesÚapply_preferred_superset)ÚDetectionDictÚDetectionResult)Úrun_pipeline)Ú_validate_encodingÚnormalize_encodings)
r   r   r   r   r   r   r   r   ÚdetectÚ
detect_allFTNÚcp1252zutf-8)Úprefer_supersetÚcompat_namesÚinclude_encodingsÚexclude_encodingsÚno_match_encodingÚempty_input_encodingc          	     ób  — t        |«       t        |«       t        ||«      }t        |d«      }t        |d«      }t	        |	d«      }t	        |
d«      }t        | t        «      r| n
t        | «      }t        |||||||¬«      }|d   j                  «       }|rt        |«       |rt        |«       |S )aŒ  Detect the encoding of the given byte string.

    :param byte_str: The byte sequence to detect encoding for.
    :param should_rename_legacy: Deprecated alias for *prefer_superset*.
    :param encoding_era: Restrict candidate encodings to the given era.
    :param chunk_size: Deprecated -- accepted for backward compatibility but
        has no effect.
    :param max_bytes: Maximum number of bytes to examine from *byte_str*.
    :param prefer_superset: If ``True``, remap subset encodings in the result
        to their decode-safe Windows/CP superset equivalents (e.g.,
        ISO-8859-1 -> Windows-1252, EUC-KR -> CP949).  Recommended when the
        result will be used to decode: detection examines at most
        *max_bytes* of input, and only the superset is guaranteed to decode
        bytes beyond that window.  If ``False`` (default), the detected
        encoding is reported under its own name --- note this only skips
        the renaming step; it is not a promise of the *smallest* matching
        encoding, since detection may natively choose a superset that fits
        the data better.  The default will change to ``True`` in chardet
        8.0; pass ``False`` explicitly if you depend on subset names.
    :param compat_names: If ``True`` (default), return encoding names
        compatible with chardet 5.x/6.x.  If ``False``, return raw Python
        codec names.
    :param include_encodings: If given, restrict detection to only these
        encodings (names or aliases).
    :param exclude_encodings: If given, remove these encodings from the
        candidate set.
    :param no_match_encoding: Encoding to return when no candidate survives
        the pipeline.  Defaults to ``"cp1252"``.
    :param empty_input_encoding: Encoding to return for empty input.  Defaults
        to ``"utf-8"``.
    :returns: A dictionary with keys ``"encoding"``, ``"confidence"``, and
        ``"language"``.
    r   r   r   r   )Ú	max_bytesr   r   r   r   r   )r
   r	   r   r   r   Ú
isinstanceÚbytesr   Úto_dictr   r   )Úbyte_strÚshould_rename_legacyÚencoding_eraÚ
chunk_sizer    r   r   r   r   r   r   ÚincludeÚexcludeÚno_matchÚemptyÚdataÚresultsÚresults                     úN/root/workspace/ytshorts/venv/lib/python3.12/site-packages/chardet/__init__.pyr   r   %   s¼   € ô^   
Ô+Ü˜	Ô"Ü.Ð/CÀ_ÓU€OÜ!Ð"3Ð5HÓI€GÜ!Ð"3Ð5HÓI€GÜ!Ð"3Ð5HÓI€HÜÐ3Ð5KÓL€EÜ! (¬EÔ2‰8¼¸h»€DÜØØØØ!Ø!Ø"Ø"ô€Gð �Q‰Z×ÑÓ!€FÙÜ  Ô(ÙÜ˜6Ô"Ø€Mó    c          
     óú  — t        |«       t        |«       t        ||«      }t        |d«      }t        |	d«      }t	        |
d«      }t	        |d«      }t        | t        «      r| n
t        | «      }t        |||||||d¬«      }|D �cg c]  }|j                  «       ‘Œ }}|s |D �cg c]  }|d   t        kD  sŒ|‘Œ }}|r|}|D ]  }|rt        |«       |sŒt        |«       Œ t        |d„ d¬	«      S c c}w c c}w )
a:  Detect all possible encodings of the given byte string.

    When *ignore_threshold* is False (the default), results with confidence
    <= MINIMUM_THRESHOLD (0.20) are filtered out.  If all results are below
    the threshold, the full unfiltered list is returned as a fallback so the
    caller always receives at least one result.

    :param byte_str: The byte sequence to detect encoding for.
    :param ignore_threshold: If ``True``, return all candidate encodings
        regardless of confidence score.
    :param should_rename_legacy: Deprecated alias for *prefer_superset*.
    :param encoding_era: Restrict candidate encodings to the given era.
    :param chunk_size: Deprecated -- accepted for backward compatibility but
        has no effect.
    :param max_bytes: Maximum number of bytes to examine from *byte_str*.
    :param prefer_superset: If ``True``, remap subset encodings in the
        results to their decode-safe Windows/CP superset equivalents.
        If ``False`` (default), skip the renaming --- not a promise of the
        smallest matching encoding.  The default will change to ``True``
        in chardet 8.0.  See :func:`detect` for details.
    :param compat_names: If ``True`` (default), return encoding names
        compatible with chardet 5.x/6.x.  If ``False``, return raw Python
        codec names.
    :param include_encodings: If given, restrict detection to only these
        encodings (names or aliases).
    :param exclude_encodings: If given, remove these encodings from the
        candidate set.
    :param no_match_encoding: Encoding to return when no candidate survives
        the pipeline.  Defaults to ``"cp1252"``.
    :param empty_input_encoding: Encoding to return for empty input.  Defaults
        to ``"utf-8"``.
    :returns: A list of dictionaries, sorted by descending confidence.
    r   r   r   r   T)r    r   r   r   r   Úfull_rankingÚ
confidencec                ó   — | d   S )Nr3   © )Úds    r/   ú<lambda>zdetect_all.<locals>.<lambda>¹   s
   €  q¨¡€ r0   )ÚkeyÚreverse)r
   r	   r   r   r   r!   r"   r   r#   r   r   r   Úsorted)r$   Úignore_thresholdr%   r&   r'   r    r   r   r   r   r   r   r(   r)   r*   r+   r,   r-   ÚrÚdictsr6   Úfiltereds                         r/   r   r   m   s  € ô`   
Ô+Ü˜	Ô"Ü.Ð/CÀ_ÓU€OÜ!Ð"3Ð5HÓI€GÜ!Ð"3Ð5HÓI€GÜ!Ð"3Ð5HÓI€HÜÐ3Ð5KÓL€EÜ! (¬EÔ2‰8¼¸h»€DÜØØØØ!Ø!Ø"Ø"Øô	€Gð #*Ö*˜QˆQ�Y‰Y�[Ð*€EÐ*ÙØ$ÖL˜!¨¨,©Ô:KÓ(K’AÐLˆÐLÙØˆEØò "ˆÙÜ$ QÔ'ÚÜ˜qÕ!ð	"ô
 �%Ñ6ÀÔEÐEùò +ùâLs   ÂC3Â&C8Â8C8)r$   úbytes | bytearrayr%   Úboolr&   r   r'   Úintr    rA   r   r@   r   r@   r   úIterable[str] | Noner   rB   r   Ústrr   rC   Úreturnr   )r$   r?   r;   r@   r%   r@   r&   r   r'   rA   r    rA   r   r@   r   r@   r   rB   r   rB   r   rC   r   rC   rD   zlist[DetectionDict])"Ú__doc__Ú
__future__r   Úcollections.abcr   Úchardet._utilsr   r   r   r   r	   r
   Úchardet._versionr   Úchardet.detectorr   Úchardet.enumsr   r   Úchardet.output_namesr   r   Úchardet.pipeliner   r   Úchardet.pipeline.orchestratorr   Úchardet.registryr   r   Ú__all__ÚALLr   r   r5   r0   r/   ú<module>rR      s¸  ðÙ Få "å $÷÷ õ )Ý .ß 5ß Mß ;Ý 6ß Dò€ð  "'Ø +§¡Ø)Ø&ðEð "ØØ.2Ø.2Ø%Ø 'ñEØðEàðEð ðEð ð	Eð
 ðEð ðEð ðEð ,ðEð ,ðEð ðEð ðEð óEðT #Ø!&Ø +§¡Ø)Ø&ðLFð "ØØ.2Ø.2Ø%Ø 'ñLFØðLFàðLFð ðLFð ð	LFð
 ðLFð ðLFð ðLFð ðLFð ,ðLFð ,ðLFð ðLFð ðLFð ôLFr0   