-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
__author__ = "Marcel Rieger" | ||
__author_email__ = "[email protected]" | ||
__copyright__ = "Copyright 2014-2024, Marcel Rieger" | ||
__copyright__ = "Copyright 2014-2025, Marcel Rieger" | ||
__credits__ = ["Marcel Rieger"] | ||
__contact__ = "https://github.com/riga/pymitter" | ||
__license__ = "BSD-3-Clause" | ||
|
@@ -63,9 +63,12 @@ def num_listeners(self) -> int: | |
return self._event_tree.num_listeners() + len(self._any_listeners) | ||
|
||
@overload | ||
def on(self, event: str, func: F, *, ttl: int = -1) -> F: ... | ||
def on(self, event: str, func: F, *, ttl: int = -1) -> F: | ||
... | ||
|
||
@overload | ||
def on(self, event: str, *, ttl: int = -1) -> Callable[[F], F]: ... | ||
def on(self, event: str, *, ttl: int = -1) -> Callable[[F], F]: | ||
... | ||
|
||
def on( | ||
self, | ||
|
@@ -95,9 +98,12 @@ def on(func: F) -> F: | |
return on(func) if func else on | ||
|
||
@overload | ||
def once(self, event: str, func: F) -> F: ... | ||
def once(self, event: str, func: F) -> F: | ||
... | ||
|
||
@overload | ||
def once(self, event: str) -> Callable[[F], F]: ... | ||
def once(self, event: str) -> Callable[[F], F]: | ||
... | ||
|
||
def once(self, event: str, func: Optional[F] = None): | ||
""" | ||
|
@@ -107,9 +113,12 @@ def once(self, event: str, func: Optional[F] = None): | |
return self.on(event, func, ttl=1) if func else self.on(event, ttl=1) | ||
|
||
@overload | ||
def on_any(self, func: F, *, ttl: int = -1) -> F: ... | ||
def on_any(self, func: F, *, ttl: int = -1) -> F: | ||
... | ||
|
||
@overload | ||
def on_any(self, *, ttl: int = -1) -> Callable[[F], F]: ... | ||
def on_any(self, *, ttl: int = -1) -> Callable[[F], F]: | ||
... | ||
|
||
def on_any(self, func: Optional[F] = None, *, ttl: int = -1): | ||
""" | ||
|
@@ -133,9 +142,12 @@ def on_any(func: F) -> F: | |
return on_any(func) if func else on_any | ||
|
||
@overload | ||
def off(self, event: str, func: F) -> F: ... | ||
def off(self, event: str, func: F) -> F: | ||
... | ||
|
||
@overload | ||
def off(self, event: str) -> Callable[[F], F]: ... | ||
def off(self, event: str) -> Callable[[F], F]: | ||
... | ||
|
||
def off(self, event: str, func: Optional[F] = None): | ||
""" | ||
|
@@ -150,9 +162,12 @@ def off(func: Callable) -> Callable: | |
return off(func) if func else off | ||
|
||
@overload | ||
def off_any(self, func: F) -> F: ... | ||
def off_any(self, func: F) -> F: | ||
... | ||
|
||
@overload | ||
def off_any(self) -> Callable[[F], F]: ... | ||
def off_any(self) -> Callable[[F], F]: | ||
... | ||
|
||
def off_any(self, func: Optional[F] = None): | ||
""" | ||
|