angr.utils.formatting¶
- angr.utils.formatting.setup_terminal()¶
Check if we are running in a TTY. If so, make sure the terminal supports ANSI escape sequences. If not, disable colorized output. Sets global ansi_color_enabled to True if colorized output should be enabled by default.
- angr.utils.formatting.ansi_color(s, color)¶
Colorize string s by wrapping in ANSI escape sequence for given color.
This function does not consider whether escape sequences are functional or not; it is up to the caller to determine if its appropriate. Check global ansi_color_enabled value in this module.
- angr.utils.formatting.add_edge_to_buffer(buf, ref, start, end, formatter=None, dashed=False, ascii_only=None)¶
Draw an edge by adding Unicode box and arrow glyphs to beginning of each line in a list of lines.
- Parameters:
buf (
Sequence[str]) – Output buffer, used to render formatted edges.ref (
Sequence[str]) – Reference buffer, used to calculate edge depth.start (
int) – Start line.end (
int) – End line, where arrow points.formatter (
Callable[[str],str] |None) – Optional callback function used to format the edge before writing it to output buffer.dashed (
bool) – Render edge line dashed instead of solid.ascii_only (
bool|None) – Render edge using ASCII characters only. If unspecified, guess by stdout encoding.
- Returns: