Skip to content

Commit d65d2b6

Browse files
committed
Ruff C417: changed map() to comprehensions and generator where possible
1 parent 16fcbbc commit d65d2b6

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

tests/fast/arrow/test_7652.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_7652(self, duckdb_cursor):
3535

3636
# Attempt to perform the same thing with duckdb.
3737
print("Retrieving from duckdb")
38-
duckdb_result = list(map(lambda v: v[0], duckdb_cursor.sql(f"select * from '{temp_file_name}'").fetchall()))
38+
duckdb_result = [v[0] for v in duckdb_cursor.sql(f"select * from '{temp_file_name}'").fetchall()]
3939

4040
print("DuckDB result:", duckdb_result)
4141
assert min(duckdb_result) == min(generated_list)

tests/fast/relational_api/test_rapi_aggregations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def test_quantile_cont(self, table):
321321
assert len(result) == len(expected)
322322
assert all(r == e for r, e in zip(result, expected))
323323
result = [
324-
list(map(lambda x: round(x, 2), r[0])) for r in table.quantile_cont("v", q=[0.1, 0.5]).execute().fetchall()
324+
[round(x, 2) for x in r[0]] for r in table.quantile_cont("v", q=[0.1, 0.5]).execute().fetchall()
325325
]
326326
expected = [[0.2, 2.0]]
327327
assert len(result) == len(expected)
@@ -331,7 +331,7 @@ def test_quantile_cont(self, table):
331331
assert len(result) == len(expected)
332332
assert all(r == e for r, e in zip(result, expected))
333333
result = [
334-
(r[0], list(map(lambda x: round(x, 2), r[1])))
334+
(r[0], [round(x, 2) for x in r[1]])
335335
for r in table.quantile_cont("v", q=[0.2, 0.5], groups="id", projected_columns="id")
336336
.order("id")
337337
.execute()

tests/fast/relational_api/test_rapi_windows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def test_quantile_cont(self, table):
680680
assert len(result) == len(expected)
681681
assert all(r == e for r, e in zip(result, expected))
682682
result = [
683-
(r[0], list(map(lambda x: round(x, 2), r[1])) if r[1] is not None else None)
683+
(r[0], [round(x, 2) for x in r[1]] if r[1] is not None else None)
684684
for r in table.quantile_cont(
685685
"v",
686686
q=[0.2, 0.5],

tests/fast/spark/test_spark_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_dataframe_from_rows(self, spark):
152152
columns = ["language", "users_count"]
153153
data = [("Java", "20000"), ("Python", "100000"), ("Scala", "3000")]
154154

155-
rowData = map(lambda x: Row(*x), data)
155+
rowData = (Row(*x) for x in data)
156156
df = spark.createDataFrame(rowData, columns)
157157
res = df.collect()
158158
assert res == [

0 commit comments

Comments
 (0)