ci: add Pyrefly type validation/code coverage and bug fixes#410
ci: add Pyrefly type validation/code coverage and bug fixes#410danudey wants to merge 7 commits into
Conversation
|
Thanks for all the fixes! Can you resolve the conflict? I think there may also be some syntaxes that need to be changed for older python versions, I try to maintain support for all versions still getting official security updates. Feel free to ignore 3.9 though, support for that version ends this month. |
|
Sounds good, I'll switch over to testing with 3.10 then and see if anything needs fixing then update the branch again. |
fdc93ec to
10c4be0
Compare
a422bda to
549e095
Compare
|
@newAM A bunch of updates in this PR, outside of the original scope. Let me know if you want me to split this off to preserve context. |
Splitting the other commit into separate PRs would help a lot the reviews. Sorry for the slow reply, I was busy moving recently. |
Pyrefly is a new, incredibly fast, type checker written in Rust by Meta. This PR adds pyrefly as a check, and also fixes all the existing issues it finds.
A few notes:
Edit
Was working on expanding code coverage and found (well, Claude found) two pre-existing bugs that were easy to fix:
In
LinuxVCP.rate_limt, the delay is computed asrate_delay = self.CMD_RATE - time.time() - self.last_set, whichtakes the 50ms constant and subtracts the last-set timestamp and the value of
time.time(), meaning it's always negative. Simple parenthesis change fixed.Also,
LinuxVCP.write_bytes, in the missing file descriptor branch we create theVCPIOError("unable write to I2C bus: no open file descriptor found")exception but we don't actuallyraiseit. Another simple fix.Wanted to fix these so that new unit tests wouldn't end up testing invalid behavior and then require fixing in a separate PR.
On top of this, added a bunch of code coverage (as mentioned) for linux_vcp.py; if this feels too far out of scope for this PR, I can refactor it out.