Remove unused imports and dead code from checksum module
This commit is contained in:
@@ -18,12 +18,8 @@ import logging
|
|||||||
import re
|
import re
|
||||||
import base64
|
import base64
|
||||||
from typing import (
|
from typing import (
|
||||||
Iterator,
|
|
||||||
Generator,
|
Generator,
|
||||||
Optional,
|
Optional,
|
||||||
Tuple,
|
|
||||||
Union,
|
|
||||||
BinaryIO,
|
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
)
|
)
|
||||||
@@ -479,35 +475,3 @@ class VerifyingStreamWrapper:
|
|||||||
def get_actual_hash(self) -> Optional[str]:
|
def get_actual_hash(self) -> Optional[str]:
|
||||||
"""Get the actual computed hash (only available after iteration)."""
|
"""Get the actual computed hash (only available after iteration)."""
|
||||||
return self._hashing_wrapper.get_hash_if_complete()
|
return self._hashing_wrapper.get_hash_if_complete()
|
||||||
|
|
||||||
|
|
||||||
def create_verifying_generator(
|
|
||||||
stream: Any,
|
|
||||||
expected_hash: str,
|
|
||||||
artifact_id: Optional[str] = None,
|
|
||||||
s3_key: Optional[str] = None,
|
|
||||||
chunk_size: int = DEFAULT_CHUNK_SIZE,
|
|
||||||
) -> Tuple[Generator[bytes, None, None], "VerifyingStreamWrapper"]:
|
|
||||||
"""
|
|
||||||
Create a verifying generator and its wrapper for manual verification.
|
|
||||||
|
|
||||||
This is useful when you need to iterate and later verify manually.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
stream: Source stream
|
|
||||||
expected_hash: Expected SHA256 hash
|
|
||||||
artifact_id: Optional artifact ID
|
|
||||||
s3_key: Optional S3 key
|
|
||||||
chunk_size: Chunk size for reading
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Tuple of (generator, wrapper) where wrapper has verify() method
|
|
||||||
"""
|
|
||||||
wrapper = VerifyingStreamWrapper(
|
|
||||||
stream=stream,
|
|
||||||
expected_hash=expected_hash,
|
|
||||||
artifact_id=artifact_id,
|
|
||||||
s3_key=s3_key,
|
|
||||||
chunk_size=chunk_size,
|
|
||||||
)
|
|
||||||
return iter(wrapper), wrapper
|
|
||||||
|
|||||||
Reference in New Issue
Block a user