Skip to content

Commit

Permalink
refactor: Add handling for outputs in __getattr__ method.
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Aug 14, 2024
1 parent d5da887 commit 662202e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ def __getattr__(self, name: str) -> Any:
return self.__dict__["_attributes"][name]
if "_inputs" in self.__dict__ and name in self.__dict__["_inputs"]:
return self.__dict__["_inputs"][name].value
if "_outputs" in self.__dict__ and name in self.__dict__["_outputs"]:
return self.__dict__["_outputs"][name]
if name in BACKWARDS_COMPATIBLE_ATTRIBUTES:
return self.__dict__[f"_{name}"]
if name.startswith("_") and name[1:] in BACKWARDS_COMPATIBLE_ATTRIBUTES:
Expand Down Expand Up @@ -500,6 +502,7 @@ def _set_outputs(self, outputs: List[dict]):
self.outputs = [Output(**output) for output in outputs]
for output in self.outputs:
setattr(self, output.name, output)
self._outputs[output.name] = output

def get_trace_as_inputs(self):
predefined_inputs = {
Expand Down

0 comments on commit 662202e

Please sign in to comment.