Module Expr Str ImportFrom alias alias ClassDef bases NameLoad body FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assert Call NameLoad NameLoad TupleLoad NameLoad NameLoad NameLoad NameLoad If Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr For NameStore AttributeLoad NameLoad attr body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr orelse Expr Call NameLoad Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad AttributeLoad NameLoad attr UnaryOpNot AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Dict AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Dict AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Str decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Str decorator_list decorator_list ClassDef bases NameLoad body ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list Assign NameStore Dict Str Str Str Str Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults body TryExcept body Return Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad handlers ExceptHandler type NameLoad body Raise Call NameLoad NameLoad decorator_list decorator_list Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Dict Str Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults body If CompareEq NameLoad Str body Return Call NameLoad If CompareIn NameLoad AttributeLoad NameLoad attr body Return Call NameLoad NameLoad NameLoad Raise Call NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad Str attr NameLoad decorator_list Assign NameStore Call NameLoad Assign NameStore ListLoad Str Str
N/A N/A 
Character attribute manipulation API

This module provides a domain-specific language (using Python syntax)
for the creation of text with additional display attributes associated
with it.  It is intended as an alternative to manually building up
strings containing ECMA 48 character attribute control codes.  It
currently supports foreground and background colors (black, red,
green, yellow, blue, magenta, cyan, and white), intensity selection,
underlining, blinking and reverse video.  Character set selection
support is planned.

Character attributes are specified by using two Python operations:
attribute lookup and indexing.  For example, the string "Hello
world" with red foreground and all other attributes set to their
defaults, assuming the name twisted.conch.insults.text.attributes has
been imported and bound to the name "A" (with the statement C{from
twisted.conch.insults.text import attributes as A}, for example) one
uses this expression::

 | A.fg.red["Hello world"]

Other foreground colors are set by substituting their name for
"red".  To set both a foreground and a background color, this
expression is used::

 | A.fg.red[A.bg.green["Hello world"]]

Note that either A.bg.green can be nested within A.fg.red or vice
versa.  Also note that multiple items can be nested within a single
index operation by separating them with commas::

 | A.bg.green[A.fg.red["Hello"], " ", A.fg.blue["world"]]

Other character attributes are set in a similar fashion.  To specify a
blinking version of the previous expression::

 | A.blink[A.bg.green[A.fg.red["Hello"], " ", A.fg.blue["world"]]]

C{A.reverseVideo}, C{A.underline}, and C{A.bold} are also valid.

A third operation is actually supported: unary negation.  This turns
off an attribute when an enclosing expression would otherwise have
caused it to be on.  For example::

 | A.underline[A.fg.red["Hello", -A.underline[" world"]]]

@author: Jp Calderone
 twisted.conch.insults helper insults _Attribute N/A object N/A __init__ N/A N/A self N/A N/A N/A N/A self children N/A N/A __getitem__ N/A N/A self item N/A N/A N/A N/A isinstance item N/A list tuple _Attribute str N/A N/A isinstance item N/A list tuple N/A N/A N/A N/A N/A self children extend item N/A N/A N/A N/A N/A self children append item N/A self N/A serialize N/A N/A self write attrs N/A None N/A N/A N/A attrs None N/A N/A attrs N/A N/A helper CharacterAttribute N/A ch N/A self children N/A N/A N/A isinstance ch _Attribute N/A N/A N/A N/A ch serialize write N/A N/A attrs copy N/A N/A N/A write N/A N/A attrs toVT102 N/A N/A write ch N/A N/A _NormalAttr N/A _Attribute N/A serialize N/A N/A self write attrs N/A N/A N/A N/A N/A attrs __init__ N/A N/A N/A N/A super _NormalAttr self serialize write attrs N/A N/A _OtherAttr N/A _Attribute N/A __init__ N/A N/A self attrname attrvalue N/A N/A N/A N/A self attrname attrname N/A N/A self attrvalue attrvalue N/A N/A self children N/A N/A __neg__ N/A N/A self N/A N/A N/A result N/A _OtherAttr N/A self attrname N/A N/A self attrvalue N/A N/A N/A N/A result children extend N/A self children N/A result N/A serialize N/A N/A self write attrs N/A N/A N/A attrs N/A N/A attrs wantOne N/A N/A self attrname N/A self attrvalue N/A N/A N/A N/A super _OtherAttr self serialize write attrs N/A N/A _ColorAttr N/A _Attribute N/A __init__ N/A N/A self color ground N/A N/A N/A N/A self color color N/A N/A self ground ground N/A N/A self children N/A N/A serialize N/A N/A self write attrs N/A N/A N/A attrs N/A N/A attrs wantOne N/A N/A self ground N/A self color N/A N/A N/A N/A super _ColorAttr self serialize write attrs N/A N/A _ForegroundColorAttr N/A _ColorAttr N/A __init__ N/A N/A self color N/A N/A N/A N/A N/A N/A super _ForegroundColorAttr self __init__ color foreground N/A N/A _BackgroundColorAttr N/A _ColorAttr N/A __init__ N/A N/A self color N/A N/A N/A N/A N/A N/A super _BackgroundColorAttr self __init__ color background N/A N/A CharacterAttributes N/A object N/A _ColorAttribute N/A object N/A __init__ N/A N/A self ground N/A N/A N/A N/A self ground ground N/A N/A attrs N/A black red green yellow blue magenta cyan white N/A helper BLACK N/A helper RED N/A helper GREEN N/A helper YELLOW N/A helper BLUE N/A helper MAGENTA N/A helper CYAN N/A helper WHITE __getattr__ N/A N/A self name N/A N/A N/A N/A N/A N/A N/A self ground N/A N/A self attrs N/A name N/A N/A N/A KeyError N/A N/A N/A AttributeError name N/A N/A N/A fg N/A _ColorAttribute _ForegroundColorAttr N/A bg N/A _ColorAttribute _BackgroundColorAttr N/A attrs N/A bold blink underline reverseVideo N/A insults BOLD N/A insults BLINK N/A insults UNDERLINE N/A insults REVERSE_VIDEO __getattr__ N/A N/A self name N/A N/A N/A N/A name normal N/A N/A N/A _NormalAttr N/A N/A name N/A self attrs N/A N/A N/A _OtherAttr name True N/A N/A AttributeError name N/A N/A flatten N/A N/A output attrs N/A N/A N/A Serialize a sequence of characters with attribute information

    The resulting string can be interpreted by VT102-compatible
    terminals so that the contained characters are displayed and, for
    those attributes which the terminal supports, have the attributes
    specified in the input.

    For example, if your terminal is VT102 compatible, you might run
    this for a colorful variation on the "hello world" theme::

     | from twisted.conch.insults.text import flatten, attributes as A
     | from twisted.conch.insults.helper import CharacterAttribute
     | print flatten(
     |     A.normal[A.bold[A.fg.red['He'], A.fg.green['ll'], A.fg.magenta['o'], ' ',
     |                     A.fg.yellow['Wo'], A.fg.blue['rl'], A.fg.cyan['d!']]],
     |     CharacterAttribute())

    @param output: Object returned by accessing attributes of the
    module-level attributes object.

    @param attrs: A L{twisted.conch.insults.helper.CharacterAttribute}
    instance

    @return: A VT102-friendly string
     N/A L N/A N/A N/A N/A output serialize N/A L append attrs N/A N/A N/A join L N/A N/A attributes N/A CharacterAttributes N/A __all__ N/A attributes flatten