Skip to content

Conversation

ordabayevy
Copy link
Member

No description provided.

@ordabayevy ordabayevy added the WIP label Nov 4, 2023
@@ -61,17 +74,15 @@ class Messenger:
Most inference operations are implemented in subclasses of this.
"""

def __call__(self, fn):
def __call__(self, fn: Callable) -> Callable:
Copy link
Member

Choose a reason for hiding this comment

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

Should we be more precise and allow passing of type information?

_F = TypeVar("_F", bound=Callable)

class Messenger:
    def __call__(self, fn: _F) -> _F:
        ...

@@ -227,7 +250,9 @@ def unregister(cls, fn=None, type=None):


@contextmanager
def block_messengers(predicate):
def block_messengers(
predicate: Callable[[Messenger], bool]
Copy link
Member

Choose a reason for hiding this comment

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

This is great!

@fritzo fritzo merged commit 71e0f9c into dev Nov 5, 2023
@ordabayevy ordabayevy deleted the type-messenger branch November 5, 2023 23:08
@ordabayevy ordabayevy mentioned this pull request Feb 5, 2024
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants