Skip to content

fix: widen Variable.sum dim parameter type to DimsLike#820

Merged
FBumann merged 1 commit into
PyPSA:masterfrom
manud99:patch-1
Jul 8, 2026
Merged

fix: widen Variable.sum dim parameter type to DimsLike#820
FBumann merged 1 commit into
PyPSA:masterfrom
manud99:patch-1

Conversation

@manud99

@manud99 manud99 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The dim argument in Variable.sum has a too strict type declaration. It also accepts Iterable[Hashable] because it passes the dim argument to BaseExpression.sum. I adapted the type of Variable.sum to fix this imprecision.

Changes proposed in this Pull Request

  • fix: change Variable.sum method parameter type to DimsLike

Checklist

  • AI-generated content is marked (see AGENTS.md).
  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@codspeed-hq

codspeed-hq Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 173 untouched benchmarks
⏩ 173 skipped benchmarks1


Comparing manud99:patch-1 (f8fd994) with master (f759df9)

Open in CodSpeed

Footnotes

  1. 173 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@FBumann FBumann changed the title Change sum method parameter type to DimsLike fix: widen Variable.sum dim parameter type to DimsLike Jul 8, 2026
@FBumann

FBumann commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

@manud99 Thanks for this quick quality fix.

@FBumann FBumann merged commit 125a7c3 into PyPSA:master Jul 8, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants