see.output module

Manipulating strings for output.

class see.output.SeeResult(tokens)

Bases: object

The output of the see() function.

Acts like a tuple of strings, so you can iterate over the output:

>>> first = see()[0]

>>> for string in see([]):
...     print(string)
filter(pattern)

Filter the results using a pattern.

This accepts a shell-style wildcard pattern (as used by the fnmatch module):

>>> see([]).filter('*op*')
    .copy()    .pop()

It also accepts a regular expression. This may be a compiled regular expression (from the re module) or a string that starts with a / (forward slash) character:

>>> see([]).filter('/[aeiou]{2}/')
    .clear()    .count()
see.output.column_width(tokens)

Return a suitable column width to display one or more strings.

see.output.display_name(name, obj, local)

Get the display name of an object.

Keyword arguments (all required):

  • name – the name of the object as a string.
  • obj – the object itself.
  • local – a boolean value indicating whether the object is in local scope or owned by an object.
see.output.justify_token(tok, col_width)

Justify a string to fill one or more columns.