mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-21 21:14:17 +02:00
Fix ruff SIM105: use contextlib.suppress
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9fd60025f8
commit
8100fc713f
1 changed files with 2 additions and 3 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue