@@ -9,7 +9,7 @@ class OPLType(Enum):
99 problem = "problem"
1010 suite = "suite"
1111 generator = "generator"
12- implementation = ' implementation'
12+ implementation = " implementation"
1313
1414
1515class YesNoSome (Enum ):
@@ -26,7 +26,7 @@ class Link(BaseModel):
2626
2727class Thing (BaseModel ):
2828 type : OPLType
29- model_config = ConfigDict (extra = ' allow' )
29+ model_config = ConfigDict (extra = " allow" )
3030
3131
3232class Objectives (RootModel ):
@@ -75,7 +75,7 @@ class Usage(BaseModel):
7575
7676
7777class Implementation (Thing ):
78- type : OPLType = OPLType .implementation
78+ type : OPLType = OPLType .implementation
7979 name : str
8080 description : str
8181 links : list [Link ] | None = None
@@ -89,7 +89,7 @@ class ProblemLike(Thing):
8989 long_name : str | None = None
9090 description : str | None = None
9191 tags : set [str ] | None = None
92- references : set [Reference ] | None = None
92+ references : list [Reference ] | None = None
9393 implementations : set [str ] | None = None
9494 objectives : set [int ] | None = None
9595 variables : Variables | None = None
@@ -106,29 +106,31 @@ class ProblemLike(Thing):
106106
107107
108108class Problem (ProblemLike ):
109- type :OPLType = OPLType .problem
109+ type : OPLType = OPLType .problem
110110 instances : ValueRange | list [str ] | None = None
111111
112112
113113class Suite (ProblemLike ):
114- type :OPLType = OPLType .suite
114+ type : OPLType = OPLType .suite
115115 problems : set [str ] | None = None
116116
117117
118118class Generator (ProblemLike ):
119- type :OPLType = OPLType .generator
119+ type : OPLType = OPLType .generator
120120
121121
122122class Library (RootModel ):
123123 root : dict [str , Problem | Generator | Suite | Implementation ] | None
124124
125- def _check_id_references (self , ids , type :OPLType ) -> None :
125+ def _check_id_references (self , ids , type : OPLType ) -> None :
126126 if not self .root :
127127 return
128128 for id in ids :
129129 if id in self .root :
130130 if self .root [id ].type != type :
131- raise ValueError (f"ID { id } is a { self .root [id ].name } , expected a { type .name } " )
131+ raise ValueError (
132+ f"ID { id } is a { self .root [id ].name } , expected a { type .name } "
133+ )
132134 else :
133135 raise ValueError (f"Missing { type .name } with id '{ id } '" )
134136
@@ -145,11 +147,16 @@ def validate(self) -> Self:
145147 if isinstance (thing , Suite ) and thing .problems :
146148 for problem_id in thing .problems :
147149 if problem_id not in self .root :
148- raise ValueError (f"Suite { id } references problem with undefined id '{ problem_id } '." )
150+ raise ValueError (
151+ f"Suite { id } references problem with undefined id '{ problem_id } '."
152+ )
149153 if self .root [problem_id ].type != OPLType .problem :
150- raise ValueError (f"Suite { id } references problem with id '{ problem_id } ' but id is a { self .root [problem_id ].type .name } ." )
154+ raise ValueError (
155+ f"Suite { id } references problem with id '{ problem_id } ' but id is a { self .root [problem_id ].type .name } ."
156+ )
151157 return self
152158
159+
153160__all__ = [
154161 "Problem" ,
155162 "Suite" ,
@@ -158,5 +165,5 @@ def validate(self) -> Self:
158165 "Library" ,
159166 "YesNoSome" ,
160167 "Link" ,
161- "Reference"
168+ "Reference" ,
162169]
0 commit comments