
    *pjL                       S r SSKJr  SSKJr  SSKJrJrJrJ	r	J
r
Jr  SSKJr  SSKJr  SSKJrJr  SSKJrJr  SS	KJrJr  SS
KJr  SSKJrJr  / SQrS\R>                  \\4SSSSSSS.                       SS jjjr SS\R>                  \\4SSSSSSS.                         SS jjjr!g)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          
     x   [        U5        [        U5        [        X5      n[        US5      n[        US5      n[	        U	S5      n[	        U
S5      n[        U [        5      (       a  U O
[        U 5      n[        UUUUUUUS9nUS   R                  5       nU(       a  [        U5        U(       a  [        U5        U$ )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                     L/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/chardet/__init__.pyr   r   %   s    ^  
+	"./CUO!"35HIG!"35HIG!"35HIH35KLE!(E228hD!!""G QZ!F (6"M    c               4   [        U5        [        U5        [        X&5      n[        US5      n[        U	S5      n[	        U
S5      n[	        US5      n[        U [        5      (       a  U O
[        U 5      n[        UUUUUUUSS9nU Vs/ s H  nUR                  5       PM     nnU(       d*  U Vs/ s H  nUS   [        :  d  M  UPM     nnU(       a  UnU H)  nU(       a  [        U5        U(       d  M  [        U5        M+     [        US SS	9$ s  snf s  snf )
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                    U S   $ )Nr3    )ds    r/   <lambda>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UO!"35HIG!"35HIG!"35HIH35KLE!(E228hD!!""	G #**'QQYY['E*$Lu!,:K(KAuLE$Q'<q!	 
 %6EE +Ls   D/DD)r$   bytes | bytearrayr%   boolr&   r   r'   intr    rB   r   rA   r   rA   r   Iterable[str] | Noner   rC   r   strr   rD   returnr   )r$   r@   r<   rA   r%   rA   r&   r   r'   rB   r    rB   r   rA   r   rA   r   rC   r   rC   r   rD   r   rD   rE   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>rS      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   