Skip to content

Commit 0d7f1e1

Browse files
[pre-commit.ci lite] apply automatic fixes
1 parent b175327 commit 0d7f1e1

10 files changed

Lines changed: 23 additions & 25 deletions

File tree

src/quart/asgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from functools import partial
66
from typing import AnyStr
77
from typing import cast
8-
from typing import Optional
98
from typing import TYPE_CHECKING
109
from urllib.parse import urlparse
1110

@@ -110,7 +109,7 @@ async def handle_request(self, request: Request, send: ASGISendCallable) -> None
110109
response = await _handle_exception(self.app, error)
111110

112111
if isinstance(response, Response) and response.timeout != Ellipsis:
113-
timeout = cast(Optional[float], response.timeout)
112+
timeout = cast(float | None, response.timeout)
114113
else:
115114
timeout = self.app.config["RESPONSE_TIMEOUT"]
116115
try:

src/quart/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import re
1111
import sys
1212
import traceback
13+
from collections.abc import Callable
1314
from importlib import import_module
1415
from operator import attrgetter
1516
from types import ModuleType
1617
from typing import Any
17-
from typing import Callable
1818
from typing import TYPE_CHECKING
1919

2020
import click

src/quart/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

33
import json
4+
from collections.abc import Callable
45
from typing import Any
5-
from typing import Callable
66

77
from flask.config import Config as FlaskConfig # noqa: F401
88
from flask.config import ConfigAttribute as ConfigAttribute # noqa: F401

src/quart/ctx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import annotations
22

33
import sys
4+
from collections.abc import Callable
45
from contextvars import Token
56
from functools import wraps
67
from types import TracebackType
78
from typing import Any
8-
from typing import Callable
99
from typing import cast
1010
from typing import TYPE_CHECKING
1111

src/quart/formparser.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from __future__ import annotations
22

33
from collections.abc import Awaitable
4+
from collections.abc import Callable
45
from typing import Any
5-
from typing import Callable
66
from typing import cast
77
from typing import IO
88
from typing import NoReturn
9-
from typing import Optional
109
from typing import TYPE_CHECKING
1110
from urllib.parse import parse_qsl
1211

@@ -28,12 +27,12 @@
2827
from .wrappers.request import Body
2928

3029
StreamFactory = Callable[
31-
[Optional[int], Optional[str], Optional[str], Optional[int]],
30+
[int | None, str | None, str | None, int | None],
3231
IO[bytes],
3332
]
3433

3534
ParserFunc = Callable[
36-
["FormDataParser", "Body", str, Optional[int], dict[str, str]],
35+
["FormDataParser", "Body", str, int | None, dict[str, str]],
3736
Awaitable[tuple[MultiDict, MultiDict]],
3837
]
3938

src/quart/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import pkgutil
66
import sys
7+
from collections.abc import Callable
78
from collections.abc import Iterable
89
from datetime import datetime
910
from datetime import timedelta
@@ -13,7 +14,6 @@
1314
from io import BytesIO
1415
from pathlib import Path
1516
from typing import Any
16-
from typing import Callable
1717
from typing import cast
1818
from typing import NoReturn
1919
from zlib import adler32

src/quart/typing.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
from collections.abc import AsyncGenerator
66
from collections.abc import Awaitable
7+
from collections.abc import Callable
78
from collections.abc import Iterator
89
from collections.abc import Mapping
910
from collections.abc import Sequence
@@ -14,7 +15,6 @@
1415
from types import TracebackType
1516
from typing import Any
1617
from typing import AnyStr
17-
from typing import Callable
1818
from typing import Optional
1919
from typing import TYPE_CHECKING
2020
from typing import Union
@@ -84,26 +84,26 @@
8484
]
8585
AfterServingCallable = Union[Callable[[], None], Callable[[], Awaitable[None]]]
8686
AfterWebsocketCallable = Union[
87-
Callable[[Optional[ResponseTypes]], Optional[ResponseTypes]],
88-
Callable[[Optional[ResponseTypes]], Awaitable[Optional[ResponseTypes]]],
87+
Callable[[ResponseTypes | None], ResponseTypes | None],
88+
Callable[[ResponseTypes | None], Awaitable[ResponseTypes | None]],
8989
]
9090
BeforeRequestCallable = Union[
91-
Callable[[], Optional[ResponseReturnValue]],
92-
Callable[[], Awaitable[Optional[ResponseReturnValue]]],
91+
Callable[[], ResponseReturnValue | None],
92+
Callable[[], Awaitable[ResponseReturnValue | None]],
9393
]
9494
BeforeServingCallable = Union[Callable[[], None], Callable[[], Awaitable[None]]]
9595
BeforeWebsocketCallable = Union[
96-
Callable[[], Optional[ResponseReturnValue]],
97-
Callable[[], Awaitable[Optional[ResponseReturnValue]]],
96+
Callable[[], ResponseReturnValue | None],
97+
Callable[[], Awaitable[ResponseReturnValue | None]],
9898
]
9999
ErrorHandlerCallable = Union[
100100
Callable[[Any], ResponseReturnValue],
101101
Callable[[Any], Awaitable[ResponseReturnValue]],
102102
]
103103
ShellContextProcessorCallable = Callable[[], dict[str, Any]]
104104
TeardownCallable = Union[
105-
Callable[[Optional[BaseException]], None],
106-
Callable[[Optional[BaseException]], Awaitable[None]],
105+
Callable[[BaseException | None], None],
106+
Callable[[BaseException | None], Awaitable[None]],
107107
]
108108
TemplateContextProcessorCallable = Union[
109109
Callable[[], dict[str, Any]], Callable[[], Awaitable[dict[str, Any]]]
@@ -112,16 +112,16 @@
112112
TemplateGlobalCallable = Callable[[Any], Any]
113113
TemplateTestCallable = Callable[[Any], bool]
114114
URLDefaultCallable = Callable[[str, dict], None]
115-
URLValuePreprocessorCallable = Callable[[Optional[str], Optional[dict]], None]
115+
URLValuePreprocessorCallable = Callable[[str | None, dict | None], None]
116116
WhileServingCallable = Callable[[], AsyncGenerator[None, None]]
117117

118118
RouteCallable = Union[
119119
Callable[..., ResponseReturnValue],
120120
Callable[..., Awaitable[ResponseReturnValue]],
121121
]
122122
WebsocketCallable = Union[
123-
Callable[..., Optional[ResponseReturnValue]],
124-
Callable[..., Awaitable[Optional[ResponseReturnValue]]],
123+
Callable[..., ResponseReturnValue | None],
124+
Callable[..., Awaitable[ResponseReturnValue | None]],
125125
]
126126

127127

src/quart/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable
34
from collections.abc import Collection
45
from typing import Any
5-
from typing import Callable
66
from typing import ClassVar
77

88
from .globals import current_app

src/quart/wrappers/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import asyncio
44
from collections.abc import Awaitable
5+
from collections.abc import Callable
56
from collections.abc import Generator
67
from typing import Any
7-
from typing import Callable
88
from typing import Literal
99
from typing import NoReturn
1010
from typing import overload

src/quart/wrappers/websocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import annotations
22

33
import asyncio
4+
from collections.abc import Callable
45
from typing import Any
56
from typing import AnyStr
6-
from typing import Callable
77

88
from hypercorn.typing import WebsocketScope
99
from werkzeug.datastructures import Headers

0 commit comments

Comments
 (0)