-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
Rename PolynomialRing_general to PolynomialRing_generic #38207
base: develop
Are you sure you want to change the base?
Conversation
A note for future me and others: Most LSPs support renaming a symbol across an entire project. I use coc.nvim so just use coc-rename to all the names across Sage. (It doesn't detect comments though :( ) |
In a somewhat different direction, we may want to look into merging constructor functions such as |
Normally I would completely agree with @mkoeppe about having the
(which doesn't even use the category framework properly too!). @grhkm21 Just do a |
Yeah that finds the appearance of the class, but the LSP method I mentioned renames the class + all references to it (including imports etc). Plus if there's hundreds of references, say I want to rename |
Re category: yes, a lot of things are not in the category framework. I plan to work on that whenever I have time during the summer. e.g. by replacing some Re constructor/classcall thing: yes in this case I don't think it's feasible. |
I've sketched this in #38228 (for a different class) |
In light of the discussion in ... we should probably also discuss a possible direction to defining suitable abstract base classes without underscores in names. One data point: For the elements, we have introduced an ABC Should we define an ABC |
@tscrim @kwankyu Hello, I want this PR to go through soon. IIRC both of you were fine with the current deprecation solution? Do you still think so? If both of you are okay let's just mark this as positive review and remove the deprecation warning soon. Or if you two agree we can even remove the deprecation warning now, and just rename this somewhat internal base class |
According to the updated rules in https://doc-release--sagemath.netlify.app/html/en/developer/coding_in_python.html#deprecation, we should first decide if I think it is internal. |
It's in our public documentation and should not be treated as internal. Moreover, it is also such an important class that we can reasonably expect people to have imported it in their local code. Hence, it should be subject to our usual deprecation policy. I also don't really see the point/benefit of doing this... |
OK. Then it should be treated as a public class. The deprecation policy should be followed. Otherwise I am positive to the PR. |
So according to the deprecation developer guideline, I should remove the # Placeholder class for deprecation
class PolynomialRing_general(PolynomialRing_generic):
... placeholder, and just do class NewClass:
...
OldClass = NewClass # OldClass is deprecated. See Issue 12345. , correct? I assume I can remove it after a year as well (adds to calendar) |
Yes. By the way, I think it should be OldClass = NewClass # OldClass is deprecated. See Issue #12345. Note the added |
Documentation preview for this PR (built with commit b0d2419; changes) is ready! 🎉 |
<!-- ^ 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". --> Fixes a typo in the developer guide, noted in sagemath#38207 (comment). ### 📝 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. - [x] 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#39074 Reported by: Kwankyu Lee Reviewer(s): Frédéric Chapoton
<!-- ^ 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". --> Fixes a typo in the developer guide, noted in sagemath#38207 (comment). ### 📝 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. - [x] 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#39074 Reported by: Kwankyu Lee Reviewer(s): Frédéric Chapoton
<!-- ^ 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". --> Fixes a typo in the developer guide, noted in sagemath#38207 (comment). ### 📝 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. - [x] 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#39074 Reported by: Kwankyu Lee Reviewer(s): Frédéric Chapoton
…eric Class names should be *_generic, and indeed is the case for at least 140 classes, but PolynomialRing is incorrectly suffixed with _general. This PR fixes this problem. ### 📝 Checklist - [X] The title is concise and informative. - [X] The description explains in detail what this PR is about. - [X] I have linked a relevant issue or discussion. - [X] I have created tests covering the changes. - [X] I have updated the documentation and checked the documentation preview. URL: sagemath#38207 Reported by: grhkm21 Reviewer(s): grhkm21, Kwankyu Lee, Matthias Köppe, Travis Scrimshaw
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
Since we changed |
Replace `isinstance(X, A) or isinstance(X, B)` with `isinstance(X, (A, B))` Co-authored-by: Martin Rubey <[email protected]>
Thank you! I have applied the changes :) |
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.
excellent, thank you!
Class names should be *_generic, and indeed is the case for at least 140 classes, but PolynomialRing is incorrectly suffixed with _general. This PR fixes this problem.
📝 Checklist