-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add Optional for types on expires/expires_days #2678
Add Optional for types on expires/expires_days #2678
Conversation
The runtime already allows and deal with None values here. Adding Optional improves the type checking and (since this is public API) allows users to run their type checker with strict-optional.
Thanks! Tornado is compatible with I think it's a good idea to switch to no-implicit-optional mode, but we should go all the way: Add |
Thanks @bdarnell for having a look and the clarification regarding strict/implicit optional. I'll have a go at enabling |
e5aa680
to
cd6cd9c
Compare
@bdarnell I added no_implicit_optional and made the necessary changes to annotations. Please have a look and let me know what you think. There is currently still one failing test: https://travis-ci.org/tornadoweb/tornado/jobs/545617971 |
ubuntu-16.04 comes with python-3.5.2, so that's why tornado is attempting to retain compatibility. Unfortunately, there were some significant bugs fixed in later python 3.5 point releases. |
... so I think one solution is to stringify the whole "Optional[Type[AsyncHTTPClient]]" to defer any parsing to mypy (and mypy checks are not run on python-3.5.2) |
9eaebf7
to
8a55930
Compare
8a55930
to
4beb228
Compare
Thanks @ploxiln for the hint. The CI is green now. Please let me know if there is anything else to change here. |
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!
The runtime already allows and deal with
None
values here. AddingOptional
improves the type checking and (since this is public API) allows users to run their type checker with strict-optional.