diff --git a/setup.py b/setup.py index d6b77c20..caba88f1 100644 --- a/setup.py +++ b/setup.py @@ -135,12 +135,14 @@ def from_env(var): sources=[os.path.join(dirpath, fn)], library_dirs=library_dirs, libraries=libraries, - define_macros=[ - ("CYTHON_TRACE", "1"), - ("CYTHON_TRACE_NOGIL", "1"), - ] - if coverage - else [], + define_macros=( + [ + ("CYTHON_TRACE", "1"), + ("CYTHON_TRACE_NOGIL", "1"), + ] + if coverage + else [] + ), ) extension.cython_directives = {"language_level": "3str"} if coverage: diff --git a/src/mbedtls/cipher/AES.py b/src/mbedtls/cipher/AES.py index 195dcc2e..2564f31c 100644 --- a/src/mbedtls/cipher/AES.py +++ b/src/mbedtls/cipher/AES.py @@ -28,8 +28,7 @@ def new( mode: Literal[Mode.CCM, Mode.GCM], iv: Optional[bytes] = ..., ad: Optional[bytes] = ..., -) -> AEADCipher: - ... +) -> AEADCipher: ... @overload @@ -37,8 +36,7 @@ def new( key: bytes, mode: Literal[Mode.CBC, Mode.CFB, Mode.CTR, Mode.ECB, Mode.OFB, Mode.XTS], iv: Optional[bytes] = ..., -) -> Cipher: - ... +) -> Cipher: ... def new( diff --git a/src/mbedtls/cipher/CHACHA20.py b/src/mbedtls/cipher/CHACHA20.py index 97def1f8..38796677 100644 --- a/src/mbedtls/cipher/CHACHA20.py +++ b/src/mbedtls/cipher/CHACHA20.py @@ -26,8 +26,7 @@ def new( key: bytes, mode: Literal[Mode.STREAM], iv: Optional[bytes] = ..., -) -> Cipher: - ... +) -> Cipher: ... @overload @@ -36,8 +35,7 @@ def new( mode: Literal[Mode.CHACHAPOLY], iv: Optional[bytes] = ..., ad: Optional[bytes] = ..., -) -> AEADCipher: - ... +) -> AEADCipher: ... def new( diff --git a/src/mbedtls/cipher/__init__.py b/src/mbedtls/cipher/__init__.py index 9a346cd2..fc255bd5 100644 --- a/src/mbedtls/cipher/__init__.py +++ b/src/mbedtls/cipher/__init__.py @@ -47,39 +47,31 @@ @runtime_checkable class CipherType(Protocol): @property - def __name__(self) -> str: - ... + def __name__(self) -> str: ... @property - def block_size(self) -> int: - ... + def block_size(self) -> int: ... @property - def key_size(self) -> int: - ... + def key_size(self) -> int: ... - def new(self, key: bytes, mode: Mode, iv: Optional[bytes]) -> Cipher: - ... + def new(self, key: bytes, mode: Mode, iv: Optional[bytes]) -> Cipher: ... @runtime_checkable class AEADCipherType(Protocol): @property - def __name__(self) -> str: - ... + def __name__(self) -> str: ... @property - def block_size(self) -> int: - ... + def block_size(self) -> int: ... @property - def key_size(self) -> int: - ... + def key_size(self) -> int: ... def new( self, key: bytes, mode: Mode, iv: Optional[bytes], ad: Optional[bytes] - ) -> AEADCipher: - ... + ) -> AEADCipher: ... __all__ = ( diff --git a/src/mbedtls/hashlib.py b/src/mbedtls/hashlib.py index cda86dc7..377d1d79 100644 --- a/src/mbedtls/hashlib.py +++ b/src/mbedtls/hashlib.py @@ -22,8 +22,7 @@ class Algorithm(Protocol): - def __call__(self, buffer: Optional[bytes] = ...) -> Hash: - ... + def __call__(self, buffer: Optional[bytes] = ...) -> Hash: ... def new(name: str, buffer: Optional[bytes] = None) -> Hash: diff --git a/src/mbedtls/hmac.py b/src/mbedtls/hmac.py index 7b5de6ae..78db5da5 100644 --- a/src/mbedtls/hmac.py +++ b/src/mbedtls/hmac.py @@ -22,8 +22,7 @@ class Algorithm(Protocol): - def __call__(self, key: bytes, buffer: Optional[bytes] = ...) -> Hmac: - ... + def __call__(self, key: bytes, buffer: Optional[bytes] = ...) -> Hmac: ... def new( diff --git a/src/mbedtls/tls.py b/src/mbedtls/tls.py index 8cbebff2..62cf56e8 100644 --- a/src/mbedtls/tls.py +++ b/src/mbedtls/tls.py @@ -413,16 +413,13 @@ def shutdown(self, how: int) -> None: # PEP 543 adds the following methods. @overload - def do_handshake(self) -> None: - ... + def do_handshake(self) -> None: ... @overload - def do_handshake(self, address: _Address) -> None: - ... + def do_handshake(self, address: _Address) -> None: ... @overload - def do_handshake(self, flags: int, address: _Address) -> None: - ... + def do_handshake(self, flags: int, address: _Address) -> None: ... def do_handshake(self, *args): # type: ignore[no-untyped-def] # pylint: disable=too-many-branches