-
-
Notifications
You must be signed in to change notification settings - Fork 655
Various small improvements to imports #39276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Mostly to try to reduce a few circular imports that happen when you don't import `sage.all`. A few of these changes are purely cosmetic.
b6662f6
to
3050d63
Compare
Documentation preview for this PR (built with commit 5b5bf6d; changes) is ready! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add some tests that the circular imports are fixed?
There's test_executable
convenience function.
src/sage/rings/rational.pyx
Outdated
@@ -182,7 +181,7 @@ cdef Rational_sub_(Rational self, Rational other): | |||
|
|||
return x | |||
|
|||
cdef Parent the_rational_ring = sage.rings.rational_field.Q | |||
cdef Parent the_rational_ring = Q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly related but maybe we can change to use QQ
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and may be use from sage.rings.rational_field import Q as the_rational_ring
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now used QQ
here. I wasn't sure about the named import as @dcoudert suggests, as this is a cdef
(and this is not really related to the aim of this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks! |
sagemathgh-39276: Various small improvements to imports Mostly to try to reduce a few circular imports that happen when you don't import `sage.all`. A few of these changes are purely cosmetic. <!-- ^ 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". --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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. - [ ] 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#39276 Reported by: Tobias Diez Reviewer(s): David Coudert, Tobias Diez, user202729
sagemathgh-39276: Various small improvements to imports Mostly to try to reduce a few circular imports that happen when you don't import `sage.all`. A few of these changes are purely cosmetic. <!-- ^ 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". --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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. - [ ] 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#39276 Reported by: Tobias Diez Reviewer(s): David Coudert, Tobias Diez, user202729
Mostly to try to reduce a few circular imports that happen when you don't import
sage.all
. A few of these changes are purely cosmetic.📝 Checklist
⌛ Dependencies