|
29 | 29 | import os
|
30 | 30 | from pathlib import Path
|
31 | 31 | import traceback
|
32 |
| -from typing import Union |
| 32 | +from typing import TypedDict, Union |
33 | 33 | import warnings
|
34 | 34 |
|
35 | 35 | import numpy
|
|
41 | 41 | server_meet_version_and_raise,
|
42 | 42 | version_requires,
|
43 | 43 | )
|
44 |
| -from ansys.dpf.core.server_types import BaseServer |
| 44 | +from ansys.dpf.core.server_types import AnyServerType |
45 | 45 | from ansys.dpf.gate import (
|
46 | 46 | data_processing_capi,
|
47 | 47 | data_processing_grpcapi,
|
|
57 | 57 | LOG.setLevel("DEBUG")
|
58 | 58 |
|
59 | 59 |
|
| 60 | +class WorkflowInfo(TypedDict): |
| 61 | + operator_names: list[str] |
| 62 | + input_names: list[str] |
| 63 | + output_names: list[str] |
| 64 | + |
| 65 | + |
60 | 66 | class Workflow:
|
61 | 67 | """Represents a workflow.
|
62 | 68 |
|
@@ -625,7 +631,7 @@ def record(self, identifier="", transfer_ownership=True):
|
625 | 631 | return self._api.work_flow_record_instance(self, identifier, transfer_ownership)
|
626 | 632 |
|
627 | 633 | @staticmethod
|
628 |
| - def get_recorded_workflow(id: int, server: BaseServer | None = None) -> Workflow: |
| 634 | + def get_recorded_workflow(id: int, server: AnyServerType | None = None) -> Workflow: |
629 | 635 | """Retrieve a workflow registered (with workflow.record()).
|
630 | 636 |
|
631 | 637 | Parameters
|
@@ -662,19 +668,19 @@ def get_recorded_workflow(id: int, server: BaseServer | None = None) -> Workflow
|
662 | 668 | return wf
|
663 | 669 |
|
664 | 670 | @property
|
665 |
| - def info(self) -> dict[str, list[str]]: |
| 671 | + def info(self) -> WorkflowInfo: |
666 | 672 | """Dictionary with the operator names and the exposed input and output names.
|
667 | 673 |
|
668 | 674 | Returns
|
669 | 675 | -------
|
670 |
| - info : dictionary str->list str |
671 |
| - Dictionary with ``"operator_names"``, ``"input_names"``, and ``"output_names"`` key. |
| 676 | + info : |
| 677 | + Dictionary with ``"operator_names"``, ``"input_names"``, and ``"output_names"`` keys. |
672 | 678 | """
|
673 |
| - return { |
674 |
| - "operator_names": self.operator_names, |
675 |
| - "input_names": self.input_names, |
676 |
| - "output_names": self.output_names, |
677 |
| - } |
| 679 | + return WorkflowInfo( |
| 680 | + operator_names=self.operator_names, |
| 681 | + input_names=self.input_names, |
| 682 | + output_names=self.output_names |
| 683 | + ) |
678 | 684 |
|
679 | 685 | @property
|
680 | 686 | def operator_names(self) -> list[str]:
|
|
0 commit comments