diff --git a/notebooks/wp4/trend_cordex_cmip6.ipynb b/notebooks/wp4/trend_cordex_cmip6.ipynb index f25dc6f..68b7c84 100644 --- a/notebooks/wp4/trend_cordex_cmip6.ipynb +++ b/notebooks/wp4/trend_cordex_cmip6.ipynb @@ -390,11 +390,9 @@ " ds_trend[f\"{da.name}_climatology\"] = clima\n", " if grid_out is not None:\n", " ds_trend = ds_trend.cf.add_bounds(\n", - " (\n", - " coord\n", - " for coord in (\"longitude\", \"latitude\")\n", - " if coord not in ds_trend.cf.bounds\n", - " )\n", + " coord\n", + " for coord in (\"longitude\", \"latitude\")\n", + " if coord not in ds_trend.cf.bounds\n", " )\n", " ds_trend = diagnostics.regrid(ds_trend, grid_out, **kwargs)\n", " return ds_trend" diff --git a/pyproject.toml b/pyproject.toml index 87b677a..a3e1631 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,8 +51,11 @@ select = [ # isort "I", # pydocstyle - "D" + "D", + # pyupgrade + "UP" ] +target-version = "py310" [tool.setuptools] packages = ["c3s_eqc_toolbox_template"] diff --git a/scripts/jupyter_server.py b/scripts/jupyter_server.py index 0d9ee92..3a9c502 100644 --- a/scripts/jupyter_server.py +++ b/scripts/jupyter_server.py @@ -5,7 +5,6 @@ import pathlib import subprocess import urllib.parse -from typing import Optional logging.basicConfig(level=logging.INFO) @@ -18,11 +17,11 @@ raise ValueError(f"Working directory must be {expected_dir}") -def get_jupyter_server_url(wd_path: pathlib.Path) -> Optional[urllib.parse.ParseResult]: +def get_jupyter_server_url(wd_path: pathlib.Path) -> urllib.parse.ParseResult | None: cmd = ["jupyter", "lab", "list"] proc = subprocess.run(cmd, capture_output=True, check=True, text=True) for line in proc.stdout.splitlines()[1:]: - jupyter_url, jupyter_dir = [segment.strip() for segment in line.split("::")] + jupyter_url, jupyter_dir = (segment.strip() for segment in line.split("::")) if pathlib.Path(jupyter_dir) == wd_path: return urllib.parse.urlparse(jupyter_url) return None