From ddd6f547c88d27eb1658cdc73d43f7fcd875745b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:20:44 +0000 Subject: [PATCH 1/2] chore: update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.1) - [github.com/python-jsonschema/check-jsonschema: 0.30.0 → 0.31.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.30.0...0.31.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4853087f..2419df4d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: additional_dependencies: [black==24.*] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.8.6" + rev: "v0.9.1" hooks: - id: ruff types: [file, python] @@ -91,7 +91,7 @@ repos: # Forbid files which have a UTF-8 Unicode replacement character. - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.30.0 + rev: 0.31.0 hooks: - id: check-dependabot - id: check-github-workflows From 88a3e6eeeadb92ee2dd0ebe6e752c96bb1b6db6f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:21:11 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/src/conf.py | 6 +++--- src/geovista/bridge.py | 3 +-- src/geovista/cli.py | 12 ++++++------ src/geovista/core.py | 7 +++---- src/geovista/geodesic.py | 2 +- src/geovista/geoplotter.py | 3 +-- src/geovista/transform.py | 6 +++--- tests/pantry/meshes/test__points_cells.py | 3 +-- 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/docs/src/conf.py b/docs/src/conf.py index f286d12f..0bf92648 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -90,7 +90,7 @@ def autolog(message: str, section: str | None = None, color: str | None = None) color = "brown" section = colorize(color, colorize("bold", f"[{section}] ")) if section else "" - msg = f'{colorize(color, section)}{colorize("darkblue", f"{message}")}' + msg = f"{colorize(color, section)}{colorize('darkblue', f'{message}')}" logger.info(msg) @@ -199,7 +199,7 @@ def autolog(message: str, section: str | None = None, color: str | None = None) rst_epilog = f""" .. |gv_version| replace:: v{version} -.. |build_date| replace:: ({now.strftime('%Y-%m-%d')}) +.. |build_date| replace:: ({now.strftime("%Y-%m-%d")}) """ # docs src directory @@ -435,7 +435,7 @@ def autolog(message: str, section: str | None = None, color: str | None = None) } html_theme_options = { - "extra_footer": f'Made with ❤️ and ☕ on {now.strftime("%b %d %Y")}.', + "extra_footer": f"Made with ❤️ and ☕ on {now.strftime('%b %d %Y')}.", "icon_links": [ { "name": "GitHub Discussions", diff --git a/src/geovista/bridge.py b/src/geovista/bridge.py index e7223954..4a4cbde0 100644 --- a/src/geovista/bridge.py +++ b/src/geovista/bridge.py @@ -223,8 +223,7 @@ def _contiguous(bnds: ArrayLike, kind: str) -> np.ndarray: if not np.allclose(left, right): emsg = ( - f"The {kind} bounds array, shape '{bnds.shape}', is not " - "contiguous." + f"The {kind} bounds array, shape '{bnds.shape}', is not contiguous." ) raise ValueError(emsg) diff --git a/src/geovista/cli.py b/src/geovista/cli.py index a52d3312..28b8a35f 100644 --- a/src/geovista/cli.py +++ b/src/geovista/cli.py @@ -94,7 +94,7 @@ def _download_group( click.echo(f"Downloading {n_fnames} {name}registered asset{_plural(n_fnames)}:") for i, fname in enumerate(fnames): - click.echo(f"[{i+1:0{width}d}/{n_fnames}] Downloading ", nl=False) + click.echo(f"[{i + 1:0{width}d}/{n_fnames}] Downloading ", nl=False) click.secho(f"{fname} ", nl=False, fg=fg_colour) click.echo("... ", nl=False) processor = None @@ -360,7 +360,7 @@ def collect(prefix: str) -> list[str]: unavailable = 0 click.echo("Verifying remote availability of registered assets:") for i, fname in enumerate(fnames): - click.echo(f"[{i+1:0{width}d}/{n_fnames}] ", nl=False) + click.echo(f"[{i + 1:0{width}d}/{n_fnames}] ", nl=False) click.secho(f"{fname} ", nl=False, fg=fg_colour) click.echo("is ... ", nl=False) status, status_fg_colour = ( @@ -396,14 +396,14 @@ def collect(prefix: str) -> list[str]: if dry_run: click.echo("URLs of registered assets:") for i, fname in enumerate(fnames): - click.echo(f"[{i+1:0{width}d}/{n_fnames}] ", nl=False) + click.echo(f"[{i + 1:0{width}d}/{n_fnames}] ", nl=False) click.secho(f"{CACHE.get_url(fname)}", fg=fg_colour) click.echo("\n👍 All done!") if show: click.echo("Names of registered assets:") for i, fname in enumerate(fnames): - click.echo(f"[{i+1:0{width}d}/{n_fnames}] ", nl=False) + click.echo(f"[{i + 1:0{width}d}/{n_fnames}] ", nl=False) click.secho(f"{fname}", fg=fg_colour) click.echo("\n👍 All done!") @@ -478,7 +478,7 @@ def examples( if run_all: for i, script in enumerate(EXAMPLES[1:]): - msg = f"Running example {script!r} ({i+1} of {n_examples}) ..." + msg = f"Running example {script!r} ({i + 1} of {n_examples}) ..." click.secho(msg, fg="green") module = importlib.import_module(f"geovista.examples.{script}") if verbose: @@ -494,7 +494,7 @@ def examples( group = [script for script in EXAMPLES[1:] if script.startswith(run_group)] n_group = len(group) for i, script in enumerate(group): - msg = f"Running {run_group!r} example {script!r} ({i+1} of {n_group}) ..." + msg = f"Running {run_group!r} example {script!r} ({i + 1} of {n_group}) ..." click.secho(msg, fg="green") module = importlib.import_module(f"geovista.examples.{script}") if verbose: diff --git a/src/geovista/core.py b/src/geovista/core.py index e677c0d6..a3612deb 100644 --- a/src/geovista/core.py +++ b/src/geovista/core.py @@ -384,21 +384,20 @@ def combine( if not isinstance(mesh, pv.PolyData): emsg = ( f"Can only combine 'pyvista.PolyData' meshes, input mesh " - f"#{i+1} has type '{mesh.__class__.__name__}'." + f"#{i + 1} has type '{mesh.__class__.__name__}'." ) raise TypeError(emsg) if mesh.n_lines: emsg = ( - f"Can only combine meshes with cells, input mesh #{i+1} " + f"Can only combine meshes with cells, input mesh #{i + 1} " "contains lines." ) raise TypeError(emsg) if mesh.n_cells == 0: emsg = ( - f"Can only combine meshes with cells, input mesh #{i+1} " - "has no cells." + f"Can only combine meshes with cells, input mesh #{i + 1} has no cells." ) raise TypeError(emsg) diff --git a/src/geovista/geodesic.py b/src/geovista/geodesic.py index c5910417..8d4ecbaf 100644 --- a/src/geovista/geodesic.py +++ b/src/geovista/geodesic.py @@ -1130,7 +1130,7 @@ def panel( if idx not in range(N_PANELS): emsg = ( f"Panel index must be in the closed interval " - f"[0, {N_PANELS-1}], got '{idx}'." + f"[0, {N_PANELS - 1}], got '{idx}'." ) raise ValueError(emsg) diff --git a/src/geovista/geoplotter.py b/src/geovista/geoplotter.py index 9d2ac901..7a36b079 100644 --- a/src/geovista/geoplotter.py +++ b/src/geovista/geoplotter.py @@ -1133,8 +1133,7 @@ def add_points( if style not in ADD_POINTS_STYLE: options = "or ".join(f"{option!r}" for option in ADD_POINTS_STYLE) emsg = ( - f"Invalid 'style' for 'add_points', expected {options}, " - f"got {style!r}." + f"Invalid 'style' for 'add_points', expected {options}, got {style!r}." ) raise ValueError(emsg) diff --git a/src/geovista/transform.py b/src/geovista/transform.py index faaa4ae8..498ec92f 100644 --- a/src/geovista/transform.py +++ b/src/geovista/transform.py @@ -358,9 +358,9 @@ def combine(xs: ArrayLike, ys: ArrayLike, zs: ArrayLike | None = None) -> ArrayL ys = np.atleast_1d(ys) zs = np.zeros_like(xs) if zs is None else np.atleast_1d(zs) - assert ( - xs.shape == ys.shape == zs.shape - ), "Cannot combine points, non-uniform shapes." + assert xs.shape == ys.shape == zs.shape, ( + "Cannot combine points, non-uniform shapes." + ) return np.vstack([xs, ys, zs]).T diff --git a/tests/pantry/meshes/test__points_cells.py b/tests/pantry/meshes/test__points_cells.py index bce3f5c2..df41ae07 100644 --- a/tests/pantry/meshes/test__points_cells.py +++ b/tests/pantry/meshes/test__points_cells.py @@ -23,8 +23,7 @@ def test_cloud_amount(preference): def test_cloud_amount__preference_bad(): """Test bad preference for cloud amount mesh.""" emsg = ( - "Expected a preference of 'low' or 'medium' or 'high' or 'very_high' " - "or 'mesh'." + "Expected a preference of 'low' or 'medium' or 'high' or 'very_high' or 'mesh'." ) with pytest.raises(ValueError, match=emsg): _ = meshes.cloud_amount(preference="bad")