From: Christian Heller Date: Tue, 23 Dec 2025 08:07:23 +0000 (+0100) Subject: Minor refactoring. X-Git-Url: https://plomlompom.com/repos/booking/%22https:/validator.w3.org/index.html?a=commitdiff_plain;h=1244779756e13ce7547d6e5fe95b5719b01a5fa9;p=ircplom Minor refactoring. --- diff --git a/src/ircplom/client.py b/src/ircplom/client.py index 1bb742f..38d912f 100644 --- a/src/ircplom/client.py +++ b/src/ircplom/client.py @@ -863,17 +863,16 @@ class Client(ABC, ClientQueueMixin): for verb in ('setattr', 'do', 'doafter'): for task, args in [t for t in ret['_tasks'].items() if t[0].verb == verb]: - path = list(task.path) - node: Any = (ret[path.pop(0)[1]] - if task.path and path[0][1].isupper() else self) - for is_dict_key, step_name in path: - if is_dict_key: - if step_name.isupper(): - step_name = ret[step_name] - node = node[step_name] - else: - node = (node(step_name) if callable(node) - else getattr(node, step_name)) + node: Any = self + for idx, step_t in enumerate(task.path): + is_dict_key, step_code = step_t + step = ret[step_code] if step_code.isupper() else step_code + if idx == 0 and not isinstance(step, str): + node = step + continue + node = (node[step] if is_dict_key + else (node(step) if callable(node) + else getattr(node, step))) for arg in args: if task.verb == 'setattr': setattr(node, arg, ret[arg])