home · contact · privacy
Minor refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 20 Oct 2025 19:41:13 +0000 (21:41 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 20 Oct 2025 19:41:13 +0000 (21:41 +0200)
src/ircplom/testing.py

index d5b1aa1fcf2480bda2e72eca50e50fa9e185dc56..eab70645b95e95f0233b7b9ec3d5be8d77939f48 100644 (file)
@@ -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)