Fix linting

This commit is contained in:
yangdx 2025-06-26 14:15:11 +08:00
parent c51079335e
commit d8b544ab6f

View File

@ -527,7 +527,9 @@ class MongoGraphStorage(BaseGraphStorage):
{"$group": {"_id": "$source_node_id", "degree": {"$sum": 1}}}, {"$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: async for doc in cursor:
merged_results[doc.get("_id")] = doc.get("degree") merged_results[doc.get("_id")] = doc.get("degree")
@ -537,7 +539,9 @@ class MongoGraphStorage(BaseGraphStorage):
{"$group": {"_id": "$target_node_id", "degree": {"$sum": 1}}}, {"$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: async for doc in cursor:
merged_results[doc.get("_id")] = merged_results.get( merged_results[doc.get("_id")] = merged_results.get(
doc.get("_id"), 0 doc.get("_id"), 0
@ -698,10 +702,7 @@ class MongoGraphStorage(BaseGraphStorage):
""" """
# Use aggregation with allowDiskUse for large datasets # Use aggregation with allowDiskUse for large datasets
pipeline = [ pipeline = [{"$project": {"_id": 1}}, {"$sort": {"_id": 1}}]
{"$project": {"_id": 1}},
{"$sort": {"_id": 1}}
]
cursor = await self.collection.aggregate(pipeline, allowDiskUse=True) cursor = await self.collection.aggregate(pipeline, allowDiskUse=True)
labels = [] labels = []
async for doc in cursor: async for doc in cursor: