Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/report_util.html
Дата изменения: Fri Apr 8 12:46:15 2016
Дата индексирования: Mon Apr 11 01:32:00 2016
Кодировка:
Python: module report_util
 
 
report_util (version 8/31/06)
index
report_util.py

PURPOSE --
This module conatains tools to simplify the making of reports
 
DEVELOPER --
Don Chance
 
MODIFICATION HISTORY --
initial implementation drc 4/12/05
add (incomplete) html renderer drc 8/31/06

 
Modules
       
string
sys

 
Classes
       
__builtin__.list(__builtin__.object)
Columns_List
Row
__builtin__.object
Column
Entry
Entry_Format
Column_Format
Renderer
Render_ascii
Render_html
Table

 
class Column(__builtin__.object)
     Methods defined here:
__init__(self, name='')
__iter__(self)
Each column is an iterator.
__repr__(self)
append(self, item)
get_entries(self)
get_format(self)
get_name(self)
next(self)
previous(self)
set_entries(self, data)
set_format(self, format)
set_name(self, name)
set_next(self, col)
set_prev(self, col)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Column_Format(Entry_Format)
    The default formatting for an entire column.
 
The formatting for any given cell will override whatever is set here.
 
 
Method resolution order:
Column_Format
Entry_Format
__builtin__.object

Methods defined here:
__init__(self, column=None)
get_width(self)
set_align(self, align)
set_colsep(self, value)
set_rowsep(self, value)
set_string_formatting(self, format)
set_valign(self, valign)
set_width(self, width)

Methods inherited from Entry_Format:
get_align(self)
get_colsep(self)
get_rowsep(self)
get_string_formatting(self)
get_valign(self)

Data descriptors inherited from Entry_Format:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from Entry_Format:
ALIGN_VALUES = ('left', 'right', 'center')
VALIGN_VALUES = ('top', 'bottom', 'center')

 
class Columns_List(__builtin__.list)
    
Method resolution order:
Columns_List
__builtin__.list
__builtin__.object

Methods defined here:
__init__(self, *args)
append(self, col)
Append a column.
extend(self, collist)
Extend one column list with another.
reverse(self)
Reverse this list and the column links.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.list:
__add__(...)
x.__add__(y) <==> x+y
__contains__(...)
x.__contains__(y) <==> y in x
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__delslice__(...)
x.__delslice__(i, j) <==> del x[i:j]
 
Use of negative indices is not supported.
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__gt__(...)
x.__gt__(y) <==> x>y
__iadd__(...)
x.__iadd__(y) <==> x+=y
__imul__(...)
x.__imul__(y) <==> x*=y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__mul__(...)
x.__mul__(n) <==> x*n
__ne__(...)
x.__ne__(y) <==> x!=y
__repr__(...)
x.__repr__() <==> repr(x)
__reversed__(...)
L.__reversed__() -- return a reverse iterator over the list
__rmul__(...)
x.__rmul__(n) <==> n*x
__setitem__(...)
x.__setitem__(i, y) <==> x[i]=y
__setslice__(...)
x.__setslice__(i, j, y) <==> x[i:j]=y
 
Use  of negative indices is not supported.
__sizeof__(...)
L.__sizeof__() -- size of L in memory, in bytes
count(...)
L.count(value) -> integer -- return number of occurrences of value
index(...)
L.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
insert(...)
L.insert(index, object) -- insert object before index
pop(...)
L.pop([index]) -> item -- remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
remove(...)
L.remove(value) -- remove first occurrence of value.
Raises ValueError if the value is not present.
sort(...)
L.sort(cmp=None, key=None, reverse=False) -- stable sort IN PLACE;
cmp(x, y) -> -1, 0, 1

Data and other attributes inherited from __builtin__.list:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class Entry(__builtin__.object)
     Methods defined here:
__init__(self, value, column=None, column_span=1, row_span=1, format=None)
__repr__(self)
get_column(self)
get_column_span(self)
get_content(self)
get_format(self)
get_row_span(self)
set_column(self, col)
set_column_span(self, span)
set_content(self, value)
set_format(self, format)
set_row_span(self, span)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Entry_Format(__builtin__.object)
     Methods defined here:
__init__(self)
get_align(self)
get_colsep(self)
get_rowsep(self)
get_string_formatting(self)
get_valign(self)
set_align(self, align)
set_colsep(self, value)
set_rowsep(self, value)
set_string_formatting(self, format)
set_valign(self, valign)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
ALIGN_VALUES = ('left', 'right', 'center')
VALIGN_VALUES = ('top', 'bottom', 'center')

 
class Render_ascii(Renderer)
    Render a table for ASCII output.
 
 
