forked from orbit-oss/flask
fix mypy findings
This commit is contained in:
parent
2d31dce826
commit
176fdfa000
2 changed files with 14 additions and 2 deletions
|
|
@ -47,9 +47,21 @@ def get_load_dotenv(default: bool = True) -> bool:
|
||||||
return val.lower() in ("0", "false", "no")
|
return val.lower() in ("0", "false", "no")
|
||||||
|
|
||||||
|
|
||||||
|
@t.overload
|
||||||
|
def stream_with_context(
|
||||||
|
generator_or_function: t.Iterator[t.AnyStr],
|
||||||
|
) -> t.Iterator[t.AnyStr]: ...
|
||||||
|
|
||||||
|
|
||||||
|
@t.overload
|
||||||
|
def stream_with_context(
|
||||||
|
generator_or_function: t.Callable[..., t.Iterator[t.AnyStr]],
|
||||||
|
) -> t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]: ...
|
||||||
|
|
||||||
|
|
||||||
def stream_with_context(
|
def stream_with_context(
|
||||||
generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]],
|
generator_or_function: t.Iterator[t.AnyStr] | t.Callable[..., t.Iterator[t.AnyStr]],
|
||||||
) -> t.Iterator[t.AnyStr]:
|
) -> t.Iterator[t.AnyStr] | t.Callable[[t.Iterator[t.AnyStr]], t.Iterator[t.AnyStr]]:
|
||||||
"""Request contexts disappear when the response is started on the server.
|
"""Request contexts disappear when the response is started on the server.
|
||||||
This is done for efficiency reasons and to make it less likely to encounter
|
This is done for efficiency reasons and to make it less likely to encounter
|
||||||
memory leaks with badly written WSGI middlewares. The downside is that if
|
memory leaks with badly written WSGI middlewares. The downside is that if
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ def _default(o: t.Any) -> t.Any:
|
||||||
return str(o)
|
return str(o)
|
||||||
|
|
||||||
if dataclasses and dataclasses.is_dataclass(o):
|
if dataclasses and dataclasses.is_dataclass(o):
|
||||||
return dataclasses.asdict(o)
|
return dataclasses.asdict(o) # type: ignore[call-overload]
|
||||||
|
|
||||||
if hasattr(o, "__html__"):
|
if hasattr(o, "__html__"):
|
||||||
return str(o.__html__())
|
return str(o.__html__())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue