Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing some performance bottlenecks #183

Merged
merged 14 commits into from
May 3, 2022
Prev Previous commit
Next Next commit
Update md.py
  • Loading branch information
deedy5 authored May 1, 2022
commit f4ba8f816b9084492ec2d3ed7368d6d459d22b98
5 changes: 3 additions & 2 deletions charset_normalizer/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self) -> None:

def eligible(self, character: str) -> bool:
return True

def feed(self, character: str) -> None:
if is_unprintable(character):
self._unprintable_count += 1
Expand All @@ -164,7 +164,7 @@ def __init__(self) -> None:

def eligible(self, character: str) -> bool:
return character.isalpha() and is_latin(character)

def feed(self, character: str) -> None:
self._character_count += 1
if (
Expand Down Expand Up @@ -442,6 +442,7 @@ def ratio(self) -> float:

return self._successive_upper_lower_count_final / self._character_count


@lru_cache(maxsize=1024)
def is_suspiciously_successive_range(
unicode_range_a: Optional[str], unicode_range_b: Optional[str]
Expand Down