Skip to content

Commit 3094ca9

Browse files
committed
Merge pull request #1081 from practicalswift/unnecessary-list-comprehensions
[gardening] Avoid unnecessary list comprehensions
2 parents 4023896 + e0fdba9 commit 3094ca9

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

utils/GYBUnicodeDataUtils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,13 @@ def serialize(self, unicode_property):
407407
self.supp_lookup2_bytes_per_entry = 1 if len(self.supp_data) < 256 else 2
408408
self.supp_data_bytes_per_entry = 1
409409

410-
BMP_lookup_words = [elt for elt in self.BMP_lookup]
410+
BMP_lookup_words = list(self.BMP_lookup)
411411
BMP_data_words = [
412412
unicode_property.to_numeric_value(elt)
413413
for block in self.BMP_data
414414
for elt in block]
415415

416-
supp_lookup1_words = [elt for elt in self.supp_lookup1]
416+
supp_lookup1_words = list(self.supp_lookup1)
417417
supp_lookup2_words = [elt for block in self.supp_lookup2 for elt in block]
418418
supp_data_words = [
419419
unicode_property.to_numeric_value(elt)

utils/name-compression/CBCGen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def addLine(line):
105105
# notice that Y and J are missing because they are escape chars:
106106
charset = r"0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXZ$"
107107
# alphabet without the escape chars.
108-
encoders = [c for c in charset]
108+
encoders = list(charset)
109109
enc_len = len(encoders)
110110

111111
# Take the most frequent entries from the table that fit into the range of

utils/pass-pipeline/scripts/pipeline_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import pass_pipeline_library
1313
import passes
1414

15-
normal_pipeline = [x for x in pass_pipeline_library.normal_passpipelines()]
15+
normal_pipeline = list(pass_pipeline_library.normal_passpipelines())
1616
pass_pipelines = [x.identifier for x in normal_pipeline]
1717

1818
parser = argparse.ArgumentParser(description=textwrap.dedent("""

utils/pre-commit-benchmark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def compareTimingsFiles(file1, file2):
222222
scores1, runs1 = getScores(file1)
223223
scores2, runs2 = getScores(file2)
224224
runs = min(runs1, runs2)
225-
keys = [f for f in set(scores1.keys() + scores2.keys())]
225+
keys = list(set(scores1.keys() + scores2.keys()))
226226
if VERBOSE:
227227
print(scores1)
228228
print(scores2)

0 commit comments

Comments
 (0)