Skip to content

Commit

Permalink
squash: fix simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
happz committed Jun 3, 2024
1 parent 863f7d1 commit 72b5974
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tmt/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,16 +1401,21 @@ def parse_hw_requirements(spec: Spec) -> BaseConstraint:


def simplify_actual_hardware(hardware: BaseConstraint) -> Spec:
assert isinstance(hardware, And)

as_spec: Spec = {}

for constraint in hardware.constraints:
def _simplify_constraint(constraint: BaseConstraint) -> Spec:
constraint_spec = constraint.to_spec()

assert isinstance(constraint_spec, dict)

as_spec.update(constraint_spec)
return cast(dict[str, str], constraint_spec)

if isinstance(hardware, And):
for constraint in hardware.constraints:
as_spec.update(_simplify_constraint(constraint))

else:
as_spec.update(_simplify_constraint(hardware))

return as_spec

Expand Down

0 comments on commit 72b5974

Please sign in to comment.