From 5996b45b1d7eb2cb228de2d2a59ba088f941f9ca Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Fri, 25 Oct 2024 18:29:41 +0200 Subject: [PATCH] hashindex: cleanup .pyi --- src/borg/hashindex.pyi | 48 ++++++------------------------------------ src/borg/hashindex.pyx | 2 +- 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/src/borg/hashindex.pyi b/src/borg/hashindex.pyi index 722baaf9f..4291c9691 100644 --- a/src/borg/hashindex.pyi +++ b/src/borg/hashindex.pyi @@ -4,68 +4,34 @@ API_VERSION: str PATH_OR_FILE = Union[str, IO] -def hashindex_variant(fn: str) -> str: ... - -class IndexBase: - value_size: int - MAX_VALUE: int - MAX_LOAD_FACTOR: int - def __init__( - self, capacity: int = ..., path: PATH_OR_FILE = ..., permit_compact: bool = ..., usable: Union[int, float] = ... - ): ... - @classmethod - def read(cls, path: PATH_OR_FILE, permit_compact: bool = False): ... - def write(self, path: PATH_OR_FILE) -> None: ... - def clear(self) -> None: ... - def setdefault(self, key: bytes, value: bytes) -> None: ... - def __delitem__(self, key: bytes) -> None: ... - def get(self, key: bytes, default: Any = ...) -> Any: ... - def pop(self, key: bytes, default: Any = ...) -> Any: ... - def __len__(self) -> int: ... - def size(self) -> int: ... - def compact(self) -> Any: ... - class ChunkIndexEntry(NamedTuple): refcount: int size: int CIE = Union[Tuple[int, int], Type[ChunkIndexEntry]] -class ChunkKeyIterator: - def __init__(self, keysize: int) -> None: ... - def __iter__(self) -> Iterator: ... - def __next__(self) -> Tuple[bytes, Type[ChunkIndexEntry]]: ... - -class ChunkIndex(IndexBase): +class ChunkIndex: def add(self, key: bytes, refs: int, size: int) -> None: ... def iteritems(self, marker: bytes = ...) -> Iterator: ... def __contains__(self, key: bytes) -> bool: ... def __getitem__(self, key: bytes) -> Type[ChunkIndexEntry]: ... def __setitem__(self, key: bytes, value: CIE) -> None: ... -class NSIndexEntry(NamedTuple): +class NSIndex1Entry(NamedTuple): segment: int offset: int - size: int -class NSKeyIterator: - def __init__(self, keysize: int) -> None: ... - def __iter__(self) -> Iterator: ... - def __next__(self) -> Tuple[bytes, Type[Any]]: ... - -class NSIndex(IndexBase): +class NSIndex1: # legacy def iteritems(self, *args, **kwargs) -> Iterator: ... def __contains__(self, key: bytes) -> bool: ... def __getitem__(self, key: bytes) -> Any: ... def __setitem__(self, key: bytes, value: Any) -> None: ... -class NSIndex1(IndexBase): # legacy - def iteritems(self, *args, **kwargs) -> Iterator: ... - def __contains__(self, key: bytes) -> bool: ... - def __getitem__(self, key: bytes) -> Any: ... - def __setitem__(self, key: bytes, value: Any) -> None: ... +class FuseVersionsIndexEntry(NamedTuple): + version: int + hash: bytes -class FuseVersionsIndex(IndexBase): +class FuseVersionsIndex: def __contains__(self, key: bytes) -> bool: ... def __getitem__(self, key: bytes) -> Any: ... def __setitem__(self, key: bytes, value: Any) -> None: ... diff --git a/src/borg/hashindex.pyx b/src/borg/hashindex.pyx index 83ae938ca..6710d6bec 100644 --- a/src/borg/hashindex.pyx +++ b/src/borg/hashindex.pyx @@ -74,7 +74,7 @@ class ChunkIndex: return self.ht.size() -FuseVersionsIndexEntry = namedtuple('FuseVersionsEntry', 'version hash') +FuseVersionsIndexEntry = namedtuple('FuseVersionsIndexEntry', 'version hash') class FuseVersionsIndex: