Fix handling of unbounded conditions
For unbounded conditions, the previous code expects "minimum" or "maximum" to be entirely absent, whereas actually they will be consistently present with one having a value of None. This means that math.inf and -math.inf are never substituted in for the absent bound, and a crash occurs when the None value propagates. This commit corrects the behaviour by checking for a value of None, instead of checking for the presence of the keys, bringing the behaviour inline with the rest of the library.
This commit is contained in:
parent
d1ec8e6979
commit
fef9e9a071
@ -352,9 +352,10 @@ def _extractSubSpace(
|
||||
def _conditionSetFrom(conditionSet: List[Dict[str, Any]]) -> ConditionSet:
|
||||
c: Dict[str, Range] = {}
|
||||
for condition in conditionSet:
|
||||
minimum, maximum = condition["minimum"], condition["maximum"]
|
||||
c[condition["name"]] = Range(
|
||||
condition.get("minimum", -math.inf),
|
||||
condition.get("maximum", math.inf),
|
||||
minimum if minimum is not None else -math.inf,
|
||||
maximum if maximum is not None else math.inf,
|
||||
)
|
||||
return c
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user