-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enforce strict mypy checks #5370
Conversation
Yes. The tests are code too. |
Also, can't you granularly apply the strictness to certain packages via |
Well. It depends :-) |
Codecov Report
@@ Coverage Diff @@
## master #5370 +/- ##
==========================================
- Coverage 97.17% 97.17% -0.01%
==========================================
Files 41 41
Lines 8742 8768 +26
Branches 1402 1404 +2
==========================================
+ Hits 8495 8520 +25
- Misses 129 130 +1
Partials 118 118
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Type checking can reveal problems in test just like in any other code. |
9408e31
to
9a77c42
Compare
CHANGES/3927.misc
Outdated
@@ -0,0 +1 @@ | |||
Use mypy --strict |
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.
Use mypy --strict | |
Use ``mypy --strict`` |
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.
Done
aiohttp/web_protocol.py
Outdated
{}, # type: ignore | ||
{}, # type: ignore |
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.
Could you specify which errors are getting ignored? I saw syntax like # type: ignore:SomeError
somewhere but I can't recall if it's documented.
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.
Done. I was not aware of this syntax.
aiohttp/client_reqrep.py
Outdated
self.body = (self.body,) # type: ignore | ||
body = (self.body,) | ||
else: | ||
body = self.body |
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.
This looks like a logic change unrelated to typing
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.
I've restored the logic
aiohttp/web_ws.py
Outdated
@@ -299,7 +309,7 @@ def ws_protocol(self) -> Optional[str]: | |||
return self._ws_protocol | |||
|
|||
@property | |||
def compress(self) -> bool: | |||
def compress(self) -> int: |
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.
Why did you change this instead of converting the return value right below?
tests/test_client_session.py
Outdated
session = ClientSession(timeout=500) | ||
assert session.timeout == 500 | ||
timeout = ClientTimeout(total=500) | ||
session = ClientSession(timeout=timeout) |
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.
Why can't session timeout accept int
?
@webknjaz I removed all changes and specified only mypy error codes in |
💔 Backport was not successfulThe PR was attempted backported to the following branches:
|
@derlih mind backporting this to 3.8? https://docs.aiohttp.org/en/stable/contributing.html#backporting |
I will try to |
This change covers the entire codebase with strict typings and makes the ignores granular. PR aio-libs#5370 by @derlih. (cherry picked from commit 742a8b6) Co-authored-by: Dmitry Erlikh <derlih@gmail.com>
This change covers the entire codebase with strict typings and makes the ignores granular. PR aio-libs#5370 by @derlih
This change covers the entire codebase with strict typings and makes the ignores granular. PR aio-libs#5370 by @derlih
This change covers the entire codebase with strict typings and makes the ignores granular. PR aio-libs#5370 by @derlih
What do these changes do?
Fix typing for mypy strict mode
Are there changes in behavior for the user?
no
Related issue number
#3927
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.