From 06fe3dfb204abd86445fe679d9b0f7fccbfa037d Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 1 Feb 2024 17:52:31 +0100 Subject: [PATCH] Make the linter happy --- lib/pp_admintools/app/__init__.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/pp_admintools/app/__init__.py b/lib/pp_admintools/app/__init__.py index 81a5689..fedbe69 100644 --- a/lib/pp_admintools/app/__init__.py +++ b/lib/pp_admintools/app/__init__.py @@ -14,7 +14,6 @@ import re import shutil import sys import termios - from collections import namedtuple from io import UnsupportedOperation @@ -49,7 +48,7 @@ class CursorPosition(namedtuple('CursorPosition', ['x', 'y'])): # ------------------------------------------------------------------------- def __str__(self): """Typecasting into a string object.""" - msg = _("Cursor position:") + msg = _('Cursor position:') msg += ' x = {x:3d}, y = {y:3d}'.format(x=self.x, y=self.y) return msg @@ -154,7 +153,7 @@ class BaseDPXApplication(FbConfigApplication): @classmethod def cursor_position(cls): """ - Retrieves the current position of the terminal cursor. + Retrieve the current position of the terminal cursor. It returns these position as a CursorPosition object. A position of (-1, -1) means, the position could not be evaluated. @@ -170,17 +169,17 @@ class BaseDPXApplication(FbConfigApplication): res = None try: - out = "" - sys.stdout.write("\x1b[6n") + out = '' + sys.stdout.write('\x1b[6n') sys.stdout.flush() while not out.endswith('R'): out += sys.stdin.read(1) - res = re.match(r".*\[(?P\d*);(?P\d*)R", out) + res = re.match(r'.*\[(?P\d*);(?P\d*)R', out) finally: termios.tcsetattr(sys.stdin, termios.TCSAFLUSH, old_stdin_mode) if res: - return CursorPosition(int(res.group("x")), int(res.group("y"))) + return CursorPosition(int(res.group('x')), int(res.group('y'))) return CursorPosition(-1, -1) -- 2.39.5