Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and Synss committed Feb 10, 2024
1 parent 4694325 commit f35e0cd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 40 deletions.
14 changes: 8 additions & 6 deletions setup.py
Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions src/mbedtls/cipher/AES.py
Expand Up @@ -28,17 +28,15 @@ def new(
mode: Literal[Mode.CCM, Mode.GCM],
iv: Optional[bytes] = ...,
ad: Optional[bytes] = ...,
) -> AEADCipher:
...
) -> AEADCipher: ...


@overload
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(
Expand Down
6 changes: 2 additions & 4 deletions src/mbedtls/cipher/CHACHA20.py
Expand Up @@ -26,8 +26,7 @@ def new(
key: bytes,
mode: Literal[Mode.STREAM],
iv: Optional[bytes] = ...,
) -> Cipher:
...
) -> Cipher: ...


@overload
Expand All @@ -36,8 +35,7 @@ def new(
mode: Literal[Mode.CHACHAPOLY],
iv: Optional[bytes] = ...,
ad: Optional[bytes] = ...,
) -> AEADCipher:
...
) -> AEADCipher: ...


def new(
Expand Down
24 changes: 8 additions & 16 deletions src/mbedtls/cipher/__init__.py
Expand Up @@ -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__ = (
Expand Down
3 changes: 1 addition & 2 deletions src/mbedtls/hashlib.py
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/mbedtls/hmac.py
Expand Up @@ -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(
Expand Down
9 changes: 3 additions & 6 deletions src/mbedtls/tls.py
Expand Up @@ -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
Expand Down

0 comments on commit f35e0cd

Please sign in to comment.