home · contact · privacy
Minor constants renaming.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 9 Jun 2025 13:38:58 +0000 (15:38 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 9 Jun 2025 13:38:58 +0000 (15:38 +0200)
ircplom.py

index bd753367dfaa795fa89ddc3b2deea14a45845490..a61a470b1cc661679108c1cc34c62f17b705611d 100755 (executable)
@@ -35,8 +35,8 @@ CMD_SHORTCUTS = {
     'disconnect': 'window.disconnect',
     'reconnect': 'window.reconnect'
 }
-PREFIX_B64 = 'b64:'
-OSC_52_PREFIX = ']52;c;'
+B64_PREFIX = 'b64:'
+OSC52_PREFIX = ']52;c;'
 
 IRCSPEC_LINE_SEPARATOR = b'\r\n'
 IRCSPEC_TAG_ESCAPES = ((r'\:', ';'),
@@ -169,14 +169,14 @@ class Terminal:
             n_gotchs_unprocessed -= n_chs_blessed_key
             if unhandleds:
                 fused = ''.join([chr(n) for n in unhandleds])
-                if fused.startswith(OSC_52_PREFIX):
-                    if not (encoded := fused[len(OSC_52_PREFIX):]):
+                if fused.startswith(OSC52_PREFIX):
+                    if not (encoded := fused[len(OSC52_PREFIX):]):
                         while True:
                             gotch = self._blessed.getch()
                             if ord(gotch) == 7:
                                 break
                             encoded += gotch
-                    yield f'{PREFIX_B64}{encoded}'
+                    yield f'{B64_PREFIX}{encoded}'
                     continue
                 yield str(unhandleds)
             elif blessed_key.name:
@@ -671,7 +671,7 @@ class Window(Widget):
 
     def cmd__paste(self) -> None:
         'Write OSC 52 ? sequence to get encoded clipboard paste into stdin.'
-        self._term.write(f'\033{OSC_52_PREFIX}?\007', self._y_status)
+        self._term.write(f'\033{OSC52_PREFIX}?\007', self._y_status)
         self.draw()
 
 
@@ -858,8 +858,8 @@ class KeyboardLoop(Loop):
     'Loop receiving and translating keyboard events towards main loop.'
 
     def process_bonus(self, yielded: str) -> None:
-        if yielded.startswith(PREFIX_B64):
-            encoded = yielded[len(PREFIX_B64):]
+        if yielded.startswith(B64_PREFIX):
+            encoded = yielded[len(B64_PREFIX):]
             to_paste = ''
             for i, c in enumerate(b64decode(encoded).decode('utf-8')):
                 if i > 512: