From 1abdbfff43f343826e58e170eae93a962b257716 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 30 Sep 2025 19:50:09 +0200 Subject: [PATCH] For MsgParseExpection task path parsing, allow starting directly with uppercase-referenced nodes. --- src/ircplom/client.py | 8 ++++---- src/ircplom/msg_parse_expectations.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ircplom/client.py b/src/ircplom/client.py index 8c65d1e..3ebbc11 100644 --- a/src/ircplom/client.py +++ b/src/ircplom/client.py @@ -922,8 +922,10 @@ class Client(ABC, ClientQueueMixin): for verb in ('setattr', 'do', 'doafter'): for task, tok_names in [t for t in ret['_tasks'].items() if t[0].verb == verb]: - node: Any = self - for step in task.path: + path = list(task.path) + node: Any = (ret[path.pop(0)] + if task.path and path[0].isupper() else self) + for step in path: key = ret[step] if step.isupper() else step node = (node[key] if isinstance(node, Dict) else (node(key) if callable(node) @@ -992,8 +994,6 @@ class Client(ABC, ClientQueueMixin): elif ret['_verb'] == 'PONG': assert self._expected_pong == ret['reply'] self._expected_pong = '' - elif ret['_verb'] == 'QUIT': - ret['quitter'].quit(ret['message']) ClientsDb = dict[str, Client] diff --git a/src/ircplom/msg_parse_expectations.py b/src/ircplom/msg_parse_expectations.py index 4027fd3..95fbc5f 100644 --- a/src/ircplom/msg_parse_expectations.py +++ b/src/ircplom/msg_parse_expectations.py @@ -568,6 +568,6 @@ MSG_EXPECTATIONS: list[_MsgParseExpectation] = [ _MsgParseExpectation( 'QUIT', - (_MsgTok.NICK_USER_HOST, ':quitter'), - ((_MsgTok.ANY, ':message'),)), + (_MsgTok.NICK_USER_HOST, ':QUITTER'), + ((_MsgTok.ANY, 'do_QUITTER.quit:message'),)), ] -- 2.30.2