Skip to content

Typing drivers - #164

Open
markus-becker-tridonic-com wants to merge 3 commits into
sde1000:typingfrom
tridonic-com:typing-drivers
Open

markus-becker-tridonic-com wants to merge 3 commits into
sde1000:typingfrom
tridonic-com:typing-drivers

Conversation

@markus-becker-tridonic-com

Copy link
Copy Markdown
Contributor

Some typing for the drivers, even if they are going to be stripped into their own libraries, they could still benefit from typing.

Annotate the abstract driver/backend contracts, the daliserver client and
the TRACE logging helper so they pass mypy --strict. Add a shared
TraceLogger type and get_logger() factory in trace_logging for the serial
and HID drivers to reuse. Fix the daliserver default result to be bytes
and Backend.write to take self.

Typing only, no behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Annotate every function in the serial driver and resolve the strict
findings: use the shared TraceLogger, add _proto/_tx accessors that
narrow the optional protocol and transport, type the RX buffers as
int lists, materialise the frame byte sequence before indexing, decode
received frames as ForwardFrames, bind the response type locally before
calling it, and cast the connection factory results. send() now accepts
any sequence generator.

Typing only, no behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Annotate every function in the shared HID base and the tridonic and
hasseb drivers, declare the instance attributes (file descriptor,
reconnect/bus-watch tasks, outstanding-command map, response buffers)
at class scope, and add _send_raw/_power_supply/_raw_write to the base
so the shared send paths type-check. Narrow the optional file
descriptor and decoded command before use, type the frame/response
union locals, and fix a command._response typo to command.response.

Typing only, no behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant