factory module¶
Pretty table factory¶
- class gemseo.third_party.prettytable.factory.TableHandler(**kwargs)[source]
Bases:
HTMLParser
Initialize and reset this instance.
If convert_charrefs is True (the default), all character references are automatically converted to the corresponding Unicode characters.
- generate_table(rows)[source]
Generates from a list of rows a PrettyTable object.
- Parameters:
rows –
- handle_data(data)[source]
- Parameters:
data –
- Return type:
None
- handle_endtag(tag)[source]
- Parameters:
tag –
- Return type:
None
- handle_starttag(tag, attrs)[source]
- Parameters:
tag – param attrs:
attrs –
- Return type:
None
- static make_fields_unique(fields)[source]
iterates over the row and make each field unique
- Parameters:
fields – fields
- Return type:
None
- gemseo.third_party.prettytable.factory.from_csv(filepath, field_names=None, **kwargs)[source]
Loads table from CSV file
- Parameters:
filepath – param field_names: (Default value = None)
field_names – (Default value = None)
- gemseo.third_party.prettytable.factory.from_db_cursor(cursor, **kwargs)[source]
- Parameters:
cursor –
kwargs –
- gemseo.third_party.prettytable.factory.from_html(html_code, **kwargs)[source]
Generates a list of PrettyTables from a string of HTML code.
Each <table> in the HTML becomes one PrettyTable object.
- Parameters:
html_code (str) – HTML code
kwargs – additional arguments
- gemseo.third_party.prettytable.factory.from_html_one(html_code, **kwargs)[source]
Generates a PrettyTables from a string of HTML code which contains only a single <table>
- Parameters:
html_code (str) – HTML code
kwargs – additional arguments
- gemseo.third_party.prettytable.factory.from_md(markdown, **kwargs)[source]
Generate PrettyTable from markdown string.
- Parameters:
markdown – markdown type string.
kwargs – additional arguments
- Returns:
a PrettyTable object.
- gemseo.third_party.prettytable.factory.split_md_row(row)[source]
Split markdown table.
- Parameters:
row – a row of markdown table
- Returns:
Split content list
- gemseo.third_party.prettytable.factory.strip_md_content(markdown)[source]
Strip the blank space and : in markdown table content cell.
- Parameters:
markdown – a row of markdown table
- Returns:
stripped content cell