Skip to content
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

mypy check_untyped_defs #966

Merged
merged 12 commits into from
Mar 15, 2023
Merged

Conversation

altendky
Copy link
Contributor

@altendky altendky commented Mar 14, 2023

@@ -377,3 +378,8 @@ def dispatch_events(self, event_queue):
if handler in self._handlers.get(watch, []):
handler.dispatch(event)
event_queue.task_done()


class BaseObserverSubclassCallable(Protocol):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dunno, I think I might rather rework the inheritance so that the init calls are "properly" compatible. But, this is a game to play for the moment.

Copy link
Collaborator

@BoboTiG BoboTiG Mar 14, 2023

Choose a reason for hiding this comment

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

The "nice" was mostly for the Protocol usage :)
I've never really used that pattern, and it may be quite helpful!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely, I tend away from inheritance and Protocol certainly gives you a nice static way to describe shared interfaces.

@@ -20,7 +20,7 @@

@pytest.mark.flaky(max_runs=5, min_passes=1)
def test_delayed_get():
q = DelayedQueue(2)
q = DelayedQueue[str](2)
Copy link
Collaborator

@BoboTiG BoboTiG Mar 14, 2023

Choose a reason for hiding this comment

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

Oh, I've learned something too today :)

@altendky
Copy link
Contributor Author

Flake8 is unhappy around the globals like p() and emitter in the tests. I'm going to make a separate PR exploring updating those patterns and see how they look.

@altendky altendky marked this pull request as ready for review March 15, 2023 17:54
@BoboTiG BoboTiG merged commit 9c28c61 into gorakhargosh:master Mar 15, 2023
@BoboTiG
Copy link
Collaborator

BoboTiG commented Mar 15, 2023

Thanks @altendky 🍾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants