Skip to content

Commit

Permalink
WIP6
Browse files Browse the repository at this point in the history
  • Loading branch information
MoessnerFabian(Group) committed Jan 29, 2025
1 parent bdefaa4 commit f8ed907
Showing 1 changed file with 1 addition and 58 deletions.
59 changes: 1 addition & 58 deletions logprep/util/ansi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
def code_to_chars(code):
return CSI + str(code) + 'm'

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'

class AnsiCodes(object):
def __init__(self):
# the subclasses declare class attributes which are numbers.
Expand All @@ -30,18 +21,6 @@ def __init__(self):
value = getattr(self, name)
setattr(self, name, code_to_chars(value))

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
Expand All @@ -53,44 +32,8 @@ class AnsiFore(AnsiCodes):
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
LIGHTMAGENTA_EX = 95
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

# 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
LIGHTMAGENTA_EX = 105
LIGHTCYAN_EX = 106
LIGHTWHITE_EX = 107

class AnsiStyle(AnsiCodes):
BRIGHT = 1
DIM = 2
NORMAL = 22
RESET_ALL = 0

Fore = AnsiFore()
Back = AnsiBack()
Style = AnsiStyle()
Cursor = AnsiCursor()
Back = AnsiBack()

0 comments on commit f8ed907

Please sign in to comment.