Skip to content

Commit

Permalink
call sum() without an intermediary list following PEP 289 recommendat…
Browse files Browse the repository at this point in the history
…ions (#129)
  • Loading branch information
adbar committed Oct 25, 2021
1 parent f1cf425 commit b89913a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charset_normalizer/cd.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charset_normalizer/md.py
Expand Up @@ -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
Expand Down

0 comments on commit b89913a

Please sign in to comment.