Skip to content

Commit

Permalink
add check for user-provided unique_id in TimeMappingDict already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
muelleram committed Sep 18, 2024
1 parent 7d11563 commit 47e8da3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bw_timex/helper_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ def add(self, process_time_tuple, unique_id=None):
return self[process_time_tuple]

if unique_id is not None:
if unique_id in self.values():
raise ValueError(
f"Unique ID {unique_id} is already assigned to another process_time_tuple."
)
self[process_time_tuple] = unique_id
return unique_id

Expand Down

0 comments on commit 47e8da3

Please sign in to comment.