From 8fb99d8adf1ca2fa5ac677dea2759f49523a5e72 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 2 Nov 2020 16:06:02 -0300 Subject: [PATCH] Adjusted flake8 details --- kibot/ansi.py | 85 ++++++++++++++++++++++++++++----------------------- kibot/log.py | 2 +- 2 files changed, 48 insertions(+), 39 deletions(-) diff --git a/kibot/ansi.py b/kibot/ansi.py index e97ba2fa..5e7d0cc4 100644 --- a/kibot/ansi.py +++ b/kibot/ansi.py @@ -11,15 +11,19 @@ OSC = '\033]' BEL = '\a' is_a_tty = sys.stderr.isatty() and os.name == 'posix' + def code_to_chars(code): return CSI + str(code) + 'm' if is_a_tty else '' + def set_title(title): return OSC + '2;' + title + BEL + def clear_screen(mode=2): return CSI + str(mode) + 'J' + def clear_line(mode=2): return CSI + str(mode) + 'K' @@ -38,67 +42,72 @@ class AnsiCodes(object): class AnsiCursor(object): def UP(self, n=1): return CSI + str(n) + 'A' + def DOWN(self, n=1): return CSI + str(n) + 'B' + def FORWARD(self, n=1): return CSI + str(n) + 'C' + def BACK(self, n=1): return CSI + str(n) + 'D' + def POS(self, x=1, y=1): return CSI + str(y) + ';' + str(x) + 'H' class AnsiFore(AnsiCodes): - BLACK = 30 - RED = 31 - GREEN = 32 - YELLOW = 33 - BLUE = 34 - MAGENTA = 35 - CYAN = 36 - WHITE = 37 - RESET = 39 + BLACK = 30 + RED = 31 + GREEN = 32 + YELLOW = 33 + BLUE = 34 + MAGENTA = 35 + CYAN = 36 + WHITE = 37 + RESET = 39 # These are fairly well supported, but not part of the standard. - LIGHTBLACK_EX = 90 - LIGHTRED_EX = 91 - LIGHTGREEN_EX = 92 - LIGHTYELLOW_EX = 93 - LIGHTBLUE_EX = 94 + LIGHTBLACK_EX = 90 + LIGHTRED_EX = 91 + LIGHTGREEN_EX = 92 + LIGHTYELLOW_EX = 93 + LIGHTBLUE_EX = 94 LIGHTMAGENTA_EX = 95 - LIGHTCYAN_EX = 96 - LIGHTWHITE_EX = 97 + LIGHTCYAN_EX = 96 + LIGHTWHITE_EX = 97 class AnsiBack(AnsiCodes): - BLACK = 40 - RED = 41 - GREEN = 42 - YELLOW = 43 - BLUE = 44 - MAGENTA = 45 - CYAN = 46 - WHITE = 47 - RESET = 49 + BLACK = 40 + RED = 41 + GREEN = 42 + YELLOW = 43 + BLUE = 44 + MAGENTA = 45 + CYAN = 46 + WHITE = 47 + RESET = 49 # These are fairly well supported, but not part of the standard. - LIGHTBLACK_EX = 100 - LIGHTRED_EX = 101 - LIGHTGREEN_EX = 102 - LIGHTYELLOW_EX = 103 - LIGHTBLUE_EX = 104 + LIGHTBLACK_EX = 100 + LIGHTRED_EX = 101 + LIGHTGREEN_EX = 102 + LIGHTYELLOW_EX = 103 + LIGHTBLUE_EX = 104 LIGHTMAGENTA_EX = 105 - LIGHTCYAN_EX = 106 - LIGHTWHITE_EX = 107 + LIGHTCYAN_EX = 106 + LIGHTWHITE_EX = 107 class AnsiStyle(AnsiCodes): - BRIGHT = 1 - DIM = 2 - NORMAL = 22 + BRIGHT = 1 + DIM = 2 + NORMAL = 22 RESET_ALL = 0 -Fore = AnsiFore() -Back = AnsiBack() -Style = AnsiStyle() + +Fore = AnsiFore() +Back = AnsiBack() +Style = AnsiStyle() Cursor = AnsiCursor() diff --git a/kibot/log.py b/kibot/log.py index 44d94511..f1f4d227 100644 --- a/kibot/log.py +++ b/kibot/log.py @@ -19,7 +19,7 @@ except ImportError: # pragma: no cover no_colorama = True # If colorama isn't installed use an ANSI basic replacement if no_colorama: - from .ansi import Fore, Back, Style + from .ansi import Fore, Back, Style # noqa: F811 else: colorama_init() # Default domain, base name for the tool