From b89913a759fabcb06cd5048878752d1af9a6fcf5 Mon Sep 17 00:00:00 2001 From: Adrien Barbaresi Date: Mon, 25 Oct 2021 14:28:06 +0200 Subject: [PATCH] call sum() without an intermediary list following PEP 289 recommendations (#129) --- charset_normalizer/cd.py | 2 +- charset_normalizer/md.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charset_normalizer/cd.py b/charset_normalizer/cd.py index 47044c03..9053d601 100644 --- a/charset_normalizer/cd.py +++ b/charset_normalizer/cd.py @@ -324,7 +324,7 @@ def coherence_ratio( sequence_frequencies = Counter(layer) # type: Counter most_common = sequence_frequencies.most_common() - character_count = sum([o for c, o in most_common]) # type: int + character_count = sum(o for c, o in most_common) # type: int if character_count <= TOO_SMALL_SEQUENCE: continue diff --git a/charset_normalizer/md.py b/charset_normalizer/md.py index 668ee780..622d48c2 100644 --- a/charset_normalizer/md.py +++ b/charset_normalizer/md.py @@ -538,7 +538,7 @@ def mess_ratio( 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]) + mean_mess_ratio = sum(dt.ratio for dt in detectors) if mean_mess_ratio >= maximum_threshold: break