[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
8924ccbbab
commit
782dff1163
|
@ -353,7 +353,7 @@ class MotorsBus(abc.ABC):
|
|||
|
||||
def _get_ids_values_dict(self, values: Value | dict[str, Value] | None) -> list[str]:
|
||||
if isinstance(values, (int, float)):
|
||||
return {id_: values for id_ in self.ids}
|
||||
return dict.fromkeys(self.ids, values)
|
||||
elif isinstance(values, dict):
|
||||
return {self.motors[motor].id: val for motor, val in values.items()}
|
||||
else:
|
||||
|
@ -499,7 +499,7 @@ class MotorsBus(abc.ABC):
|
|||
try:
|
||||
drive_modes = self.sync_read("Drive_Mode", normalize=False)
|
||||
except KeyError:
|
||||
drive_modes = {name: 0 for name in self.names}
|
||||
drive_modes = dict.fromkeys(self.names, 0)
|
||||
|
||||
calibration = {}
|
||||
for name, motor in self.motors.items():
|
||||
|
|
|
@ -85,7 +85,7 @@ def ensure_safe_goal_position(
|
|||
"""Caps relative action target magnitude for safety."""
|
||||
|
||||
if isinstance(max_relative_target, float):
|
||||
diff_cap = {key: max_relative_target for key in goal_present_pos}
|
||||
diff_cap = dict.fromkeys(goal_present_pos, max_relative_target)
|
||||
elif isinstance(max_relative_target, dict):
|
||||
if not set(goal_present_pos) == set(max_relative_target):
|
||||
raise ValueError("max_relative_target keys must match those of goal_present_pos.")
|
||||
|
|
Loading…
Reference in New Issue