Skip to content

Consider surface constants and coordinates to be a Sequence, not an Iterable#926

Merged
MicahGale merged 6 commits intominor-rel-devfrom
number_sequence
Mar 10, 2026
Merged

Consider surface constants and coordinates to be a Sequence, not an Iterable#926
MicahGale merged 6 commits intominor-rel-devfrom
number_sequence

Conversation

@tjlaboss
Copy link
Collaborator

@tjlaboss tjlaboss commented Mar 10, 2026

Pull Request Checklist for MontePy

Description

Previously, the type checker verified that surface coordinates and coefficients were instances of Iterable. This was overly permissive, as it would allow objects like sets and generators to be used. Now, they only allowed to be instances of Sequence, which has a definite order and length.

Fixes #914


General Checklist

  • I have performed a self-review of my own code.
  • The code follows the standards outlined in the development documentation.
  • I have formatted my code with black version 25 or 26.
  • I have added tests that prove my fix is effective or that my feature works (if applicable).

LLM Disclosure

  1. Are you?

    • A human user
  2. Were any large language models (LLM or "AI") used in to generate any of this code?

  • No

Additional Notes for Reviewers

Ensure that:

  • This PR fully addresses and resolves the referenced issue(s).
  • The submitted code is consistent with the merge checklist outlined here.
  • The PR covers all relevant aspects according to the development guidelines.
  • 100% coverage of the patch is achieved, or justification for a variance is given.

📚 Documentation preview 📚: https://montepy--926.org.readthedocs.build/en/926/

@tjlaboss tjlaboss added the code improvement A feature request that will improve the software and its maintainability, but be invisible to users. label Mar 10, 2026
Copy link
Collaborator

@MicahGale MicahGale left a comment

Choose a reason for hiding this comment

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

Looks pretty good. Changelog isn't necessary. Probably should go through the entire code base too.

@tjlaboss
Copy link
Collaborator Author

Not sure why black is failing:

$ python -m black tests/
All done! ✨ 🍰 ✨
33 files left unchanged.
$ python -m black --version
python -m black, 25.1.0 (compiled: yes)
Python (CPython) 3.13.2

Probably should go through the entire code base too.

Every other use of Iterable was appropriate. Only these needed to be Sequence specifically.

@tjlaboss tjlaboss requested a review from MicahGale March 10, 2026 20:12
@tjlaboss
Copy link
Collaborator Author

Perhaps it is time to revise the black behavior in CI; black 25.1 is now too far out of date to pass the test.

@MicahGale
Copy link
Collaborator

Perhaps it is time to revise the black behavior in CI; black 25.1 is now too far out of date to pass the test.

Yeah let's make an issue to make the CI job just commit the changes if needed.

Copy link
Collaborator

@MicahGale MicahGale left a comment

Choose a reason for hiding this comment

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

LGTM.

@MicahGale MicahGale merged commit 894135e into minor-rel-dev Mar 10, 2026
22 checks passed
@MicahGale MicahGale deleted the number_sequence branch March 10, 2026 20:33
@MicahGale
Copy link
Collaborator

FYI #914 won't auto-close. You should keep an eye on this @tjlaboss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code improvement A feature request that will improve the software and its maintainability, but be invisible to users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants