From ac9af956910c587b033a4beb756ad2d21697e78c Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 8 May 2024 12:10:23 +0200 Subject: Make CVXOPInfo behave like a dataclass --- sumofsquares/cvxopt.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sumofsquares/cvxopt.py b/sumofsquares/cvxopt.py index ce7b093..12f8e44 100644 --- a/sumofsquares/cvxopt.py +++ b/sumofsquares/cvxopt.py @@ -18,6 +18,13 @@ from .variable import OptVariable class CVXOPTInfo(SolverInfo, UserDict): """ Dictionary returned by CVXOPT. """ + def __getattr__(self, attr): + key = " ".join(attr.split("_")) + if key not in self.keys(): + raise KeyError(f"Key {key} was not found") + return self[key] + + def solve_sos_cone(prob: Problem, verbose: bool = False, *args, **kwargs) -> tuple[dict[OptVariable, float], CVXOPTInfo]: r""" -- cgit v1.2.1