Skip to content

Commit 63d6692

Browse files
committed
Add return types on functions
1 parent 4e80016 commit 63d6692

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ ignore = [
8989
"PLR0913", # Allow many arguments in function definition
9090
"PD901", # Allow variable name df
9191
# TODO: Enable all of the following, but this PR is getting too large already
92-
# "ANN001",
93-
"ANN202",
9492
"PTH",
9593
"N812",
9694
"INP001",
@@ -127,7 +125,7 @@ extend-allowed-calls = ["lit", "datafusion.lit"]
127125
"PLR0913",
128126
"PT004",
129127
]
130-
"examples/*" = ["D", "W505", "E501", "T201", "S101", "PLR2004", "ANN001"]
128+
"examples/*" = ["D", "W505", "E501", "T201", "S101", "PLR2004", "ANN001", "ANN202"]
131129
"dev/*" = ["D", "E", "T", "S", "PLR", "C", "SIM", "UP", "EXE", "N817", "ERA001", "ANN001"]
132130
"benchmarks/*" = ["D", "F", "T", "BLE", "FURB", "PLR", "E", "TD", "TRY", "S", "SIM", "EXE", "UP", "ERA001", "ANN001"]
133131
"docs/*" = ["D"]

python/datafusion/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ def literal(value: Any) -> Expr:
124124
return Expr.literal(value)
125125

126126

127-
def string_literal(value: str):
127+
def string_literal(value: str) -> Expr:
128128
"""Create a UTF8 literal expression.
129129
130130
It differs from `literal` which creates a UTF8view literal.
131131
"""
132132
return Expr.string_literal(value)
133133

134134

135-
def str_lit(value: str):
135+
def str_lit(value: str) -> Expr:
136136
"""Alias for `string_literal`."""
137137
return string_literal(value)
138138

python/datafusion/user_defined.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ def _decorator(
218218
volatility: Volatility | str,
219219
name: str | None = None,
220220
) -> Callable:
221-
def decorator(func: Callable):
221+
def decorator(func: Callable) -> Callable:
222222
udf_caller = ScalarUDF.udf(
223223
func, input_types, return_type, volatility, name
224224
)
225225

226226
@functools.wraps(func)
227-
def wrapper(*args: Any, **kwargs: Any):
227+
def wrapper(*args: Any, **kwargs: Any) -> Callable:
228228
return udf_caller(*args, **kwargs)
229229

230230
return wrapper

0 commit comments

Comments
 (0)