Repository navigation
Typing drivers - #164
Open
markus-becker-tridonic-com wants to merge 3 commits into
Open
Typing drivers#164markus-becker-tridonic-com wants to merge 3 commits into
markus-becker-tridonic-com wants to merge 3 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some typing for the drivers, even if they are going to be stripped into their own libraries, they could still benefit from typing.