Skip to content

Commit ba6d090

Browse files
committed
mypy
1 parent f103b8b commit ba6d090

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/axiomatic/pic_helpers.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def print_statements(
452452
print("\n-----------------------------------\n")
453453

454454

455-
def _str_units_to_float(str_units: str) -> float:
455+
def _str_units_to_float(str_units: str) -> Optional[float]:
456456
unit_conversions = {
457457
"nm": 1e-3,
458458
"um": 1,
@@ -492,8 +492,11 @@ def update_wavelengths(mapping: Dict[str, Optional[Computation]], min_wl: float,
492492
and len(comp.arguments["wavelength_range"]) == 2
493493
and all(isinstance(wl, str) for wl in comp.arguments["wavelength_range"])
494494
):
495-
min_wl = min(min_wl, _str_units_to_float(comp.arguments["wavelength_range"][0])) if _str_units_to_float(comp.arguments["wavelength_range"][0]) is not None else min_wl
496-
max_wl = max(max_wl, _str_units_to_float(comp.arguments["wavelength_range"][1])) if _str_units_to_float(comp.arguments["wavelength_range"][1]) is not None else max_wl
495+
mi = _str_units_to_float(comp.arguments["wavelength_range"][0])
496+
ma = _str_units_to_float(comp.arguments["wavelength_range"][1])
497+
if mi is not None and ma is not None:
498+
min_wl = min(min_wl, mi)
499+
max_wl = max(max_wl, ma)
497500
return min_wl, max_wl, vlines
498501

499502
for cost_stmt in statements.cost_functions or []:

0 commit comments

Comments
 (0)