Skip to content

Commit

Permalink
modify convert_coated_side
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmcquillen committed Jul 23, 2021
1 parent baaf232 commit 6f8fdb9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/pywincalc/integrated.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ def convert_subtype(subtype):
return pywincalc_material


def convert_coated_side(coated_side):
mapping = {"front": pywincalc.CoatedSide.FRONT, "back": pywincalc.CoatedSide.BACK,
"both": pywincalc.CoatedSide.BOTH, "neither": pywincalc.CoatedSide.NEITHER}

pywincalc_coated_side = mapping.get(coated_side.lower())
if pywincalc_coated_side is None:
raise RuntimeError("Unsupported coated side: {v}".format(v=coated_side))

return pywincalc_coated_side
def convert_coated_side(coated_side) -> str:
if not coated_side:
return pywincalc.CoatedSide.NEITHER.name
try:
return pywincalc.CoatedSide[coated_side.upper()].name
except KeyError:
raise RuntimeError(f"Unsupported coated side: {coated_side}")


def convert_product(product):
Expand Down

0 comments on commit 6f8fdb9

Please sign in to comment.