Page MenuHomeSoftware Heritage

Make StorageInterface a Protocol.
ClosedPublic

Authored by vlorentz on Sep 1 2020, 10:38 AM.

Details

Summary

We're already using 'StorageInterface' as type annotation where we expect an object
that implements the same methods, but it isn't technically correct since these
objects aren't an instance of a subclass.

Making StorageInterface a protocol reflects how we already use it, without
lying to mypy.

Diff Detail

Repository
rDSTO Storage manager
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 D3855 (id=13614)

Rebasing onto 5afd985ebd...

Current branch diff-target is up to date.
Changes applied before test
commit e6c17f6ed58737aee8f4839eecbb73553e946b2c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Tue Sep 1 10:38:36 2020 +0200

    Make StorageInterface a Protocol.
    
    We're already using 'StorageInterface' as type annotation where we expect an object
    that implements the same methods, but it isn't technically correct since these
    objects aren't an instance of a subclass.
    
    Making StorageInterface a protocol reflects how we already use it, without
    lying to mypy.

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

anlambert added a subscriber: anlambert.

Looks good to me.

This revision is now accepted and ready to land.Sep 1 2020, 11:53 AM
This revision was automatically updated to reflect the committed changes.