class documentation

class PyvalColorizer:

View In Hierarchy

Syntax highlighter for Python values.
Method __init__ Undocumented
Method colorize Entry Point.
Constant COLON​_TAG Undocumented
Constant COMMA​_TAG Undocumented
Constant CONST​_TAG Undocumented
Constant ELLIPSIS Undocumented
Constant ELLIPSIS​_TAG Undocumented
Constant GENERIC​_OBJECT​_RE Undocumented
Constant GROUP​_TAG Undocumented
Constant LINEWRAP Undocumented
Constant LINEWRAP​_TAG Undocumented
Constant LINK​_TAG Undocumented
Constant NEWLINE Undocumented
Constant NUMBER​_TAG Undocumented
Constant QUOTE​_TAG Undocumented
Constant RE​_CHAR​_TAG Undocumented
Constant RE​_COMPILE​_SIGNATURE Undocumented
Constant RE​_FLAGS​_TAG Undocumented
Constant RE​_GROUP​_TAG Undocumented
Constant RE​_OP​_TAG Undocumented
Constant RE​_REF​_TAG Undocumented
Constant STRING​_TAG Undocumented
Constant UNKNOWN​_REPR Undocumented
Constant UNKNOWN​_TAG Undocumented
Constant WORD​_BREAK​_OPPORTUNITY Undocumented
Instance Variable linebreakok Undocumented
Instance Variable linelen Undocumented
Instance Variable maxlines Undocumented
Static Method ​_get​_ast​_constant​_val Undocumented
Static Method ​_is​_ast​_constant Undocumented
Method ​_colorize Undocumented
Method ​_colorize​_ast Undocumented
Method ​_colorize​_ast​_attribute Undocumented
Method ​_colorize​_ast​_binary​_op Undocumented
Method ​_colorize​_ast​_bool​_op Undocumented
Method ​_colorize​_ast​_call Undocumented
Method ​_colorize​_ast​_call​_generic Undocumented
Method ​_colorize​_ast​_constant Undocumented
Method ​_colorize​_ast​_generic Undocumented
Method ​_colorize​_ast​_name Undocumented
Method ​_colorize​_ast​_re Undocumented
Method ​_colorize​_ast​_subscript Undocumented
Method ​_colorize​_ast​_unary​_op Undocumented
Method ​_colorize​_dict Undocumented
Method ​_colorize​_iter Undocumented
Method ​_colorize​_re​_flags Undocumented
Method ​_colorize​_re​_pattern Undocumented
Method ​_colorize​_re​_pattern​_str Undocumented
Method ​_colorize​_re​_tree Undocumented
Method ​_colorize​_str Undocumented
Method ​_insert​_comma Undocumented
Method ​_multiline Helper for container-type colorizers. First, try calling func(pyval, state, **kwargs) with linebreakok set to false; and if that fails, then try again with it set to true.
Method ​_output No summary
Method ​_trim​_result Undocumented
def __init__(self, linelen, maxlines, linebreakok=True):

Undocumented

Parameters
linelen:Optional[int]Undocumented
maxlines:intUndocumented
linebreakok:boolUndocumented
def colorize(self, pyval):
Entry Point.
Parameters
pyval:AnyUndocumented
Returns
ColorizedPyvalReprUndocumented
COLON_TAG =

Undocumented

Value
None
COMMA_TAG =

Undocumented

Value
None
CONST_TAG =

Undocumented

Value
None
ELLIPSIS =

Undocumented

Value
nodes.inline('...', '...',
             classes=[ELLIPSIS_TAG])
ELLIPSIS_TAG: str =

Undocumented

Value
'variable-ellipsis'
GENERIC_OBJECT_RE =

Undocumented

Value
re.compile(r'^<(?P<descr>.*) at (?P<addr>0x[0-9a-f]+)>$',
           re.IGNORECASE)
GROUP_TAG =

Undocumented

Value
None
LINEWRAP =

Undocumented

Value
nodes.inline('', chr(8629),
             classes=[LINEWRAP_TAG])
LINEWRAP_TAG: str =

Undocumented

Value
'variable-linewrap'
LINK_TAG: str =

Undocumented

Value
'variable-link'
NEWLINE =

Undocumented

Value
nodes.Text('\n', '\n')
NUMBER_TAG =

Undocumented

Value
None
QUOTE_TAG: str =

Undocumented

Value
'variable-quote'
RE_CHAR_TAG =

Undocumented

Value
None
RE_COMPILE_SIGNATURE =

Undocumented

Value
signature(re.compile)
RE_FLAGS_TAG: str =

Undocumented

Value
're-flags'
RE_GROUP_TAG: str =

Undocumented

Value
're-group'
RE_OP_TAG: str =

Undocumented

Value
're-op'
RE_REF_TAG: str =

Undocumented

