10. pypsi.ansi - ANSI Escape Code Support¶
Stream classes for writing to files.
- 
class pypsi.ansi.AnsiCode(code, s=None, end_code=None)[source]¶
- Bases: - object- A single ansi escape code. - Parameters: 
- 
class pypsi.ansi.AnsiCodesSingleton[source]¶
- Bases: - object- Holds all supported ansi escape codes. - 
black= None¶
- Black 
 - 
blue= None¶
- Blue (bold) 
 - 
clear_screen= None¶
- Clear the screen 
 - 
codes= None¶
- all codes as a dict, useful for formatting an ansi string 
 - 
cyan= None¶
- Cyan (bold) 
 - 
gray= None¶
- Gray 
 - 
green= None¶
- Green (bold) 
 - 
purple= None¶
- Purple (bold) 
 - 
red= None¶
- Red (bold) 
 - 
reset= None¶
- Reset terminal color and style 
 - 
underline= None¶
- Underline text 
 - 
white= None¶
- White (bold) 
 - 
yellow= None¶
- Yellow (bold) 
 
- 
- 
pypsi.ansi.ansi_len(value)[source]¶
- Get the length of the provided str, not counting any ansi codes. - Parameters: - value (str) – the input string 
- 
pypsi.ansi.ansi_ljust(s, width)[source]¶
- Left justify an input string, ensuring that it contains width charaters. - Parameters: - Returns str: - the output string 
- 
pypsi.ansi.ansi_rjust(s, width)[source]¶
- Right justify the input string. - Parameters: - Returns str: - the output string 
- 
pypsi.ansi.AnsiCodes= <pypsi.ansi.AnsiCodesSingleton object>¶
- Global instance for all supported ansi codes (instance of - AnsiCodesSingleton)