44Autogenerated DPF operator classes.
55"""
66
7+ from __future__ import annotations
8+
79from warnings import warn
810from ansys.dpf.core.dpf_operator import Operator
911from ansys.dpf.core.inputs import Input, _Inputs
@@ -17,36 +19,39 @@ from ansys.dpf.core.outputs import _Outputs
1719from ansys.dpf.core.outputs import _modify_output_spec_with_one_type
1820{ {/multiple_output_types} }
1921from ansys.dpf.core.operators.specification import PinSpecification, Specification
22+ from ansys.dpf.core.config import Config
23+ from ansys.dpf.core.server_types import AnyServerType
24+
2025
2126class { {class_name} }(Operator):
22- """{ {{docstring} }}
27+ r """{ {{docstring} }}
2328
2429 Parameters
2530 ----------
2631 { {#input_pins} }
2732 { {#optional} }
28- { {name} } :{ {#types_for_docstring} } { {types_for_docstring} },{ {/types_for_docstring} } optional
33+ { {name} }:{ {#types_for_docstring} } { {types_for_docstring} },{ {/types_for_docstring} } optional
2934 { {/optional} }
3035 { {^optional} }
31- { {name} } :{ {#types_for_docstring} } { {types_for_docstring} }{ {/types_for_docstring} }
36+ { {name} }:{ {#types_for_docstring} } { {types_for_docstring} }{ {/types_for_docstring} }
3237 { {/optional} }
33- { {#document } }
34- { {{document } }}
35- { {/document } }
38+ { {#document_pin_docstring } }
39+ { {{document_pin_docstring } }}
40+ { {/document_pin_docstring } }
3641 { {/input_pins} }
3742
3843 Returns
3944 -------
4045 { {#output_pins} }
4146 { {#optional} }
42- { {name} } :{ {#types_for_docstring} } { {types_for_docstring} },{ {/types_for_docstring} } optional
47+ { {name} }:{ {#types_for_docstring} } { {types_for_docstring} },{ {/types_for_docstring} } optional
4348 { {/optional} }
4449 { {^optional} }
45- { {name} } :{ {#types_for_docstring} } { {types_for_docstring} }{ {/types_for_docstring} }
50+ { {name} }:{ {#types_for_docstring} } { {types_for_docstring} }{ {/types_for_docstring} }
4651 { {/optional} }
47- { {#document } }
48- { {{document } }}
49- { {/document } }
52+ { {#document_pin_docstring } }
53+ { {{document_pin_docstring } }}
54+ { {/document_pin_docstring } }
5055 { {/output_pins} }
5156
5257 Examples
@@ -87,8 +92,8 @@ class {{class_name}}(Operator):
8792 { {/input_pins} }
8893
8994 @staticmethod
90- def _spec():
91- description = """{ {specification_description} }"""
95+ def _spec() -> Specification :
96+ description = r """{ {{ specification_description} }}"""
9297 spec = Specification(
9398 description=description,
9499 map_input_pin_spec={
@@ -102,7 +107,7 @@ class {{class_name}}(Operator):
102107 type_names=["any"],
103108 { {/has_types} }
104109 optional={ {optional} },
105- document="""{ {{document} }}""",
110+ document=r """{ {{document} }}""",
106111 { {#has_derived_class} }
107112 name_derived_class=["{ {{derived_type_name} }}"],
108113 { {/has_derived_class} }
@@ -117,7 +122,7 @@ class {{class_name}}(Operator):
117122 type_names={ {{types} }},
118123 { {/has_types} }
119124 optional={ {optional} },
120- document="""{ {{document} }}""",
125+ document=r """{ {{document} }}""",
121126 { {#has_derived_class} }
122127 name_derived_class=["{ {{derived_type_name} }}"],
123128 { {/has_derived_class} }
@@ -128,7 +133,7 @@ class {{class_name}}(Operator):
128133 return spec
129134
130135 @staticmethod
131- def default_config(server= None):
136+ def default_config(server: AnyServerType = None) -> Config :
132137 """Returns the default config of the operator.
133138
134139 This config can then be changed to the user needs and be used to
@@ -137,32 +142,40 @@ class {{class_name}}(Operator):
137142
138143 Parameters
139144 ----------
140- server : server.DPFServer, optional
145+ server:
141146 Server with channel connected to the remote or local instance. When
142147 ``None``, attempts to use the global server.
148+
149+ Returns
150+ -------
151+ config:
152+ A new Config instance equivalent to the default config for this operator.
143153 """
144154 return Operator.default_config(name="{ {operator_name} }", server=server)
145155
146156 @property
147- def inputs(self):
157+ def inputs(self) -> Inputs { {capital_class_name } } :
148158 """Enables to connect inputs to the operator
149159
150160 Returns
151161 --------
152- inputs : Inputs{ {capital_class_name} }
162+ inputs:
163+ An instance of Inputs{ {capital_class_name} }.
153164 """
154165 return super().inputs
155166
156167 @property
157- def outputs(self):
168+ def outputs(self) -> Outputs { {capital_class_name } } :
158169 """Enables to get outputs of the operator by evaluating it
159170
160171 Returns
161172 --------
162- outputs : Outputs{ {capital_class_name} }
173+ outputs:
174+ An instance of Outputs{ {capital_class_name} }.
163175 """
164176 return super().outputs
165177
178+
166179class Inputs{ {capital_class_name} }(_Inputs):
167180 """Intermediate class used to connect user inputs to
168181 { {class_name} } operator.
@@ -183,19 +196,20 @@ class Inputs{{capital_class_name}}(_Inputs):
183196 self._{ {name} } = Input({ {class_name} }._spec().input_pin({ {id} }), { {id} }, op, { {ellipsis} })
184197 self._inputs.append(self._{ {name} })
185198 { {/input_pins} }
186-
187199 { {#input_pins} }
200+
188201 @property
189- def { {name} }(self):
190- """Allows to connect { {name} } input to the operator.
191- { {#document } }
202+ def { {name} }(self) -> Input :
203+ r """Allows to connect { {name} } input to the operator.
204+ { {#document_pin_docstring } }
192205
193- { {{document } }}
194- { {/document } }
206+ { {{document_pin_docstring } }}
207+ { {/document_pin_docstring } }
195208
196- Parameters
197- ----------
198- my_{ {name} } :{ {#types_for_docstring} } { {types_for_docstring} }{ {/types_for_docstring} }
209+ Returns
210+ -------
211+ input:
212+ An Input instance for this pin.
199213
200214 Examples
201215 --------
@@ -206,8 +220,9 @@ class Inputs{{capital_class_name}}(_Inputs):
206220 >>> op.inputs.{ {name} }(my_{ {name} })
207221 """
208222 return self._{ {name} }
209-
210223 { {/input_pins} }
224+
225+
211226class Outputs{ {capital_class_name} }(_Outputs):
212227 """Intermediate class used to get outputs from
213228 { {class_name} } operator.
@@ -236,27 +251,29 @@ class Outputs{{capital_class_name}}(_Outputs):
236251 self._outputs.append(self._{ {name} })
237252 { {/multiple_types} }
238253 { {/output_pins} }
239- { {#output_pins} }{ {^multiple_types} }
240254
255+ { {#output_pins} }
256+ { {^multiple_types} }
241257 @property
242- def { {name} }(self):
243- """Allows to get { {name} } output of the operator
258+ def { {name} }(self) -> Output:
259+ r"""Allows to get { {name} } output of the operator
260+ { {#document_pin_docstring} }
261+
262+ { {{document_pin_docstring} }}
263+ { {/document_pin_docstring} }
244264
245265 Returns
246- ----------
247- { {#derived_type_name} }
248- my_{ {name} } : { {derived_type_name} }
249- { {/derived_type_name} }
250- { {^derived_type_name} }
251- my_{ {name} } :{ {#types_for_docstring} } { {types_for_docstring} }{ {/types_for_docstring} }
252- { {/derived_type_name} }
266+ -------
267+ output:
268+ An Output instance for this pin.
253269
254270 Examples
255271 --------
256272 >>> from ansys.dpf import core as dpf
257273 >>> op = dpf.operators.{ {category} }.{ {class_name} }()
258- >>> # Connect inputs : op.inputs . ...
274+ >>> # Get the output from op.outputs . ...
259275 >>> result_{ {name} } = op.outputs.{ {name} }()
260- """ # noqa: E501
276+ """
261277 return self._{ {name} }
262- { {/multiple_types} }{ {/output_pins} }
278+ { {/multiple_types} }
279+ { {/output_pins} }
0 commit comments