Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get optimization result by id #1116

Merged
merged 4 commits into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}")