From 52891f339ee1266008e652aafa5e53588153c21b Mon Sep 17 00:00:00 2001 From: "Marcel R." Date: Sat, 4 Jan 2025 19:29:09 +0100 Subject: [PATCH] Prepare for 1.0 release. --- .flake8 | 2 +- pymitter/__init__.py | 37 ++++++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.flake8 b/.flake8 index 7671491..cd023d6 100644 --- a/.flake8 +++ b/.flake8 @@ -3,7 +3,7 @@ max-line-length = 101 # codes of errors to ignore -ignore = E128, E306, E402, E722, E731, W504, E704 +ignore = E128, E306, E402, E722, E731, W504 # enforce double quotes inline-quotes = double diff --git a/pymitter/__init__.py b/pymitter/__init__.py index 9af15b5..0876f83 100644 --- a/pymitter/__init__.py +++ b/pymitter/__init__.py @@ -8,7 +8,7 @@ __author__ = "Marcel Rieger" __author_email__ = "github.riga@icloud.com" -__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): """