Skip to content

Commit

Permalink
Update colcon_core/shell/template/__init__.py
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Lalancette <[email protected]>
  • Loading branch information
cottsay and clalancette authored Sep 6, 2024
1 parent 54c9285 commit 1e6c9b9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions colcon_core/shell/template/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,15 @@ def __init__(self, decoree, cache):
super().__init__(decoree, _cache=cache, _idx=0)

def one(self, *args, **kwargs):
try:
if self._idx < len(self._cache):
token, count = self._cache[self._idx]
except IndexError:
self.advance(count)
self.sync()
else:
count = len(self._decoree)
token = self._decoree.one(*args, **kwargs)
count -= len(self._decoree)
self._cache.append((token, count))
else:
self.advance(count)
self.sync()

self._idx += 1
return token
Expand Down

0 comments on commit 1e6c9b9

Please sign in to comment.