From c8adbbc6cf39b9a63715e745c769f58ac0c7910f Mon Sep 17 00:00:00 2001 From: giulero Date: Thu, 2 Jan 2025 17:34:31 +0100 Subject: [PATCH] Refactor model to use property for link number instead of post init --- src/adam/model/model.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/adam/model/model.py b/src/adam/model/model.py index 544b7ba..1696edc 100644 --- a/src/adam/model/model.py +++ b/src/adam/model/model.py @@ -17,9 +17,14 @@ class Model: NDoF: int actuated_joints: list[str] - def __post_init__(self): - """set the "length of the model as the number of links""" - self.N = len(self.links) + @property + def N(self) -> int: + """ + + Returns: + int: the number of links in the model + """ + return len(self.links) @staticmethod def build(factory: ModelFactory, joints_name_list: list[str] = None) -> "Model":