Apply suggestions from code review 3

Co-authored-by: Simon Alibert <75076266+aliberts@users.noreply.github.com>
This commit is contained in:
Steven Palma
2025-05-20 19:10:06 +02:00
committed by GitHub
parent 33b8559060
commit a36536dc07

View File

@@ -27,14 +27,12 @@ class RobotConfig(draccus.ChoiceRegistry, abc.ABC):
calibration_dir: Path | None = None
def __post_init__(self):
if hasattr(self, "cameras"):
cameras = self.cameras
if cameras:
for cam_name, cam_config in cameras.items():
for attr in ["width", "height", "fps"]:
if getattr(cam_config, attr) is None:
raise ValueError(
f"Camera config for '{cam_name}' has None value for required attribute '{attr}'"
if hasattr(self, "cameras") and self.cameras:
for name, config in self.cameras.items():
for attr in ["width", "height", "fps"]:
if getattr(config, attr) is None:
raise ValueError(
f"Specifying '{attr}' is required for the camera to be used in a robot"
)
@property