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

chore: update pre-commit hooks #1265

Merged
merged 2 commits into from
Jan 13, 2025
Merged
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions src/geovista/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions src/geovista/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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!")

Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions src/geovista/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/geovista/geodesic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions src/geovista/geoplotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions src/geovista/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions tests/pantry/meshes/test__points_cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading