src.utils.table_manager package

Submodules

src.utils.table_manager.csv_table_manager module

src.utils.table_manager.excel_table_manager module

src.utils.table_manager.i_table_manager module

src.utils.table_manager.sample_sheet_builder module

A builder class for constructing a sample sheet text from a container of sections.

This module provides a class SampleSheetBuilder for assembling a sample sheet from various sections.

It handles formatting and joining sections into a coherent text representation.

The class is designed to be used with SampleSheetContainer objects, which hold the individual sections.

class src.utils.table_manager.sample_sheet_builder.SampleSheetBuilder(container: SampleSheetContainer, separator: str = ',')[source]

Bases: object

A builder class for constructing a sample sheet text from a container of sections.

container

The container holding the sections to be included in the sample sheet.

Type:

SampleSheetContainer

lines

A list of strings representing each line of the constructed sample sheet.

Type:

list

separator

The separator used to join values in the output (default is comma).

Type:

str

build() None[source]

Builds the sample sheet lines from the sections in the container. Populates the self.lines list with the constructed lines.

get_lines() list[str][source]

Retrieves the constructed sample sheet lines.

Returns:

A list of strings representing the sample sheet.

Return type:

list

save_to_csv(path: PathLike) None[source]

Saves the constructed sample sheet to a CSV file at the specified path.

Parameters:

path (PathLike[AnyStr]) – The file path where the sample sheet will be saved.

Raises:

Exception – Propagates any exception raised during file operations.

src.utils.table_manager.sample_sheet_container module

A module for representing and managing sample sheet data.

This module defines data structures for organizing sample sheet information, allowing for flexible storage of various data types within different sections. It is designed to handle both simple key-value pairs and more complex structures within each section of the sample sheet.

class src.utils.table_manager.sample_sheet_container.Section(name: str, data: dict[str, str] | list[dict | str])[source]

Bases: object

Represents a section within the sample sheet.

name

The name of the section.

Type:

str

data

The data associated with the section, which can be a dictionary of string key-value pairs or a list containing dictionaries or strings.

Type:

Union[Dict[str, str], List[Union[Dict, str]]]

name: str
data: dict[str, str] | list[dict | str]
class src.utils.table_manager.sample_sheet_container.SampleSheetContainer(sections: list[~src.utils.table_manager.sample_sheet_container.Section] = <factory>)[source]

Bases: object

Container for managing multiple sections of a sample sheet.

sections

A list of Section objects.

Type:

List[Section]

sections: list[Section]
add_section(section: Section) None[source]

Adds a new section to the container.

Parameters:

section (Section) – The Section object to add.

get_sections() list[Section][source]

Retrieves all sections stored in the container.

Returns:

The list of Section objects.

Return type:

list[Section]

src.utils.table_manager.table_manager_factory module

src.utils.table_manager.xml_table_manager module

Module contents