Skip to content

Commit

Permalink
Merge pull request jceb#304 from akstrfn/stopiter_fix
Browse files Browse the repository at this point in the history
fix : RuntimeError: generator raised StopIteration
  • Loading branch information
Psirus authored Jul 25, 2018
2 parents ce17a40 + bb503b2 commit 35e9421
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions ftplugin/orgmode/liborgmode/checkboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ def all_siblings(self):
else:
p = self.parent
if not p.children:
raise StopIteration()
return

c = p.first_checkbox
while c:
yield c
c = c.next_sibling
raise StopIteration()
return

def all_children(self):
if not self.children:
raise StopIteration()
return

c = self.first_checkbox
while c:
Expand All @@ -268,7 +268,7 @@ def all_children(self):
yield d
c = c.next_sibling

raise StopIteration()
return

def all_children_status(self):
u""" Return checkboxes status for currnet checkbox's all children
Expand Down
4 changes: 2 additions & 2 deletions ftplugin/orgmode/liborgmode/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ def all_headings(self):
the current file in serialized order
"""
if not self.headings:
raise StopIteration()
return

h = self.headings[0]
while h:
yield h
h = h.next_heading
raise StopIteration()
return

def find_heading(
self, position=0, direction=Direction.FORWARD, heading=Heading,
Expand Down
8 changes: 4 additions & 4 deletions ftplugin/orgmode/liborgmode/headings.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,24 +223,24 @@ def all_checkboxes(self):
the current heading in serialized order
"""
if not self.checkboxes:
raise StopIteration()
return

c = self.first_checkbox
while c:
yield c
c = c.next_checkbox
raise StopIteration()
return

def all_toplevel_checkboxes(self):
u""" return all top level checkboxes for current heading """
if not self.checkboxes:
raise StopIteration()
return

c = self.first_checkbox
while c:
yield c
c = c.next_sibling
raise StopIteration()
return

def find_checkbox(self, position=0, direction=Direction.FORWARD,
checkbox=Checkbox, connect_with_heading=True):
Expand Down

0 comments on commit 35e9421

Please sign in to comment.