]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Make the linter happy
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 1 Feb 2024 16:52:31 +0000 (17:52 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 1 Feb 2024 16:52:31 +0000 (17:52 +0100)
lib/pp_admintools/app/__init__.py

index 81a56891eb34a7dbe674a3257503c085e8209215..fedbe69da8615a1c0853beee96726689db7cc689 100644 (file)
@@ -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<y>\d*);(?P<x>\d*)R", out)
+            res = re.match(r'.*\[(?P<y>\d*);(?P<x>\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)