ruff-only #1
|
@ -133,7 +133,10 @@ if use_trio: # pragma: no cover
|
||||||
return trio.Path(path).stat()
|
return trio.Path(path).stat()
|
||||||
|
|
||||||
open_async = trio.open_file
|
open_async = trio.open_file
|
||||||
CancelledErrors: tuple[type[BaseException], ...] = (asyncio.CancelledError, trio.Cancelled)
|
CancelledErrors: tuple[type[BaseException], ...] = (
|
||||||
|
asyncio.CancelledError,
|
||||||
|
trio.Cancelled,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if PYPY_IMPLEMENTATION:
|
if PYPY_IMPLEMENTATION:
|
||||||
pypy_os_module_patch()
|
pypy_os_module_patch()
|
||||||
|
|
|
@ -20,6 +20,7 @@ CIPHERS_TLS12 = [
|
||||||
TlsDef = None | ssl.SSLContext | dict[str, Any] | str
|
TlsDef = None | ssl.SSLContext | dict[str, Any] | str
|
||||||
TlsDefs = TlsDef | list[TlsDef] | tuple[TlsDef, ...]
|
TlsDefs = TlsDef | list[TlsDef] | tuple[TlsDef, ...]
|
||||||
|
|
||||||
|
|
||||||
def create_context(
|
def create_context(
|
||||||
certfile: str | None = None,
|
certfile: str | None = None,
|
||||||
keyfile: str | None = None,
|
keyfile: str | None = None,
|
||||||
|
@ -38,9 +39,7 @@ def create_context(
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
def shorthand_to_ctx(
|
def shorthand_to_ctx(ctxdef: TlsDef) -> ssl.SSLContext | None:
|
||||||
ctxdef: TlsDef
|
|
||||||
) -> ssl.SSLContext | None:
|
|
||||||
"""Convert an ssl argument shorthand to an SSLContext object."""
|
"""Convert an ssl argument shorthand to an SSLContext object."""
|
||||||
if ctxdef is None or isinstance(ctxdef, ssl.SSLContext):
|
if ctxdef is None or isinstance(ctxdef, ssl.SSLContext):
|
||||||
return ctxdef
|
return ctxdef
|
||||||
|
@ -54,9 +53,7 @@ def shorthand_to_ctx(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def process_to_context(
|
def process_to_context(ssldef: TlsDefs) -> ssl.SSLContext | None:
|
||||||
ssldef: TlsDefs
|
|
||||||
) -> ssl.SSLContext | None:
|
|
||||||
"""Process app.run ssl argument from easy formats to full SSLContext."""
|
"""Process app.run ssl argument from easy formats to full SSLContext."""
|
||||||
return (
|
return (
|
||||||
CertSelector(map(shorthand_to_ctx, ssldef))
|
CertSelector(map(shorthand_to_ctx, ssldef))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user