Skip to content

Commit 3da46a9

Browse files
committed
Fix a type error
Signed-off-by: Mihai Maruseac <[email protected]>
1 parent deac27f commit 3da46a9

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

model_signing/manifest/manifest.py

+12-17
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
from typing import Self
4242
from typing_extensions import override
4343

44+
from model_signing.hashing import hashing
45+
4446

4547
class ManifestItem(metaclass=ABCMeta):
4648
"""An item that can be included in the manifest.
@@ -114,28 +116,21 @@ def from_str(as_str: str) -> Self:
114116
return ManifestFileChunkItem(file, start, end)
115117

116118

117-
@dataclass(frozen=True)
118-
class ManifestDigest:
119-
"""A computed digest (algorithm and hash) for a `ManifestItem`."""
120-
algorithm: str
121-
digest: bytes
122-
123-
124119
class Manifest(metaclass=ABCMeta):
125120
"""Generic manifest file to represent a model."""
126-
objects: dict[ManifestItem, ManifestDigest] = {}
121+
objects: dict[ManifestItem, hashing.Digest] = {}
127122
constraints: list[set[ManifestItem]] = set()
128123

129-
def prepare_manifest_for_signing(self) -> Any:
130-
"""Computes the final form of the manifest for signing in memory.
124+
#def prepare_manifest_for_signing(self) -> Any:
125+
# """Computes the final form of the manifest for signing in memory.
131126

132-
Implementations decide the output type, as this can be from an
133-
external dependency.
127+
# Implementations decide the output type, as this can be from an
128+
# external dependency.
134129

135-
This method is optional, but implementations must define at least one
136-
of `prepare_manifest_for_signing` and `write_manifest`.
137-
"""
138-
pass
130+
# This method is optional, but implementations must define at least one
131+
# of `prepare_manifest_for_signing` and `write_manifest`.
132+
# """
133+
# pass
139134

140135
def write_manifest(self, path: pathlib.Path) -> None:
141136
"""Writes the manifest to a file to be signed afterwards.
@@ -171,7 +166,7 @@ def verify(self, only_for_objects: list[ManifestItem]) -> bool:
171166
@abstractmethod
172167
def update(
173168
self,
174-
objects: dict[ManifestItem, ManifestDigest],
169+
objects: dict[ManifestItem, hashing.Digest],
175170
constraints: list[set[ManifestItem]],
176171
) -> None:
177172
"""Updates the manifest with new integrity data."""

0 commit comments

Comments
 (0)