diff --git a/gen/flights/flightplan.py b/gen/flights/flightplan.py index 80a7f6e1..07498342 100644 --- a/gen/flights/flightplan.py +++ b/gen/flights/flightplan.py @@ -219,11 +219,7 @@ class FlightPlan: tot_waypoint = self.tot_waypoint if tot_waypoint is None: return None - - time = self.tot - if time is None: - return None - return time - self._travel_time_to_waypoint(tot_waypoint) + return self.tot - self._travel_time_to_waypoint(tot_waypoint) def startup_time(self) -> Optional[timedelta]: takeoff_time = self.takeoff_time() diff --git a/gen/flights/loadouts.py b/gen/flights/loadouts.py index 5906315e..8b34f9ef 100644 --- a/gen/flights/loadouts.py +++ b/gen/flights/loadouts.py @@ -19,7 +19,11 @@ class Loadout: is_custom: bool = False, ) -> None: self.name = name - self.pylons = {k: v for k, v in pylons.items() if v is not None} + # We clear unused pylon entries on initialization, but UI actions can still + # cause a pylon to be emptied, so make the optional type explicit. + self.pylons: Mapping[int, Optional[Weapon]] = { + k: v for k, v in pylons.items() if v is not None + } self.date = date self.is_custom = is_custom diff --git a/mypy.ini b/mypy.ini index b63df6a9..f4888eca 100644 --- a/mypy.ini +++ b/mypy.ini @@ -13,7 +13,7 @@ namespace_packages = True no_implicit_optional = True warn_redundant_casts = True # warn_return_any = True -# warn_unreachable = True +warn_unreachable = True warn_unused_ignores = True [mypy-dcs.*]