From 20ba197954764d3b280b4b4b029dca27d799d3ff Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 16:59:53 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.14.14 → v0.15.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.14...v0.15.8) - [github.com/igorshubovych/markdownlint-cli: v0.47.0 → v0.48.0](https://github.com/igorshubovych/markdownlint-cli/compare/v0.47.0...v0.48.0) - [github.com/kynan/nbstripout: 0.9.0 → 0.9.1](https://github.com/kynan/nbstripout/compare/0.9.0...0.9.1) - [github.com/codespell-project/codespell: v2.4.1 → v2.4.2](https://github.com/codespell-project/codespell/compare/v2.4.1...v2.4.2) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index beb44d39c..25e70ee3a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.14 + rev: v0.15.8 hooks: - id: ruff-format types_or: [python, pyi, jupyter] @@ -17,11 +17,11 @@ repos: types_or: [python, pyi, jupyter] args: [--fix] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.47.0 + rev: v0.48.0 hooks: - id: markdownlint-fix - repo: https://github.com/kynan/nbstripout - rev: 0.9.0 + rev: 0.9.1 hooks: - id: nbstripout files: ".ipynb" @@ -36,7 +36,7 @@ repos: - id: pretty-format-toml args: [--autofix, --indent, "4", --no-sort] - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.2 hooks: - id: codespell args: [--ignore-words, .codespell_ignore.txt] From e01bb7af7cc1fc2225d29d3815c653b8fdaa0e2e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 17:00:05 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/user-guide/add-region.ipynb | 8 ++++---- src/muse/outputs/cache.py | 10 ++++++---- tests/test_minimum_service.py | 12 ++++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/user-guide/add-region.ipynb b/docs/user-guide/add-region.ipynb index 8ab1a7911..fcc9c22b1 100644 --- a/docs/user-guide/add-region.ipynb +++ b/docs/user-guide/add-region.ipynb @@ -112,11 +112,11 @@ " )\n", " g = sns.FacetGrid(data=sector_capacity, col=\"region\")\n", " g.map_dataframe(\n", - " lambda data, **kwargs: data.pivot(\n", - " index=\"year\", columns=\"technology\", values=\"capacity\"\n", + " lambda data, **kwargs: (\n", + " data.pivot(index=\"year\", columns=\"technology\", values=\"capacity\")\n", + " .reindex(all_years)\n", + " .plot(kind=\"bar\", stacked=True, ax=plt.gca())\n", " )\n", - " .reindex(all_years)\n", - " .plot(kind=\"bar\", stacked=True, ax=plt.gca())\n", " )\n", " g.add_legend()\n", " g.set_ylabels(\"Capacity (PJ)\")\n", diff --git a/src/muse/outputs/cache.py b/src/muse/outputs/cache.py index 0c00eb093..eb0b8efe1 100644 --- a/src/muse/outputs/cache.py +++ b/src/muse/outputs/cache.py @@ -384,10 +384,12 @@ def check_col(colname: str) -> str: return colname return reduce( - lambda left, right: pd.DataFrame.merge(left, right, how="outer", on=cols) - .T.groupby(check_col) - .last() - .T, + lambda left, right: ( + pd.DataFrame.merge(left, right, how="outer", on=cols) + .T.groupby(check_col) + .last() + .T + ), data, ) diff --git a/tests/test_minimum_service.py b/tests/test_minimum_service.py index c75d74795..50545ff1c 100644 --- a/tests/test_minimum_service.py +++ b/tests/test_minimum_service.py @@ -71,10 +71,14 @@ def test_minimum_service_factor(check_mock, tmp_path, minimum_service_factors): for process, service_factor in zip(processes, minimum_service_factors): supply_process = supply[supply.technology == process] supply_process.loc[:, "min_supply"] = supply_process.apply( - lambda x: x.capacity - * service_factor[x.timeslice] - * float( - techno_out[techno_out.ProcessName == process]["electricity"].values[0] + lambda x: ( + x.capacity + * service_factor[x.timeslice] + * float( + techno_out[techno_out.ProcessName == process]["electricity"].values[ + 0 + ] + ) ), axis=1, )