forked from orbit-oss/flask
fix pyright type errors
This commit is contained in:
parent
5e8cb74018
commit
9e831e915f
10 changed files with 22 additions and 19 deletions
|
|
@ -59,6 +59,7 @@ if t.TYPE_CHECKING: # pragma: no cover
|
|||
|
||||
from .testing import FlaskClient
|
||||
from .testing import FlaskCliRunner
|
||||
from .typing import HeadersValue
|
||||
|
||||
T_shell_context_processor = t.TypeVar(
|
||||
"T_shell_context_processor", bound=ft.ShellContextProcessorCallable
|
||||
|
|
@ -349,7 +350,7 @@ class Flask(App):
|
|||
path = os.path.join(self.root_path, resource)
|
||||
|
||||
if mode == "rb":
|
||||
return open(path, mode)
|
||||
return open(path, mode) # pyright: ignore
|
||||
|
||||
return open(path, mode, encoding=encoding)
|
||||
|
||||
|
|
@ -1163,7 +1164,8 @@ class Flask(App):
|
|||
response object.
|
||||
"""
|
||||
|
||||
status = headers = None
|
||||
status: int | None = None
|
||||
headers: HeadersValue | None = None
|
||||
|
||||
# unpack tuple returns
|
||||
if isinstance(rv, tuple):
|
||||
|
|
@ -1175,7 +1177,7 @@ class Flask(App):
|
|||
# decide if a 2-tuple has status or headers
|
||||
elif len_rv == 2:
|
||||
if isinstance(rv[1], (Headers, dict, tuple, list)):
|
||||
rv, headers = rv
|
||||
rv, headers = rv # pyright: ignore
|
||||
else:
|
||||
rv, status = rv # type: ignore[assignment,misc]
|
||||
# other sized tuples are not allowed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue