-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix type hint errors on Twisted trunk #16526
Conversation
self._reactor, # type: ignore[arg-type,unused-ignore] | ||
self._reactor.getThreadPool(), # type: ignore[arg-type,unused-ignore] | ||
self._writer, # type: ignore[arg-type,unused-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.
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.
I don't really like this, but I don't see another option for getting this to work?
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?)
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
What's the misc
complaint about OOI?
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.
tests/http/server/_base.py:338: error: Access to generic instance variables via class is ambiguous [misc]
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 think it is complaining about snagging a instance level method from a class?
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, pretty much. 👍
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 for looking into this!
See #16289