Page MenuHomeSoftware Heritage

Add a method to generate a Content from binary data
ClosedPublic

Authored by olasd on Mar 2 2020, 2:07 PM.

Details

Summary

This lets us generate Content objects directly from a bytestring, with the
proper set of hashes auto-generated from the contents.

Test Plan

added tox tests

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

This revision is now accepted and ready to land.Mar 2 2020, 2:10 PM
vlorentz requested changes to this revision.Mar 2 2020, 3:23 PM
vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/model/model.py
411

reason should default to None, and the function error if it's not set.

This revision now requires changes to proceed.Mar 2 2020, 3:23 PM

Shuffle methods around to improve arguments handling

olasd marked an inline comment as done.Mar 2 2020, 4:00 PM
swh/model/model.py
392–399

Maybe prepend an underscore? There's not reason for it to be used by other modules.

Underscore internal method

olasd marked an inline comment as done.Mar 2 2020, 4:19 PM
This revision is now accepted and ready to land.Mar 2 2020, 4:25 PM