Skip to content

Commit

Permalink
Run lint
Browse files Browse the repository at this point in the history
ruff hvplot --select=UP --target-version=py38 --fix
  • Loading branch information
hoxbro committed Aug 29, 2023
1 parent 8a7d90e commit d3946bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
27 changes: 13 additions & 14 deletions hvplot/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ def __init__(
if self.geo:
if self.kind not in self._geo_types:
param.main.param.warning(
"geo option cannot be used with kind=%r plot "
f"geo option cannot be used with kind={self.kind!r} plot "
"type. Geographic plots are only supported for "
"following plot types: %r" % (self.kind, self._geo_types))
f"following plot types: {self._geo_types!r}")
from cartopy import crs as ccrs
from geoviews.util import project_extents

Expand All @@ -436,7 +436,7 @@ def __init__(
else:
raise ValueError(
"Projection must be defined as cartopy CRS or "
"one of the following CRS string:\n {}".format(all_crs))
f"one of the following CRS string:\n {all_crs}")

projection = projection or (ccrs.GOOGLE_MERCATOR if tiles else self.crs)
if tiles and projection != ccrs.GOOGLE_MERCATOR:
Expand Down Expand Up @@ -664,8 +664,8 @@ def _process_crs(self, data, crs):
# only raise error if crs was specified in kwargs
if crs:
raise ValueError(
"'{}' must be either a valid crs or an reference to "
"a `data.attr` containing a valid crs.".format(crs))
f"'{crs}' must be either a valid crs or an reference to "
"a `data.attr` containing a valid crs.")

def _process_data(self, kind, data, x, y, by, groupby, row, col,
use_dask, persist, backlog, label, group_label,
Expand Down Expand Up @@ -851,14 +851,14 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col,
groupby.append(data_dim)
self.variables = list(data.coords) + data_vars
if groupby and not_found:
raise ValueError('The supplied groupby dimension(s) %s '
raise ValueError(f'The supplied groupby dimension(s) {not_found} '
'could not be found, expected one or '
'more of: %s' % (not_found, list(data.coords)))
f'more of: {list(data.coords)}')
else:
if gridded and kind not in ('points', 'dataset'):
raise ValueError('%s plot type requires gridded data, '
raise ValueError(f'{kind} plot type requires gridded data, '
'e.g. a NumPy array or xarray Dataset, '
'found %s type' % (kind, type(self.data).__name__))
f'found {type(self.data).__name__} type')

if hasattr(data, 'columns') and hasattr(data.columns, 'name') and data.columns.name and not group_label:
group_label = data.columns.name
Expand Down Expand Up @@ -903,9 +903,9 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col,
not_found = [g for g in groupby+by_cols if g not in list(self.data.columns)+indexes]
not_found, self.data = process_derived_datetime_pandas(self.data, not_found, indexes)
if groupby and not_found:
raise ValueError('The supplied groupby dimension(s) %s '
raise ValueError(f'The supplied groupby dimension(s) {not_found} '
'could not be found, expected one or '
'more of: %s' % (not_found, list(self.data.columns)))
f'more of: {list(self.data.columns)}')

if transforms:
self.data = Dataset(self.data, indexes).transform(**transforms).data
Expand Down Expand Up @@ -967,7 +967,7 @@ def _process_data(self, kind, data, x, y, by, groupby, row, col,
except Exception as e:
if attr_labels is True:
param.main.param.warning('Unable to auto label using xarray attrs '
'because {e}'.format(e=e))
f'because {e}')

def _process_plot(self):
kind = self.kind
Expand Down Expand Up @@ -1387,8 +1387,7 @@ def _apply_layers(self, obj):

if self.tiles:
tile_source = 'EsriImagery' if self.tiles == 'ESRI' else self.tiles
warning = ("%s tiles not recognized, must be one of: %s or a tile object" %
(tile_source, sorted(hv.element.tile_sources)))
warning = ("{} tiles not recognized, must be one of: {} or a tile object".format(tile_source, sorted(hv.element.tile_sources)))
if tile_source is True:
tiles = hv.element.tiles.OSM()
elif tile_source in hv.element.tile_sources.keys():
Expand Down
4 changes: 2 additions & 2 deletions hvplot/plotting/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def __getattribute__(self, name):
if "kind" in plot_opts and name in HoloViewsConverter._kind_mapping:
param.main.param.warning(
"Custom options for existing plot types should not "
"declare the 'kind' argument. The .%s plot method "
"was unexpectedly customized with kind=%r." % (plot_opts["kind"], name)
"declare the 'kind' argument. The .{} plot method "
"was unexpectedly customized with kind={!r}.".format(plot_opts["kind"], name)
)
plot_opts["kind"] = name
return hvPlotBase(self._data, **dict(self._metadata, **plot_opts))
Expand Down
6 changes: 2 additions & 4 deletions hvplot/plotting/scatter_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ def scatter_matrix(data, c=None, chart='scatter', diagonal='hist',
data = _hv.Dataset(_convert_col_names_to_str(data))
supported = list(HoloViewsConverter._kind_mapping)
if diagonal not in supported:
raise ValueError('diagonal type must be one of: %s, found %s' %
(supported, diagonal))
raise ValueError(f'diagonal type must be one of: {supported}, found {diagonal}')
if chart not in supported:
raise ValueError('Chart type must be one of: %s, found %s' %
(supported, chart))
raise ValueError(f'Chart type must be one of: {supported}, found {chart}')
diagonal = HoloViewsConverter._kind_mapping[diagonal]
chart = HoloViewsConverter._kind_mapping[chart]

Expand Down
2 changes: 1 addition & 1 deletion hvplot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def check_crs(crs):
try:
crs_type = pyproj.crs.CRS
except AttributeError:
class Dummy():
class Dummy:
pass
crs_type = Dummy

Expand Down

0 comments on commit d3946bb

Please sign in to comment.