raesl.excel.utils#

Excel export utility methods.

Module Contents#

Functions#

get_all_tags(→ List[str])

Get all tagged comment keys from a list of nodes.

make_table() → openpyxl.worksheet.table.Table)

Make a table of a cell range in a worksheet.

apply_styling(ws, headers[, defaults, start_row, end_row])

Apply styling to columns given some default option dictionary.

parent_component(→ str)

Get parent component name of a requirement.

parent_def(→ str)

Get the parent (component) definition of a requirement.

format_multiline(→ str)

Format multiline (list) text.

requirement_kind(→ str)

Get requirement kind.

dedupe(→ List[Any])

Deduplicate any iterable into a list where the first occurrence is preserved.

yield_functional_dependencies(...)

Yield all functional dependencies with which a component is involved.

yield_all_function_specifications(...)

Yield all function specification nodes and edge combinations for a given iterable of dependency edges.

yield_function_specifications(...)

Get all function specification nodes corresponding to a functional dependency edge.

get_function_specification_names(→ List[str])

Get the function specification node names corresponding to a functional dependency edge.

yield_active_functions(→ Generator[ragraph.node.Node, ...)

Yield all edge function combinations for which the active component matches the given path.

get_goal_active(→ Optional[str])

Get the active component in a function specification.

yield_passive_functions(...)

Yield all edge function combinations for which the passive component matches the given path.

get_goal_passive(→ Optional[str])

Get the receiving component of a goal function.

get_function_flow_variables() → Set[str])

Get the variables involved with a functional dependency.

get_function_subclauses(→ List[str])

Get the subclauses belonging to a function specification.

get_variable_type(→ str)

Get the variable type of a node.

build_active_goal_data() → Generator[Dict[str, Any], ...)

Create data dictionaries for the outgoing goals in the component overview.

