diplomat.utils.pretty_printer.IndentPrinter¶
- class diplomat.utils.pretty_printer.IndentPrinter(output: ~typing.TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, indent: int = 4, term_width: int = None)[source]¶
Bases:
objectCreate a custom printing function that matches python’s print function, but also properly handles indented lines in the CLI by indenting each following line when a single line in the printout can’t be displayed on a single line in the CLI.
- __init__(output: ~typing.TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, indent: int = 4, term_width: int = None)[source]¶
Create a new pretty indenting printer.
- Parameters:
output – File object to write resulting text to, defaults to stdout.
indent – How many spaces to turn each tab in the input into.
term_width – The width of the terminal, in characters. If None, will try to automatically determine it.
Methods
__init__([output, indent, term_width])Create a new pretty indenting printer.