Skip to content

Commit

Permalink
pyupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Jul 14, 2023
1 parent cad4545 commit 363e27b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 3 additions & 5 deletions notebooks/wp4/trend_cordex_cmip6.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ select = [
# isort
"I",
# pydocstyle
"D"
"D",
# pyupgrade
"UP"
]
target-version = "py310"

[tool.setuptools]
packages = ["c3s_eqc_toolbox_template"]
Expand Down
5 changes: 2 additions & 3 deletions scripts/jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pathlib
import subprocess
import urllib.parse
from typing import Optional

logging.basicConfig(level=logging.INFO)

Expand All @@ -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
Expand Down

0 comments on commit 363e27b

Please sign in to comment.