Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Ehwald <[email protected]>
  • Loading branch information
Aonokishi and DoctorJohn authored Aug 12, 2024
1 parent fb982a5 commit d93a24e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cfmtoolbox/plugins/featureide_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,17 @@ def traverse_xml(element: Element | None, cfm: CFM) -> list[Feature]:


def parse_formula_value_and_feature(formula: Element, cfm: CFM) -> tuple[bool, Feature]:
if len(formula) == 0 and formula.tag == FormulaTypes.VAR.value:
if formula.tag == FormulaTypes.VAR.value and len(formula) == 0:
if formula.text is None:
raise TypeError("No valid feature name found in formula")

return (True, cfm.find_feature(formula.text))

if len(formula) != 1:
raise TooComplexConstraintError()

if formula.tag == FormulaTypes.NOT.value:
if formula.tag == FormulaTypes.NOT.value and len(formula) == 1:
value, feature = parse_formula_value_and_feature(formula[0], cfm)
return (not value, feature)

else:
raise TooComplexConstraintError()
raise TooComplexConstraintError()


def parse_constraints(
Expand Down

0 comments on commit d93a24e

Please sign in to comment.