Skip to content

Fix Generalized Petersen graph name and update others to f-string syntax #40036

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

Merged
merged 2 commits into from
May 11, 2025

Conversation

ed359
Copy link
Contributor

@ed359 ed359 commented May 2, 2025

There is a bug in the naming of the generalized Petersen graphs: the parameters aren't interpolated into the name string properly. This PR fixes that bug and updates all names in sage.graphs.generators.families to use f-strings.

📝 Checklist

  • 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

Copy link

github-actions bot commented May 2, 2025

Documentation preview for this PR (built with commit a226b50; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@fchapoton
Copy link
Contributor

Please add a doctest showing what has been fixed.

@@ -1711,6 +1711,13 @@ def GeneralizedPetersenGraph(n, k):
sage: g.is_bipartite()
True

TESTS::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one colon in this line

Copy link
Contributor Author

@ed359 ed359 May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's confusing, because I copied the syntax from elsewhere in the file. E.g. in the definition of MathonPseudocyclicMergingGraph (line 3829) SEEALSO and TESTS both have double-colons. There are ~20 other places with TESTS::. Are these also docstring bugs that I should fix while I'm working on this file?

Copy link
Contributor

@fchapoton fchapoton May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double colon means that it is followed by an indented block. Here it is not because you have another line with the same indent, itself ending with a double colon and followed by its indented block. So : just put one single colon at the end of TESTS on the one line that I designated

@ed359 ed359 force-pushed the graphs/familynames branch from 3e094f3 to d9a291a Compare May 2, 2025 14:51
@ed359 ed359 force-pushed the graphs/familynames branch from d9a291a to a226b50 Compare May 2, 2025 14:52
Copy link
Contributor

@fchapoton fchapoton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now, thanks

@ed359
Copy link
Contributor Author

ed359 commented May 2, 2025

Thank you for the quick review. I have to say that since I got my first small PR into sage in 2019 the developer experience has improved immensely. Github is easier for me than trac ever was, and the new conda install methods for both using sage and developing sage are awesome compared to compiling from source. Such amazing work by the community over the years.

vbraun pushed a commit to vbraun/sage that referenced this pull request May 4, 2025
sagemathgh-40036: Fix Generalized Petersen graph name and update others to f-string syntax
    
There is a bug in the naming of the generalized Petersen graphs: the
parameters aren't interpolated into the name string properly. This PR
fixes that bug and updates all names in
`sage.graphs.generators.families` to use f-strings.


### 📝 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.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies
    
URL: sagemath#40036
Reported by: Ewan Davies
Reviewer(s): Ewan Davies, Frédéric Chapoton
vbraun pushed a commit to vbraun/sage that referenced this pull request May 5, 2025
sagemathgh-40036: Fix Generalized Petersen graph name and update others to f-string syntax
    
There is a bug in the naming of the generalized Petersen graphs: the
parameters aren't interpolated into the name string properly. This PR
fixes that bug and updates all names in
`sage.graphs.generators.families` to use f-strings.


### 📝 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.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies
    
URL: sagemath#40036
Reported by: Ewan Davies
Reviewer(s): Ewan Davies, Frédéric Chapoton
vbraun pushed a commit to vbraun/sage that referenced this pull request May 6, 2025
sagemathgh-40036: Fix Generalized Petersen graph name and update others to f-string syntax
    
There is a bug in the naming of the generalized Petersen graphs: the
parameters aren't interpolated into the name string properly. This PR
fixes that bug and updates all names in
`sage.graphs.generators.families` to use f-strings.


### 📝 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.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies
    
URL: sagemath#40036
Reported by: Ewan Davies
Reviewer(s): Ewan Davies, Frédéric Chapoton
@vbraun vbraun merged commit d42a0a9 into sagemath:develop May 11, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants