Page MenuHomeSoftware Heritage

Fix MetadataAuthority.from_dict()
ClosedPublic

Authored by douardda on Mar 8 2021, 4:16 PM.

Details

Summary

was modifying the dict given as argument.

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

Build is green

Patch application report for D5215 (id=18684)

Rebasing onto 2185f9308e...

Current branch diff-target is up to date.
Changes applied before test
commit fca36585a39ce15a48204f7362a9c49f164723d2
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 8 16:11:22 2021 +0100

    Fix MetadataAuthority.from_dict()
    
    was modifying the dict given as argument.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/283/ for more details.

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/model/model.py
851–855

for consistency with other from_dict methods:

d = d.copy()
d["type"] = MetadataAuthorityType(d["type"])

(mypy isn't smart enough to detect we're changing the type so it's fine)

This revision is now accepted and ready to land.Mar 8 2021, 4:19 PM
This revision was automatically updated to reflect the committed changes.