[chore] Rework SQLResult dataclass to not require all fields when used in for loops#1438
Conversation
|
@rolandwalker Had a moment of (I think) insight on how to meet my initial goal for this, which was to not have to use all SQLResult fields (i.e. command) in the for loops as that would get out of hand quick on future additions. This also makes things a bit more consistent. Let me know if you see any problems with it though, however it appears to work as I would expect anyway. Didn't update the changelog, as if this gets included it can just be part of the initial dataclass change anyway. |
mycli/packages/special/iocommands.py
Outdated
| command = { | ||
| "name": "watch", | ||
| "seconds": seconds, | ||
| "seconds": str(seconds), |
There was a problem hiding this comment.
Why str() here and float() later?
There was a problem hiding this comment.
In the weeds on trying to make mypy happy. I reworked it a bit to be more explicit and found a combo mypy liked, so let me know if that's any better.
|
I would work toward not needing |
Description
Initial goal of the SQLResult dataclass was to be able to use it without having to add all new attributes (i.e. command) to the for loops of every section of the code that uses the basic title/cursor/headers/status fields. This PR reworks the initial implementation to meet that goal.
Checklist
changelog.md.AUTHORSfile (or it's already there).uv run ruff check && uv run ruff format && uv run mypy --install-types .to lint and format the code.