Page MenuHomeSoftware Heritage

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

Authored by vlorentz on Thu, Jul 30, 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 created this revision.Thu, Jul 30, 7:05 PM
vlorentz retitled this revision from core.loader: Fix Iterable/List type confusion. to core.loader: Fix Iterable/List typing issues..Thu, Jul 30, 7:05 PM
vlorentz updated this revision to Diff 12871.Thu, Jul 30, 7:06 PM

better commit title

ardumont accepted this revision.Thu, Jul 30, 7:08 PM
ardumont added a subscriber: ardumont.

yeah, thanks.

This should fix builds [1] [2] when merged and a new release of core is done.

[1] https://jenkins.softwareheritage.org/job/DLDG/job/tests/758/console

[2] https://jenkins.softwareheritage.org/job/DLDHG/job/tests/732/console

This revision is now accepted and ready to land.Thu, Jul 30, 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.

This revision was automatically updated to reflect the committed changes.