Skip to content

Commit

Permalink
fix group function for generators
Browse files Browse the repository at this point in the history
  • Loading branch information
scottstanie committed Oct 6, 2023
1 parent 39d3745 commit 5b4ea85
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/dolphin/opera_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,13 @@ def get_burst_id(filename):

def sort_by_burst_id(file_list):
"""Sort files by burst id."""
burst_ids = [get_burst_id(f) for f in file_list]
file_burst_tups = sorted(
[(Path(f), d) for f, d in zip(file_list, burst_ids)],
file_burst_tuples = sorted(
[(Path(f), get_burst_id(f)) for f in file_list],
# use the date or dates as the key
key=lambda f_d_tuple: f_d_tuple[1], # type: ignore
key=lambda f_b_tuple: f_b_tuple[1], # type: ignore
)
# Unpack the sorted pairs with new sorted values
file_list, burst_ids = zip(*file_burst_tups) # type: ignore
file_list, _ = zip(*file_burst_tuples) # type: ignore
return file_list

if not file_list:
Expand Down

0 comments on commit 5b4ea85

Please sign in to comment.