Skip to content

Commit

Permalink
Simplify the _extract_events function by using a list comprehension i…
Browse files Browse the repository at this point in the history
…nstead of map and lambda. This improves code readability and maintainability.
  • Loading branch information
JonasTheinl authored and MP-StefanKraus committed Jan 12, 2025
1 parent e138b57 commit a2317a8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/fretish_robot/generate_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def _extract_scope_modes(fret_req: FRETRequirement) -> list[tuple[str | None, TA
# to also support '&'
def _extract_events(event: str | None) -> list[tuple[str | None, TAG]]:
if event is not None:
all_events = re.findall(r"\w+", event)
return list(map(lambda x: (x, x), all_events))
return [(x, x) for x in re.findall(r"\w+", event)]
else:
return [(None, "always")]

Expand Down

0 comments on commit a2317a8

Please sign in to comment.