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 e0dcf0d commit 7bcc152
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,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 @@ -493,6 +495,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 7bcc152

Please sign in to comment.