Page MenuHomeSoftware Heritage

Make SWHID immutable and hashable.
ClosedPublic

Authored by vlorentz on Jul 7 2020, 3:13 PM.

Details

Summary

Will be needed in the in-mem storage, as it will use SWHIDs as keys in a dict

Depends on D3445 and D3446.

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 D3447 (id=12212)

Could not rebase; Attempt merge onto 9e475a702a...

Updating 9e475a7..bea256e
Fast-forward
 swh/model/collections.py            | 12 ++++++-
 swh/model/identifiers.py            | 16 ++++++---
 swh/model/test_identifiers.py       | 72 +++++++++++++++++++++++++++++++++++++
 swh/model/tests/test_collections.py | 36 +++++++++++++++++++
 4 files changed, 130 insertions(+), 6 deletions(-)
 create mode 100644 swh/model/test_identifiers.py
Changes applied before test
commit bea256e39037ac31fd1d075845ccf2bc71d4cb35
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Jul 7 15:12:44 2020 +0200

    Make SWHID immutable and hashable.

commit 06837d5c877c6d06fc0fef193b80b1e2dc76691b
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Jul 7 15:10:53 2020 +0200

    Implement ImmutableDict.__hash__.

commit c4dad17f223d2300c7db187807ed74603a0e2002
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Jul 7 15:04:54 2020 +0200

    Allow passing an ImmutableDict as argument to ImmutableDict's constructor.
    
    It allows easy conversion of Union[ImmutableDict, Dict] to ImmutableDict.

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

This revision is now accepted and ready to land.Jul 7 2020, 3:42 PM
This revision was automatically updated to reflect the committed changes.