From 5e2b3c2e59858bf79d42475d514982645a5f3f1f Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Fri, 31 Oct 2025 16:57:55 +0000 Subject: [PATCH] address pyright syntax errors --- cognee-mcp/src/tools/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cognee-mcp/src/tools/utils.py b/cognee-mcp/src/tools/utils.py index b36c05318..f89be5f0b 100644 --- a/cognee-mcp/src/tools/utils.py +++ b/cognee-mcp/src/tools/utils.py @@ -29,6 +29,10 @@ def load_class(model_file, model_name): """Dynamically load a class from a file.""" model_file = os.path.abspath(model_file) spec = importlib.util.spec_from_file_location("graph_model", model_file) + if spec is None: + raise ValueError(f"Could not load specification for module from file: {model_file}") + if spec.loader is None: + raise ImportError(f"Spec loader is None for module file: {model_file}") module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) model_class = getattr(module, model_name)