ts_ids_core.mapping_table.locate module

exception MissingLineError[source]

Bases: Exception

Error class for missing line errors

class Pattern(name: str, regex: str)[source]

Bases: object

Dataclass to store a pattern’s name and regex

name: str
regex: str
get_field_paths(schema: dict, path: str = '') List[str][source]

Function for Depth First traversal of the dereferenced IDS dictionary

get_header_line_index(markdown_lines: List[str], section_heading: str) int[source]

Find the index of a table header line in a list of lines

Arguments:

markdown_lines – List of lines to look in heading – The heading of the section containing the table

get_line_index_with_pattern(pattern: Pattern, lines: List[str]) int[source]

Find a line matching a pattern in a list of lines

Arguments:

pattern – Pattern instance lines – List of lines to look in

Raises:

MissingLineError: could not find a line which matches the pattern

get_table_indexes(markdown_lines: List[str], section_heading: str) Tuple[int, int][source]

Find the indexes of the header and last row of a table in list of markdown lines

Arguments:

markdown_lines – List of lines to look in section_heading – The heading of the section containing the table

get_table_lines(markdown_lines: List[str], section_heading: str) List[str][source]

Get the table lines from a list of markdown lines

Arguments:

markdown_lines – List of lines to look in section_heading – The heading of the section containing the table