瀏覽代碼

*.pyi: fix types, add missing attrs

Thomas Waldmann 2 年之前
父節點
當前提交
90a9a124d4
共有 3 個文件被更改,包括 12 次插入8 次删除
  1. 3 3
      src/borg/compress.pyi
  2. 4 3
      src/borg/hashindex.pyi
  3. 5 2
      src/borg/item.pyi

+ 3 - 3
src/borg/compress.pyi

@@ -1,4 +1,4 @@
-from typing import Any, Type
+from typing import Any, Type, Dict, Tuple
 
 API_VERSION: str
 
@@ -12,8 +12,8 @@ class CompressionSpec:
 
 class Compressor:
     def __init__(self, name: Any = ..., **kwargs) -> None: ...
-    def compress(self, data: bytes) -> bytes: ...
-    def decompress(self, data: bytes) -> bytes: ...
+    def compress(self, meta: Dict, data: bytes) -> Tuple[Dict, bytes]: ...
+    def decompress(self, meta: Dict, data: bytes) -> Tuple[Dict, bytes]: ...
     @staticmethod
     def detect(data: bytes) -> Any: ...
 

+ 4 - 3
src/borg/hashindex.pyi

@@ -28,9 +28,8 @@ class IndexBase:
 class ChunkIndexEntry(NamedTuple):
     refcount: int
     size: int
-    csize: int
 
-CIE = Union[Tuple[int, int, int], Type[ChunkIndexEntry]]
+CIE = Union[Tuple[int, int], Type[ChunkIndexEntry]]
 
 class ChunkKeyIterator:
     def __init__(self, keysize: int) -> None: ...
@@ -38,7 +37,7 @@ class ChunkKeyIterator:
     def __next__(self) -> Tuple[bytes, Type[ChunkIndexEntry]]: ...
 
 class ChunkIndex(IndexBase):
-    def add(self, key: bytes, refs: int, size: int, csize: int) -> None: ...
+    def add(self, key: bytes, refs: int, size: int) -> None: ...
     def decref(self, key: bytes) -> CIE: ...
     def incref(self, key: bytes) -> CIE: ...
     def iteritems(self, marker: bytes = ...) -> Iterator: ...
@@ -65,12 +64,14 @@ class NSIndex(IndexBase):
     def __contains__(self, key: bytes) -> bool: ...
     def __getitem__(self, key: bytes) -> Any: ...
     def __setitem__(self, key: bytes, value: Any) -> None: ...
+    def flags(self, key: bytes, mask: int, value: int = None) -> int: ...
 
 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: ...
+    def flags(self, key: bytes, mask: int, value: int = None) -> int: ...
 
 class FuseVersionsIndex(IndexBase):
     def __contains__(self, key: bytes) -> bool: ...

+ 5 - 2
src/borg/item.pyi

@@ -4,7 +4,7 @@ from .helpers import StableDict
 
 API_VERSION: str
 
-def want_bytes(v: Any, *, errors: str) -> bytes: ...
+def want_bytes(v: Any, *, errors: str = ...) -> bytes: ...
 def chunks_contents_equal(chunks1: Iterator, chunks2: Iterator) -> bool: ...
 
 class PropDict:
@@ -106,7 +106,6 @@ class ArchiveItem(PropDict):
 class ChunkListEntry(NamedTuple):
     id: bytes
     size: int
-    csize: int
 
 class Item(PropDict):
     @property
@@ -178,6 +177,10 @@ class Item(PropDict):
     @deleted.setter
     def deleted(self, val: bool) -> None: ...
     @property
+    def hlid(self) -> bytes: ...
+    @hlid.setter
+    def hlid(self, val: bytes) -> None: ...
+    @property
     def hardlink_master(self) -> bool: ...
     @hardlink_master.setter
     def hardlink_master(self, val: bool) -> None: ...