neuralib.util.table.Column
- class neuralib.util.table.Column[source]
Bases:
objectDefines a column within a ~Table.
- Args:
title (Union[str, Text], optional): The title of the table rendered at the top. Defaults to None. caption (Union[str, Text], optional): The table caption rendered below. Defaults to None. width (int, optional): The width in characters of the table, or
Noneto automatically fit. Defaults to None. min_width (Optional[int], optional): The minimum width of the table, orNonefor no minimum. Defaults to None. box (box.Box, optional): One of the constants in box.py used to draw the edges (see appendix_box), orNonefor no box lines. Defaults to box.HEAVY_HEAD. safe_box (Optional[bool], optional): Disable box characters that don’t display on windows legacy terminal with raster fonts. Defaults to True. padding (PaddingDimensions, optional): Padding for cells (top, right, bottom, left). Defaults to (0, 1). collapse_padding (bool, optional): Enable collapsing of padding around cells. Defaults to False. pad_edge (bool, optional): Enable padding of edge cells. Defaults to True. show_header (bool, optional): Show a header row. Defaults to True. show_footer (bool, optional): Show a footer row. Defaults to False. show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True. show_lines (bool, optional): Draw lines between every row. Defaults to False. leading (int, optional): Number of blank lines between rows (precludesshow_lines). Defaults to 0. style (Union[str, Style], optional): Default style for the table. Defaults to “none”. row_styles (List[Union, str], optional): Optional list of row styles, if more than one style is given then the styles will alternate. Defaults to None. header_style (Union[str, Style], optional): Style of the header. Defaults to “table.header”. footer_style (Union[str, Style], optional): Style of the footer. Defaults to “table.footer”. border_style (Union[str, Style], optional): Style of the border. Defaults to None. title_style (Union[str, Style], optional): Style of the title. Defaults to None. caption_style (Union[str, Style], optional): Style of the caption. Defaults to None. title_justify (str, optional): Justify method for title. Defaults to “center”. caption_justify (str, optional): Justify method for caption. Defaults to “center”. highlight (bool, optional): Highlight cell contents (if str). Defaults to False.
- __init__(header='', footer='', header_style='', footer_style='', style='', justify='left', vertical='top', overflow='ellipsis', width=None, min_width=None, max_width=None, ratio=None, no_wrap=False, highlight=False, _index=0, _cells=<factory>)
- Parameters:
header (RenderableType)
footer (RenderableType)
header_style (str | Style)
footer_style (str | Style)
style (str | Style)
justify (JustifyMethod)
vertical (VerticalAlignMethod)
overflow (OverflowMethod)
width (int | None)
min_width (int | None)
max_width (int | None)
ratio (int | None)
no_wrap (bool)
highlight (bool)
_index (int)
_cells (List[RenderableType])
- Return type:
None
Methods
__init__([header, footer, header_style, ...])copy()Return a copy of this Column.
Attributes
Get all cells in the column, not including header.
Check if this column is flexible.
RenderableType: Renderable for the footer (typically a string)
StyleType: The style of the footer.
RenderableType: Renderable for the header (typically a string)
StyleType: The style of the header.
bool: Apply highlighter to column.
str: How to justify text within the column ("left", "center", "right", or "full")
Optional[int]: Maximum width of column, or
Nonefor no maximum.Optional[int]: Minimum width of column, or
Nonefor no minimum.bool: Prevent wrapping of text within the column.
str: Overflow method.
Optional[int]: Ratio to use when calculating column width, or
None(default) to adapt to column contents.StyleType: The style of the column.
str: How to vertically align content ("top", "middle", or "bottom")
Optional[int]: Width of the column, or
None(default) to auto calculate width.- header: RenderableType = ''
RenderableType: Renderable for the header (typically a string)
RenderableType: Renderable for the footer (typically a string)
- header_style: str | Style = ''
StyleType: The style of the header.
StyleType: The style of the footer.
- style: str | Style = ''
StyleType: The style of the column.
- justify: JustifyMethod = 'left'
str: How to justify text within the column (“left”, “center”, “right”, or “full”)
- vertical: VerticalAlignMethod = 'top'
str: How to vertically align content (“top”, “middle”, or “bottom”)
- overflow: OverflowMethod = 'ellipsis'
str: Overflow method.
- width: int | None = None
Optional[int]: Width of the column, or
None(default) to auto calculate width.
- min_width: int | None = None
Optional[int]: Minimum width of column, or
Nonefor no minimum. Defaults to None.
- max_width: int | None = None
Optional[int]: Maximum width of column, or
Nonefor no maximum. Defaults to None.
- ratio: int | None = None
Optional[int]: Ratio to use when calculating column width, or
None(default) to adapt to column contents.
- no_wrap: bool = False
bool: Prevent wrapping of text within the column. Defaults to
False.
- highlight: bool = False
bool: Apply highlighter to column. Defaults to
False.
- property cells: Iterable[RenderableType]
Get all cells in the column, not including header.
- property flexible: bool
Check if this column is flexible.
- __init__(header='', footer='', header_style='', footer_style='', style='', justify='left', vertical='top', overflow='ellipsis', width=None, min_width=None, max_width=None, ratio=None, no_wrap=False, highlight=False, _index=0, _cells=<factory>)
- Parameters:
header (RenderableType)
footer (RenderableType)
header_style (str | Style)
footer_style (str | Style)
style (str | Style)
justify (JustifyMethod)
vertical (VerticalAlignMethod)
overflow (OverflowMethod)
width (int | None)
min_width (int | None)
max_width (int | None)
ratio (int | None)
no_wrap (bool)
highlight (bool)
_index (int)
_cells (List[RenderableType])
- Return type:
None