Proc Replay: cleanup iterable log typing (#30261)

* cleanup log typing

* use iterable

* fix those

* Cleanup

* cleanup

* missed that one
old-commit-hash: 1820b5f25930ae68e760157d6ff026516e3811ed
This commit is contained in:
Justin Newberry
2023-10-17 15:58:28 -04:00
committed by GitHub
parent 2b5ad3fe86
commit ef1acd4e6c
4 changed files with 16 additions and 14 deletions
+5 -2
View File
@@ -6,11 +6,14 @@ import urllib.parse
import capnp
import warnings
from typing import Iterable, Iterator
from cereal import log as capnp_log
from openpilot.tools.lib.filereader import FileReader
from openpilot.tools.lib.route import Route, SegmentName
LogIterable = Iterable[capnp._DynamicStructReader]
# this is an iterator itself, and uses private variables from LogReader
class MultiLogIterator:
def __init__(self, log_paths, sort_by_time=False):
@@ -30,7 +33,7 @@ class MultiLogIterator:
return self._log_readers[i]
def __iter__(self):
def __iter__(self) -> Iterator[capnp._DynamicStructReader]:
return self
def _inc(self):
@@ -107,7 +110,7 @@ class LogReader:
def from_bytes(cls, dat):
return cls("", dat=dat)
def __iter__(self):
def __iter__(self) -> Iterator[capnp._DynamicStructReader]:
for ent in self._ents:
if self._only_union_types:
try: