From 70e5d50a121bfb5d945600d0598ab8a8997c0ba3 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli <zack@upsilon.cc> Date: Fri, 20 Sep 2019 12:13:58 +0200 Subject: [PATCH] identifiers.py: do not inherit from on-the-fly namedtuple --- swh/model/identifiers.py | 19 +++++++++++-------- swh/model/merkle.py | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/swh/model/identifiers.py b/swh/model/identifiers.py index 0254a89c..6a000681 100644 --- a/swh/model/identifiers.py +++ b/swh/model/identifiers.py @@ -638,14 +638,17 @@ _object_type_map = { } -class PersistentId(NamedTuple( - 'PersistentId', [ - ('namespace', str), - ('scheme_version', int), - ('object_type', str), - ('object_id', str), - ('metadata', Dict[str, Any]), - ])): +_PersistentId = NamedTuple( + 'PersistentId', [ + ('namespace', str), + ('scheme_version', int), + ('object_type', str), + ('object_id', str), + ('metadata', Dict[str, Any]), + ]) + + +class PersistentId(_PersistentId): """ Named tuple holding the relevant info associated to a Software Heritage persistent identifier. diff --git a/swh/model/merkle.py b/swh/model/merkle.py index 15c5db62..02c6f2b2 100644 --- a/swh/model/merkle.py +++ b/swh/model/merkle.py @@ -110,7 +110,7 @@ class MerkleNode(dict, metaclass=abc.ABCMeta): """ __slots__ = ['parents', 'data', '__hash', 'collected'] - type = None # type: Optional[str] + type = None # type: Optional[str] # TODO: make this an enum """Type of the current node (used as a classifier for :func:`collect`)""" def __init__(self, data=None): -- GitLab