From 917dc39334d99120f98ede2c7cb13c70bdf78e24 Mon Sep 17 00:00:00 2001 From: zrguo <49157727+LarFii@users.noreply.github.com> Date: Wed, 5 Mar 2025 17:00:01 +0800 Subject: [PATCH] fix linting --- lightrag/lightrag.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index f81ade0b..5c060658 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -1963,12 +1963,16 @@ class LightRAG: await self.chunk_entity_relation_graph.upsert_edge( new_entity_name, target, edge_data ) - relations_to_update.append((new_entity_name, target, edge_data)) + relations_to_update.append( + (new_entity_name, target, edge_data) + ) else: # target == entity_name await self.chunk_entity_relation_graph.upsert_edge( source, new_entity_name, edge_data ) - relations_to_update.append((source, new_entity_name, edge_data)) + relations_to_update.append( + (source, new_entity_name, edge_data) + ) # Delete old entity await self.chunk_entity_relation_graph.delete_node(entity_name) @@ -1983,13 +1987,13 @@ class LightRAG: keywords = edge_data.get("keywords", "") source_id = edge_data.get("source_id", "") weight = float(edge_data.get("weight", 1.0)) - + # Create new content for embedding content = f"{src}\t{tgt}\n{keywords}\n{description}" - + # Calculate relationship ID relation_id = compute_mdhash_id(src + tgt, prefix="rel-") - + # Prepare data for vector database update relation_data = { relation_id: { @@ -2002,7 +2006,7 @@ class LightRAG: "weight": weight, } } - + # Update vector database await self.relationships_vdb.upsert(relation_data)