Skip to content

Commit

Permalink
Add a deprecation warning when using pin aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Feb 7, 2025
1 parent 5344a94 commit fe19730
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ansys/dpf/core/operators/operator.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,11 @@ class Inputs{{capital_class_name}}(_Inputs):
{{#input_pins}}
{{#has_aliases}}
if name in {{{aliases}}}:
warn(DeprecationWarning(f"Operator {{class_name}}: Input name \"{name}\" is deprecated in favor of \"{{name}}\"."))
return self.{{name}}
{{/has_aliases}}
{{/input_pins}}
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'.")


class Outputs{{capital_class_name}}(_Outputs):
Expand Down Expand Up @@ -278,7 +279,8 @@ class Outputs{{capital_class_name}}(_Outputs):
{{#output_pins}}
{{#has_aliases}}
if name in {{{aliases}}}:
warn(DeprecationWarning(f"Operator {{class_name}}: Output name \"{name}\" is deprecated in favor of \"{{name}}\"."))
return self.{{name}}
{{/has_aliases}}
{{/output_pins}}
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'.")

0 comments on commit fe19730

Please sign in to comment.