gh-37154: minor details in logic folder
This is just fixing some suggestions of ruff and pycodestyle in the
logic folder.
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
URL: https://github.com/sagemath/sage/pull/37154
Reported by: Frédéric Chapoton
Reviewer(s): Travis Scrimshaw