From e951fd9d125cfcc2b78792ca82c3a807ba129212 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 28 Nov 2026 15:50:42 -0600 Subject: [PATCH] bump ty to 0.0.112 and fix the type errors it finds (#39506) --- openpilot/system/ubloxd/binary_struct.py | 17 +++++------------ openpilot/system/ubloxd/ubloxd.py | 8 ++++---- openpilot/tools/replay/lib/ui_helpers.py | 3 +-- prebuilt.json | 2 +- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/openpilot/system/ubloxd/binary_struct.py b/openpilot/system/ubloxd/binary_struct.py index 5bc05094f3..d31a5cdb14 100644 --- a/openpilot/system/ubloxd/binary_struct.py +++ b/openpilot/system/ubloxd/binary_struct.py @@ -176,16 +176,6 @@ class BinaryStruct: fields = list(getattr(cls, '__annotations__', {}).items()) cls.__binary_fields__ = fields - @classmethod - def _read(inner_cls, reader: BinaryReader): - obj = inner_cls.__new__(inner_cls) - for name, spec in inner_cls.__binary_fields__: - value = _parse_field(spec, reader, obj) - setattr(obj, name, value) - return obj - - cls._read = _read # ty: ignore[invalid-assignment] # installed dynamically for each subclass - @classmethod def from_bytes(cls: type[T], data: bytes) -> T: """Parse struct from bytes.""" @@ -194,8 +184,11 @@ class BinaryStruct: @classmethod def _read(cls: type[T], reader: BinaryReader) -> T: - """Override in subclasses to implement parsing.""" - raise NotImplementedError + obj = cls.__new__(cls) + for name, spec in cls.__binary_fields__: + value = _parse_field(spec, reader, obj) + setattr(obj, name, value) + return obj def _resolve_path(obj: Any, path: str) -> Any: diff --git a/openpilot/system/ubloxd/ubloxd.py b/openpilot/system/ubloxd/ubloxd.py index e609e65cf0..d278fe39a5 100755 --- a/openpilot/system/ubloxd/ubloxd.py +++ b/openpilot/system/ubloxd/ubloxd.py @@ -442,7 +442,7 @@ class UbloxMsgParser: mb[i].pseudorange = m.pr_mes mb[i].carrierCycles = m.cp_mes mb[i].doppler = m.do_mes - mb[i].gnssId = int(m.gnss_id.value) + mb[i].gnssId = int(m.gnss_id) mb[i].glonassFrequencyIndex = m.freq_id mb[i].locktime = m.lock_time mb[i].cno = m.cno @@ -470,7 +470,7 @@ class UbloxMsgParser: svs = sr.init('svs', msg.num_svs) for i, s in enumerate(msg.svs): svs[i].svId = s.sv_id - svs[i].gnssId = int(s.gnss_id.value) + svs[i].gnssId = int(s.gnss_id) svs[i].flagsBitfield = s.flags svs[i].cno = s.cno svs[i].elevationDeg = s.elev @@ -484,8 +484,8 @@ class UbloxMsgParser: hw.noisePerMS = msg.noise_per_ms hw.flags = msg.flags hw.agcCnt = msg.agc_cnt - hw.aStatus = int(msg.a_status.value) - hw.aPower = int(msg.a_power.value) + hw.aStatus = int(msg.a_status) + hw.aPower = int(msg.a_power) hw.jamInd = msg.jam_ind return ('ubloxGnss', dat) diff --git a/openpilot/tools/replay/lib/ui_helpers.py b/openpilot/tools/replay/lib/ui_helpers.py index 478117e2a1..a80ea2c667 100644 --- a/openpilot/tools/replay/lib/ui_helpers.py +++ b/openpilot/tools/replay/lib/ui_helpers.py @@ -198,9 +198,8 @@ def plot_lead(rs, top_down): def maybe_update_radar_points(lt, lid_overlay): - ar_pts = [] + ar_pts = {} if lt is not None: - ar_pts = {} for track in lt: ar_pts[track.trackId] = [track.dRel, track.yRel, track.vRel] for pt in ar_pts.values(): diff --git a/prebuilt.json b/prebuilt.json index 643208150f..d0217d85a4 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "544b6ccef703912fd1c59d25d01b3dabb1df49b268787b02866cbd1d93ba0368", "schema_version": 1} +{"protected_inventory_sha256": "82f1879d2d060a47f9391a9e7544573e4ec88c29266c87fe80fb533a51f3d605", "schema_version": 1}