-
-
Notifications
You must be signed in to change notification settings - Fork 700
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
mypy check_untyped_defs #966
Conversation
src/watchdog/observers/api.py
Outdated
@@ -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): |
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.
Nice!
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 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.
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.
The "nice" was mostly for the Protocol
usage :)
I've never really used that pattern, and it may be quite helpful!
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.
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) |
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.
Oh, I've learned something too today :)
Flake8 is unhappy around the globals like |
Thanks @altendky 🍾 |
Draft for: