Skip to content
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

[pre-commit.ci] pre-commit autoupdate #261

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exclude: ^(LICENSES|README.md)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
Expand All @@ -20,7 +20,7 @@ repos:

# Sort package imports alphabetically
- repo: https://github.com/PyCQA/isort
rev: 5.13.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
Expand All @@ -36,7 +36,7 @@ repos:

# Formatting with "black" coding style
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.10.0
hooks:
# Format Python files
- id: black
Expand All @@ -45,21 +45,21 @@ repos:

# Do YAML formatting (before the linter checks it for misses)
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
rev: v2.14.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --preserve-quotes]

# Use yamllint to check for valid YAML files and list syntax errors
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
rev: v1.35.1
hooks:
- id: yamllint
args: [--format, parsable, -c=.yamllint]

# Format Snakemake rule / workflow files
- repo: https://github.com/snakemake/snakefmt
rev: v0.8.5
rev: v0.10.2
hooks:
- id: snakefmt

Expand Down
18 changes: 10 additions & 8 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ rule prepare_sector_networks:
RDIR
+ "/prenetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}.nc",
**config["scenario"],
**config["costs"]
**config["costs"],
),


Expand All @@ -107,7 +107,7 @@ rule override_res_all_nets:
+ "/prenetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_presec.nc",
**config["scenario"],
**config["costs"],
**config["export"]
**config["export"],
),


Expand All @@ -118,7 +118,7 @@ rule solve_all_networks:
+ "/postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_{h2export}export.nc",
**config["scenario"],
**config["costs"],
**config["export"]
**config["export"],
),


Expand Down Expand Up @@ -212,9 +212,11 @@ rule prepare_sector_network:
+ RDIR_PE
+ "bus_regions/regions_onshore_elec_s{simpl}_{clusters}.geojson"
),
pipelines="data_custom/pipelines.csv"
if config["custom_data"]["gas_network"]
else "resources/gas_networks/gas_network_elec_s{simpl}_{clusters}.csv",
pipelines=(
"data_custom/pipelines.csv"
if config["custom_data"]["gas_network"]
else "resources/gas_networks/gas_network_elec_s{simpl}_{clusters}.csv"
),
output:
RDIR
+ "/prenetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}.nc",
Expand Down Expand Up @@ -596,15 +598,15 @@ rule make_summary:
+ "/postnetworks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}_{planning_horizons}_{discountrate}_{demand}_{h2export}export.nc",
**config["scenario"],
**config["costs"],
**config["export"]
**config["export"],
),
costs=CDIR + "costs_{planning_horizons}.csv",
plots=expand(
RDIR
+ "/maps/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}_{sopts}-costs-all_{planning_horizons}_{discountrate}_{demand}_{h2export}export.pdf",
**config["scenario"],
**config["costs"],
**config["export"]
**config["export"],
),
output:
nodal_costs=SDIR + "/csvs/nodal_costs.csv",
Expand Down
20 changes: 10 additions & 10 deletions scripts/build_base_energy_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def calc_sector(sector):
energy_totals_base.at[country, "total domestic aviation"] = np.NaN

elif sector == "navigation":
energy_totals_base.at[
country, "total international navigation"
] = np.NaN
energy_totals_base.at[country, "total international navigation"] = (
np.NaN
)
energy_totals_base.at[country, "total domestic navigation"] = np.NaN

_logger.warning("No data for " + country + " in the sector " + sector + ".")
Expand Down Expand Up @@ -274,13 +274,13 @@ def calc_sector(sector):
)

elif sector == "navigation":
energy_totals_base.at[
country, "total international navigation"
] = round(
df_sector[
df_sector.Transaction == "International marine bunkers"
].Quantity_TWh.sum(),
4,
energy_totals_base.at[country, "total international navigation"] = (
round(
df_sector[
df_sector.Transaction == "International marine bunkers"
].Quantity_TWh.sum(),
4,
)
)
energy_totals_base.at[country, "total domestic navigation"] = round(
df_sector[
Expand Down
12 changes: 6 additions & 6 deletions scripts/build_industrial_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ def create_cement_db():
)
avg_c_cap = df_cement.groupby(df_cement.country)["capacity"].mean()
df_cement["capacity"] = df_cement.apply(
lambda x: avg_c_cap[x["country"]]
if math.isnan(x["capacity"])
else x["capacity"],
lambda x: (
avg_c_cap[x["country"]] if math.isnan(x["capacity"]) else x["capacity"]
),
axis=1,
)

Expand Down Expand Up @@ -468,9 +468,9 @@ def create_paper_df():
na_index

df_paper["capacity"] = df_paper.apply(
lambda x: avg_c_cap[x["country"]]
if math.isnan(x["capacity"])
else x["capacity"],
lambda x: (
avg_c_cap[x["country"]] if math.isnan(x["capacity"]) else x["capacity"]
),
axis=1,
)

Expand Down
8 changes: 5 additions & 3 deletions scripts/plot_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,11 @@ def plot_balances():

# remove trailing link ports
df.index = [
i[:-1]
if ((i != "co2") and (i != "H2") and (i[-1:] in ["0", "1", "2", "3"]))
else i
(
i[:-1]
if ((i != "co2") and (i != "H2") and (i[-1:] in ["0", "1", "2", "3"]))
else i
)
for i in df.index
]

Expand Down
6 changes: 3 additions & 3 deletions scripts/prepare_airports.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def download_airports():

df.insert(2, "airport_size_nr", 1)
df.loc[df["type"].isin(["medium_airport"]), "airport_size_nr"] = 1
df.loc[
df["type"].isin(["large_airport"]), "airport_size_nr"
] = snakemake.params.airport_sizing_factor
df.loc[df["type"].isin(["large_airport"]), "airport_size_nr"] = (
snakemake.params.airport_sizing_factor
)

# Calculate the number of total airports size
df1 = df.copy()
Expand Down
Loading