Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/ansys/dpf/core/operators/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import black
import chevron

from ansys.dpf import core as dpf
from ansys.dpf.core import common
from ansys.dpf.core.dpf_operator import available_operator_names
Expand All @@ -15,6 +16,12 @@
from ansys.dpf.core.operators.translator import Markdown2RstTranslator


# Operator internal names to call if first name is not available
# Allows deprecating internal names associated to public Python operator modules
operator_aliases = {
"support_provider_cyclic": "mapdl::rst::support_provider_cyclic"
}

def build_docstring(specification_description):
"""Used to generate class docstrings."""
docstring = ""
Expand Down Expand Up @@ -157,6 +164,8 @@ def build_operator(
"date_and_time": date_and_time,
"has_input_aliases": has_input_aliases,
"has_output_aliases": has_output_aliases,
"has_internal_name_alias": operator_name in operator_aliases.keys(),
"internal_name_alias": operator_aliases.get(operator_name),
}

this_path = os.path.dirname(os.path.abspath(__file__))
Expand Down
15 changes: 14 additions & 1 deletion src/ansys/dpf/core/operators/metadata/cyclic_support_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import annotations

from warnings import warn
from ansys.dpf.core.core import errors
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import Output, _Outputs
Expand Down Expand Up @@ -81,7 +82,19 @@ def __init__(
config=None,
server=None,
):
super().__init__(name="support_provider_cyclic", config=config, server=server)
try:
super().__init__(
name="support_provider_cyclic", config=config, server=server
)
except (KeyError, errors.DPFServerException) as e:
if "doesn't exist in the registry" in str(e):
super().__init__(
name="mapdl::rst::support_provider_cyclic",
config=config,
server=server,
)
else:
raise e
self._inputs = InputsCyclicSupportProvider(self)
self._outputs = OutputsCyclicSupportProvider(self)
if streams_container is not None:
Expand Down
14 changes: 14 additions & 0 deletions src/ansys/dpf/core/operators/operator.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Autogenerated DPF operator classes.
from __future__ import annotations

from warnings import warn
{{#has_internal_name_alias}}
from ansys.dpf.core.core import errors
{{/has_internal_name_alias}}
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
{{#outputs}}
Expand Down Expand Up @@ -83,7 +86,18 @@ class {{class_name}}(Operator):
"""

def __init__(self, {{#input_pins}}{{name}}=None, {{/input_pins}}config=None, server=None{{#has_input_aliases}}, {{#input_pins}}{{#aliases_list}}{{alias}}=None, {{/aliases_list}}{{/input_pins}}{{/has_input_aliases}}):
{{^has_internal_name_alias}}
super().__init__(name="{{operator_name}}", config=config, server=server)
{{/has_internal_name_alias}}
{{#has_internal_name_alias}}
try:
super().__init__(name="{{operator_name}}", config=config, server=server)
except (KeyError, errors.DPFServerException) as e:
if "doesn't exist in the registry" in str(e):
super().__init__(name="{{internal_name_alias}}", config=config, server=server)
else:
raise e
{{/has_internal_name_alias}}
self._inputs = Inputs{{capital_class_name}}(self)
self._outputs = Outputs{{capital_class_name}}(self)
{{#input_pins}}
Expand Down
Loading