Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #105

Merged
merged 3 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
force-check = True
filename = *.pyx,*.pxd,*.py
ignore = E211, E225, E226, E227, E402, E501, E999, PT011, PT012, W503
ignore = E704, E211, E225, E226, E227, E402, E501, E999, PT011, PT012, W503
extend-ignore = E203
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: 'https://github.com/charliermarsh/ruff-pre-commit'
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
- repo: 'https://github.com/psf/black'
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
types: [python]
Expand All @@ -45,7 +45,7 @@ repos:
hooks:
- id: cython-lint
- repo: 'https://github.com/pycqa/flake8'
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
Expand Down Expand Up @@ -77,6 +77,6 @@ repos:
- '--py38-plus'
- '--keep-runtime-typing'
- repo: 'https://github.com/abravalheri/validate-pyproject'
rev: v0.15
rev: v0.16
hooks:
- id: validate-pyproject
14 changes: 8 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading