mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-19 03:54:18 +02:00
fix: use contextlib.suppress for SIM105 linting
🤖 Generated with Claude Code
This commit is contained in:
parent
5c094a270e
commit
da9b26329a
1 changed files with 3 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ This module provides functions to:
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import hashlib
|
||||
import importlib.util
|
||||
import sys
|
||||
|
|
@ -164,10 +165,8 @@ def import_module_from_file(
|
|||
) from e
|
||||
finally:
|
||||
if path_added:
|
||||
try:
|
||||
with contextlib.suppress(ValueError):
|
||||
sys.path.remove(package_parent)
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
# Import directly using spec_from_file_location
|
||||
stem = file_path.stem
|
||||
|
|
@ -227,10 +226,8 @@ def import_module_from_file(
|
|||
return module
|
||||
finally:
|
||||
if path_added:
|
||||
try:
|
||||
with contextlib.suppress(ValueError):
|
||||
sys.path.remove(parent_dir)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
def extract_components(module: ModuleType) -> list[FastMCPComponent]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue