py1.tty¶
Functions for making the most of a TTY.
Functions
ansi_highlight_code (python_code, ansi_colors) |
Adds ANSI color code to make python_code pretty. |
count_ansi_colors ([term_name]) |
Counts ANSI-coded colors a terminal supports. |
Exceptions
Error |
Base class for errors from this module. |
-
ansi_highlight_code
(python_code, ansi_colors)[source]¶ Adds ANSI color code to make python_code pretty.
Parameters: Returns: The prettified Python code.
Return type:
-
count_ansi_colors
(term_name=None)[source]¶ Counts ANSI-coded colors a terminal supports.
Bug: Subsequent calls might return the same value as the first if terminfo has to be used that is when term_info is not in ‘xterm-256colors’, ‘xterm’, ‘unknown’.
Parameters: term_name (str) – A string like ‘xterm’ or ‘unknown’, defaults to the environment value for TERM. Returns: Number of ANSI-coded colors the terminal supports. Return type: int