Skip to content

Commit

Permalink
Prepare for 1.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jan 4, 2025
1 parent 4bd3f77 commit 52891f3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 26 additions & 11 deletions pymitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
"""
Expand All @@ -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):
"""
Expand All @@ -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):
"""
Expand All @@ -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):
"""
Expand Down

0 comments on commit 52891f3

Please sign in to comment.