-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MPP-3698: Enable mypy --check-untyped-def --no-implicit-reexport
across code
#4347
Conversation
8464f62
to
d69f791
Compare
PR #4321 is merged, this is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One blocking question about returning 401
status code that's very important to get right because Firefox clients change their behavior based on that status code.
privaterelay/tests/mgmt_sync_phone_related_dates_on_profile_tests.py
Outdated
Show resolved
Hide resolved
d69f791
to
f38a5ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick review @groovecoder! I've answered some questions, and made two suggested changes:
- Removed
Optional
fromprivaterelay/settings.py
- Added
create_free_phones_flag_for_user
helper
privaterelay/tests/mgmt_sync_phone_related_dates_on_profile_tests.py
Outdated
Show resolved
Hide resolved
mypy --check-untyped-def --no-implicit-reeexport
across codemypy --check-untyped-def --no-implicit-reexport
across code
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
For MPP-3698, I updated the code so both
--check-untyped-def
and--no-implicit-reexport
is used across our code. This means that code without type annotations is checked bymypy
rather than skipped, and finds errors like not consideringNone
or other alternate return types.This is a big PR, but the changes themselves are small.
Bugs Fixed
api/authentication.py
introspect_token
- Error handler referred tofxa_resp
, was not initialized (SentryRELAY-J0
,RELAY-J2
)api/permissions.py
HasPremium
called abool
(unused in code)emails/management/commands/process_emails_from_sqs.py
Command.handle
- Use different name for exception inside of an exception handlerCode changes
emails_config()
is now inemails.app.py
.assert
to ensure a value is notNone
whenmypy
complainedisinstance
to ensurerequest.user
is not an anonymous user in API codehasattr
checks as needed for dynamically added fields# noqa: E501
comment.:=
) to assign and assert (usually notNone
) in one lineOptional[X]
to Python 3.9 formatX | None
from __future__ import annotations
for PEP-563, Postponed Evaluation of Annotations, to allow more forward annotations without quotes.api/tests/authentication_tests.py
FxaTokenAuthentication
instead of class inFxaTokenAuthenticationTest
FxaTokenAuthenticationTest
privaterelay/settings.py
RELAY_CHANNEL
is now restricted to "local", "dev", "stage", or "prod"privaterelay/settings.py
for "circular import" issues.cast=str
when it is the default.AUTO_RELOAD_BUNDLES = False
to avoiddjango-ftl
warning