mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
fix(graph): using assignment expression to avoid repeated function call (#1174)
* using assignment expression to avoid repeated function call * format
This commit is contained in:
@@ -136,10 +136,10 @@ class UndirectedGraph(Graph):
|
||||
-------
|
||||
|
||||
"""
|
||||
if self.get_node(node.id):
|
||||
node = self.get_node(node.id)
|
||||
elif self.find_node(content=node.content, label=node.label):
|
||||
node = self.find_node(content=node.content, label=node.label)
|
||||
if tmp_node := self.get_node(node.id):
|
||||
node = tmp_node
|
||||
elif tmp_node := self.find_node(content=node.content, label=node.label):
|
||||
node = tmp_node
|
||||
else:
|
||||
# same_node = self.semantic_search(node=node.content, similarity_threshold=same_node_threshold, topk_k=1)
|
||||
# if len(same_node):
|
||||
@@ -150,10 +150,10 @@ class UndirectedGraph(Graph):
|
||||
self.nodes.update({node.id: node})
|
||||
|
||||
if neighbor is not None:
|
||||
if self.get_node(neighbor.id):
|
||||
neighbor = self.get_node(neighbor.id)
|
||||
elif self.find_node(content=neighbor.content, label=node.label):
|
||||
neighbor = self.find_node(content=neighbor.content, label=node.label)
|
||||
if tmp_neighbor := self.get_node(neighbor.id):
|
||||
neighbor = tmp_neighbor
|
||||
elif tmp_neighbor := self.find_node(content=neighbor.content, label=node.label):
|
||||
neighbor = tmp_neighbor
|
||||
else:
|
||||
# same_node = self.semantic_search(node=neighbor.content,
|
||||
# similarity_threshold=same_node_threshold, topk_k=1)
|
||||
|
||||
Reference in New Issue
Block a user