-
Notifications
You must be signed in to change notification settings - Fork 13
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
run no_implicit_optional #53
run no_implicit_optional #53
Conversation
Codecov Report
@@ Coverage Diff @@
## master #53 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 13 13
Lines 321 321
=========================================
Hits 321 321
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
67cd19a
to
5dd3846
Compare
5dd3846
to
a660a26
Compare
I realized from typing import Optional
def f(x: Optional[int] = None) -> None:
... But your local code style uses import typing
def f(x: typing.Optional[int] = None) -> None:
... I updated the change appropriately |
Thanks @AllSeeingEyeTolledEweSew. I've also pushed a commit to explicitly set the mypy version we're testing against. |
Some cleanup to do on the repo, as things haven't been updated in a while. Hold on… |
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 @AllSeeingEyeTolledEweSew! I'll do some more cleanup and updates, then release a new version.
mypy
has recently disabled implicitOptional
by default (sodef f(x: int = None):
is no longer allowed)They created a tool, no_implicit_optional, to auto-modify code.
However, I found that since my app's tests use asgi-lifespan, I cannot just run the
no_implicit_optional
tool on my own code. Sincemypy
now defaults toimplicit_optional = False
, this results in wrong typing forasgi_lifespan.LifespanManager
.mypy
then complains about my own correct use ofLifespanManager
.For now, I'm working around my use of
LifespanManager
with# type: ignore
, but it would be nice to make asgi-lifespan use strictOptional
.Before:
I ran:
After: