in robogym/robot/shadow_hand/hand_interface.py [0:0]
def filter_actuator_groups(actuators: Optional[Iterable[str]]) -> Dict[str, List[str]]:
"""
Return new actuator groups that contains only provided actuators.
Actuator group is filtered out if and only if there is no actuator from the provided
collection of actuators belonging to the actuator group. Actuators of remaining actuator
groups are filtered out as well to include only specified actuators.
:param actuators: actuators to include; each actuator is a string exactly
matching actuator name from shadow_hand.ACTUATORS
:return: list of new filtered recording groups
"""
actuators = set(actuators) if actuators else set()
filtered_actuator_groups = {}
for group_name, group_actuators in ACTUATOR_GROUPS.items():
if not actuators:
filtered_actuator_groups[group_name] = group_actuators.copy()
elif not set(group_actuators).isdisjoint(actuators):
filtered_actuator_groups[group_name] = [
actuator for actuator in group_actuators if actuator in actuators
]
return filtered_actuator_groups