Page MenuHomeSoftware Heritage

api: Add typing to view function signatures
ClosedPublic

Authored by anlambert on Jun 3 2022, 3:56 PM.

Details

Summary

Because parameters of Web API view functions were not typed, mypy was
not processing the body of those functions and thus typing errors could
be missed.

So add typing to these function signatures and fix new mypy errors now
new code is processed.

Diff Detail

Repository
rDWAPPS Web applications
Branch
api-add-views-typing
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 29802
Build 46576: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 46575: arc lint + arc unit

Event Timeline

Build was aborted

Patch application report for D7959 (id=28675)

Rebasing onto 3a4e607645...

Current branch diff-target is up to date.
Changes applied before test
commit cfe35486e698352221ec91d432a34ff5438bd4c0
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Fri Jun 3 15:19:03 2022 +0200

    api: Add typing to view function signatures
    
    Because parameters of Web API view functions were not typed, mypy was
    not processing the body of those functions and thus typing errors could
    be missed.
    
    So add typing to these function signatures and fix new mypy errors now
    new code is processed.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1880/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1880/console

Harbormaster returned this revision to the author for changes because remote builds failed.Jun 3 2022, 4:25 PM
Harbormaster failed remote builds in B29759: Diff 28675!

Build has FAILED

Patch application report for D7959 (id=28675)

Rebasing onto 3a4e607645...

Current branch diff-target is up to date.
Changes applied before test
commit cfe35486e698352221ec91d432a34ff5438bd4c0
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Fri Jun 3 15:19:03 2022 +0200

    api: Add typing to view function signatures
    
    Because parameters of Web API view functions were not typed, mypy was
    not processing the body of those functions and thus typing errors could
    be missed.
    
    So add typing to these function signatures and fix new mypy errors now
    new code is processed.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1881/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1881/console

Build is green

Patch application report for D7959 (id=28682)

Rebasing onto 631925c646...

Current branch diff-target is up to date.
Changes applied before test
commit 6727a2385f9d2497787ce30a68f36fdd13b7e360
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Fri Jun 3 15:19:03 2022 +0200

    api: Add typing to view function signatures
    
    Because parameters of Web API view functions were not typed, mypy was
    not processing the body of those functions and thus typing errors could
    be missed.
    
    So add typing to these function signatures and fix new mypy errors now
    new code is processed.

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

vlorentz added a subscriber: vlorentz.

nice

swh/web/api/views/metadata.py
82

slightly incorrect message now, as we may raise it when it is provided but empty

swh/web/api/views/origin.py
101

Instead of this change, change the type of enrich_origin to take Union[Dict[str, Any], OriginInfo] as argument

swh/web/api/views/origin_save.py
118
swh/web/api/views/raw.py
89–92

avoids shadowing a built-in

This revision is now accepted and ready to land.Jun 7 2022, 10:48 AM

Build is green

Patch application report for D7959 (id=28721)

Rebasing onto 66ded032dc...

Current branch diff-target is up to date.
Changes applied before test
commit 72b6022e096697ca0a9bfbec9e2e285197c2a5a8
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Fri Jun 3 15:19:03 2022 +0200

    api: Add typing to view function signatures
    
    Because parameters of Web API view functions were not typed, mypy was
    not processing the body of those functions and thus typing errors could
    be missed.
    
    So add typing to these function signatures and fix new mypy errors now
    new code is processed.

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