Skip to content

Commit 9e15805

Browse files
committed
Fix mypy
1 parent 4972815 commit 9e15805

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

providers/common/ai/src/airflow/providers/common/ai/utils/function_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def extract_function_description(fn: Callable[..., Any]) -> str:
8080
or type(fn).__name__
8181
)
8282

83-
return _first_docstring_paragraph(fn) or fn.__name__ # type: ignore[return-value]
83+
return _first_docstring_paragraph(fn) or fn.__name__
8484

8585

8686
def build_function_json_schema(fn: Callable[..., Any]) -> dict[str, Any]:

providers/common/ai/tests/unit/common/ai/utils/test_function_schema.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# ---------------------------------------------------------------------------
3535

3636

37-
def _plain(x: int, y: str = "hi") -> str:
37+
def _plain(x: int, y: str = "hi") -> str: # type: ignore[empty-body]
3838
"""Do something useful.
3939
4040
Args:
@@ -46,22 +46,22 @@ def _plain(x: int, y: str = "hi") -> str:
4646
"""
4747

4848

49-
def _no_doc(x: int) -> str:
49+
def _no_doc(x: int) -> str: # type: ignore[empty-body]
5050
pass
5151

5252

5353
def _no_params() -> None:
5454
"""No parameters at all."""
5555

5656

57-
def _annotated(q: Annotated[str, "The search query"], limit: Annotated[int, "Max results"] = 10) -> list:
57+
def _annotated(q: Annotated[str, "The search query"], limit: Annotated[int, "Max results"] = 10) -> list: # type: ignore[empty-body]
5858
"""Search."""
5959

6060

6161
class _CallableObj:
6262
"""Callable object used to test non-function callables."""
6363

64-
def __call__(self, value: str) -> str:
64+
def __call__(self, value: str) -> str: # type: ignore[empty-body]
6565
"""Process value."""
6666

6767

@@ -96,13 +96,13 @@ def test_callable_object_falls_back_to_class_docstring(self):
9696
class _NoCallDoc:
9797
"""Describes the class."""
9898

99-
def __call__(self, x: int) -> int: ...
99+
def __call__(self, x: int) -> int: ... # type: ignore[empty-body]
100100

101101
assert extract_function_description(_NoCallDoc()) == "Describes the class."
102102

103103
def test_callable_object_falls_back_to_class_name(self):
104104
class _NoDocs:
105-
def __call__(self, x: int) -> int: ...
105+
def __call__(self, x: int) -> int: ... # type: ignore[empty-body]
106106

107107
assert extract_function_description(_NoDocs()) == "_NoDocs"
108108

@@ -270,15 +270,15 @@ def test_additional_properties_stripped(self):
270270
assert "additionalProperties" not in schema
271271

272272
def test_partial_positional_bind_removes_param(self):
273-
def add(a: int, b: int) -> int: ...
273+
def add(a: int, b: int) -> int: ... # type: ignore[empty-body]
274274

275275
p = functools.partial(add, 1)
276276
schema = build_function_json_schema(p)
277277
assert "a" not in schema.get("properties", {})
278278
assert "b" in schema["properties"]
279279

280280
def test_partial_keyword_bind_keeps_param_as_optional(self):
281-
def add(a: int, b: int) -> int: ...
281+
def add(a: int, b: int) -> int: ... # type: ignore[empty-body]
282282

283283
p = functools.partial(add, a=1)
284284
schema = build_function_json_schema(p)
@@ -287,7 +287,7 @@ def add(a: int, b: int) -> int: ...
287287
assert "b" in schema["required"]
288288

289289
def test_nested_partial_unwraps_hint_source(self):
290-
def fn(x: int, y: str) -> str: ...
290+
def fn(x: int, y: str) -> str: ... # type: ignore[empty-body]
291291

292292
p = functools.partial(functools.partial(fn, 1), "hello")
293293
schema = build_function_json_schema(p)

0 commit comments

Comments
 (0)