Page MenuHomeSoftware Heritage

Add a from_dict() method to model classes, that does the inverse of to_dict().
ClosedPublic

Authored by vlorentz on Apr 12 2019, 3:51 PM.

Diff Detail

Repository
rDMOD Data Model
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz created this revision.Apr 12 2019, 3:51 PM
douardda requested changes to this revision.Apr 15 2019, 1:40 PM
douardda added a subscriber: douardda.
douardda added inline comments.
swh/model/model.py
34

I'm a bit puzzled by the fact the commit message says:

Add a from_dict() method to model classes, that does the inverse of to_dict()

so I read it like "to_dict already exists"... which looks like it is not the case, at least not everywhere. Maybe a better commit message? Also this needs to be documented since it's now part of the api of the model, so it also needs docstrings.

This revision now requires changes to proceed.Apr 15 2019, 1:40 PM
vlorentz updated this revision to Diff 4580.Apr 15 2019, 3:24 PM

More doc.

swh/model/model.py
34

so I read it like "to_dict already exists"... which looks like it is not the case, at least not everywhere

It did exist, but was missing from some classes where is was not necessary.

douardda accepted this revision.Apr 15 2019, 4:40 PM
This revision is now accepted and ready to land.Apr 15 2019, 4:40 PM
This revision was automatically updated to reflect the committed changes.