lint: justify 4 best-effort try/except/pass (S110) so CI ruff passes

the CI ruff gate flagged 4 S110s in code added this cycle: the /api/debug/memory/objects
endpoint (len() on an exotic object; optional psutil rss) and the GC sweeper (malloc_trim
resolution + the trim call — absent on musl/non-Linux). all are genuinely best-effort, so add
'# noqa: S110' with a one-line reason on each. ruff check . is clean.
This commit is contained in:
BoulderBadgeDad 2026-06-28 00:03:19 -07:00
parent 2b8f6f8611
commit d72f6396f0

View file

@ -3011,14 +3011,14 @@ def debug_memory_objects():
if sz > 1_000_000 and isinstance(o, (dict, list, set, frozenset, bytes, bytearray, str, tuple)):
try:
biggest.append((sz, tn, len(o)))
except Exception:
except Exception: # noqa: S110 — debug stat, len() on an exotic obj is non-fatal
pass
biggest.sort(reverse=True)
rss = None
try:
import psutil
rss = round(psutil.Process(os.getpid()).memory_info().rss / (1024 * 1024), 1)
except Exception:
except Exception: # noqa: S110 — psutil optional; rss stays None in the debug payload
pass
return jsonify({
'rss_mb': rss,
@ -38649,7 +38649,7 @@ def start_runtime_services():
_libc = ctypes.CDLL(ctypes.util.find_library('c') or 'libc.so.6')
if hasattr(_libc, 'malloc_trim'):
_trim = _libc.malloc_trim
except Exception:
except Exception: # noqa: S110 — malloc_trim absent on musl/non-Linux; just skip it
pass
floor = rss_mb()
last = time.time()
@ -38661,7 +38661,7 @@ def start_runtime_services():
if _trim is not None:
try:
_trim(0)
except Exception:
except Exception: # noqa: S110 — best-effort OS reclaim, never fatal
pass
floor = rss_mb()
last = time.time()