Skip to content

Commit 6dd2f77

Browse files
committed
Code format
1 parent e66c915 commit 6dd2f77

40 files changed

Lines changed: 317 additions & 323 deletions

emmett_core/_emmett_core.pyi

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Dict, Iterator, Optional, Tuple
1+
from typing import Any
2+
from collections.abc import Iterator
23

34
__version__: str
45

@@ -20,35 +21,33 @@ def pbkdf2_sha512(data: bytes, salt: bytes, rounds: int, klen: int) -> bytes: ..
2021

2122
#: routing
2223
class HTTPRouter:
23-
def add_static_route(
24-
self, route, path: str, method: str, host: Optional[str] = None, scheme: Optional[str] = None
25-
): ...
24+
def add_static_route(self, route, path: str, method: str, host: str | None = None, scheme: str | None = None): ...
2625
def add_re_route(
2726
self,
2827
route,
2928
rule: str,
30-
rgtmap: Dict[str, str],
29+
rgtmap: dict[str, str],
3130
method: str,
32-
host: Optional[str] = None,
33-
scheme: Optional[str] = None,
31+
host: str | None = None,
32+
scheme: str | None = None,
3433
): ...
35-
def match_route_direct(self, method: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
36-
def match_route_scheme(self, scheme: str, method: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
37-
def match_route_host(self, host: str, method: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
38-
def match_route_all(self, host: str, scheme: str, method: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
34+
def match_route_direct(self, method: str, path: str) -> tuple[Any, dict[str, Any]]: ...
35+
def match_route_scheme(self, scheme: str, method: str, path: str) -> tuple[Any, dict[str, Any]]: ...
36+
def match_route_host(self, host: str, method: str, path: str) -> tuple[Any, dict[str, Any]]: ...
37+
def match_route_all(self, host: str, scheme: str, method: str, path: str) -> tuple[Any, dict[str, Any]]: ...
3938

4039
class WSRouter:
41-
def add_static_route(self, route, path: str, host: Optional[str] = None, scheme: Optional[str] = None): ...
40+
def add_static_route(self, route, path: str, host: str | None = None, scheme: str | None = None): ...
4241
def add_re_route(
43-
self, route, rule: str, rgtmap: Dict[str, str], host: Optional[str] = None, scheme: Optional[str] = None
42+
self, route, rule: str, rgtmap: dict[str, str], host: str | None = None, scheme: str | None = None
4443
): ...
45-
def match_route_direct(self, path: str) -> Tuple[Any, Dict[str, Any]]: ...
46-
def match_route_scheme(self, scheme: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
47-
def match_route_host(self, host: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
48-
def match_route_all(self, host: str, scheme: str, path: str) -> Tuple[Any, Dict[str, Any]]: ...
44+
def match_route_direct(self, path: str) -> tuple[Any, dict[str, Any]]: ...
45+
def match_route_scheme(self, scheme: str, path: str) -> tuple[Any, dict[str, Any]]: ...
46+
def match_route_host(self, host: str, path: str) -> tuple[Any, dict[str, Any]]: ...
47+
def match_route_all(self, host: str, scheme: str, path: str) -> tuple[Any, dict[str, Any]]: ...
4948

5049
#: http
51-
def get_content_type(header_value: str) -> Optional[str]: ...
50+
def get_content_type(header_value: str) -> str | None: ...
5251

5352
#: multipart
5453
class MultiPartReader:
@@ -57,14 +56,14 @@ class MultiPartReader:
5756
def contents(self) -> MultiPartContentsIter: ...
5857

5958
class MultiPartContentsIter:
60-
def __iter__(self) -> Iterator[Tuple[str, bool, Any]]: ...
59+
def __iter__(self) -> Iterator[tuple[str, bool, Any]]: ...
6160

6261
class FilePartReader:
63-
content_type: Optional[str]
62+
content_type: str | None
6463
content_length: int
65-
filename: Optional[str]
64+
filename: str | None
6665

67-
def read(self, size: Optional[int] = None) -> bytes: ...
66+
def read(self, size: int | None = None) -> bytes: ...
6867
def __iter__(self) -> Iterator[bytes]: ...
6968

7069
class MultiPartEncodingError(UnicodeDecodeError): ...

emmett_core/_internal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import traceback
77
import warnings
88
from types import ModuleType
9-
from typing import Any, Generic, Optional
9+
from typing import Any, Generic
1010

1111
from .typing import T
1212

@@ -101,7 +101,7 @@ def _get_robj(self) -> T:
101101

102102

103103
#: application loaders
104-
def get_app_module(module_name: str, raise_on_failure: bool = True) -> Optional[ModuleType]:
104+
def get_app_module(module_name: str, raise_on_failure: bool = True) -> ModuleType | None:
105105
try:
106106
__import__(module_name)
107107
except ImportError:
@@ -144,7 +144,7 @@ class RemovedInNextVersionWarning(DeprecationWarning):
144144
pass
145145

146146

147-
class deprecated(object):
147+
class deprecated:
148148
def __init__(self, old_method_name, new_method_name, class_name=None, s=0):
149149
self.class_name = class_name
150150
self.old_method_name = old_method_name

0 commit comments

Comments
 (0)