-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix type hint errors on Twisted trunk #16526
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Improve type hints. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -335,7 +335,7 @@ def __init__(self, seen_awaits: Set[Tuple[str, ...]], request_number: int): | |
self._request_number = request_number | ||
self._seen_awaits = seen_awaits | ||
|
||
self._original_Deferred___next__ = Deferred.__next__ | ||
self._original_Deferred___next__ = Deferred.__next__ # type: ignore[misc,unused-ignore] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is complaining about snagging a instance level method from a class? |
||
|
||
# The number of `await`s on `Deferred`s we have seen so far. | ||
self.awaits_seen = 0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
Generic, | ||
Iterable, | ||
List, | ||
Mapping, | ||
NoReturn, | ||
Optional, | ||
Tuple, | ||
|
@@ -251,7 +252,7 @@ def assertObjectHasAttributes(self, attrs: Dict[str, object], obj: object) -> No | |
except AssertionError as e: | ||
raise (type(e))(f"Assert error for '.{key}':") from e | ||
|
||
def assert_dict(self, required: dict, actual: dict) -> None: | ||
def assert_dict(self, required: Mapping, actual: Mapping) -> None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surprised twisted picked this up. Is the point that some twisted function now returns a proper type, so we get a Mapping instead of an Any? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, pretty much. 👍 |
||
"""Does a partial assert of a dict. | ||
|
||
Args: | ||
|
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 don't really like this, but I don't see another option for getting this to work?
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.
Note that these ignores are here for Twisted release, the Twisted Trunk job ignore unused ignores.
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.
Let's roll with this. (ParamSpec chaining has been a source of pain for me, too. I think it tends not to go well if you pass it into an overloaded function?)