raesl.excel
¶
Module to export as an Excel workbook.
component_overview
¶
component_overview(
graph: Graph,
component_path: str,
flow_labels: Optional[List[str]] = None,
output: Optional[Union[str, Path]] = None,
language: str = "en",
) -> 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:
Name | Type | Description | Default |
---|---|---|---|
graph
|
Graph
|
Compiled ESL graph. |
required |
component_path
|
str
|
ESL specification paths. |
required |
flow_labels
|
Optional[List[str]]
|
Flow types to include in sheets. |
None
|
output
|
Optional[Union[str, Path]]
|
Optional Workbook output path (will be overwritten without warning). |
None
|
language
|
str
|
Output language. |
'en'
|
Returns:
Type | Description |
---|---|
Workbook
|
Excel workbook instance. |
Source code in src/raesl/excel/__init__.py
convert
¶
convert(
*paths: Union[str, Path],
output: Optional[Union[str, Path]] = OUTPUT,
scopes: Dict[str, Optional[int]] = SCOPES,
language: str = "en"
) -> Workbook
Write (part of) an ESL specification to a Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paths
|
Union[str, Path]
|
ESL specification paths. |
()
|
output
|
Optional[Union[str, Path]]
|
Optional Workbook output path (will be overwritten without warning). |
OUTPUT
|
scopes
|
Dict[str, Optional[int]]
|
Dictionary of component paths to relative depths of subcomponents to include as scopes for the generated output. Defaults to the complete tree. |
SCOPES
|
language
|
str
|
Output language. |
'en'
|
Returns:
Type | Description |
---|---|
Workbook
|
Excel workbook instance. |
Source code in src/raesl/excel/__init__.py
overview
¶
overview(
graph: Graph,
output: Optional[Union[str, Path]] = OUTPUT,
scopes: Dict[str, Optional[int]] = SCOPES,
language: str = "en",
) -> Workbook
Write (part of) an ESL specification to a Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph
|
Graph
|
Compiled ESL graph. |
required |
output
|
Optional[Union[str, Path]]
|
Optional Workbook output path (will be overwritten without warning). |
OUTPUT
|
scopes
|
Dict[str, Optional[int]]
|
Dictionary of component paths to relative depths of subcomponents to include as scopes for the generated output. Defaults to the complete tree. |
SCOPES
|
language
|
str
|
Output language. |
'en'
|
Returns:
Type | Description |
---|---|
Workbook
|
Excel workbook instance. |
Source code in src/raesl/excel/__init__.py
cli
¶
ESL to Excel Command Line Interface.
component_excel
¶
Convert ESL files and/or directories to an Excel workbook.
Source code in src/raesl/excel/cli.py
excel
¶
Convert ESL files and/or directories to an Excel workbook.
Source code in src/raesl/excel/cli.py
defaults
¶
Default options for ESL to Excel workbook conversion.
sheets
¶
Excel sheet generation.
add_behaviors_sheet
¶
add_behaviors_sheet(
wb: Workbook, graph: Graph, components: List[Node]
) -> Tuple[Worksheet, List[Node]]
Add a behavior requirements sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the behavior requirements sheet to. |
required |
graph
|
Graph
|
Graph to fetch behavior nodes from. |
required |
components
|
List[Node]
|
Component nodes to fetch behavior requirements for. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Behavior requirements worksheet instance. |
Source code in src/raesl/excel/sheets.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
add_components_sheet
¶
Add a components overview sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the components sheet to. |
required |
components
|
List[Node]
|
List of component nodes. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Components worksheet instance. |
Source code in src/raesl/excel/sheets.py
add_designs_sheet
¶
add_designs_sheet(
wb: Workbook, graph: Graph, components: List[Node]
) -> Tuple[Worksheet, List[Node]]
Add a design requirements sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the design requirements sheet to. |
required |
graph
|
Graph
|
Graph to fetch designrule nodes from. |
required |
components
|
List[Node]
|
Component nodes to fetch design requirements for. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Design requirements worksheet instance. |
Source code in src/raesl/excel/sheets.py
add_goals_sheet
¶
add_goals_sheet(
wb: Workbook, graph: Graph, components: List[Node]
) -> Tuple[Worksheet, List[Node]]
Add a goal requirements sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the goals sheet to. |
required |
graph
|
Graph
|
Graph to fetch goals from. |
required |
components
|
List[Node]
|
Component nodes to fetch goals for. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Goal requirements worksheet instance. |
Source code in src/raesl/excel/sheets.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
add_needs_sheet
¶
add_needs_sheet(
wb: Workbook, graph: Graph, components: List[Node]
) -> Tuple[Worksheet, List[Node]]
Add a needs sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the needs sheet to. |
required |
graph
|
Graph
|
Graph to fetch need nodes from. |
required |
components
|
List[Node]
|
Component nodes to fetch needs for. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Needs worksheet instance. |
Source code in src/raesl/excel/sheets.py
add_overview_sheet
¶
add_overview_sheet(
wb: Workbook,
graph: Graph,
components: List[Node],
goals: List[Node],
transformations: List[Node],
designs: List[Node],
behaviors: List[Node],
needs: List[Node],
) -> Worksheet
Add an overview sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the needs sheet to. |
required |
components
|
List[Node]
|
Component nodes. |
required |
goals
|
List[Node]
|
Goal requirement nodes. |
required |
transformations
|
List[Node]
|
Transformation requirement nodes. |
required |
designs
|
List[Node]
|
Design requirement nodes. |
required |
behaviors
|
List[Node]
|
Behavior requirement nodes. |
required |
needs
|
List[Node]
|
Need nodes. |
required |
Returns:
Type | Description |
---|---|
Worksheet
|
Overview worksheet instance. |
Source code in src/raesl/excel/sheets.py
add_transformations_sheet
¶
add_transformations_sheet(
wb: Workbook, graph: Graph, components: List[Node]
) -> Tuple[Worksheet, List[Node]]
Add a transformation requirements sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the transformations sheet to. |
required |
graph
|
Graph
|
Graph to fetch transformation nodes from. |
required |
components
|
List[Node]
|
Component nodes to fetch transformations for. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Transformation requirements worksheet instance. |
Source code in src/raesl/excel/sheets.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
add_variable_sheet
¶
add_variable_sheet(
wb: Workbook, graph: Graph, components: List[Node]
) -> Tuple[Worksheet, List[Node]]
Add a variable sheet to an Excel workbook.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wb
|
Workbook
|
Excel workbook to add the needs sheet to. |
required |
graph
|
Graph
|
Graph to fetch need nodes from. |
required |
components
|
List[Node]
|
Component nodes to fetch needs for. |
required |
Returns:
Type | Description |
---|---|
Tuple[Worksheet, List[Node]]
|
Needs worksheet instance. |
Source code in src/raesl/excel/sheets.py
text
¶
Raw text export of ESL requirement nodes.
abbreviate_comparison
¶
Use symbols instead of full text for comparison text.
Source code in src/raesl/excel/text.py
behavior_text
¶
Re-format behavior requirement as text.
Source code in src/raesl/excel/text.py
case_text
¶
case_text(
case: Dict[str, Any], graph: Graph, skip: str = "world"
) -> str
Re-format behavior requirement case as text.
Source code in src/raesl/excel/text.py
design_text
¶
Re-format design requirement as text.
designclause_text
¶
designclause_text(
bodies: List[Dict[str, Any]],
graph: Graph,
label: Optional[str] = None,
skip: Optional[str] = "world",
) -> str
Re-format design clause as text.
Source code in src/raesl/excel/text.py
designrule_text
¶
designrule_text(
body: Dict[str, Any],
graph: Graph,
skip: Optional[str] = "world",
) -> str
Re-format design rule as text.
Source code in src/raesl/excel/text.py
get_common_parts
¶
Find out the largest shared substrings separated on dots '.'.
Source code in src/raesl/excel/text.py
goal_text
¶
Re-format goal requirement as text.
Source code in src/raesl/excel/text.py
need_text
¶
Re-format need as text.
Source code in src/raesl/excel/text.py
requirement_text
¶
Re-format the requirement as text.
Source code in src/raesl/excel/text.py
strip_prefix
¶
subclauses_text
¶
subclauses_text(
requirement: Node,
graph: Graph,
skip: Optional[str] = "world",
spaces: int = 2,
) -> str
Re-format subclauses as text.
Source code in src/raesl/excel/text.py
transformation_text
¶
Re-format transformation requirement as text.
Source code in src/raesl/excel/text.py
utils
¶
Excel export utility methods.
apply_styling
¶
apply_styling(
ws: Worksheet,
headers: List[str],
defaults: Dict[str, Any] = dict(),
start_row: int = 0,
end_row: Optional[int] = None,
)
Apply styling to columns given some default option dictionary.
Source code in src/raesl/excel/utils.py
build_active_goal_data
¶
build_active_goal_data(
graph: Graph,
edge: Edge,
goal: Node,
function_specifications: Set[Node] = set(),
) -> Generator[Dict[str, Any], None, None]
Create data dictionaries for the outgoing goals in the component overview.
Keys
Source code in src/raesl/excel/utils.py
build_passive_goal_data
¶
build_passive_goal_data(
graph: Graph,
edge: Edge,
goal: Node,
function_specifications: Set[Node],
) -> Generator[Dict[str, Any], None, None]
Create data dictionaries for the incoming goals in the component overview.
Keys
Source code in src/raesl/excel/utils.py
build_subclause_body_data
¶
Create a subclause's body data dict for use in the component overview.
Keys
Source code in src/raesl/excel/utils.py
build_subclause_data
¶
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
Source code in src/raesl/excel/utils.py
dedupe
¶
Deduplicate any iterable into a list where the first occurrence is preserved.
Source code in src/raesl/excel/utils.py
format_multiline
¶
get_all_tags
¶
get_all_tags(nodes: List[Node]) -> List[str]
Get all tagged comment keys from a list of nodes.
Source code in src/raesl/excel/utils.py
get_function_flow_variables
¶
get_function_flow_variables(
function_specification: Node,
edge: Edge,
function_specifications: Set[Node] = set(),
) -> Set[str]
Get the variables involved with a functional dependency.
Source code in src/raesl/excel/utils.py
get_function_specification_names
¶
get_function_specification_names(
functional_dependency: Edge,
) -> List[str]
Get the function specification node names corresponding to a functional dependency edge.
Source code in src/raesl/excel/utils.py
get_function_subclauses
¶
get_function_subclauses(
function_specification: Node,
) -> List[str]
Get the subclauses belonging to a function specification.
Source code in src/raesl/excel/utils.py
get_goal_active
¶
get_goal_active(
function_specification: Node,
) -> Optional[str]
Get the active component in a function specification.
Source code in src/raesl/excel/utils.py
get_goal_passive
¶
get_goal_passive(
function_specification: Node,
) -> Optional[str]
Get the receiving component of a goal function.
Source code in src/raesl/excel/utils.py
make_table
¶
make_table(
ws: Worksheet,
name: str = "Table",
min_row: int = 1,
max_row: int = 1,
min_col: int = 1,
max_col: int = 1,
style: TableStyleInfo = TableStyleInfo(
name="TableStyleMedium9", showRowStripes=True
),
) -> Table
Make a table of a cell range in a worksheet.
Source code in src/raesl/excel/utils.py
parent_component
¶
parent_component(
requirement: Node, skip: Optional[str] = "world"
) -> str
Get parent component name of a requirement.
Source code in src/raesl/excel/utils.py
parent_def
¶
Get the parent (component) definition of a requirement.
Source code in src/raesl/excel/utils.py
requirement_kind
¶
requirement_kind(requirement: Node) -> str
Get requirement kind.
Source code in src/raesl/excel/utils.py
yield_active_functions
¶
yield_active_functions(
function_specifications: Iterable[Node],
active_path: str,
) -> Generator[Node, None, None]
Yield all edge function combinations for which the active component matches the given path.
Source code in src/raesl/excel/utils.py
yield_all_function_specifications
¶
yield_all_function_specifications(
g: Graph, functional_dependencies: Iterable[Edge]
) -> Generator[Tuple[Node, Node], None, None]
Yield all function specification nodes and edge combinations for a given iterable of dependency edges.
Source code in src/raesl/excel/utils.py
yield_function_specifications
¶
yield_function_specifications(
g: Graph, functional_dependency: Edge
) -> Generator[Tuple[Node, Node], None, None]
Get all function specification nodes corresponding to a functional dependency edge.
Source code in src/raesl/excel/utils.py
yield_functional_dependencies
¶
yield_functional_dependencies(
g: Graph, component: Node, flows: Optional[Set[str]]
) -> Generator[Edge, None, None]
Yield all functional dependencies with which a component is involved.
Source code in src/raesl/excel/utils.py
yield_passive_functions
¶
yield_passive_functions(
function_specifications: Iterable[Node],
passive_path: str,
) -> Generator[Tuple[Node, Node], None, None]
Yield all edge function combinations for which the passive component matches the given path.