calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
276 stars 89 forks source link

Add pyupgrade to ruff config #631

Closed brynpickering closed 2 days ago

brynpickering commented 2 days ago

Fixes all our outdated Python syntax.

Thanks to @irm-codebase for pointing to pyupgrade. I think it's worth having it in our core config as it will keep our code cleaner and easier to review/maintain.

Summary of changes in this pull request

Reviewer checklist

codecov[bot] commented 2 days ago

Codecov Report

Attention: Patch coverage is 92.30769% with 5 lines in your changes missing coverage. Please review.

Project coverage is 95.40%. Comparing base (b7faf2c) to head (6a08c9e). Report is 1 commits behind head on main.

:exclamation: Current head 6a08c9e differs from pull request most recent head 459ee05

Please upload reports for the commit 459ee05 to get more accurate results.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #631 +/- ## ========================================== + Coverage 95.35% 95.40% +0.05% ========================================== Files 24 24 Lines 3656 3657 +1 Branches 801 732 -69 ========================================== + Hits 3486 3489 +3 + Misses 82 81 -1 + Partials 88 87 -1 ``` | [Files](https://app.codecov.io/gh/calliope-project/calliope/pull/631?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project) | Coverage Δ | | |---|---|---| | [src/calliope/attrdict.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fattrdict.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2F0dHJkaWN0LnB5) | `96.48% <100.00%> (-0.02%)` | :arrow_down: | | [src/calliope/backend/backend\_model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fbackend_model.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvYmFja2VuZF9tb2RlbC5weQ==) | `98.09% <100.00%> (+<0.01%)` | :arrow_up: | | [src/calliope/backend/expression\_parser.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fexpression_parser.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvZXhwcmVzc2lvbl9wYXJzZXIucHk=) | `93.53% <100.00%> (+0.01%)` | :arrow_up: | | [src/calliope/backend/helper\_functions.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fhelper_functions.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvaGVscGVyX2Z1bmN0aW9ucy5weQ==) | `96.86% <100.00%> (+0.01%)` | :arrow_up: | | [src/calliope/backend/latex\_backend\_model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Flatex_backend_model.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvbGF0ZXhfYmFja2VuZF9tb2RlbC5weQ==) | `96.32% <100.00%> (ø)` | | | [src/calliope/backend/parsing.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fparsing.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvcGFyc2luZy5weQ==) | `96.03% <100.00%> (+0.01%)` | :arrow_up: | | [src/calliope/backend/pyomo\_backend\_model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fpyomo_backend_model.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvcHlvbW9fYmFja2VuZF9tb2RlbC5weQ==) | `95.60% <100.00%> (+0.01%)` | :arrow_up: | | [src/calliope/backend/where\_parser.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fbackend%2Fwhere_parser.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2JhY2tlbmQvd2hlcmVfcGFyc2VyLnB5) | `97.30% <100.00%> (+0.01%)` | :arrow_up: | | [src/calliope/exceptions.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fexceptions.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2V4Y2VwdGlvbnMucHk=) | `96.96% <100.00%> (-0.09%)` | :arrow_down: | | [src/calliope/io.py](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree&filepath=src%2Fcalliope%2Fio.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2lvLnB5) | `96.84% <ø> (-0.04%)` | :arrow_down: | | ... and [10 more](https://app.codecov.io/gh/calliope-project/calliope/pull/631?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project) | |
irm-codebase commented 2 days ago

Please update the CHANGELOG (adding it to the other linting update should be enough, imo).