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
Branch
from_dict
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5449
Build 7385: tox-on-jenkinsJenkins
Build 7384: arc lint + arc unit

Event Timeline

douardda added a subscriber: douardda.
douardda added inline comments.
swh/model/model.py
33

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

More doc.

swh/model/model.py
33

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.

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.