raesl.excel#

Module to export as an Excel workbook.

Submodules#

Package Contents#

Functions#

register_locale([locale])

Register a locale. Existing locales are re-registered.

get_scoped_nodes(→ List[ragraph.node.Node])

Get scoped nodes, being subtrees of the graph of varying depth.

convert(→ openpyxl.workbook.Workbook)

Write (part of) an ESL specification to a Excel workbook.

overview(→ openpyxl.workbook.Workbook)

Write (part of) an ESL specification to a Excel workbook.

component_overview(→ openpyxl.workbook.Workbook)

Create a component overview Excel sheet. Somewhat like a free body diagram for a single

Attributes#

logger

raesl.excel.logger#
raesl.excel.register_locale(locale: str = 'en')#

Register a locale. Existing locales are re-registered.

raesl.excel.get_scoped_nodes(graph: ragraph.graph.Graph, scopes: Dict[str, int | None]) List[ragraph.node.Node]#

Get scoped nodes, being subtrees of the graph of varying depth.

Parameters:
  • graph – Graph data.

  • scopes – Node names mapped to depths of the subtree to include. A depth of None includes the whole subtree starting at that node.

Returns:

List of nodes in all given scopes.

raesl.excel.convert(*paths: str | pathlib.Path, output: str | pathlib.Path | None = defaults.OUTPUT, scopes: Dict[str, int | None] = defaults.SCOPES, language: str = 'en') openpyxl.workbook.Workbook#

Write (part of) an ESL specification to a Excel workbook.

Parameters:
  • paths – ESL specification paths.

  • output – Optional Workbook output path (will be overwritten without warning).

  • scopes – Dictionary of component paths to relative depths of subcomponents to include as scopes for the generated output. Defaults to the complete tree.

Returns:

Excel workbook instance.

raesl.excel.overview(graph: ragraph.graph.Graph, output: str | pathlib.Path | None = defaults.OUTPUT, scopes: Dict[str, int | None] = defaults.SCOPES, language: str = 'en') openpyxl.workbook.Workbook#

Write (part of) an ESL specification to a Excel workbook.

Parameters:
  • graph – Compiled ESL graph.

  • output – Optional Workbook output path (will be overwritten without warning).

  • scopes – Dictionary of component paths to relative depths of subcomponents to include as scopes for the generated output. Defaults to the complete tree.

Returns:

Excel workbook instance.

raesl.excel.component_overview(graph: ragraph.graph.Graph, component_path: str, flow_labels: List[str] | None = None, output: str | pathlib.Path | None = None, language: str = 'en') openpyxl.workbook.Workbook#

Create a component overview Excel sheet. Somewhat like a free body diagram for a single component. Meant to be more discrete but also compact than the complete overview Excel.

Parameters:
  • paths – ESL specification paths.

  • flow_types – Flow types to include in sheets.

  • output – Optional Workbook output path (will be overwritten without warning).

Returns:

Excel workbook instance.