class documentation

class FancyFormatter: (source)

View In Hierarchy

Apply color and bold font to terminal output. This currently only works on Linux and Mac.

Method __init__ Undocumented
Method colorize Colorize an output line by highlighting the status and error code.
Method fit_in_terminal Improve readability by wrapping error messages and trimming source code.
Method format_error Format a short summary in case of errors.
Method format_success Format short summary in case of success.
Method highlight_quote_groups Make groups quoted with double quotes bold (including quotes).
Method initialize_unix_colors Return True if initialization was successful and we can use colors, False otherwise
Method initialize_vt100_colors Return True if initialization was successful and we can use colors, False otherwise
Method initialize_win_colors Return True if initialization was successful and we can use colors, False otherwise
Method style Apply simple color and style (underlined or bold).
Method underline_link Underline a link in a note message (if any).
Instance Variable BLUE Undocumented
Instance Variable BOLD Undocumented
Instance Variable colors Undocumented
Instance Variable DIM Undocumented
Instance Variable dummy_term Undocumented
Instance Variable GREEN Undocumented
Instance Variable hide_error_codes Undocumented
Instance Variable NORMAL Undocumented
Instance Variable RED Undocumented
Instance Variable UNDER Undocumented
Instance Variable YELLOW Undocumented
def __init__(self, f_out: IO[str], f_err: IO[str], hide_error_codes: bool): (source)

Undocumented

def colorize(self, error: str) -> str: (source)

Colorize an output line by highlighting the status and error code.

def fit_in_terminal(self, messages: list[str], fixed_terminal_width: int|None = None) -> list[str]: (source)

Improve readability by wrapping error messages and trimming source code.

def format_error(self, n_errors: int, n_files: int, n_sources: int, *, blockers: bool = False, use_color: bool = True) -> str: (source)

Format a short summary in case of errors.

def format_success(self, n_sources: int, use_color: bool = True) -> str: (source)

Format short summary in case of success. n_sources is total number of files passed directly on command line, i.e. excluding stubs and followed imports.

def highlight_quote_groups(self, msg: str) -> str: (source)

Make groups quoted with double quotes bold (including quotes). This is used to highlight types, attribute names etc.

def initialize_unix_colors(self) -> bool: (source)

Return True if initialization was successful and we can use colors, False otherwise

def initialize_vt100_colors(self) -> bool: (source)

Return True if initialization was successful and we can use colors, False otherwise

def initialize_win_colors(self) -> bool: (source)

Return True if initialization was successful and we can use colors, False otherwise

def style(self, text: str, color: Literal['red', 'green', 'blue', 'yellow', 'none'], bold: bool = False, underline: bool = False, dim: bool = False) -> str: (source)

Apply simple color and style (underlined or bold).

def underline_link(self, note: str) -> str: (source)

Underline a link in a note message (if any). This assumes there is at most one link in the message.

Undocumented

Undocumented

Undocumented

Undocumented

dummy_term = (source)

Undocumented

Undocumented

hide_error_codes = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented