From 1a4357d3a90d9f04ae15f613e8dacf4f19915605 Mon Sep 17 00:00:00 2001 From: levi-rs Date: Fri, 9 Mar 2018 15:48:50 -0600 Subject: [PATCH] Replace raise StopIteration with return - Raising StopIteration was deprecated in python 3.5, and throws warnings when used - Replace `raise StopIteration` with canonical `return` --- pygraphviz/agraph.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pygraphviz/agraph.py b/pygraphviz/agraph.py index 4cb8fc24..ebee1546 100644 --- a/pygraphviz/agraph.py +++ b/pygraphviz/agraph.py @@ -375,7 +375,7 @@ def nodes_iter(self): while nh is not None: yield Node(self, nh=nh) nh = gv.agnxtnode(self.handle, nh) - raise StopIteration + return iternodes = nodes_iter @@ -598,7 +598,7 @@ def neighbors_iter(self, n): else: yield Node(self, s) eh = gv.agnxtedge(self.handle, eh, nh) - raise StopIteration + return def neighbors(self, n): """Return a list of the nodes attached to n.""" @@ -658,7 +658,7 @@ def out_edges_iter(self, nbunch=None, keys=False): else: yield e eh = gv.agnxtout(self.handle, eh) - raise StopIteration + return iteroutedges = out_edges_iter @@ -714,7 +714,7 @@ def in_edges_iter(self, nbunch=None, keys=False): else: yield e eh = gv.agnxtin(self.handle, eh) - raise StopIteration + return def edges_iter(self, nbunch=None, keys=False): """Return iterator over edges in the graph. @@ -781,7 +781,7 @@ def predecessors_iter(self, n): else: yield Node(self, s) eh = gv.agnxtin(self.handle, eh) - raise StopIteration + return iterpred = predecessors_iter @@ -803,7 +803,7 @@ def successors_iter(self, n): else: yield Node(self, s) eh = gv.agnxtout(self.handle, eh) - raise StopIteration + return itersucc = successors_iter @@ -1090,7 +1090,7 @@ def subgraphs_iter(self): directed=self.directed, handle=handle) handle = gv.agnxtsubg(handle) - raise StopIteration + return def subgraphs(self): """Return a list of all subgraphs in the graph."""