Page MenuHomeSoftware Heritage

core.loader: Fix Iterable/List typing issues.
ClosedPublic

Authored by vlorentz on Jul 30 2020, 7:05 PM.

Details

Summary
  1. origin_visit_add returns an iterable, not a sequence
  2. starting with v0.11.6, _add() endpoints now require a List instead of an Iteralble.

All these will trigger type warning with swh.core > 0.2.0,
as it will no longer hide the signature of storage endpoints
from mypy

Diff Detail

Repository
rDLDBASE Generic VCS/Package Loader
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz retitled this revision from core.loader: Fix Iterable/List type confusion. to core.loader: Fix Iterable/List typing issues..Jul 30 2020, 7:05 PM
This revision is now accepted and ready to land.Jul 30 2020, 7:08 PM

Build is green

Patch application report for D3656 (id=12870)

Could not rebase; Attempt merge onto 30556901ae...

Updating 3055690..03577d7
Fast-forward
 swh/loader/core/loader.py    | 23 ++++++++++++++---------
 swh/loader/package/loader.py | 14 ++++++++------
 2 files changed, 22 insertions(+), 15 deletions(-)
Changes applied before test
commit 03577d7b7c58d97a3ec102635d0430c023e6d6b3
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jul 30 19:00:08 2020 +0200

    core.loader: Fix Iterable/List type confusion.
    
    1. origin_visit_add returns an iterable, not a sequence
    2. starting with v0.11.6, _add() endpoints now require a List
       instead of an Iteralble.
    
    All these will trigger type warning with swh.core > 0.2.0,
    as it will no longer hide the signature of storage endpoints
    from mypy

commit 8808b7563a78f74e23795ed684c7445feb8dc6e1
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jul 30 11:10:53 2020 +0200

    package.loader: Fix type warning with swh.core > 0.2.0
    
    The next version of swh.core will allow mypy to detect the return
    type of origin_visit_add is Iterable.

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

Build is green

Patch application report for D3656 (id=12871)

Could not rebase; Attempt merge onto 30556901ae...

Updating 3055690..3b97703
Fast-forward
 swh/loader/core/loader.py    | 23 ++++++++++++++---------
 swh/loader/package/loader.py | 14 ++++++++------
 2 files changed, 22 insertions(+), 15 deletions(-)
Changes applied before test
commit 3b97703d7f14e145d6124f1c61f5f283ee8eecf2
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jul 30 19:00:08 2020 +0200

    core.loader: Fix Iterable/List typing issues
    
    1. origin_visit_add returns an iterable, not a sequence
    2. starting with v0.11.6, _add() endpoints now require a List
       instead of an Iteralble.
    
    All these will trigger type warning with swh.core > 0.2.0,
    as it will no longer hide the signature of storage endpoints
    from mypy

commit 8808b7563a78f74e23795ed684c7445feb8dc6e1
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Jul 30 11:10:53 2020 +0200

    package.loader: Fix type warning with swh.core > 0.2.0
    
    The next version of swh.core will allow mypy to detect the return
    type of origin_visit_add is Iterable.

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