# Path: charset_normalizer/constant.py
# IANA_SUPPORTED = sorted(
#     filter(
#         lambda x: x.endswith("_codec") is False
#         and x not in {"rot_13", "tactis", "mbcs"},
#         list(set(aliases.values())),
#     )
# )  # type: List[str]
# 
# TOO_BIG_SEQUENCE = int(10e6)  # type: int
# 
# TOO_SMALL_SEQUENCE = 32  # type: int
# 
# TRACE = 5  # type: int
# 
# Path: charset_normalizer/md.py
# @lru_cache(maxsize=2048)
# def mess_ratio(
#     decoded_sequence: str, maximum_threshold: float = 0.2, debug: bool = False
# ) -> float:
#     """
#     Compute a mess ratio given a decoded bytes sequence. The maximum threshold does stop the computation earlier.
#     """
# 
#     detectors = [
#         md_class() for md_class in MessDetectorPlugin.__subclasses__()
#     ]  # type: List[MessDetectorPlugin]
# 
#     length = len(decoded_sequence) + 1  # type: int
# 
#     mean_mess_ratio = 0.0  # type: float
# 
#     if length < 512:
#         intermediary_mean_mess_ratio_calc = 32  # type: int
#     elif length <= 1024:
#         intermediary_mean_mess_ratio_calc = 64
#     else:
#         intermediary_mean_mess_ratio_calc = 128
# 
#     for character, index in zip(decoded_sequence + "\n", range(length)):
#         for detector in detectors:
#             if detector.eligible(character):
#                 detector.feed(character)
# 
#         if (
#             index > 0 and index % intermediary_mean_mess_ratio_calc == 0
#         ) or index == length - 1:
#             mean_mess_ratio = sum(dt.ratio for dt in detectors)
# 
#             if mean_mess_ratio >= maximum_threshold:
#                 break
# 
#     if debug:
#         for dt in detectors:  # pragma: nocover
#             print(dt.__class__, dt.ratio)
# 
#     return round(mean_mess_ratio, 3)


import logging
from os.path import basename, splitext
from typing import BinaryIO, List, Optional, Set
    from os import PathLike
from .cd import (
    coherence_ratio,
    encoding_languages,
    mb_encoding_languages,
    merge_coherence_ratios,
)
from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE
from .md import mess_ratio
from .models import CharsetMatch, CharsetMatches
from .utils import (
    any_specified_encoding,
    iana_name,
    identify_sig_or_bom,
    is_cp_similar,
    is_multi_byte_encoding,
    should_strip_sig_or_bom,
)
        cp_isolation = [iana_name(cp, False) for cp in cp_isolation]
    else:
        cp_isolation = []

    if cp_exclusion is not None:
        logger.log(
            TRACE,
            "cp_exclusion is set. use this flag for debugging purpose. "
            "limited list of encoding excluded : %s.",
            ", ".join(cp_exclusion),
        )
        cp_exclusion = [iana_name(cp, False) for cp in cp_exclusion]
    else:
        cp_exclusion = []

    if length <= (chunk_size * steps):
        logger.log(
            TRACE,
            "override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.",
            steps,
            chunk_size,
            length,
        )
        steps = 1
        chunk_size = length

    if steps > 1 and length / steps < chunk_size:
        chunk_size = int(length / steps)

    is_too_small_sequence = len(sequences) < TOO_SMALL_SEQUENCE  # type: bool

# Path: charset_normalizer/constant.py
# IANA_SUPPORTED = sorted(
#     filter(
#         lambda x: x.endswith("_codec") is False
#         and x not in {"rot_13", "tactis", "mbcs"},
#         list(set(aliases.values())),
#     )
# )  # type: List[str]
# 
# TOO_BIG_SEQUENCE = int(10e6)  # type: int
# 
# TOO_SMALL_SEQUENCE = 32  # type: int
# 
# TRACE = 5  # type: int
# 
# Path: charset_normalizer/md.py
# @lru_cache(maxsize=2048)
# def mess_ratio(
#     decoded_sequence: str, maximum_threshold: float = 0.2, debug: bool = False
# ) -> float:
#     """
#     Compute a mess ratio given a decoded bytes sequence. The maximum threshold does stop the computation earlier.
#     """
# 
#     detectors = [
#         md_class() for md_class in MessDetectorPlugin.__subclasses__()
#     ]  # type: List[MessDetectorPlugin]
# 
#     length = len(decoded_sequence) + 1  # type: int
# 
#     mean_mess_ratio = 0.0  # type: float
# 
#     if length < 512:
#         intermediary_mean_mess_ratio_calc = 32  # type: int
#     elif length <= 1024:
#         intermediary_mean_mess_ratio_calc = 64
#     else:
#         intermediary_mean_mess_ratio_calc = 128
# 
#     for character, index in zip(decoded_sequence + "\n", range(length)):
#         for detector in detectors:
#             if detector.eligible(character):
#                 detector.feed(character)
# 
#         if (
#             index > 0 and index % intermediary_mean_mess_ratio_calc == 0
#         ) or index == length - 1:
#             mean_mess_ratio = sum(dt.ratio for dt in detectors)
# 
#             if mean_mess_ratio >= maximum_threshold:
#                 break
# 
#     if debug:
#         for dt in detectors:  # pragma: nocover
#             print(dt.__class__, dt.ratio)
# 
#     return round(mean_mess_ratio, 3)


# Path: charset_normalizer/api.py
import logging
from os.path import basename, splitext
from typing import BinaryIO, List, Optional, Set
    from os import PathLike
from .cd import (
    coherence_ratio,
    encoding_languages,
    mb_encoding_languages,
    merge_coherence_ratios,
)
from .constant import IANA_SUPPORTED, TOO_BIG_SEQUENCE, TOO_SMALL_SEQUENCE, TRACE
from .md import mess_ratio
from .models import CharsetMatch, CharsetMatches
from .utils import (
    any_specified_encoding,
    iana_name,
    identify_sig_or_bom,
    is_cp_similar,
    is_multi_byte_encoding,
    should_strip_sig_or_bom,
)

        cp_isolation = [iana_name(cp, False) for cp in cp_isolation]
    else:
        cp_isolation = []

    if cp_exclusion is not None:
        logger.log(
            TRACE,
            "cp_exclusion is set. use this flag for debugging purpose. "
            "limited list of encoding excluded : %s.",
            ", ".join(cp_exclusion),
        )
        cp_exclusion = [iana_name(cp, False) for cp in cp_exclusion]
    else:
        cp_exclusion = []

    if length <= (chunk_size * steps):
        logger.log(
            TRACE,
            "override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.",
            steps,
            chunk_size,
            length,
        )
        steps = 1
        chunk_size = length

    if steps > 1 and length / steps < chunk_size:
        chunk_size = int(length / steps)

    is_too_small_sequence = len(sequences) < TOO_SMALL_SEQUENCE  # type: bool

    is_too_large_sequence = len(sequences) >= TOO_BIG_SEQUENCE  # type: bool