Page MenuHomeSoftware Heritage

origin_visit_add: Change return type to OriginVisit
ClosedPublic

Authored by ardumont on Mar 12 2020, 2:23 PM.

Details

Reviewers
vlorentz
Group Reviewers
Reviewers
Summary

What's really used after that call is the visit object and not the origin one.

Before:

def origin_visit_add(
     self, origin: Origin,
     date: Union[datetime.datetime, str],
     type: str) -> Optional[Dict[str, BaseModel]]:

After:

def origin_visit_add(
        self, origin: Origin,
        date: Union[str, datetime.datetime],
        type: str) -> OriginVisit:

Might as well remove the indirection

Depends on D2820

Test Plan

tox

Diff Detail

Repository
rDSTO Storage manager
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11086
Build 16712: tox-on-jenkinsJenkins
Build 16711: arc lint + arc unit

Event Timeline

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/storage/cassandra/storage.py
671–672

you should break line earlier, so the return type isn't split in half.

(and why isn't there a corresponding change in interface.py?)

This revision is now accepted and ready to land.Mar 12 2020, 2:37 PM
swh/storage/cassandra/storage.py
671–672

i think it's because it's not exposed, it's a cassandra specific one.

swh/storage/cassandra/storage.py
671–672

Yes, that's the reason.