Skip to content

Commit

Permalink
🔥 Remove the warning (about small content) in favor of a simple loggi…
Browse files Browse the repository at this point in the history
…ng.warning (#92)

Raising a warning is a bit excessive and seems to bother more than it helped.
  • Loading branch information
Ousret committed Sep 13, 2021
1 parent 2ff1301 commit 28d3997
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions charset_normalizer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
PathLike = Union[str, "os.PathLike[str]"] # type: ignore

import logging
from warnings import warn

from .cd import (
coherence_ratio,
Expand Down Expand Up @@ -119,11 +118,17 @@ def from_bytes(
is_too_large_sequence = len(sequences) >= TOO_BIG_SEQUENCE # type: bool

if is_too_small_sequence:
warn(
logger.warning(
"Trying to detect encoding from a tiny portion of ({}) byte(s).".format(
length
)
)
elif is_too_large_sequence:
logger.info(
"Using lazy str decoding because the payload is quite large, ({}) byte(s).".format(
length
)
)

prioritized_encodings = [] # type: List[str]

Expand Down

0 comments on commit 28d3997

Please sign in to comment.