Skip to content

Commit

Permalink
Get optimization result by id (#1116)
Browse files Browse the repository at this point in the history
* add possibility to get an optimization result with specified id
  • Loading branch information
plakrisenko authored Oct 10, 2023
1 parent 2f0f50d commit 9b0d7fd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pypesto/result/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,3 +406,11 @@ def get_for_key(self, key) -> list:
"releases."
)
return [res[key] for res in self.list]

def get_by_id(self, ores_id: str):
"""Get OptimizationResult with the specified id."""
for res in self.list:
if res.id == ores_id:
return res
else:
raise ValueError(f"no optimization result with id={ores_id}")

0 comments on commit 9b0d7fd

Please sign in to comment.