Skip to content

Commit

Permalink
Replace raise StopIteration with return
Browse files Browse the repository at this point in the history
 - Raising StopIteration was deprecated in python 3.5, and throws
   warnings when used
 - Replace `raise StopIteration` with canonical `return`
  • Loading branch information
leviable committed Mar 9, 2018
1 parent 36120f2 commit 1a4357d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pygraphviz/agraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 1a4357d

Please sign in to comment.