Skip to content

Commit 176fdfa

Browse files
committed
fix mypy findings
1 parent 2d31dce commit 176fdfa

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/flask/helpers.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,21 @@ def get_load_dotenv(default: bool = True) -> bool:
4747
return val.lower() in ("0", "false", "no")
4848

4949

50+
@t.overload
51+
def stream_with_context(
52+
generator_or_function: t.Iterator[t.AnyStr],
53+
) -> t.Iterator[t.AnyStr]: ...
54+
55+
56+
@t.overload
57+
def stream_with_context(
58+
generator_or_function: t.Callable[..., t.Iterator[t.AnyStr]],
59+
) -> t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]: ...
60+
61+
5062
def stream_with_context(
5163
generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]],
52-
) -> t.Iterator[t.AnyStr]:
64+
) -> t.Iterator[t.AnyStr] | t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]:
5365
"""Request contexts disappear when the response is started on the server.
5466
This is done for efficiency reasons and to make it less likely to encounter
5567
memory leaks with badly written WSGI middlewares. The downside is that if

src/flask/json/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _default(o: t.Any) -> t.Any:
113113
return str(o)
114114

115115
if dataclasses and dataclasses.is_dataclass(o):
116-
return dataclasses.asdict(o)
116+
return dataclasses.asdict(o) # type: ignore[call-overload]
117117

118118
if hasattr(o, "__html__"):
119119
return str(o.__html__())

0 commit comments

Comments
 (0)