Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if v is None: (u,v)=u # no v given, assume u is an edge tuple
try:
uh=Node(self,u).handle
except:
self.add_node(u)
uh=Node(self,u).handle
try:
vh=Node(self,v).handle
except:
self.add_node(v)
vh=Node(self,v).handle
try:
if key is not None:
if not self._is_string_like(key):
key=str(key)
eh=gv.agedge(self.handle,uh,vh,key,_Action.create)
e=Edge(self,eh=eh)
e.attr.update(**attr)
except KeyError:
return None # silent failure for strict graph, already added
uh = Node(self, u).handle
except:
self.add_node(u)
uh = Node(self, u).handle
try:
vh = Node(self, v).handle
except:
self.add_node(v)
vh = Node(self, v).handle
if key is not None:
if not is_string_like(key):
key = str(key)
key = key.encode(self.encoding)
try:
# new
eh = gv.agedge(self.handle, uh, vh, key, _Action.create)
except KeyError:
# for strict graph, or already added
eh = gv.agedge(self.handle, uh, vh, key, _Action.find)
e = Edge(self, eh=eh)
e.attr.update(**attr)
uh = Node(self, u).handle
try:
vh = Node(self, v).handle
except:
self.add_node(v)
vh = Node(self, v).handle
if key is not None:
if not is_string_like(key):
key = str(key)
key = key.encode(self.encoding)
try:
# new
eh = gv.agedge(self.handle, uh, vh, key, _Action.create)
except KeyError:
# for strict graph, or already added
eh = gv.agedge(self.handle, uh, vh, key, _Action.find)
e = Edge(self, eh=eh)
e.attr.update(**attr)