Changeset View
Changeset View
Standalone View
Standalone View
swh/model/model.py
Show First 20 Lines • Show All 1,087 Lines • ▼ Show 20 Lines | def from_dict(cls, d): | ||||
} | } | ||||
swhid_keys = ("snapshot", "release", "revision", "directory") | swhid_keys = ("snapshot", "release", "revision", "directory") | ||||
for swhid_key in swhid_keys: | for swhid_key in swhid_keys: | ||||
if d.get(swhid_key): | if d.get(swhid_key): | ||||
d[swhid_key] = CoreSWHID.from_string(d[swhid_key]) | d[swhid_key] = CoreSWHID.from_string(d[swhid_key]) | ||||
return super().from_dict(d) | return super().from_dict(d) | ||||
def unique_key(self) -> KeyType: | |||||
return { | |||||
"target": str(self.target), | |||||
"authority_type": self.authority.type.value, | |||||
"authority_url": self.authority.url, | |||||
"discovery_date": str(self.discovery_date), | |||||
"fetcher_name": self.fetcher.name, | |||||
"fetcher_version": self.fetcher.version, | |||||
} |