ruff format

This commit is contained in:
L. Kärkkäinen
2023-10-25 00:22:00 +01:00
parent 209840b771
commit 140d27ef96
10 changed files with 12 additions and 17 deletions

View File

@@ -349,8 +349,7 @@ def parse_content_header(value: str) -> Tuple[str, Options]:
options: Dict[str, Union[int, str]] = {}
else:
options = {
m.group(1)
.lower(): (m.group(2) or m.group(3))
m.group(1).lower(): (m.group(2) or m.group(3))
.replace("%22", '"')
.replace("%0D%0A", "\n")
for m in _param.finditer(value[pos:])

View File

@@ -14,7 +14,7 @@ class ExceptionMixin(metaclass=SanicMeta):
def exception(
self,
*exceptions: Union[Type[Exception], List[Type[Exception]]],
apply: bool = True
apply: bool = True,
) -> Callable:
"""Decorator used to register an exception handler for the current application or blueprint instance.

View File

@@ -25,7 +25,7 @@ class MiddlewareMixin(metaclass=SanicMeta):
attach_to: str = "request",
apply: bool = True,
*,
priority: int = 0
priority: int = 0,
) -> MiddlewareType:
...
@@ -36,7 +36,7 @@ class MiddlewareMixin(metaclass=SanicMeta):
attach_to: str = "request",
apply: bool = True,
*,
priority: int = 0
priority: int = 0,
) -> Callable[[MiddlewareType], MiddlewareType]:
...
@@ -46,7 +46,7 @@ class MiddlewareMixin(metaclass=SanicMeta):
attach_to: str = "request",
apply: bool = True,
*,
priority: int = 0
priority: int = 0,
) -> Union[MiddlewareType, Callable[[MiddlewareType], MiddlewareType]]:
"""Decorator for registering middleware.

View File

@@ -44,12 +44,8 @@ class ConnInfo:
self.server_name = ""
self.cert: Dict[str, Any] = {}
self.network_paths: List[Any] = []
sslobj: Optional[SSLObject] = transport.get_extra_info(
"ssl_object"
) # type: ignore
sslctx: Optional[SSLContext] = transport.get_extra_info(
"ssl_context"
) # type: ignore
sslobj: Optional[SSLObject] = transport.get_extra_info("ssl_object") # type: ignore
sslctx: Optional[SSLContext] = transport.get_extra_info("ssl_context") # type: ignore
if sslobj:
self.ssl = True
self.server_name = getattr(sslobj, "sanic_server_name", None) or ""

View File

@@ -57,9 +57,7 @@ class WebsocketFrameAssembler:
self.read_mutex = asyncio.Lock()
self.write_mutex = asyncio.Lock()
self.completed_queue = asyncio.Queue(
maxsize=1
) # type: asyncio.Queue[Data]
self.completed_queue = asyncio.Queue(maxsize=1) # type: asyncio.Queue[Data]
# put() sets this event to tell get() that a message can be fetched.
self.message_complete = asyncio.Event()