fix(ci): Avoid pylint pointless-statement in signal validation

The bare signal.Signals[...] lookup used only for its side effect
tripped pylint W0104. Replace the try/except with an explicit
membership test against signal.Signals, which validates both signal
names and numbers without a pointless expression.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tanmoy Sarkar 2026-06-13 00:00:07 +05:30
parent db212bdc12
commit 10a41a1cc5

View File

@ -101,12 +101,11 @@ def _validate_stop_signal(stop_signal, name):
config is loaded or rereaded, rather than crashing the manager later when config is loaded or rereaded, rather than crashing the manager later when
it tries to send the signal. it tries to send the signal.
""" """
try: if isinstance(stop_signal, str):
if isinstance(stop_signal, str): valid = stop_signal in signal.Signals.__members__
signal.Signals[stop_signal] else:
else: valid = stop_signal in set(signal.Signals)
signal.Signals(stop_signal) if not valid:
except (KeyError, ValueError):
raise ValueError( raise ValueError(
"companion %s has unknown stop_signal %r" % (name, stop_signal)) "companion %s has unknown stop_signal %r" % (name, stop_signal))