hexsample.pprint
— Pretty printing#
This module provides facilities for pretty printing, including support for
colors and special effects in the terminal, and other functions that are useful
for ASCII-art like rendering. Most notably, this is useful in
DigiEvent
.
See also
Module documentation#
Pretty printing.
- class hexsample.pprint.AnsiFontEffect(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Small enum class to support colors and advanced formatting in the rendering of digitized event data.
See https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences for a useful recap of the basic rules.
- RESET = 0#
- BOLD = 1#
- UNDERLINE = 4#
- FG_BLACK = 30#
- FG_RED = 31#
- FG_GREEN = 32#
- FG_YELLOW = 33#
- FG_BLUE = 34#
- FG_MAGENTA = 35#
- FG_CYAN = 36#
- FG_WHITE = 37#
- BG_BLACK = 40#
- BG_RED = 41#
- BG_GREEN = 42#
- BG_YELLOW = 43#
- BG_BLUE = 44#
- BG_MAGENTA = 45#
- BG_CYAN = 46#
- BG_WHITE = 47#
- FG_BRIGHT_BLACK = 90#
- FG_BRIGHT_RED = 91#
- FG_BRIGHT_GREEN = 92#
- FG_BRIGHT_YELLOW = 93#
- FG_BRIGHT_BLUE = 94#
- FG_BRIGHT_MAGENTA = 95#
- FG_BRIGHT_CYAN = 96#
- FG_BRIGHT_WHITE = 97#
- BG_BRIGHT_BLACK = 100#
- BG_BRIGHT_RED = 101#
- BG_BRIGHT_GREEN = 102#
- BG_BRIGHT_YELLOW = 103#
- BG_BRIGHT_BLUE = 104#
- BG_BRIGHT_MAGENTA = 105#
- BG_BRIGHT_CYAN = 106#
- BG_BRIGHT_WHITE = 107#
- hexsample.pprint.ansi_format(text: str, *effects: AnsiFontEffect) str #
Return the proper combination of escape sequences to render a given piece of text with a series of font effects.
- Parameters:
text (str) – The text to be rendered with special effects.
effects (AnsiFontEffect) – The effects to be applied to the text.
- hexsample.pprint._repeat(text: str, repetitions: int) str #
Repeat a given piece of text for a given number of times.
- hexsample.pprint.space(width: int) str #
Return a sequence of spaces of a given width.
- hexsample.pprint.line(width: int) str #
Return a sequence of spaces of a given width.