Fix various files so the entire trio/ directory can be type-checked#2763
Merged
jakkdl merged 9 commits intopython-trio:masterfrom Aug 18, 2023
Merged
Fix various files so the entire trio/ directory can be type-checked#2763jakkdl merged 9 commits intopython-trio:masterfrom
jakkdl merged 9 commits intopython-trio:masterfrom
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2763 +/- ##
==========================================
+ Coverage 98.92% 98.93% +0.01%
==========================================
Files 113 113
Lines 16728 16752 +24
Branches 3026 3027 +1
==========================================
+ Hits 16548 16574 +26
+ Misses 124 123 -1
+ Partials 56 55 -1
|
jakkdl
commented
Aug 17, 2023
Member
Author
There was a problem hiding this comment.
without (possibly a subset of) the changes to _fake_net:
trio/testing/_fake_net.py:107: error: Signature of "socket" incompatible with supertype "SocketFactory" [override]
trio/testing/_fake_net.py:107: note: Superclass:
trio/testing/_fake_net.py:107: note: def socket(self, family: Union[AddressFamily, int, None] = ..., type: Union[SocketKind, int, None] = ..., proto: Optional[int] = ...) -> _SocketType
trio/testing/_fake_net.py:107: note: Subclass:
trio/testing/_fake_net.py:107: note: def socket(self, family: int, type: int, proto: int) -> FakeSocket
trio/testing/_fake_net.py:116: error: Argument 1 of "getaddrinfo" is incompatible with supertype "HostnameResolver"; supertype defines the argument type as "Union[bytes, str, None]" [override]
trio/testing/_fake_net.py:116: note: This violates the Liskov substitution principle
trio/testing/_fake_net.py:116: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
trio/testing/_fake_net.py:116: error: Argument 2 of "getaddrinfo" is incompatible with supertype "HostnameResolver"; supertype defines the argument type as "Union[bytes, str, int, None]" [override]
trio/testing/_fake_net.py:131: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
trio/testing/_fake_net.py:179: error: Need type annotation for "_packet_sender" [var-annotated]
trio/testing/_fake_net.py:179: error: Need type annotation for "_packet_receiver" [var-annotated]
Found 5 errors in 1 file (checked 129 source files)
TeamSpen210
reviewed
Aug 17, 2023
TeamSpen210
approved these changes
Aug 17, 2023
CoolCat467
requested changes
Aug 18, 2023
CoolCat467
approved these changes
Aug 18, 2023
Member
Author
|
merging this one so any additional minor problem in other typing PRs can be caught, gonna lead to a bunch of merge conflicts in |
Closed
41 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a squash of #2721 to avoid having to navigate a huge and messy PR. It consists of a ton of small fixes or
type: ignoresto any file that raised errors when runningmypy trio/, and it also transitionspyproject.tomlfrom being a list of files to check strictly, to an ignore-list with files to disable strict checks for. This doubles as a TODO-list, and it's easy to explode wildcards, or remove a disabled check, or similar.The test changes has caught several small typing errors introduced in various PRs that haven't been checked in CI, or when files have been forgotten to get added.
All the changes should be non-controversial, if anything is up for debate I'll just mark it with a comment and/or revert it, and add it to #2734 or directly split out to a separate PR