Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9697695
D3471.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3471.id.diff
View Options
diff --git a/mypy.ini b/mypy.ini
--- a/mypy.ini
+++ b/mypy.ini
@@ -40,3 +40,6 @@
[mypy-swh.deposit.*]
ignore_missing_imports = True
+[mypy-swh.model.*]
+ignore_missing_imports = True
+
diff --git a/requirements-swh.txt b/requirements-swh.txt
--- a/requirements-swh.txt
+++ b/requirements-swh.txt
@@ -1,4 +1,4 @@
swh.core >= 0.0.75
-swh.model >= 0.3.7
+swh.model >= 0.5.0
swh.scheduler >= 0.4.0
swh.storage >= 0.10.1
diff --git a/swh/loader/package/loader.py b/swh/loader/package/loader.py
--- a/swh/loader/package/loader.py
+++ b/swh/loader/package/loader.py
@@ -16,6 +16,7 @@
from swh.core.tarball import uncompress
from swh.core.config import SWHConfig
from swh.model import from_disk
+from swh.model.collections import ImmutableDict
from swh.model.hashutil import hash_to_hex
from swh.model.model import (
BaseModel,
@@ -422,11 +423,16 @@
# skipping those
return None
- metadata = revision.metadata or {}
- metadata.update(
- {"original_artifact": [hashes for _, hashes in dl_artifacts],}
+ extra_metadata: Tuple[str, Any] = (
+ "original_artifact",
+ [hashes for _, hashes in dl_artifacts],
)
- revision = attr.evolve(revision, metadata=metadata)
+ if revision.metadata is not None:
+ full_metadata = list(revision.metadata.items()) + [extra_metadata]
+ else:
+ full_metadata = [extra_metadata]
+
+ revision = attr.evolve(revision, metadata=ImmutableDict(full_metadata))
logger.debug("Revision: %s", revision)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 18, 12:39 AM (2 w, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217300
Attached To
D3471: Update the revision metadata field as an immutable dict
Event Timeline
Log In to Comment