Skip to content

Commit

Permalink
Handle default __getattr__
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Feb 7, 2025
1 parent 8018230 commit 5344a94
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ansys/dpf/core/operators/operator.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class Inputs{{capital_class_name}}(_Inputs):
return self.{{name}}
{{/has_aliases}}
{{/input_pins}}
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")


class Outputs{{capital_class_name}}(_Outputs):
Expand Down Expand Up @@ -272,3 +273,12 @@ class Outputs{{capital_class_name}}(_Outputs):
""" # noqa: E501
return self._{{name}}
{{/multiple_types}}{{/output_pins}}

def __getattr__(self, name):
{{#output_pins}}
{{#has_aliases}}
if name in {{{aliases}}}:
return self.{{name}}
{{/has_aliases}}
{{/output_pins}}
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")

0 comments on commit 5344a94

Please sign in to comment.