|
@@ -2079,7 +2079,7 @@ class PackIndexer(DeltaChainIterator[PackIndexEntry]):
|
|
|
class PackInflater(DeltaChainIterator[ShaFile]):
|
|
class PackInflater(DeltaChainIterator[ShaFile]):
|
|
|
"""Delta chain iterator that yields ShaFile objects."""
|
|
"""Delta chain iterator that yields ShaFile objects."""
|
|
|
|
|
|
|
|
- def _result(self, unpacked: UnpackedObject) -> Any:
|
|
|
|
|
|
|
+ def _result(self, unpacked: UnpackedObject) -> ShaFile:
|
|
|
"""Convert unpacked object to ShaFile.
|
|
"""Convert unpacked object to ShaFile.
|
|
|
|
|
|
|
|
Args:
|
|
Args:
|
|
@@ -2088,8 +2088,6 @@ class PackInflater(DeltaChainIterator[ShaFile]):
|
|
|
Returns:
|
|
Returns:
|
|
|
ShaFile object from the unpacked data
|
|
ShaFile object from the unpacked data
|
|
|
"""
|
|
"""
|
|
|
-
|
|
|
|
|
- def _result(self, unpacked: UnpackedObject) -> ShaFile:
|
|
|
|
|
return unpacked.sha_file()
|
|
return unpacked.sha_file()
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2195,22 +2193,6 @@ class SHA1Reader(BinaryIO):
|
|
|
"""
|
|
"""
|
|
|
return self.f.readlines(hint)
|
|
return self.f.readlines(hint)
|
|
|
|
|
|
|
|
- def writelines(self, lines) -> None:
|
|
|
|
|
- """Not supported for read-only file.
|
|
|
|
|
-
|
|
|
|
|
- Raises:
|
|
|
|
|
- UnsupportedOperation: Always raised
|
|
|
|
|
- """
|
|
|
|
|
- raise UnsupportedOperation("writelines")
|
|
|
|
|
-
|
|
|
|
|
- def write(self, data) -> int:
|
|
|
|
|
- """Not supported for read-only file.
|
|
|
|
|
-
|
|
|
|
|
- Raises:
|
|
|
|
|
- UnsupportedOperation: Always raised
|
|
|
|
|
- """
|
|
|
|
|
- raise UnsupportedOperation("write")
|
|
|
|
|
-
|
|
|
|
|
def writelines(self, lines: Iterable[bytes], /) -> None: # type: ignore[override]
|
|
def writelines(self, lines: Iterable[bytes], /) -> None: # type: ignore[override]
|
|
|
"""Write multiple lines to the file (not supported)."""
|
|
"""Write multiple lines to the file (not supported)."""
|
|
|
raise UnsupportedOperation("writelines")
|
|
raise UnsupportedOperation("writelines")
|
|
@@ -2304,14 +2286,6 @@ class SHA1Writer(BinaryIO):
|
|
|
self.length += len(sha)
|
|
self.length += len(sha)
|
|
|
return sha
|
|
return sha
|
|
|
|
|
|
|
|
- def close(self) -> bytes:
|
|
|
|
|
- """Close the file after writing SHA1.
|
|
|
|
|
-
|
|
|
|
|
- Returns:
|
|
|
|
|
- The SHA1 digest bytes
|
|
|
|
|
- """
|
|
|
|
|
- sha = self.write_sha()
|
|
|
|
|
-
|
|
|
|
|
def close(self) -> None:
|
|
def close(self) -> None:
|
|
|
"""Close the pack file and finalize the SHA."""
|
|
"""Close the pack file and finalize the SHA."""
|
|
|
self.digest = self.write_sha()
|
|
self.digest = self.write_sha()
|
|
@@ -2407,19 +2381,6 @@ class SHA1Writer(BinaryIO):
|
|
|
|
|
|
|
|
def __iter__(self) -> "SHA1Writer":
|
|
def __iter__(self) -> "SHA1Writer":
|
|
|
"""Return iterator."""
|
|
"""Return iterator."""
|
|
|
-
|
|
|
|
|
- def __enter__(self) -> "SHA1Writer":
|
|
|
|
|
- return self
|
|
|
|
|
-
|
|
|
|
|
- def __exit__(
|
|
|
|
|
- self,
|
|
|
|
|
- type: Optional[type],
|
|
|
|
|
- value: Optional[BaseException],
|
|
|
|
|
- traceback: Optional[TracebackType],
|
|
|
|
|
- ) -> None:
|
|
|
|
|
- self.close()
|
|
|
|
|
-
|
|
|
|
|
- def __iter__(self) -> "SHA1Writer":
|
|
|
|
|
return self
|
|
return self
|
|
|
|
|
|
|
|
def __next__(self) -> bytes:
|
|
def __next__(self) -> bytes:
|