diff --git a/PKG-INFO b/PKG-INFO index db060458509c8318c24862a8adc8eacd7e83299e..5092500d5f53a013fc6bd73905054de4b00d4af7 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: swh.model -Version: 0.0.43 +Version: 0.0.44 Summary: Software Heritage data model Home-page: https://forge.softwareheritage.org/diffusion/DMOD/ Author: Software Heritage developers diff --git a/swh.model.egg-info/PKG-INFO b/swh.model.egg-info/PKG-INFO index db060458509c8318c24862a8adc8eacd7e83299e..5092500d5f53a013fc6bd73905054de4b00d4af7 100644 --- a/swh.model.egg-info/PKG-INFO +++ b/swh.model.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: swh.model -Version: 0.0.43 +Version: 0.0.44 Summary: Software Heritage data model Home-page: https://forge.softwareheritage.org/diffusion/DMOD/ Author: Software Heritage developers diff --git a/swh/model/model.py b/swh/model/model.py index fc5a21fccce4fab6127fdff88d393197505240e1..badac8c6b119f6f30c448f6093de76499754b50a 100644 --- a/swh/model/model.py +++ b/swh/model/model.py @@ -94,8 +94,8 @@ class TimestampWithTimezone(BaseModel): @attr.s class Origin(BaseModel): """Represents a software source: a VCS and an URL.""" - type = attr.ib(type=str) url = attr.ib(type=str) + type = attr.ib(type=Optional[str], default=None) @attr.s @@ -283,19 +283,16 @@ class Revision(BaseModel): @classmethod def from_dict(cls, d): + d = d.copy() return cls( - id=d['id'], - message=d['message'], - author=Person.from_dict(d['author']), - committer=Person.from_dict(d['committer']), - date=TimestampWithTimezone.from_dict(d['date']), + id=d.pop('id'), + author=Person.from_dict(d.pop('author')), + committer=Person.from_dict(d.pop('committer')), + date=TimestampWithTimezone.from_dict(d.pop('date')), committer_date=TimestampWithTimezone.from_dict( - d['committer_date']), - type=RevisionType(d['type']), - directory=d['directory'], - synthetic=d['synthetic'], - metadata=d['metadata'], - parents=d['parents']) + d.pop('committer_date')), + type=RevisionType(d.pop('type')), + **d) @attr.s diff --git a/version.txt b/version.txt index 9142329e4fcf6bd4d6fbbcf74b6bdbd3e13f9ae4..aa6ed2afee0d1e7b4e4eb957a5001a7f2479d083 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.0.43-0-gfd2e6da \ No newline at end of file +v0.0.44-0-ge77c94d \ No newline at end of file