Page MenuHomeSoftware Heritage

Update type annotations and signatures to match djangorestframework-stubs
ClosedPublic

Authored by olasd on Apr 8 2020, 8:44 PM.

Details

Summary

I noticed this because my virtualenv ended up with the djangorestframework-stubs
package installed, which made the mypy pre-commit hook fail.

This commit adds drf-stubs to the tox.ini, and does the relevant updates to our
type annotations/signatures.

Turns out that upstream DRF has all request parameters named that way, so we
rename all our req parameters to match, which appeases mypy's signature
checks.

Test Plan

happy tox is happy

Diff Detail

Repository
rDDEP Push deposit
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D2985 (id=10609)

Rebasing onto f5426d6722...

Current branch diff-target is up to date.
Changes applied before test
commit ed54e9636998b2df53f7f92c7cb7abc3a8310dfd
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 20:40:06 2020 +0200

    Update type annotations and signatures to match djangorestframework-stubs
    
    I noticed this because my virtualenv ended up with the djangorestframework-stubs
    package installed, which made the mypy pre-commit hook fail.
    
    This commit adds drf-stubs to the tox.ini, and does the relevant updates to our
    type annotations/signatures.
    
    Turns out that upstream DRF has all `request` parameters named that way, so we
    rename all our `req` parameters to match, which appeases mypy's signature
    checks.

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

This revision is now accepted and ready to land.Apr 8 2020, 8:54 PM

Build is green

Patch application report for D2985 (id=10610)

Rebasing onto 1bc1732fde...

Current branch diff-target is up to date.
Changes applied before test
commit dfd33d2d970ff3db08e547002dcea1f8304bee8a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 20:40:06 2020 +0200

    Update type annotations and signatures to match djangorestframework-stubs
    
    I noticed this because my virtualenv ended up with the djangorestframework-stubs
    package installed, which made the mypy pre-commit hook fail.
    
    This commit adds drf-stubs to the tox.ini, and does the relevant updates to our
    type annotations/signatures.
    
    Turns out that upstream DRF has all `request` parameters named that way, so we
    rename all our `req` parameters to match, which appeases mypy's signature
    checks.

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