MultiLogIterator: remove wraparound mode (#23360)

old-commit-hash: 92f194decc2bce39d6dd0dbabf39b2a9b1aa53e5
This commit is contained in:
Adeeb Shihadeh
2022-01-02 15:16:44 -08:00
committed by GitHub
parent f7df13244f
commit c036e64c86
6 changed files with 7 additions and 12 deletions
+2 -7
View File
@@ -13,9 +13,8 @@ from cereal import log as capnp_log
# this is an iterator itself, and uses private variables from LogReader
class MultiLogIterator:
def __init__(self, log_paths, wraparound=False, sort_by_time=False):
def __init__(self, log_paths, sort_by_time=False):
self._log_paths = log_paths
self._wraparound = wraparound
self._first_log_idx = next(i for i in range(len(log_paths)) if log_paths[i] is not None)
self._current_log = self._first_log_idx
@@ -42,12 +41,8 @@ class MultiLogIterator:
self._idx = 0
self._current_log = next(i for i in range(self._current_log + 1, len(self._log_readers) + 1)
if i == len(self._log_readers) or self._log_paths[i] is not None)
# wraparound
if self._current_log == len(self._log_readers):
if self._wraparound:
self._current_log = self._first_log_idx
else:
raise StopIteration
raise StopIteration
def __next__(self):
while 1:
+1 -1
View File
@@ -35,7 +35,7 @@ def main(argv):
args.data_dir = os.path.dirname(args.data_dir)
route = Route(args.route_name, args.data_dir)
lr = MultiLogIterator(route.log_paths(), wraparound=False)
lr = MultiLogIterator(route.log_paths())
with open(args.out_path, 'wb') as f:
try: