mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-06 07:15:09 +00:00
fix(vegas): type the static pause fallback on its own (mypy ratchet)
_static_pause_duration assigned the fallback to `seconds`, which the except branch typed as float before finite_seconds() reassigned it as float | None. A separate `fallback` keeps both types exact; behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1076,23 +1076,23 @@ class VegasModeCoordinator:
|
|||||||
value = plugin.get_display_duration()
|
value = plugin.get_display_duration()
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err: # pylint: disable=broad-except
|
||||||
problem = f"get_display_duration() raised {type(err).__name__}: {err}"
|
problem = f"get_display_duration() raised {type(err).__name__}: {err}"
|
||||||
seconds = _UNREADABLE_DURATION
|
fallback = _UNREADABLE_DURATION
|
||||||
else:
|
else:
|
||||||
seconds = finite_seconds(value)
|
seconds = finite_seconds(value)
|
||||||
if seconds is not None and seconds > 0:
|
if seconds is not None and seconds > 0:
|
||||||
return seconds
|
return seconds
|
||||||
if seconds is None:
|
if seconds is None:
|
||||||
problem = f"display duration {value!r} is not a number"
|
problem = f"display duration {value!r} is not a number"
|
||||||
seconds = _UNREADABLE_DURATION
|
fallback = _UNREADABLE_DURATION
|
||||||
else:
|
else:
|
||||||
problem = f"display duration {value!r} is not above zero"
|
problem = f"display duration {value!r} is not above zero"
|
||||||
seconds = _NOT_POSITIVE_DURATION
|
fallback = _NOT_POSITIVE_DURATION
|
||||||
plugin_id = plugin.plugin_id
|
plugin_id = plugin.plugin_id
|
||||||
if plugin_id not in self._duration_warned:
|
if plugin_id not in self._duration_warned:
|
||||||
self._duration_warned = self._duration_warned | {plugin_id}
|
self._duration_warned = self._duration_warned | {plugin_id}
|
||||||
logger.warning("[%s] %s; its static pause lasts %.0fs (logged once)",
|
logger.warning("[%s] %s; its static pause lasts %.0fs (logged once)",
|
||||||
plugin_id, problem, seconds)
|
plugin_id, problem, fallback)
|
||||||
return seconds
|
return fallback
|
||||||
|
|
||||||
def _end_static_pause(self) -> None:
|
def _end_static_pause(self) -> None:
|
||||||
"""End static pause and restore scroll state."""
|
"""End static pause and restore scroll state."""
|
||||||
|
|||||||
Reference in New Issue
Block a user