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

Class PyvalColorizer

source code

Syntax highlighter for Python values.

Instance Methods [hide private]
 
__init__(self, linelen=75, maxlines=5, linebreakok=True, sort=True) source code
call graph 
 
colorize(self, pyval, parse_repr=None, min_score=None)
Returns: A ColorizedPyvalRepr describing the given pyval.
source code
call graph 
 
_colorize(self, pyval, state) source code
call graph 
 
_sort(self, items) source code
call graph 
 
_trim_result(self, result, num_chars) source code
call graph 
 
_multiline(self, func, pyval, state, *args)
Helper for container-type colorizers.
source code
call graph 
 
_colorize_iter(self, pyval, state, prefix, suffix) source code
call graph 
 
_colorize_dict(self, items, state, prefix, suffix) source code
call graph 
 
_colorize_str(self, pyval, state, prefix, encoding) source code
call graph 
 
_colorize_re(self, pyval, state) source code
call graph 
 
_colorize_re_flags(self, flags, state) source code
call graph 
 
_colorize_re_tree(self, tree, state, noparen, groups) source code
call graph 
 
_output(self, s, tag, state)
Add the string `s` to the result list, tagging its contents with tag `tag`.
source code
call graph 
Class Variables [hide private]
  GROUP_TAG = 'variable-group'
  COMMA_TAG = 'variable-op'
  COLON_TAG = 'variable-op'
  CONST_TAG = None
  NUMBER_TAG = None
  QUOTE_TAG = 'variable-quote'
  STRING_TAG = 'variable-string'
  RE_CHAR_TAG = None
  RE_GROUP_TAG = 're-group'
  RE_REF_TAG = 're-ref'
  RE_OP_TAG = 're-op'
  RE_FLAGS_TAG = 're-flags'
  ELLIPSIS = Element(code, u'...', style='variable-ellipsis')
  LINEWRAP = Element(symbol, u'crarr')
  UNKNOWN_REPR = Element(code, u'??', style='variable-unknown')
  GENERIC_OBJECT_RE = re.compile(r'(?i)^<.* at 0x[0-9a-f]+>$')
  ESCAPE_UNICODE = False
Method Details [hide private]

colorize(self, pyval, parse_repr=None, min_score=None)

source code 
call graph 
Returns:
A ColorizedPyvalRepr describing the given pyval.

_multiline(self, func, pyval, state, *args)

source code 
call graph 

Helper for container-type colorizers. First, try calling func(pyval, state, *args) with linebreakok set to false; and if that fails, then try again with it set to true.

_output(self, s, tag, state)

source code 
call graph 

Add the string `s` to the result list, tagging its contents with tag `tag`. Any lines that go beyond `self.linelen` will be line-wrapped. If the total number of lines exceeds `self.maxlines`, then raise a `_Maxlines` exception.