[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2025-03-24 13:41:27 +00:00
committed by Michel Aractingi
parent 2abbd60a0d
commit 0ea27704f6
123 changed files with 1161 additions and 3425 deletions

View File

@@ -31,11 +31,7 @@ from lerobot.common.robot_devices.motors.utils import (
)
from lerobot.common.utils.import_utils import is_package_available
DEVICE = (
os.environ.get("LEROBOT_TEST_DEVICE", "cuda")
if torch.cuda.is_available()
else "cpu"
)
DEVICE = os.environ.get("LEROBOT_TEST_DEVICE", "cuda") if torch.cuda.is_available() else "cpu"
TEST_ROBOT_TYPES = []
for robot_type in available_robots:
@@ -51,13 +47,9 @@ for motor_type in available_motors:
# Camera indices used for connecting physical cameras
OPENCV_CAMERA_INDEX = int(os.environ.get("LEROBOT_TEST_OPENCV_CAMERA_INDEX", 0))
INTELREALSENSE_SERIAL_NUMBER = int(
os.environ.get("LEROBOT_TEST_INTELREALSENSE_SERIAL_NUMBER", 128422271614)
)
INTELREALSENSE_SERIAL_NUMBER = int(os.environ.get("LEROBOT_TEST_INTELREALSENSE_SERIAL_NUMBER", 128422271614))
DYNAMIXEL_PORT = os.environ.get(
"LEROBOT_TEST_DYNAMIXEL_PORT", "/dev/tty.usbmodem575E0032081"
)
DYNAMIXEL_PORT = os.environ.get("LEROBOT_TEST_DYNAMIXEL_PORT", "/dev/tty.usbmodem575E0032081")
DYNAMIXEL_MOTORS = {
"shoulder_pan": [1, "xl430-w250"],
"shoulder_lift": [2, "xl430-w250"],
@@ -67,9 +59,7 @@ DYNAMIXEL_MOTORS = {
"gripper": [6, "xl330-m288"],
}
FEETECH_PORT = os.environ.get(
"LEROBOT_TEST_FEETECH_PORT", "/dev/tty.usbmodem585A0080971"
)
FEETECH_PORT = os.environ.get("LEROBOT_TEST_FEETECH_PORT", "/dev/tty.usbmodem585A0080971")
FEETECH_MOTORS = {
"shoulder_pan": [1, "sts3215"],
"shoulder_lift": [2, "sts3215"],
@@ -168,13 +158,9 @@ def require_package_arg(func):
if "required_packages" in arg_names:
# Get the index of 'required_packages' and retrieve the value from args
index = arg_names.index("required_packages")
required_packages = (
args[index] if len(args) > index else kwargs.get("required_packages")
)
required_packages = args[index] if len(args) > index else kwargs.get("required_packages")
else:
raise ValueError(
"Function does not have 'required_packages' as an argument."
)
raise ValueError("Function does not have 'required_packages' as an argument.")
if required_packages is None:
return func(*args, **kwargs)
@@ -231,17 +217,11 @@ def require_robot(func):
mock = kwargs.get("mock")
if robot_type is None:
raise ValueError(
"The 'robot_type' must be an argument of the test function."
)
raise ValueError("The 'robot_type' must be an argument of the test function.")
if request is None:
raise ValueError(
"The 'request' fixture must be an argument of the test function."
)
raise ValueError("The 'request' fixture must be an argument of the test function.")
if mock is None:
raise ValueError(
"The 'mock' variable must be an argument of the test function."
)
raise ValueError("The 'mock' variable must be an argument of the test function.")
# Run test with a real robot. Skip test if robot connection fails.
if not mock and not request.getfixturevalue("is_robot_available"):
@@ -261,17 +241,11 @@ def require_camera(func):
mock = kwargs.get("mock")
if request is None:
raise ValueError(
"The 'request' fixture must be an argument of the test function."
)
raise ValueError("The 'request' fixture must be an argument of the test function.")
if camera_type is None:
raise ValueError(
"The 'camera_type' must be an argument of the test function."
)
raise ValueError("The 'camera_type' must be an argument of the test function.")
if mock is None:
raise ValueError(
"The 'mock' variable must be an argument of the test function."
)
raise ValueError("The 'mock' variable must be an argument of the test function.")
if not mock and not request.getfixturevalue("is_camera_available"):
pytest.skip(f"A {camera_type} camera is not available.")
@@ -290,17 +264,11 @@ def require_motor(func):
mock = kwargs.get("mock")
if request is None:
raise ValueError(
"The 'request' fixture must be an argument of the test function."
)
raise ValueError("The 'request' fixture must be an argument of the test function.")
if motor_type is None:
raise ValueError(
"The 'motor_type' must be an argument of the test function."
)
raise ValueError("The 'motor_type' must be an argument of the test function.")
if mock is None:
raise ValueError(
"The 'mock' variable must be an argument of the test function."
)
raise ValueError("The 'mock' variable must be an argument of the test function.")
if not mock and not request.getfixturevalue("is_motor_available"):
pytest.skip(f"A {motor_type} motor is not available.")