tablate.classes.bases package#

Submodules#

tablate.classes.bases.TablateApiBase module#

class tablate.classes.bases.TablateApiBase.TablateApiBase(container_border=None, container_padding=None, container_width=None, html_default_colors=None, frame_divider=None, background=None, background_padding=None, html_px_multiplier=None, html_container_styles=None, column_styles=None, text_styles=None, html_frame_styles=None, html_column_styles=None, html_text_styles=None)[source]#

Bases: TablateBase

apply(function, raise_merge_error=True)[source]#

Iterates over frame items and calls the passed function for on each iteration. Optionally, if the functions returns a valid frame options dict or global options dicts, these will be set to the internal store. If there is an error, trying to set the return objects, the .apply() method will break and reset the internal stores.

Note

As a rule of thumb, the return objects should have the same form as the third (frame options) and forth (global options) arguments passed to the .apply() method.

Parameters:
  • function (Callable[[str, Literal['text', 'grid', 'table'], dict, dict], Tuple[dict, dict]]) – A function called for each frame element. The function accepts four arguments: the frame type, the frame name, the frame options and the global options. The function may return a tuple containing the frame options and the global options. Tablate will attempt to apply the return values, if set, to its internal frame store and the global options store.

  • raise_merge_error (bool) – If set to True, the apply function will raise an

apply_style(selector, css, sub_selector=None)[source]#

Applies custom CSS styling to the Tablate container instance. CSS stylings are scoped to the specific Tablate container instance.

Parameters:
  • selector (str) – The HTML classnames within the Tablate container instance.

  • css (str) – The CSS style to be set (for instance: background-color: #FFFFFF).

  • sub_selector (Optional[str]) – An additional selector appended immediately after the main selector block.

to_string()[source]#

Generates an ASCII rendering of the Tablate container instance.

Returns: An ASCII rendering of the Tablate container instance.

Return type:

str

print()[source]#

Prints an ASCII rendering of the Tablate container instance.

Return type:

None

to_html()[source]#

Generates an HTML rendering of the Tablate container instance.

Returns: An HTML rendering of the Tablate container instance.

Return type:

str

tablate.classes.bases.TablateApiItem module#

class tablate.classes.bases.TablateApiItem.TablateApiItem(container_border=None, container_padding=None, container_width=None, html_default_colors=None, frame_divider=None, background=None, background_padding=None, html_px_multiplier=None, html_container_styles=None, column_styles=None, text_styles=None, html_frame_styles=None, html_column_styles=None, html_text_styles=None)[source]#

Bases: TablateApiBase

property name#

The name of the frame.

Type:

Returns

rename(new_name)[source]#

Renames the frame. :type new_name: str :param new_name: The new name set on the frame.

to_dict()[source]#

Returns: A Pandas compatible dict.

tablate.classes.bases.TablateApiSet module#

class tablate.classes.bases.TablateApiSet.TablateApiSet(container_border=None, container_padding=None, container_width=None, html_default_colors=None, frame_divider=None, background=None, background_padding=None, html_px_multiplier=None, html_container_styles=None, column_styles=None, text_styles=None, html_frame_styles=None, html_column_styles=None, html_text_styles=None)[source]#

Bases: TablateApiBase

list_frames()[source]#

List the frames in the Tablate container instance with some details about each frame.

get_frame(selector, apply_globals=False)[source]#

Gets a frame from the Tablate container instance and returns it as a TablateItem. :type selector: Union[int, str] :param selector: The index or name of the frame to select. :type apply_globals: bool :param apply_globals: Whether to apply the global defaults and container styles to the returned TablateItem.

Returns:

remove_frame(selector)[source]#

Deletes a frame. :type selector: Union[int, str] :param selector: The index or name of the frame to delete.

replace_frame(selector, new_frame, new_name=None)[source]#

Replaces a frame with another frame. :type selector: Union[int, str] :param selector: The index or name of the frame to replace. :type new_frame: TablateBase :param new_frame: A Tablate Container instance to replace the frame with (if more than one frame in the Tablate container instance, only the first frame will be used). :type new_name: Optional[str] :param new_name: (Optional) The new name of the frame.

rename_frame(selector, new_name)[source]#

Renames a frame. :type selector: Union[int, str] :param selector: The index or name of the frame to rename. :type new_name: str :param new_name: The new name to apply to the frame.

move_frame(from_selector, to_index)[source]#

Move a frame within a Tablate container instance to a new index. :type from_selector: Union[int, str] :param from_selector: The index or name of the frame to move. :type to_index: int :param to_index: The index to which the selected frame should be moved.

insert_frame(insert_index, new_frame, new_name=None)[source]#

Insert a frame into a Tablate container instance at a specified index. :type insert_index: int :param insert_index: The index at which the new frame should be inserted. :type new_frame: TablateBase :param new_frame: The Tablate container instance to insert. :type new_name: Optional[str] :param new_name: (Optional) The name to apply to the inserted frame.

tablate.classes.bases.TablateBase module#

class tablate.classes.bases.TablateBase.TablateBase[source]#

Bases: object

tablate.classes.bases.TablateItem module#

class tablate.classes.bases.TablateItem.TablateItem(frame_item, container_border=None, container_padding=None, container_width=None, frame_divider=None, background=None, background_padding=None, html_px_multiplier=None, html_container_styles=None, html_default_colors=None, column_styles=None, text_styles=None, html_frame_styles=None, html_column_styles=None, html_text_styles=None)[source]#

Bases: TablateApiItem

tablate.classes.bases.TablateSet module#

class tablate.classes.bases.TablateSet.TablateSet(frame_list, container_border=None, container_padding=None, container_width=None, frame_divider=None, background=None, background_padding=None, html_px_multiplier=None, html_container_styles=None, column_styles=None, text_styles=None, html_frame_styles=None, html_column_styles=None, html_text_styles=None)[source]#

Bases: TablateApiSet

Module contents#