Skip to content

Commit

Permalink
use next() to return the formatted vector in axes map function
Browse files Browse the repository at this point in the history
  • Loading branch information
Frix-x committed Nov 23, 2024
1 parent 5185715 commit a9a0a3e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions shaketune/graph_creators/axes_map_graph_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,8 @@ def _format_direction_vector(self, vectors: List[np.ndarray]) -> str:
axes_count[MACHINE_AXES[i]] += 1
break

# Check if all axes are present in the axes_map and return an error message if not
for _, count in axes_count.items():
if count != 1:
return 'unable to determine it correctly!'

return ', '.join(formatted_vector)
# If all axes are present, return the formatted vector
return next(
('unable to determine it correctly!' for count in axes_count.values() if count != 1),
', '.join(formatted_vector),
)

0 comments on commit a9a0a3e

Please sign in to comment.