Skip to content

Commit dc08108

Browse files
committed
Enabled ruff rule ANN201
1 parent c774360 commit dc08108

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

benchmarks/db-benchmark/groupby-datafusion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
exec(open("./_helpers/helpers.py").read())
3838

3939

40-
def ans_shape(batches):
40+
def ans_shape(batches) -> tuple[int, int]:
4141
rows, cols = 0, 0
4242
for batch in batches:
4343
rows += batch.num_rows
@@ -48,7 +48,7 @@ def ans_shape(batches):
4848
return rows, cols
4949

5050

51-
def execute(df):
51+
def execute(df) -> list:
5252
print(df.execution_plan().display_indent())
5353
return df.collect()
5454

benchmarks/db-benchmark/join-datafusion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
exec(open("./_helpers/helpers.py").read())
3030

3131

32-
def ans_shape(batches):
32+
def ans_shape(batches) -> tuple[int, int]:
3333
rows, cols = 0, 0
3434
for batch in batches:
3535
rows += batch.num_rows

benchmarks/tpch/tpch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from datafusion import SessionContext
2222

2323

24-
def bench(data_path, query_path):
24+
def bench(data_path, query_path) -> None:
2525
with open("results.csv", "w") as results:
2626
# register tables
2727
start = time.time()

dev/release/generate-changelog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from github import Github
2525

2626

27-
def print_pulls(repo_name, title, pulls):
27+
def print_pulls(repo_name, title, pulls) -> None:
2828
if len(pulls) > 0:
2929
print(f"**{title}:**")
3030
print()
@@ -34,7 +34,7 @@ def print_pulls(repo_name, title, pulls):
3434
print()
3535

3636

37-
def generate_changelog(repo, repo_name, tag1, tag2, version):
37+
def generate_changelog(repo, repo_name, tag1, tag2, version) -> None:
3838
# get a list of commits between two tags
3939
print(f"Fetching list of commits between {tag1} and {tag2}", file=sys.stderr)
4040
comparison = repo.compare(tag1, tag2)
@@ -154,7 +154,7 @@ def generate_changelog(repo, repo_name, tag1, tag2, version):
154154
)
155155

156156

157-
def cli(args=None):
157+
def cli(args=None) -> None:
158158
"""Process command line arguments."""
159159
if not args:
160160
args = sys.argv[1:]

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
autoapi_python_class_content = "both"
7474

7575

76-
def autoapi_skip_member_fn(app, what, name, obj, skip, options): # noqa: ARG001
76+
def autoapi_skip_member_fn(app, what, name, obj, skip, options) -> bool: # noqa: ARG001
7777
skip_contents = [
7878
# Re-exports
7979
("class", "datafusion.DataFrame"),
@@ -93,7 +93,7 @@ def autoapi_skip_member_fn(app, what, name, obj, skip, options): # noqa: ARG001
9393
return skip
9494

9595

96-
def setup(sphinx):
96+
def setup(sphinx) -> None:
9797
sphinx.connect("autoapi-skip-member", autoapi_skip_member_fn)
9898

9999

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ignore = [
8686
# "EM101",
8787
"PLR0913",
8888
# "PLR1714",
89-
"ANN201",
89+
# "ANN201",
9090
"C400",
9191
"TRY003",
9292
"B904",

python/datafusion/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,17 @@
9292
]
9393

9494

95-
def column(value: str):
95+
def column(value: str) -> Expr:
9696
"""Create a column expression."""
9797
return Expr.column(value)
9898

9999

100-
def col(value: str):
100+
def col(value: str) -> Expr:
101101
"""Create a column expression."""
102102
return Expr.column(value)
103103

104104

105-
def literal(value):
105+
def literal(value) -> Expr:
106106
"""Create a literal expression."""
107107
return Expr.literal(value)
108108

@@ -120,6 +120,6 @@ def str_lit(value):
120120
return string_literal(value)
121121

122122

123-
def lit(value):
123+
def lit(value) -> Expr:
124124
"""Create a literal expression."""
125125
return Expr.literal(value)

python/datafusion/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ def from_polars(self, data: polars.DataFrame, name: str | None = None) -> DataFr
719719

720720
# https://github.com/apache/datafusion-python/pull/1016#discussion_r1983239116
721721
# is the discussion on how we arrived at adding register_view
722-
def register_view(self, name: str, df: DataFrame):
722+
def register_view(self, name: str, df: DataFrame) -> None:
723723
"""Register a :py:class: `~datafusion.detaframe.DataFrame` as a view.
724724
725725
Args:

python/datafusion/expr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ def get_lower_bound(self) -> WindowFrameBound:
708708
"""Returns starting bound."""
709709
return WindowFrameBound(self.window_frame.get_lower_bound())
710710

711-
def get_upper_bound(self):
711+
def get_upper_bound(self) -> WindowFrameBound:
712712
"""Returns end bound."""
713713
return WindowFrameBound(self.window_frame.get_upper_bound())
714714

0 commit comments

Comments
 (0)