Skip to content

Commit

Permalink
chore: Update pre-commit (#771)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Nov 28, 2024
1 parent fb6fd20 commit 2bfbeea
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: check-json
- id: detect-private-key
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.8.0
hooks:
- id: ruff
files: geoviews/
Expand Down
11 changes: 5 additions & 6 deletions geoviews/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
from .util import from_xarray

__all__ = (
"RGB",
"WMTS",
"Contours",
"Cycle",
"Dataset",
Expand Down Expand Up @@ -84,7 +86,6 @@
"Points",
"Polygons",
"QuadMesh",
"RGB",
"Rectangles",
"Segments",
"Shape",
Expand All @@ -93,26 +94,24 @@
"Tiles",
"TriMesh",
"VectorField",
"WMTS",
"WindBarbs",
"__version__",
"annotate", # Lazy modules
"data",
"dim",
"extension",
"feature",
"from_xarray",
"help",
"operation", # Lazy modules
"opts",
"output",
"plotting",
"project", # Lazy modules
"render",
"renderer",
"save",
"tile_sources",
# Lazy modules
"annotate",
"project",
"operation",
)

# Ensure opts utility is initialized with GeoViews elements
Expand Down
4 changes: 2 additions & 2 deletions geoviews/_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from packaging.version import Version

__all__ = (
"deprecated",
"find_stack_level",
"GeoviewsDeprecationWarning",
"GeoviewsUserWarning",
"deprecated",
"find_stack_level",
"warn",
)

Expand Down
2 changes: 1 addition & 1 deletion geoviews/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .geopandas import GeoPandasInterface
from .iris import CubeInterface

__all__ = ("GeomDictInterface", "GeoPandasInterface", "CubeInterface")
__all__ = ("CubeInterface", "GeoPandasInterface", "GeomDictInterface")
7 changes: 3 additions & 4 deletions geoviews/data/geom_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ def validate(cls, dataset, validate_vdims):
from shapely.geometry.base import BaseGeometry
geom_dims = cls.geom_dims(dataset)
if len(geom_dims) != 2:
raise DataError('Expected %s instance to declare two key '
raise DataError(f'Expected {type(dataset).__name__} instance to declare two key '
'dimensions corresponding to the geometry '
'coordinates but %d dimensions were found '
'which did not refer to any columns.'
% (type(dataset).__name__, len(geom_dims)), cls)
f'coordinates but {len(geom_dims)} dimensions were found '
'which did not refer to any columns.', cls)
elif 'geometry' not in dataset.data:
raise DataError("Could not find a 'geometry' column in the data.")
elif not isinstance(dataset.data['geometry'], BaseGeometry):
Expand Down
7 changes: 3 additions & 4 deletions geoviews/data/geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ def validate(cls, dataset, vdims=True):
dim_types = 'key' if vdims else 'all'
geom_dims = cls.geom_dims(dataset)
if len(geom_dims) > 0 and len(geom_dims) != 2:
raise DataError('Expected %s instance to declare two key '
raise DataError(f'Expected {type(dataset).__name__} instance to declare two key '
'dimensions corresponding to the geometry '
'coordinates but %d dimensions were found '
'which did not refer to any columns.'
% (type(dataset).__name__, len(geom_dims)), cls)
f'coordinates but {len(geom_dims)} dimensions were found '
'which did not refer to any columns.', cls)
not_found = [d.name for d in dataset.dimensions(dim_types)
if d not in geom_dims and d.name not in dataset.data]
if not_found:
Expand Down
4 changes: 2 additions & 2 deletions geoviews/element/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
)

__all__ = (
"RGB",
"WMTS",
"Contours",
"Dataset",
"EdgePaths",
Expand All @@ -54,15 +56,13 @@
"Points",
"Polygons",
"QuadMesh",
"RGB",
"Rectangles",
"Segments",
"Shape",
"Text",
"Tiles",
"TriMesh",
"VectorField",
"WMTS",
"WindBarbs",
"is_geographic",
)
Expand Down
2 changes: 1 addition & 1 deletion geoviews/operation/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ def clean_weight_files(cls):
deleted.append(f)
except FileNotFoundError:
pass
print('Deleted %d weight files' % len(deleted))
print(f'Deleted {len(deleted)} weight files')
cls._files = []

0 comments on commit 2bfbeea

Please sign in to comment.