From d8b544ab6f4f96edf410479d7321aedbcd6e5909 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 26 Jun 2025 14:15:11 +0800 Subject: [PATCH] Fix linting --- lightrag/kg/mongo_impl.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lightrag/kg/mongo_impl.py b/lightrag/kg/mongo_impl.py index 45f6f4de..ac32268f 100644 --- a/lightrag/kg/mongo_impl.py +++ b/lightrag/kg/mongo_impl.py @@ -527,7 +527,9 @@ class MongoGraphStorage(BaseGraphStorage): {"$group": {"_id": "$source_node_id", "degree": {"$sum": 1}}}, ] - cursor = await self.edge_collection.aggregate(outbound_pipeline, allowDiskUse=True) + cursor = await self.edge_collection.aggregate( + outbound_pipeline, allowDiskUse=True + ) async for doc in cursor: merged_results[doc.get("_id")] = doc.get("degree") @@ -537,7 +539,9 @@ class MongoGraphStorage(BaseGraphStorage): {"$group": {"_id": "$target_node_id", "degree": {"$sum": 1}}}, ] - cursor = await self.edge_collection.aggregate(inbound_pipeline, allowDiskUse=True) + cursor = await self.edge_collection.aggregate( + inbound_pipeline, allowDiskUse=True + ) async for doc in cursor: merged_results[doc.get("_id")] = merged_results.get( doc.get("_id"), 0 @@ -698,10 +702,7 @@ class MongoGraphStorage(BaseGraphStorage): """ # Use aggregation with allowDiskUse for large datasets - pipeline = [ - {"$project": {"_id": 1}}, - {"$sort": {"_id": 1}} - ] + pipeline = [{"$project": {"_id": 1}}, {"$sort": {"_id": 1}}] cursor = await self.collection.aggregate(pipeline, allowDiskUse=True) labels = [] async for doc in cursor: