mpu.shell

Enhancing printed terminal output.

class mpu.shell.Codes[source]

Bases: object

Escape sequences for enhanced shell output.

BACKGROUND_BLACK = '\x1b[40m'
BACKGROUND_BLUE = '\x1b[44m'
BACKGROUND_CYAN = '\x1b[46m'
BACKGROUND_DARK_GRAY = '\x1b[100m'
BACKGROUND_DEFAULT = '\x1b[49m'
BACKGROUND_GREEN = '\x1b[42m'
BACKGROUND_LIGHT_BLUE = '\x1b[104m'
BACKGROUND_LIGHT_CYAN = '\x1b[106m'
BACKGROUND_LIGHT_GRAY = '\x1b[47m'
BACKGROUND_LIGHT_GREEN = '\x1b[102m'
BACKGROUND_LIGHT_MAGENTA = '\x1b[105m'
BACKGROUND_LIGHT_RED = '\x1b[101m'
BACKGROUND_LIGHT_YELLOW = '\x1b[103m'
BACKGROUND_MAGENTA = '\x1b[45m'
BACKGROUND_RED = '\x1b[41m'
BACKGROUND_WHITE = '\x1b[107m'
BACKGROUND_YELLOW = '\x1b[43m'
BLACK = '\x1b[30m'
BLUE = '\x1b[34m'
BOLD = '\x1b[1m'
CYAN = '\x1b[36m'
DARK_GRAY = '\x1b[90m'
DEFAULT = '\x1b[39m'
DIM = '\x1b[2m'
GREEN = '\x1b[32m'
HIDDEN = '\x1b[8m'
LIGHT_BLUE = '\x1b[94m'
LIGHT_CYAN = '\x1b[96m'
LIGHT_GRAY = '\x1b[37m'
LIGHT_GREEN = '\x1b[92m'
LIGHT_MAGENTA = '\x1b[95m'
LIGHT_RED = '\x1b[91m'
LIGHT_YELLOW = '\x1b[93m'
MAGENTA = '\x1b[35m'
RED = '\x1b[31m'
RESET_ALL = '\x1b[0m'
RESET_BOLD = '\x1b[21m'
RESET_DIM = '\x1b[22m'
RESET_HIDDEN = '\x1b[28m'
RESET_REVERSE = '\x1b[27m'
RESET_UNDERLINED = '\x1b[24m'
REVERSE = '\x1b[7m'
UNDERLINED = '\x1b[4m'
WHITE = '\x1b[97m'
YELLOW = '\x1b[33m'
mpu.shell.print_table(table: List)None[source]

Print as a table.

I recommend looking at [tabulate](https://pypi.org/project/tabulate/).

Parameters

table (List) –

Examples

>>> print_table([[1, 2, 3], [41, 0, 1]])
 1  2  3
41  0  1
mpu.shell.text_input(text: str)str[source]

Ask the user for textual input.

Parameters

text (str) – What the user sees.

Returns

entered_text – What the user wrote.

Return type

str