diff --git a/CHANGELOG.md b/CHANGELOG.md index eba4d0dd..43530e17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,11 @@ All notable changes to charset-normalizer will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [3.3.3](https://github.com/Ousret/charset_normalizer/compare/3.3.2...master) (2024-09-??) +## [3.4.0](https://github.com/Ousret/charset_normalizer/compare/3.3.2...master) (2024-10-08) ### Added - Argument `--no-preemptive` in the CLI to prevent the detector to search for hints. +- Support for Python 3.13 (#512) ### Fixed - Relax the TypeError exception thrown when trying to compare a CharsetMatch with anything else than a CharsetMatch. diff --git a/build-requirements.txt b/build-requirements.txt index 41627ccd..b4a8a406 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -4,5 +4,5 @@ mypy==1.11.2; python_version >= '3.8' and python_version < '3.13' mypy==1.12.0; python_version >= '3.13' mypy==1.4.1; python_version < '3.8' -build==0.10.0 +build>=0.10.0,<2 wheel==0.42.0 diff --git a/charset_normalizer/api.py b/charset_normalizer/api.py index 70a90182..e3f2283b 100644 --- a/charset_normalizer/api.py +++ b/charset_normalizer/api.py @@ -456,6 +456,17 @@ def from_bytes( encoding_iana in [specified_encoding, "ascii", "utf_8"] and mean_mess_ratio < 0.1 ): + # If md says nothing to worry about, then... stop immediately! + if mean_mess_ratio == 0.0: + logger.debug( + "Encoding detection: %s is most likely the one.", + current_match.encoding, + ) + if explain: + logger.removeHandler(explain_handler) + logger.setLevel(previous_logger_level) + return CharsetMatches([current_match]) + early_stop_results.append(current_match) if ( diff --git a/charset_normalizer/version.py b/charset_normalizer/version.py index 709140e5..699990ee 100644 --- a/charset_normalizer/version.py +++ b/charset_normalizer/version.py @@ -2,5 +2,5 @@ Expose version """ -__version__ = "3.3.3" +__version__ = "3.4.0" VERSION = __version__.split(".") diff --git a/dev-requirements.txt b/dev-requirements.txt index f4004bcd..12c2ebfd 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,7 +4,7 @@ chardet==5.1.0 isort==5.11.4 codecov==2.1.13 pytest-cov==4.1.0 -build==0.10.0 +build>=0.10.0,<2 wheel==0.42.0 black==23.3.0 mypy==1.11.2; python_version >= '3.8' and python_version < '3.13' diff --git a/setup.cfg b/setup.cfg index 37895a0e..3eb71fa8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ long_description_content_type = text/markdown keywords = encoding, charset, charset-detector, detector, normalization, unicode, chardet, detect url = https://github.com/Ousret/charset_normalizer license = MIT -author_email = ahmed.tahri@cloudnursery.dev +author_email = tahri.ahmed@proton.me author = Ahmed TAHRI project_urls = Bug Reports = https://github.com/Ousret/charset_normalizer/issues