build_passive_goal_data(→ Generator[Dict[str, Any], ...)

Create data dictionaries for the incoming goals in the component overview.

build_subclause_data(→ Generator[Dict[str, Any], None, ...)

Create a subclause data dictionary for each OR clause for use in the component overview.

build_subclause_body_data(→ Dict[str, Any])

Create a subclause's body data dict for use in the component overview.

raesl.excel.utils.get_all_tags(nodes: List[ragraph.node.Node]) List[str]#

Get all tagged comment keys from a list of nodes.

raesl.excel.utils.make_table(ws: openpyxl.worksheet.worksheet.Worksheet, name: str = 'Table', min_row: int = 1, max_row: int = 1, min_col: int = 1, max_col: int = 1, style: openpyxl.worksheet.table.TableStyleInfo = TableStyleInfo(name='TableStyleMedium9', showRowStripes=True)) openpyxl.worksheet.table.Table#

Make a table of a cell range in a worksheet.

raesl.excel.utils.apply_styling(ws: openpyxl.worksheet.worksheet.Worksheet, headers: List[str], defaults: Dict[str, Any] = dict(), start_row: int = 0, end_row: int | None = None)#

Apply styling to columns given some default option dictionary.

raesl.excel.utils.parent_component(requirement: ragraph.node.Node, skip: str | None = 'world') str#

Get parent component name of a requirement.

raesl.excel.utils.parent_def(graph: ragraph.graph.Graph, requirement: ragraph.node.Node) str#

Get the parent (component) definition of a requirement.

raesl.excel.utils.format_multiline(comments: List[str]) str#

Format multiline (list) text.

raesl.excel.utils.requirement_kind(requirement: ragraph.node.Node) str#

Get requirement kind.

raesl.excel.utils.dedupe(iterable: Iterable) List[Any]#

Deduplicate any iterable into a list where the first occurrence is preserved.

raesl.excel.utils.yield_functional_dependencies(g: ragraph.graph.Graph, component: ragraph.node.Node, flows: Set[str] | None) Generator[ragraph.edge.Edge, None, None]#

Yield all functional dependencies with which a component is involved.

raesl.excel.utils.yield_all_function_specifications(g: ragraph.graph.Graph, functional_dependencies: Iterable[ragraph.edge.Edge]) Generator[Tuple[ragraph.node.Node, ragraph.node.Node], None, None]#

Yield all function specification nodes and edge combinations for a given iterable of dependency edges.

raesl.excel.utils.yield_function_specifications(g: ragraph.graph.Graph, functional_dependency: ragraph.edge.Edge) Generator[Tuple[ragraph.node.Node, ragraph.node.Node], None, None]#

Get all function specification nodes corresponding to a functional dependency edge.

raesl.excel.utils.get_function_specification_names(functional_dependency: ragraph.edge.Edge) List[str]#

Get the function specification node names corresponding to a functional dependency edge.

raesl.excel.utils.yield_active_functions(function_specifications: Iterable[ragraph.node.Node], active_path: str) Generator[ragraph.node.Node, None, None]#

Yield all edge function combinations for which the active component matches the given path.

raesl.excel.utils.get_goal_active(function_specification: ragraph.node.Node) str | None#

Get the active component in a function specification.

raesl.excel.utils.yield_passive_functions(function_specifications: Iterable[ragraph.node.Node], passive_path: str) Generator[Tuple[ragraph.node.Node, ragraph.node.Node], None, None]#

Yield all edge function combinations for which the passive component matches the given path.

raesl.excel.utils.get_goal_passive(function_specification: ragraph.node.Node) str | None#

Get the receiving component of a goal function.

raesl.excel.utils.get_function_flow_variables(function_specification: ragraph.node.Node, edge: ragraph.edge.Edge, function_specifications: Set[ragraph.node.Node] = set()) Set[str]#

Get the variables involved with a functional dependency.

raesl.excel.utils.get_function_subclauses(function_specification: ragraph.node.Node) List[str]#

Get the subclauses belonging to a function specification.

raesl.excel.utils.get_variable_type(variable: ragraph.node.Node) str#

Get the variable type of a node.

raesl.excel.utils.build_active_goal_data(graph: ragraph.graph.Graph, edge: ragraph.edge.Edge, goal: ragraph.node.Node, function_specifications: Set[ragraph.node.Node] = set()) Generator[Dict[str, Any], None, None]#

Create data dictionaries for the outgoing goals in the component overview.

Keys:

label: Goal label. target: Target component (shared path skipped). flows: Sent flow variables (shared path skipped). types: Flow variable types. subclause: Subclause label, optionally prefixed with numbers for OR-concatenations. subject: Subclause subject with prefix skipped. comparison: Abbreviated comparison (<, <=, ==, >=, >, ++, –). bound: Comparison variable or value. unit: Comparison value unit.

raesl.excel.utils.build_passive_goal_data(graph: ragraph.graph.Graph, edge: ragraph.edge.Edge, goal: ragraph.node.Node, function_specifications: Set[ragraph.node.Node]) Generator[Dict[str, Any], None, None]#

Create data dictionaries for the incoming goals in the component overview.

Keys:

label: Goal label. target: Target component (shared path skipped). flows: Sent flow variables (shared path skipped). types: Flow variable types. subclause: Subclause label, optionally prefixed with numbers for OR-concatenations. subject: Subclause subject with prefix skipped. comparison: Abbreviated comparison (<, <=, ==, >=, >, ++, –). bound: Comparison variable or value. unit: Comparison value unit.

raesl.excel.utils.build_subclause_data(subclause_info: Dict[str, Any], skip_prefix: str) Generator[Dict[str, Any], None, None]#

Create a subclause data dictionary for each OR clause for use in the component overview.

Keys:

subclause: Subclause label, optionally prefixed with numbers for OR-concatenations. subject: Subclause subject with prefix skipped. comparison: Abbreviated comparison (<, <=, ==, >=, >, ++, –). bound: Comparison variable or value. unit: Comparison value unit.

raesl.excel.utils.build_subclause_body_data(subclause_body: Dict[str, Any], skip_prefix: str) Dict[str, Any]#

Create a subclause’s body data dict for use in the component overview.

Keys:

subject: Subclause subject with prefix skipped. comparison: Abbreviated comparison (<, <=, ==, >=, >, ++, –). bound: Comparison variable or value. unit: Comparison value unit.