bump ty to 0.0.112 and fix the type errors it finds (#39506)

This commit is contained in:
Adeeb Shihadeh
2026-11-28 15:50:42 -06:00
committed by firestar5683
parent 9f8edc570d
commit e951fd9d12
4 changed files with 11 additions and 19 deletions
+5 -12
View File
@@ -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:
+4 -4
View File
@@ -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)
+1 -2
View File
@@ -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():
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "544b6ccef703912fd1c59d25d01b3dabb1df49b268787b02866cbd1d93ba0368", "schema_version": 1}
{"protected_inventory_sha256": "82f1879d2d060a47f9391a9e7544573e4ec88c29266c87fe80fb533a51f3d605", "schema_version": 1}