Fix ruff 0.16 findings; bump dependency minimums to match
- pyproject [tool.ruff.lint]: ignore RUF022/RUF023 (deliberately grouped __all__/__slots__), SIM117, BLE001 (blind except is intentional at CFFI callback boundaries) - Legit fixes: dict/tuple instead of typing.Dict/Tuple in generate.py, unquoted annotations in raf.py, Self return for __enter__ methods, explicit check=False on subprocess.run, collapsed nested ifs, sorted test imports, unused-unpacked-variable in test_raises - Bump minimum versions to the synced toolchain: cffi 2.1.1, ruff 0.16.10, pytest 9.1.1, auditwheel 6.8.2, setuptools 84.0.0, setuptools-scm 10.3.4 (project deps and build-system requires)
This commit is contained in:
1 parent
1eb0b6e8c0
commit
b4404b42e6
10 files changed
+54
-42
No files matched your search
+9
-9
@@ -18,7 +18,7 @@ import hashlib
|
||||
import io as io_module
|
||||
import os
|
||||
import threading
|
||||
from typing import NamedTuple, Protocol, runtime_checkable
|
||||
from typing import NamedTuple, Protocol, Self, runtime_checkable
|
||||
|
||||
from . import cipher as _cipher_for_name
|
||||
from . import random as _random
|
||||
@@ -163,7 +163,7 @@ class FileStorage:
|
||||
os.close(self._fd)
|
||||
self._closed = True
|
||||
|
||||
def __enter__(self) -> FileStorage:
|
||||
def __enter__(self) -> Self:
|
||||
return self
|
||||
|
||||
def __exit__(self, *args) -> None:
|
||||
@@ -213,7 +213,7 @@ class BytesIOStorage:
|
||||
"""Return the entire buffer contents."""
|
||||
return bytes(self._data)
|
||||
|
||||
def __enter__(self) -> BytesIOStorage:
|
||||
def __enter__(self) -> Self:
|
||||
return self
|
||||
|
||||
def __exit__(self, *args) -> None:
|
||||
@@ -272,7 +272,7 @@ class StreamStorage:
|
||||
if hasattr(self._stream, "flush"):
|
||||
self._stream.flush()
|
||||
|
||||
def __enter__(self) -> StreamStorage:
|
||||
def __enter__(self) -> Self:
|
||||
return self
|
||||
|
||||
def __exit__(self, *args) -> None:
|
||||
@@ -588,8 +588,8 @@ def create(
|
||||
truncate: bool = False,
|
||||
merkle: bool | MerkleHasher = False,
|
||||
merkle_max_chunks: int = 16384,
|
||||
rng: "_random.RandomSource | None" = None,
|
||||
) -> "Raf":
|
||||
rng: _random.RandomSource | None = None,
|
||||
) -> Raf:
|
||||
"""Create a new encrypted file.
|
||||
|
||||
Args:
|
||||
@@ -641,8 +641,8 @@ def open(
|
||||
*,
|
||||
merkle: bool | MerkleHasher = False,
|
||||
merkle_max_chunks: int = 16384,
|
||||
rng: "_random.RandomSource | None" = None,
|
||||
) -> "Raf":
|
||||
rng: _random.RandomSource | None = None,
|
||||
) -> Raf:
|
||||
"""Open an existing encrypted file.
|
||||
|
||||
The header is probed to size internal buffers and its alg_id is checked
|
||||
@@ -922,7 +922,7 @@ class Raf:
|
||||
"""True if the file has been closed."""
|
||||
return self._closed
|
||||
|
||||
def __enter__(self) -> "Raf":
|
||||
def __enter__(self) -> Self:
|
||||
return self
|
||||
|
||||
def __exit__(self, *args) -> None:
|
||||
|
||||
Reference in new issue
Block a user