mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 10:11:30 +08:00
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:
parent
db212bdc12
commit
10a41a1cc5
@ -101,12 +101,11 @@ def _validate_stop_signal(stop_signal, name):
|
||||
config is loaded or rereaded, rather than crashing the manager later when
|
||||
it tries to send the signal.
|
||||
"""
|
||||
try:
|
||||
if isinstance(stop_signal, str):
|
||||
signal.Signals[stop_signal]
|
||||
else:
|
||||
signal.Signals(stop_signal)
|
||||
except (KeyError, ValueError):
|
||||
if isinstance(stop_signal, str):
|
||||
valid = stop_signal in signal.Signals.__members__
|
||||
else:
|
||||
valid = stop_signal in set(signal.Signals)
|
||||
if not valid:
|
||||
raise ValueError(
|
||||
"companion %s has unknown stop_signal %r" % (name, stop_signal))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user