Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9339355
D3995.id14082.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D3995.id14082.diff
View Options
diff --git a/swh/model/identifiers.py b/swh/model/identifiers.py
--- a/swh/model/identifiers.py
+++ b/swh/model/identifiers.py
@@ -10,7 +10,6 @@
from typing import Any, Dict, Union
import attr
-from deprecated import deprecated
from .collections import ImmutableDict
from .exceptions import ValidationError
@@ -30,13 +29,6 @@
SWHID_SEP = ":"
SWHID_CTXT_SEP = ";"
-# deprecated variables
-PID_NAMESPACE = SWHID_NAMESPACE
-PID_VERSION = SWHID_VERSION
-PID_TYPES = SWHID_TYPES
-PID_SEP = SWHID_SEP
-PID_CTXT_SEP = SWHID_CTXT_SEP
-
@lru_cache()
def identifier_to_bytes(identifier):
@@ -736,20 +728,6 @@
return swhid
-@deprecated("Use swh.model.identifiers.SWHID instead")
-class PersistentId(SWHID):
- """
- Named tuple holding the relevant info associated to a SoftWare Heritage
- persistent IDentifier.
-
- .. deprecated:: 0.3.8
- Use :class:`swh.model.identifiers.SWHID` instead
-
- """
-
- pass
-
-
def swhid(
object_type: str,
object_id: Union[str, Dict[str, Any]],
@@ -784,17 +762,6 @@
return str(swhid)
-@deprecated("Use swh.model.identifiers.swhid instead")
-def persistent_identifier(*args, **kwargs) -> str:
- """Compute :ref:`persistent-identifiers`
-
- .. deprecated:: 0.3.8
- Use :func:`swh.model.identifiers.swhid` instead
-
- """
- return swhid(*args, **kwargs)
-
-
def parse_swhid(swhid: str) -> SWHID:
"""Parse :ref:`persistent-identifiers`.
@@ -848,13 +815,3 @@
_id,
_metadata, # type: ignore # mypy can't properly unify types
)
-
-
-@deprecated("Use swh.model.identifiers.parse_swhid instead")
-def parse_persistent_identifier(persistent_id: str) -> PersistentId:
- """Parse :ref:`persistent-identifiers`.
-
- .. deprecated:: 0.3.8
- Use :func:`swh.model.identifiers.parse_swhid` instead
- """
- return PersistentId(**parse_swhid(persistent_id).to_dict())
diff --git a/swh/model/model.py b/swh/model/model.py
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -856,7 +856,7 @@
"Got SWHID as id for origin metadata (expected an URL)."
)
else:
- self._check_pid(self.type.value, value)
+ self._check_swhid(self.type.value, value)
@discovery_date.validator
def check_discovery_date(self, attribute, value):
@@ -925,7 +925,7 @@
f"Unexpected 'snapshot' context for {self.type.value} object: {value}"
)
- self._check_pid("snapshot", value)
+ self._check_swhid("snapshot", value)
@release.validator
def check_release(self, attribute, value):
@@ -941,7 +941,7 @@
f"Unexpected 'release' context for {self.type.value} object: {value}"
)
- self._check_pid("release", value)
+ self._check_swhid("release", value)
@revision.validator
def check_revision(self, attribute, value):
@@ -953,7 +953,7 @@
f"Unexpected 'revision' context for {self.type.value} object: {value}"
)
- self._check_pid("revision", value)
+ self._check_swhid("revision", value)
@path.validator
def check_path(self, attribute, value):
@@ -975,20 +975,20 @@
f"Unexpected 'directory' context for {self.type.value} object: {value}"
)
- self._check_pid("directory", value)
+ self._check_swhid("directory", value)
- def _check_pid(self, expected_object_type, pid):
- if isinstance(pid, str):
- raise ValueError(f"Expected SWHID, got a string: {pid}")
+ def _check_swhid(self, expected_object_type, swhid):
+ if isinstance(swhid, str):
+ raise ValueError(f"Expected SWHID, got a string: {swhid}")
- if pid.object_type != expected_object_type:
+ if swhid.object_type != expected_object_type:
raise ValueError(
f"Expected SWHID type '{expected_object_type}', "
- f"got '{pid.object_type}' in {pid}"
+ f"got '{swhid.object_type}' in {swhid}"
)
- if pid.metadata:
- raise ValueError(f"Expected core SWHID, but got: {pid}")
+ if swhid.metadata:
+ raise ValueError(f"Expected core SWHID, but got: {swhid}")
def to_dict(self):
d = super().to_dict()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jul 3 2025, 9:38 AM (5 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3224215
Attached To
D3995: model: remove deprecated and unused PID methods
Event Timeline
Log In to Comment