
    3j                    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 ISO subset encodings to their
        Windows/CP superset equivalents (e.g., ISO-8859-1 -> Windows-1252).
    :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                     =/DATA/.local/lib/python3.12/site-packages/chardet/__init__.pyr   r   %   s    L  
+	"./C_UO!"35HIG!"35HIG!"35HIH35KLE!(E28hD!!""G QZ!F (6"M    c          	        t        |       t        |       t        ||      }t        |d      }t        |	d      }t	        |
d      }t	        |d      }t        | t              r| n
t        |       }t        |||||||      }|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 )
aV  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 ISO subset encodings to their
        Windows/CP superset equivalents.
    :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   r    
confidencec                    | d   S )Nr3    )ds    r0   <lambda>zdetect_all.<locals>.<lambda>   s    qr1   T)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                         r0   r   r   d   s   Z  
+	"./C_UO!"35HIG!"35HIG!"35HIH35KLE!(E28hD!!""G #**'QQYY['E*$Lu!,:K(KAuLE$Q'q!	 
 %6EE +Ls   C2%C77C7)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.equivalencesr   r   chardet.pipeliner   r   chardet.pipeline.orchestratorr   chardet.registryr   r   __all__ALLr   r   r5   r1   r0   <module>rR      s   F " $  ) . 5 M ; 6 D  "' +)&< ".2.2% '<<< < 	<
 < < < ,< ,< < < <B #!& +)&HF ".2.2% 'HFHFHF HF 	HF
 HF HF HF HF ,HF ,HF HF HF HFr1   