Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix type hint errors on Twisted trunk #16526

Merged
merged 4 commits into from
Oct 23, 2023
Merged

Fix type hint errors on Twisted trunk #16526

merged 4 commits into from
Oct 23, 2023

Conversation

clokep
Copy link
Member

@clokep clokep commented Oct 19, 2023

See #16289

@clokep clokep marked this pull request as ready for review October 19, 2023 19:54
@clokep clokep requested a review from a team as a code owner October 19, 2023 19:54
Comment on lines +89 to +91
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]
Copy link
Member Author

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?

Copy link
Member Author

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.

Copy link
Contributor

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]
Copy link
Contributor

@DMRobertson DMRobertson Oct 23, 2023

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?

Copy link
Member Author

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]

Copy link
Member Author

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:
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, pretty much. 👍

Copy link
Contributor

@DMRobertson DMRobertson left a 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!

@clokep clokep merged commit 3ab861a into develop Oct 23, 2023
38 checks passed
@clokep clokep deleted the clokep/twisted-trunk branch October 23, 2023 18:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants