From 9cadcee8446df9a071391a78827e10b9c7f81820 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Mon, 1 Jun 2020 11:35:26 +0200 Subject: [PATCH] [core/events] simplify args/kwargs detection --- bumblebee_status/core/event.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bumblebee_status/core/event.py b/bumblebee_status/core/event.py index 3cd7931..88096a5 100644 --- a/bumblebee_status/core/event.py +++ b/bumblebee_status/core/event.py @@ -3,7 +3,7 @@ __callbacks = {} def register(event, callback, *args, **kwargs): cb = callback - if len(args) + len(kwargs) > 0: + if args or kwargs: cb = lambda: callback(*args, **kwargs) __callbacks.setdefault(event, []).append(cb) @@ -19,10 +19,10 @@ def trigger(event, *args, **kwargs): return False for callback in cb: - if len(args) + len(kwargs) == 0: - callback() - else: + if args or kwargs: callback(*args, **kwargs) + else: + callback() return True