Replace deprecated abc.abstractproperty

This commit is contained in:
Simon Alibert
2025-05-20 13:16:34 +02:00
parent 9dab08dfbc
commit 8ab2227148
4 changed files with 24 additions and 12 deletions

View File

@@ -32,7 +32,8 @@ class EnvConfig(draccus.ChoiceRegistry, abc.ABC):
def type(self) -> str:
return self.get_choice_name(self.__class__)
@abc.abstractproperty
@property
@abc.abstractmethod
def gym_kwargs(self) -> dict:
raise NotImplementedError()

View File

@@ -49,15 +49,18 @@ class Robot(abc.ABC):
return f"{self.id} {self.__class__.__name__}"
# TODO(aliberts): create a proper Feature class for this that links with datasets
@abc.abstractproperty
@property
@abc.abstractmethod
def observation_features(self) -> dict:
pass
@abc.abstractproperty
@property
@abc.abstractmethod
def action_features(self) -> dict:
pass
@abc.abstractproperty
@property
@abc.abstractmethod
def is_connected(self) -> bool:
pass
@@ -66,7 +69,8 @@ class Robot(abc.ABC):
"""Connects to the robot."""
pass
@abc.abstractproperty
@property
@abc.abstractmethod
def is_calibrated(self) -> bool:
pass

View File

@@ -47,15 +47,18 @@ class Teleoperator(abc.ABC):
def __str__(self) -> str:
return f"{self.id} {self.__class__.__name__}"
@abc.abstractproperty
@property
@abc.abstractmethod
def action_features(self) -> dict:
pass
@abc.abstractproperty
@property
@abc.abstractmethod
def feedback_features(self) -> dict:
pass
@abc.abstractproperty
@property
@abc.abstractmethod
def is_connected(self) -> bool:
pass
@@ -64,7 +67,8 @@ class Teleoperator(abc.ABC):
"""Connects to the teleoperator."""
pass
@abc.abstractproperty
@property
@abc.abstractmethod
def is_calibrated(self) -> bool:
pass

View File

@@ -78,15 +78,18 @@ class PreTrainedConfig(draccus.ChoiceRegistry, HubMixin, abc.ABC):
def type(self) -> str:
return self.get_choice_name(self.__class__)
@abc.abstractproperty
@property
@abc.abstractmethod
def observation_delta_indices(self) -> list | None:
raise NotImplementedError
@abc.abstractproperty
@property
@abc.abstractmethod
def action_delta_indices(self) -> list | None:
raise NotImplementedError
@abc.abstractproperty
@property
@abc.abstractmethod
def reward_delta_indices(self) -> list | None:
raise NotImplementedError