Package epydoc :: Package markup :: Module pyval_repr |
[hide private]
[frames] | no frames]

# Module pyval_repr

source code

Syntax highlighter for Python values. Currently provides special colorization support for:

- lists, tuples, sets, frozensets, dicts
- numbers
- strings
- compiled regexps

The highlighter also takes care of line-wrapping, and automatically stops generating repr output as soon as it has exceeded the specified number of lines (which should make it faster than pprint for large values). It does not bother to do automatic cycle detection, because maxlines is typically around 5, so it's really not worth it.

The syntax-highlighted output is encoded using a ParsedEpytextDocstring, which can then be used to generate output in a variety of formats.

Classes | [hide private]
| _ColorizerState An object uesd to keep track of the current state of the pyval colorizer.
| _Maxlines A control-flow exception that is raised when PyvalColorizer exeeds the maximum number of allowed lines.
| _Linebreak A control-flow exception that is raised when PyvalColorizer generates a string containing a newline, but the state object's linebreakok variable is False.
| ColorizedPyvalRepr
| PyvalColorizer Syntax highlighter for Python values.

Functions | [hide private]
is_re_pattern(pyval) | source code call graph
Call Graph
colorize_pyval(pyval, parse_repr=None, min_score=None, linelen=75, maxlines=5, linebreakok=True, sort=True) | source code call graph
Call Graph