home · contact · privacy
Minor refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 23 Dec 2025 08:07:23 +0000 (09:07 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 23 Dec 2025 08:07:23 +0000 (09:07 +0100)
src/ircplom/client.py

index 1bb742f416792d47b40faf701b7f40e4fb8c7e8e..38d912f958a5240e29b681a9118b79105e74c1f5 100644 (file)
@@ -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])