libtbx.table_utils
index
/net/chevy/raid1/rwgk/dist/cctbx_project/libtbx/table_utils.py

## Some functionality for formatted printing,
## indentation and simple tables
##
## Take from
##   http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662
## slightly modifed functionality.
##

 
Modules
       
cStringIO
libtbx
math
operator
re

 
Functions
       
exercise()
format(rows, comments=None, has_header=False, header_char='-', delim=' | ', justify='left', separate_rows=False, leading_and_terminal_separator=True, prefix='', postfix='', wrapfunc=<function <lambda> at 0x116d050>)
Indents a table by column.
- rows: A sequence of sequences of items, one sequence per row.
- hasHeader: True if the first row consists of the columns' names.
- headerChar: Character to be used for the row separator line
  (if hasHeader==True or separateRows==True).
- delim: The column delimiter.
- justify: Determines how are data justified in their column.
  Valid values are 'left','right' and 'center'.
- separateRows: True if rows are to be separated by a line
  of 'headerChar's.
- prefix: A string prepended to each printed row.
- postfix: A string appended to each printed row.
- wrapfunc: A function f(text) for wrapping text; each element in
  the table is first wrapped by this function.
wrap_always(text, width)
A simple word-wrap function that wraps text on exactly width characters.
It doesn't split the text in words.
wrap_onspace(text, width)
    A word-wrap function that preserves existing line breaks
    and most spaces in the text. Expects that existing line
    breaks are posix newlines (
).
wrap_onspace_strict(text, width)
Similar to wrap_onspace, but enforces the width constraint:
words longer than width are split.