From 8100fc713ff3caa28c8b60af802519d541e3ba7b Mon Sep 17 00:00:00 2001 From: strawgate Date: Tue, 12 May 2026 23:00:15 -0500 Subject: [PATCH] Fix ruff SIM105: use contextlib.suppress Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- fastmcp_slim/fastmcp/utilities/callable_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fastmcp_slim/fastmcp/utilities/callable_utils.py b/fastmcp_slim/fastmcp/utilities/callable_utils.py index 567434511..6ae5a4a9c 100644 --- a/fastmcp_slim/fastmcp/utilities/callable_utils.py +++ b/fastmcp_slim/fastmcp/utilities/callable_utils.py @@ -7,6 +7,7 @@ extraction logic, and callable unwrapping across the codebase. from __future__ import annotations +import contextlib import functools import inspect from collections.abc import Callable @@ -77,10 +78,8 @@ def prepare_callable(fn: Callable[..., Any]) -> Callable[..., Any]: except AttributeError: pass else: - try: + with contextlib.suppress(AttributeError): setattr(fn, attr, val) - except AttributeError: - pass # Callable classes (not routines, not partials) → unwrap to __call__ if not inspect.isroutine(fn) and not isinstance(fn, functools.partial):