Method resolution order:
Render_ascii
Renderer
__builtin__.object

Methods defined here:
__init__(self, table=None, outfile=<open file '<stdout>', mode 'w' at 0x47078>)
calc_column_width(self, column)
calc_entry_width(self, entry)
calc_table_width(self)
Calculate the natural width for this table
format_entry(self, text, format, column)
Return the text properly justified according to the input format.
get_column_width(self, column)
render(self)

Methods inherited from Renderer:
get_entry_format(self, entry)
get_outfile(self)
get_table(self)
set_outfile(self, outfile)
set_table(self, table)
write(self, outfile=None)
Render the table and write it to the outfile.

Data descriptors inherited from Renderer:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Render_html(Renderer)
    Render a table object into an HTML table.
 
 
Method resolution order:
Render_html
Renderer
__builtin__.object

Methods defined here:
__init__(self, table=None, outfile=<open file '<stdout>', mode 'w' at 0x47078>)
easy_render(self)
render(self)

Data and other attributes defined here:
FRAME_MAPPING = {'all': 'box', 'bottom': 'below', 'none': 'void', 'sides': 'vsides', 'top': 'above', 'topbot': 'hsides'}
TABLE_NO = 1

Methods inherited from Renderer:
get_entry_format(self, entry)
get_outfile(self)
get_table(self)
set_outfile(self, outfile)
set_table(self, table)
write(self, outfile=None)
Render the table and write it to the outfile.

Data descriptors inherited from Renderer:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Renderer(__builtin__.object)
    An abstract class from which other Render classes
(such ast Render_ascii and Render_html) are derived.
 
  Methods defined here:
__init__(self, table=None, outfile=<open file '<stdout>', mode 'w' at 0x47078>)
get_entry_format(self, entry)
get_outfile(self)
get_table(self)
render(self)
Return the rendered table as a string.
set_outfile(self, outfile)
set_table(self, table)
write(self, outfile=None)
Render the table and write it to the outfile.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Row(__builtin__.list)
    
Method resolution order:
Row
__builtin__.list
__builtin__.object

Methods defined here:
__init__(self, *args)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from __builtin__.list:
__add__(...)
x.__add__(y) <==> x+y
__contains__(...)
x.__contains__(y) <==> y in x
__delitem__(...)
x.__delitem__(y) <==> del x[y]
__delslice__(...)
x.__delslice__(i, j) <==> del x[i:j]
 
Use of negative indices is not supported.
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__gt__(...)
x.__gt__(y) <==> x>y
__iadd__(...)
x.__iadd__(y) <==> x+=y
__imul__(...)
x.__imul__(y) <==> x*=y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__mul__(...)
x.__mul__(n) <==> x*n
__ne__(...)
x.__ne__(y) <==> x!=y
__repr__(...)
x.__repr__() <==> repr(x)
__reversed__(...)
L.__reversed__() -- return a reverse iterator over the list
__rmul__(...)
x.__rmul__(n) <==> n*x
__setitem__(...)
x.__setitem__(i, y) <==> x[i]=y
__setslice__(...)
x.__setslice__(i, j, y) <==> x[i:j]=y
 
Use  of negative indices is not supported.
__sizeof__(...)
L.__sizeof__() -- size of L in memory, in bytes
append(...)
L.append(object) -- append object to end
count(...)
L.count(value) -> integer -- return number of occurrences of value
extend(...)
L.extend(iterable) -- extend list by appending elements from the iterable
index(...)
L.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
insert(...)
L.insert(index, object) -- insert object before index
pop(...)
L.pop([index]) -> item -- remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
remove(...)
L.remove(value) -- remove first occurrence of value.
Raises ValueError if the value is not present.
reverse(...)
L.reverse() -- reverse IN PLACE
sort(...)
L.sort(cmp=None, key=None, reverse=False) -- stable sort IN PLACE;
cmp(x, y) -> -1, 0, 1

Data and other attributes inherited from __builtin__.list:
__hash__ = None
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class Table(__builtin__.object)
     Methods defined here:
__init__(self, data=None, title='')
get_columns(self)
get_data(self)
get_entry_format(self)
get_frame(self)
get_title(self)
set_columns(self, cols)
set_data(self, data)
Build a table from a list of lists (or tuples).
set_entry_format(self, format)
set_frame(self, value)
set_title(self, title)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
FRAME_VALUES = ['sides', 'top', 'bottom', 'topbot', 'all', 'none']

 
Functions
       
morph(list_of_dicts, ddict)
validate_boolean(value)

 
Data
        ALIGN_VALUES = ['left', 'center', 'right', 'justify', None]
VALIGN_VALUES = ['top', 'middle', 'bottom', None]
__version__ = '8/31/06'