Skip to content

Commit ed4df9b

Browse files
committed
remove: _get_smart_id
1 parent 4fafde9 commit ed4df9b

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

nx_arangodb/classes/digraph.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,6 @@ def add_node_override(self, node_for_adding, **attr):
232232
if node_for_adding is None:
233233
raise ValueError("None cannot be a node")
234234

235-
# New:
236-
# if self.is_smart:
237-
# node_for_adding = self._get_smart_id(node_for_adding, attr)
238-
239-
# Reason:
240-
# Support for ArangoDB Smart Graphs requires the smart field
241-
# to be set before adding the node to the graph. This is because
242-
# the smart field is used to generate the node's key.
243-
244235
if node_for_adding not in self._succ:
245236

246237
self._succ[node_for_adding] = self.adjlist_inner_dict_factory()

nx_arangodb/classes/graph.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
node_attr_dict_factory,
3030
node_dict_factory,
3131
)
32-
from .function import cast_to_string, get_node_id
32+
from .function import get_node_id
3333
from .reportviews import ArangoEdgeView, ArangoNodeView
3434

3535
networkx_api = nxadb.utils.decorators.networkx_class(nx.Graph) # type: ignore
@@ -614,24 +614,6 @@ def chat(
614614

615615
return str(response["result"])
616616

617-
def _get_smart_id(self, node_for_adding: str, attr: dict[Any, Any]) -> str:
618-
raise NotImplementedError(
619-
"This is broken if node_for_adding is structured like an ArangoDB ID"
620-
) # noqa: E501
621-
# Should we really be doing this? Database would catch this error anyways...
622-
623-
if self.smart_field not in attr:
624-
m = f"Node {node_for_adding} missing smart field '{self.smart_field}'" # noqa: E501
625-
raise KeyError(m)
626-
627-
# TODO: Revisit this behaviour.
628-
# Too magical? Raise error instead? Let ArangoDB handle it?
629-
node_for_adding = cast_to_string(node_for_adding)
630-
if ":" not in node_for_adding:
631-
node_for_adding = f"{attr[self.smart_field]}:{node_for_adding}"
632-
633-
return node_for_adding
634-
635617
#####################
636618
# nx.Graph Overides #
637619
#####################
@@ -699,15 +681,6 @@ def add_node_override(self, node_for_adding, **attr):
699681
if node_for_adding is None:
700682
raise ValueError("None cannot be a node")
701683

702-
# New:
703-
# if self.is_smart:
704-
# node_for_adding = self._get_smart_id(node_for_adding, attr)
705-
706-
# Reason:
707-
# Support for ArangoDB Smart Graphs requires the smart field
708-
# to be set before adding the node to the graph. This is because
709-
# the smart field is used to generate the node's key.
710-
711684
if node_for_adding not in self._node:
712685
self._adj[node_for_adding] = self.adjlist_inner_dict_factory()
713686

0 commit comments

Comments
 (0)