Value
're-ref'
STRING_TAG: str =

Undocumented

Value
'variable-string'
UNKNOWN_REPR =

Undocumented

Value
nodes.inline('??', '??',
             classes=[UNKNOWN_TAG])
UNKNOWN_TAG: str =

Undocumented

Value
'variable-unknown'
WORD_BREAK_OPPORTUNITY =

Undocumented

Value
wbr()
linebreakok =

Undocumented

linelen: Optional[int] =

Undocumented

maxlines: Union[int, float] =

Undocumented

@staticmethod
def _get_ast_constant_val(node):

Undocumented

Parameters
node:ast.ASTUndocumented
Returns
AnyUndocumented
@staticmethod
def _is_ast_constant(node):

Undocumented

Parameters
node:ast.ASTUndocumented
Returns
boolUndocumented
def _colorize(self, pyval, state):

Undocumented

Parameters
pyval:AnyUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast(self, pyval, state):

Undocumented

Parameters
pyval:ast.ASTUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_attribute(self, pyval, state):

Undocumented

Parameters
pyval:ast.AttributeUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_binary_op(self, pyval, state):

Undocumented

Parameters
pyval:ast.BinOpUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_bool_op(self, pyval, state):

Undocumented

Parameters
pyval:ast.BoolOpUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_call(self, node, state):

Undocumented

Parameters
node:ast.CallUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_call_generic(self, node, state):

Undocumented

Parameters
node:ast.CallUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_constant(self, pyval, state):

Undocumented

Parameters
pyval:ast.ASTUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_generic(self, pyval, state):

Undocumented

Parameters
pyval:ast.ASTUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_name(self, pyval, state):

Undocumented

Parameters
pyval:ast.NameUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_re(self, node, state):

Undocumented

Parameters
node:ast.CallUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_subscript(self, node, state):

Undocumented

Parameters
node:ast.SubscriptUndocumented
state:_ColorizerStateUndocumented
def _colorize_ast_unary_op(self, pyval, state):

Undocumented

Parameters
pyval:ast.UnaryOpUndocumented
state:_ColorizerStateUndocumented
def _colorize_dict(self, items, state, prefix, suffix):

Undocumented

Parameters
items:Iterable[Tuple[Any, Any]]Undocumented
state:_ColorizerStateUndocumented
prefix:strUndocumented
suffix:strUndocumented
def _colorize_iter(self, pyval, state, prefix=None, suffix=None):

Undocumented

Parameters
pyval:Iterable[Any]Undocumented
state:_ColorizerStateUndocumented
prefix:Optional[AnyStr]Undocumented
suffix:Optional[AnyStr]Undocumented
def _colorize_re_flags(self, flags, state):

Undocumented

Parameters
flags:intUndocumented
state:_ColorizerStateUndocumented
def _colorize_re_pattern(self, pat, state, prefix):

Undocumented

Parameters
pat:AnyStrUndocumented
state:_ColorizerStateUndocumented
prefix:AnyStrUndocumented
def _colorize_re_pattern_str(self, pat, state):

Undocumented

Parameters
pat:AnyStrUndocumented
state:_ColorizerStateUndocumented
def _colorize_re_tree(self, tree, state, noparen, groups):

Undocumented

Parameters
tree:Sequence[Tuple[sre_constants._NamedIntConstant, Any]]Undocumented
state:_ColorizerStateUndocumented
noparen:boolUndocumented
groups:Dict[int, str]Undocumented
def _colorize_str(self, pyval, state, prefix, escape_fcn):

Undocumented

Parameters
pyval:AnyStrUndocumented
state:_ColorizerStateUndocumented
prefix:AnyStrUndocumented
escape​_fcn:Callable[[AnyStr], str]Undocumented
def _insert_comma(self, indent, state):

Undocumented

Parameters
indent:intUndocumented
state:_ColorizerStateUndocumented
def _multiline(self, func, pyval, state, **kwargs):
Helper for container-type colorizers. First, try calling func(pyval, state, **kwargs) with linebreakok set to false; and if that fails, then try again with it set to true.
Parameters
func:Callable[..., None]Undocumented
pyval:Iterable[Any]Undocumented
state:_ColorizerStateUndocumented
**kwargs:AnyUndocumented
def _output(self, s, css_class, state, link=False):
Add the string s to the result list, tagging its contents with the specified css_class. Any lines that go beyond PyvalColorizer.linelen will be line-wrapped. If the total number of lines exceeds PyvalColorizer.maxlines, then raise a _Maxlines exception.
Parameters
s:AnyStrUndocumented
css​_class:Optional[str]Undocumented
state:_ColorizerStateUndocumented
link:boolUndocumented
def _trim_result(self, result, num_chars):

Undocumented

Parameters
result:List[nodes.Node]Undocumented
num​_chars:intUndocumented