Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
aligned_sequence: tolerate index out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Sep 22, 2023
1 parent 3f90930 commit 43efacd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion util/aligned_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ def map_index(self, index):
if not isinstance(index, int):
raise TypeError(f"Expected integer as index", index)

return self.get_coordinates_mapping()[index]
mapping = self.get_coordinates_mapping()
if index < len(mapping):
return mapping[index]
else:
return mapping[-1]


def index(self, index):
Expand Down

0 comments on commit 43efacd

Please sign in to comment.