Skip to content

Commit

Permalink
馃悰 fix has_node throwing instead of False return.
Browse files Browse the repository at this point in the history
closes #38
  • Loading branch information
ehne committed May 16, 2022
1 parent 5b2ec7d commit c8d8304
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pynode_next/graph.py
Expand Up @@ -134,7 +134,11 @@ def remove_edge(self, nodeA, nodeB, directed: bool = False):

def has_node(self, node):
"""Checks if a node exists in the graph."""
return self.node(node) is not None
try:
self.node(node)
return True
except NodeDoesntExistError:
return False

def add_all(self, elements: Iterable[Union[Node, Edge]]):
"""Adds all node and edge objects from an iterable. all elements need to be of the type `Node` or `Edge`"""
Expand Down

0 comments on commit c8d8304

Please sign in to comment.