faust.utils.terminal

class faust.utils.terminal.Spinner(file: IO = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>) → None[source]

Progress bar spinner.

bell = '\x08'
sprites = ['◢', '◣', '◤', '◥']
cursor_hide = '\x1b[?25l'
cursor_show = '\x1b[?25h'
hide_cursor = True
stopped = False
update() → None[source]
Return type:None
stop() → None[source]
Return type:None
reset() → None[source]
Return type:None
write(s: str) → None[source]
Return type:None
begin() → None[source]
Return type:None
finish() → None[source]
Return type:None
class faust.utils.terminal.SpinnerHandler(spinner: faust.utils.terminal.spinners.Spinner, **kwargs) → None[source]

A logger handler that iterates our progress spinner for each log.

emit(_record: logging.LogRecord) → None[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

Return type:None
faust.utils.terminal.Table

alias of terminaltables.base_table.BaseTable

faust.utils.terminal.TableDataT

alias of typing.Sequence

faust.utils.terminal.isatty(fh: IO) → bool[source]

Return True if fh has a controlling terminal.

Notes

Use with e.g. sys.stdin.

Return type:bool
faust.utils.terminal.logtable(data: Sequence[Sequence[str]], *, title: str, target: IO = None, tty: bool = None, headers: Sequence[str] = None, **kwargs) → str[source]

Prepare table for logging.

Will use ANSI escape codes if the log file is a tty.

Return type:str
faust.utils.terminal.table(data: Sequence[Sequence[str]], *, title: str, target: IO = None, tty: bool = None, **kwargs) → terminaltables.base_table.BaseTable[source]

Create suitable terminaltables table for target.

Parameters:
  • data (Sequence[Sequence[str]]) – Table data.
  • target (IO) – Target should be the destination output file for your table, and defaults to sys.stdout. ANSI codes will be used if the target has a controlling terminal, but not otherwise, which is why it’s important to pass the correct output file.
Return type:

BaseTable