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
Branch
interface-protocol
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 14846
Build 22870: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 22869: arc lint + arc unit

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.