neuralib.util.table.Column

class neuralib.util.table.Column[source]

Bases: object

Defines 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 None to automatically fit. Defaults to None. min_width (Optional[int], optional): The minimum width of the table, or None for no minimum. Defaults to None. box (box.Box, optional): One of the constants in box.py used to draw the edges (see appendix_box), or None for 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 (precludes show_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

cells

Get all cells in the column, not including header.

flexible

Check if this column is flexible.

footer

RenderableType: Renderable for the footer (typically a string)

footer_style

StyleType: The style of the footer.

header

RenderableType: Renderable for the header (typically a string)

header_style

StyleType: The style of the header.

highlight

bool: Apply highlighter to column.

justify

str: How to justify text within the column ("left", "center", "right", or "full")

max_width

Optional[int]: Maximum width of column, or None for no maximum.

min_width

Optional[int]: Minimum width of column, or None for no minimum.

no_wrap

bool: Prevent wrapping of text within the column.

overflow

str: Overflow method.

ratio

Optional[int]: Ratio to use when calculating column width, or None (default) to adapt to column contents.

style

StyleType: The style of the column.

vertical

str: How to vertically align content ("top", "middle", or "bottom")

width

Optional[int]: Width of the column, or None (default) to auto calculate width.

header: RenderableType = ''

RenderableType: Renderable for the header (typically a string)

footer: RenderableType = ''

RenderableType: Renderable for the footer (typically a string)

header_style: str | Style = ''

StyleType: The style of the header.

footer_style: str | Style = ''

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 None for no minimum. Defaults to None.

max_width: int | None = None

Optional[int]: Maximum width of column, or None for 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.

copy()[source]

Return a copy of this Column.

Return type:

Column

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