From 93536f95036ac19e4384fb258d00800f44cbbf6d Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 20 Sep 2025 01:34:41 +0200 Subject: [PATCH] Drop unnecessary complexity of _UpdatingNode.log_scopes. --- ircplom/client_tui.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ircplom/client_tui.py b/ircplom/client_tui.py index 8bc3a79..9a5cf8a 100644 --- a/ircplom/client_tui.py +++ b/ircplom/client_tui.py @@ -46,19 +46,10 @@ class _Update: class _UpdatingNode(AutoAttrMixin): - log_scopes: dict[str, LogScope] = {'': LogScope.SERVER} def _make_attr(self, cls: Callable, key: str): return cls() - @classmethod - def _scope(cls, key: str) -> LogScope: - scopes: dict[str, LogScope] = {} - for c in cls.__mro__: - if hasattr(c, 'log_scopes'): - scopes = c.log_scopes | scopes - return scopes.get(key, scopes['']) - def recursive_set_and_report_change(self, update: _Update) -> None: 'Apply update, and, if it makes a difference, add to its .results.' update.force_log = update.force_log or (not self._is_set(update.key)) @@ -68,7 +59,6 @@ class _UpdatingNode(AutoAttrMixin): node.recursive_set_and_report_change(update) else: update.old_value = node - scope = self._scope(update.key) do_report = update.force_log if update.value is None: if self._is_set(update.key): @@ -78,7 +68,7 @@ class _UpdatingNode(AutoAttrMixin): self._set(update.key, update.value) do_report |= True if do_report: - update.results += [(scope, + update.results += [(LogScope.SERVER, tuple(sorted(update.value)) if isinstance(update.value, set) else update.value)] @@ -247,7 +237,6 @@ class _UpdatingChannel(_UpdatingNode, Channel): class _UpdatingUser(_UpdatingNode, User): - log_scopes = {'exit_msg': LogScope.USER_NO_CHANNELS} prev_nick = '?' def recursive_set_and_report_change(self, update: _Update) -> None: @@ -265,7 +254,7 @@ class _UpdatingUser(_UpdatingNode, User): msg = f':{self} quits' if len(update.value) > 1: msg += f': {update.value[1:]}' - update.results += [(self._scope(update.key), [msg])] + update.results += [(LogScope.USER_NO_CHANNELS, [msg])] @property def prev(self) -> str: -- 2.30.2