omero.util.text module

class util.text.ALIGN[source]

Bases: object

LEFT = '-'
RIGHT = ''
class util.text.CSVStyle[source]

Bases: PlainStyle

NAME = 'csv'
get_rows(table)[source]
class util.text.Column(name, data, align='-', style=<util.text.SQLStyle object>)[source]

Bases: list

class util.text.JSONStyle[source]

Bases: Style

NAME = 'json'
format(width, align)[source]
get_rows(table)[source]
class util.text.PlainStyle[source]

Bases: Style

NAME = 'plain'
SEPARATOR = ','
format(width, align)[source]
get_rows(table)[source]
class util.text.SQLStyle[source]

Bases: Style

NAME = 'sql'
SEPARATOR = '|'
format(width, align)[source]
get_rows(table)[source]
line(table)[source]
status(table)[source]
class util.text.Style[source]

Bases: object

NAME = 'unknown'
headers(table)[source]
width(name, decoded_data)[source]
class util.text.StyleRegistry[source]

Bases: dict

class util.text.Table(*columns)[source]

Bases: object

get_row(i=None)[source]
get_rows()[source]
page(offset, limit, total)[source]
set_style(style)[source]
class util.text.TableBuilder(*headers)[source]

Bases: object

OMERO-addition to make working with Tables easier

build()[source]
col(name)[source]

Add a new column and back fill spaces

cols(names)[source]

Similar to col() but only adds unknown columns

get_col(name)[source]

Return a column by header name.

page(offset, limit, total)[source]
replace_col(name, col)[source]

Replace a column by header name, it must be the same length.

replace_header(name, new_name)[source]

Replace a header name with a new name.

row(*items, **by_name)[source]
set_align(align)[source]

Set column alignments using alignments string, one char for each column. ‘r’ for right-aligned columns, the default, anything else, is left-aligned. If the argument list in too short it will be padded with the default.

set_style(style)[source]
sort(cols=[0], reverse=False)[source]

Sort the results on a given column by transposing, sorting and then transposing.

util.text.filesizeformat(bytes)[source]

Formats the value like a ‘human-readable’ file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc).

Copied largely from django.template.defaultfilters

util.text.find_style(style, error_strategy=None)[source]

Lookup method for well-known styles by name. None may be returned.

util.text.list_styles()[source]

List the styles that are known by find_style