PEP8 and typing annotations for function fields#40972
PEP8 and typing annotations for function fields#40972vbraun merged 17 commits intosagemath:developfrom
Conversation
|
Documentation preview for this PR (built with commit 09e0016; changes) is ready! 🎉 |
fchapoton
left a comment
There was a problem hiding this comment.
ok, but please next time:
- do no make any change about spaces around arithmetic operators ;
- rather do only annotations changes, when changing so many files
- I would also prefer to avoid Literal for the moment
|
Thanks for the review!
I can certainly do that, but can I ask why you don't like the spaces around arithmetic operators? Do you not like spaces around operators, or is it just too annoying to review for how minor of a fix it is?
For sure! Originally I was not planning to change this many files but I guess I got carried away.
Sure. There aren't many places where we can use it anyway since it only works with Python literals. Something like The reason I wanted to use def constant_false() -> Literal[False]:
return FalseThe hope was that if a Cython file imported if constant_false():
assert Falsethat the if statement would be optimized out. Unfortunately, at least as far as I can tell, it isn't currently optimized out. |
|
@fchapoton Just resolving the merge conflict. Still good? |
sagemathgh-40972: PEP8 and typing annotations for function fields <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Mostly done with `ruff` and `autotyping`, but also some manually for the main function field classes. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40972 Reported by: Vincent Macri Reviewer(s): Frédéric Chapoton
Mostly done with
ruffandautotyping, but also some manually for the main function field classes.📝 Checklist
⌛ Dependencies