mirror of
https://github.com/bckelley/tconnectsync.git
synced 2026-08-24 03:34:12 -05:00
Type-check the full tconnectsync package, not just process_alarm
Remove the single-file opt-in in setup.cfg ([mypy] files) so mypy checks the entire tconnectsync package, and fix everything that surfaced. Config: - setup.cfg: mypy `files` now points at the whole `tconnectsync` package. Event processors (were typed as BaseEvent, which lacks the per-event fields like seqNum and the event-specific attributes): - Type each *_to_nsentry / helper with the concrete event type(s) it handles (or a Union of them), matching the existing process_alarm.py pattern. - process_basal_suspension, process_basal_resume, process_cgm_start_join_stop: filter out None before appending to ns_entries, matching process_basal / process_cgm_alert. Previously a None from a non-matching event would have been appended and passed to upload_entry(). - Add explicit `return None` fall-throughs where a helper annotated to return a value could implicitly return None. - process_cgm_reading: give each sensor's GlucosevaluestatusEnum its own local variable so the enum types don't clash. process.py: - Add an EventProcessor Protocol and annotate event_classes with it, so the instantiated handlers are typed instead of `object`. - Rename the updater-loop variable so it no longer collides with the processor-loop variable's type. Other: - api/tandemsource.py: narrow the JWKS key to RSAPublicKey before jwt.decode, and use arrow.get() (not time.time()) when forcing token expiry so the attribute type stays consistent. - api/common.py: split_days_range returns Arrow tuples, not str tuples. - parser/nightscout.py: sort profile segments by the typed startTime rather than an untyped dict value (same resulting order). - domain/tandemsource/pump_settings.py: PumpSettings inherits DataClassJsonMixin so from_dict is visible to the type checker. - domain/tandemsource/event_class.py: ignore the set/Enum __hash__ clash. - nightscout.py: explicit return None when a ConnectionError is swallowed. No runtime behavior change; full test suite (461 passed, 1 skipped) still green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UaQXTakxAKEfeeys5cv3en
This commit is contained in: