formatter
index
/usr/lib/python2.1/formatter.py

Generic output formatting.
 
Formatter objects transform an abstract flow of formatting events into
specific output events on writer objects. Formatters manage several stack
structures to allow various properties of a writer object to be changed and
restored; writers need not be able to handle relative changes nor any sort
of ``change back'' operation. Specific writer properties which may be
controlled via formatter objects are horizontal alignment, font, and left
margin indentations. A mechanism is provided which supports providing
arbitrary, non-exclusive style settings to a writer as well. Additional
interfaces facilitate formatting events which are not reversible, such as
paragraph separation.
 
Writer objects encapsulate device interfaces. Abstract devices, such as
file formats, are supported as well as physical devices. The provided
implementations all work with abstract devices. The interface makes
available mechanisms for setting the properties which formatter objects
manage and inserting data into the output.

 
Modules
            
string
sys

 
Classes
            
AbstractFormatter
NullFormatter
NullWriter
AbstractWriter
DumbWriter

 
class AbstractFormatter
       
  
__init__(self, writer)
add_flowing_data(self, data, whitespace='\t\n\x0b\x0c\r ', join=<function join>, split=<function split>)
add_hor_rule(self, *args, **kw)
add_label_data(self, format, counter, blankline=None)
add_line_break(self)
add_literal_data(self, data)
assert_line_data(self, flag=1)
end_paragraph(self, blankline)
flush_softspace(self)
format_counter(self, format, counter)
format_letter(self, case, counter)
format_roman(self, case, counter)
pop_alignment(self)
pop_font(self)
pop_margin(self)
pop_style(self, n=1)
push_alignment(self, align)
push_font(self, (size, i, b, tt))
push_margin(self, margin)
push_style(self, *styles)
set_spacing(self, spacing)

 
class AbstractWriter(NullWriter)
       
  
__init__(self)
flush(self) from NullWriter
new_alignment(self, align)
new_font(self, font)
new_margin(self, margin, level)
new_spacing(self, spacing)
new_styles(self, styles)
send_flowing_data(self, data)
send_hor_rule(self, *args, **kw)
send_label_data(self, data)
send_line_break(self)
send_literal_data(self, data)
send_paragraph(self, blankline)

 
class DumbWriter(NullWriter)
       
  
__init__(self, file=None, maxcol=72)
flush(self) from NullWriter
new_alignment(self, align) from NullWriter
new_font(self, font) from NullWriter
new_margin(self, margin, level) from NullWriter
new_spacing(self, spacing) from NullWriter
new_styles(self, styles) from NullWriter
reset(self)
send_flowing_data(self, data)
send_hor_rule(self, *args, **kw)
send_label_data(self, data) from NullWriter
send_line_break(self)
send_literal_data(self, data)
send_paragraph(self, blankline)

 
class NullFormatter
       
  
__init__(self, writer=None)
add_flowing_data(self, data)
add_hor_rule(self, *args, **kw)
add_label_data(self, format, counter, blankline=None)
add_line_break(self)
add_literal_data(self, data)
assert_line_data(self, flag=1)
end_paragraph(self, blankline)
flush_softspace(self)
pop_alignment(self)
pop_font(self)
pop_margin(self)
pop_style(self, n=1)
push_alignment(self, align)
push_font(self, x)
push_margin(self, margin)
push_style(self, *styles)
set_spacing(self, spacing)

 
class NullWriter
      Minimal writer interface to use in testing & inheritance.
 
  
__init__(self)
flush(self)
new_alignment(self, align)
new_font(self, font)
new_margin(self, margin, level)
new_spacing(self, spacing)
new_styles(self, styles)
send_flowing_data(self, data)
send_hor_rule(self, *args, **kw)
send_label_data(self, data)
send_line_break(self)
send_literal_data(self, data)
send_paragraph(self, blankline)

 
Functions
            
test(file=None)

 
Data
             AS_IS = None
StringType = <type 'string'>
__file__ = '/usr/lib/python2.1/formatter.pyc'
__name__ = 'formatter'