From d777d9cff6d82e794990dc36a8f58a48998429fe Mon Sep 17 00:00:00 2001 From: elig0n <31196036+elig0n@users.noreply.github.com> Date: Wed, 20 Mar 2024 21:21:30 +0200 Subject: [PATCH 1/3] Update __init__.py Use hasattr() --- i3pystatus/core/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3pystatus/core/__init__.py b/i3pystatus/core/__init__.py index d9cbd675..02f30350 100644 --- a/i3pystatus/core/__init__.py +++ b/i3pystatus/core/__init__.py @@ -113,7 +113,7 @@ def register(self, module, *args, **kwargs): # Merge the module's hints with the default hints # and overwrite any duplicates with the hint from the module - hints = self.default_hints.copy() if self.default_hints else {} + hints = self.default_hints.copy() if hasattr(self, "default_hints") else {} hints.update(kwargs.get('hints', {})) if hints: kwargs['hints'] = hints From 592f39c78c5a384562bcfdcda87fdbb68a4d425f Mon Sep 17 00:00:00 2001 From: elig0n <31196036+elig0n@users.noreply.github.com> Date: Wed, 20 Mar 2024 21:58:46 +0200 Subject: [PATCH 2/3] Update __init__.py --- i3pystatus/core/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3pystatus/core/__init__.py b/i3pystatus/core/__init__.py index 02f30350..b845ac1c 100644 --- a/i3pystatus/core/__init__.py +++ b/i3pystatus/core/__init__.py @@ -66,7 +66,7 @@ class Status: def __init__(self, standalone=True, click_events=True, interval=1, input_stream=None, logfile=None, internet_check=None, keep_alive=False, logformat=DEFAULT_LOG_FORMAT, - default_hints=None): + default_hints={}): self.standalone = standalone self.default_hints = default_hints self.click_events = standalone and click_events @@ -113,7 +113,7 @@ def register(self, module, *args, **kwargs): # Merge the module's hints with the default hints # and overwrite any duplicates with the hint from the module - hints = self.default_hints.copy() if hasattr(self, "default_hints") else {} + hints = self.default_hints.copy() hints.update(kwargs.get('hints', {})) if hints: kwargs['hints'] = hints From fef3112b2b7b53588e0e3e326fa63448313bd1ec Mon Sep 17 00:00:00 2001 From: elig0n <31196036+elig0n@users.noreply.github.com> Date: Wed, 20 Mar 2024 22:06:05 +0200 Subject: [PATCH 3/3] Update __init__.py --- i3pystatus/core/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3pystatus/core/__init__.py b/i3pystatus/core/__init__.py index b845ac1c..69c3ac59 100644 --- a/i3pystatus/core/__init__.py +++ b/i3pystatus/core/__init__.py @@ -113,7 +113,7 @@ def register(self, module, *args, **kwargs): # Merge the module's hints with the default hints # and overwrite any duplicates with the hint from the module - hints = self.default_hints.copy() + hints = self.default_hints.copy() if hasattr(self, "default_hints") else {} hints.update(kwargs.get('hints', {})) if hints: kwargs['hints'] = hints