ruff-only #1

Open
leo wants to merge 17 commits from ruff-only into main
2 changed files with 7 additions and 7 deletions
Showing only changes of commit 00493a6954 - Show all commits

View File

@ -133,7 +133,10 @@ if use_trio: # pragma: no cover
return trio.Path(path).stat()
open_async = trio.open_file
CancelledErrors: tuple[type[BaseException], ...] = (asyncio.CancelledError, trio.Cancelled)
CancelledErrors: tuple[type[BaseException], ...] = (
asyncio.CancelledError,
trio.Cancelled,
)
else:
if PYPY_IMPLEMENTATION:
pypy_os_module_patch()

View File

@ -20,6 +20,7 @@ CIPHERS_TLS12 = [
TlsDef = None | ssl.SSLContext | dict[str, Any] | str
TlsDefs = TlsDef | list[TlsDef] | tuple[TlsDef, ...]
def create_context(
certfile: str | None = None,
keyfile: str | None = None,
@ -38,9 +39,7 @@ def create_context(
return context
def shorthand_to_ctx(
ctxdef: TlsDef
) -> ssl.SSLContext | None:
def shorthand_to_ctx(ctxdef: TlsDef) -> ssl.SSLContext | None:
"""Convert an ssl argument shorthand to an SSLContext object."""
if ctxdef is None or isinstance(ctxdef, ssl.SSLContext):
return ctxdef
@ -54,9 +53,7 @@ def shorthand_to_ctx(
)
def process_to_context(
ssldef: TlsDefs
) -> ssl.SSLContext | None:
def process_to_context(ssldef: TlsDefs) -> ssl.SSLContext | None:
"""Process app.run ssl argument from easy formats to full SSLContext."""
return (
CertSelector(map(shorthand_to_ctx, ssldef))