From e679aee9f9f685a8209858dfabdcd80b79089243 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 20 Oct 2025 21:41:13 +0200 Subject: [PATCH] Minor refactoring. --- src/ircplom/testing.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ircplom/testing.py b/src/ircplom/testing.py index d5b1aa1..eab7064 100644 --- a/src/ircplom/testing.py +++ b/src/ircplom/testing.py @@ -25,11 +25,13 @@ _MARK_REPEAT = 'repeat' _MARK_SCREENLINE = 'line' _MARK_SERVERMSG = 'servermsg' _MARK_WAIT = 'wait' +_SCREENLINE_IGNORE_CHAR = '§' +_SCREENLINE_PADDING_SUFFIX = 2 * _SCREENLINE_IGNORE_CHAR _SEP_0 = ' ' _SEP_1 = ',' _SEP_2 = ':' -_SCREENLINE_IGNORE_CHAR = '§' -_SCREENLINE_PADDING_SUFFIX = 2 * _SCREENLINE_IGNORE_CHAR +_TOK_IDX_LOGSRVRMSG = 's' +_TOK_IDX_REPEAT = 'r' _SIGNATURE_FOR_CMD = { _MARK_LOG: (2, 0), @@ -205,9 +207,9 @@ class _Playbook: for c in fmt[:-1]: assert c in LOG_FMT_ATTRS assert fmt[0] == LOG_PREFIX_IN - return [(f'{index_str}:s:0', + return [(_SEP_2.join((index_str, _TOK_IDX_LOGSRVRMSG, str(0))), _SEP_0.join((_MARK_SERVERMSG, args[0], msg_no_fmt))), - (f'{index_str}:s:1', + (_SEP_2.join((index_str, _TOK_IDX_LOGSRVRMSG, str(1))), _SEP_0.join((_MARK_LOG, args[1], args[2])))] def repeat(index_str: str, @@ -242,7 +244,7 @@ class _Playbook: inserts += [(candidate[0], cmd_name, cmd_args)] line_offset = 0 - (lowest_int or 0) return [ - (index_str + ':r:' + insert_t[0], + (_SEP_2.join((index_str, _TOK_IDX_REPEAT, insert_t[0])), _SEP_0.join( [insert_t[1]] + [arg if isinstance(arg, str) -- 2.30.2