Page MenuHomeSoftware Heritage

postgresql: Add type annotation for 'db' argument
ClosedPublic

Authored by vlorentz on Jun 28 2021, 5:28 PM.

Details

Summary

This allows mypy to actually type-check calls to db methods.

This commit also fixes an issue found by mypy.

Thanks to @anlambert noticing this issue in D5934

Diff Detail

Repository
rDSTO Storage manager
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 22297
Build 34704: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 34703: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D5937 (id=21316)

Could not rebase; Attempt merge onto ec2fac4478...

Updating ec2fac44..f1cac4fc
Fast-forward
 swh/storage/cassandra/cql.py       |  12 +++
 swh/storage/cassandra/storage.py   |  12 +++
 swh/storage/in_memory.py           |   6 ++
 swh/storage/interface.py           |   7 ++
 swh/storage/postgresql/db.py       |  16 +++-
 swh/storage/postgresql/storage.py  | 162 ++++++++++++++++++++++---------------
 swh/storage/tests/storage_tests.py |  49 +++++++++++
 7 files changed, 199 insertions(+), 65 deletions(-)
Changes applied before test
commit f1cac4fcaa153f2cba5af2eaa4e5c0aa14868f49
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jun 28 17:28:15 2021 +0200

    postgresql: Add type annotation for 'db' argument
    
    This allows mypy to actually type-check calls to db methods.
    
    This commit also fixes an issue found by mypy.

commit dd8a590b629dc322ef42c111ab710dce06f2542e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jun 28 17:21:18 2021 +0200

    --amend

commit c5beb49a73cd0004459ceea736efe3d989037420
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Mon Jun 28 15:30:41 2021 +0200

    Add endpoint raw_extrinsic_metadata_get_authorities
    
    This will make it easier for users of swh-web to discover metadata
    on a given SWHID, as you otherwise need to specify an authority to
    fetch metadata.

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

This revision is now accepted and ready to land.Jun 29 2021, 9:47 AM