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

Maint update #5943

Merged
merged 3 commits into from
Oct 17, 2023
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
11 changes: 7 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: check-yaml
exclude: conda.recipe/meta.yaml
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
exclude: \.min\.js$
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.0
hooks:
- id: ruff
args: [holoviews]
Expand Down
8 changes: 4 additions & 4 deletions holoviews/core/data/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def concat_dim(cls, datasets, dim, vdims):
shapes = {arr.shape for arr in arrays}
if len(shapes) > 1:
raise DataError('When concatenating gridded data the shape '
'of arrays must match. {} found that arrays '
'along the {} dimension do not match.'.format(cls.__name__, vdim.name))
f'of arrays must match. {cls.__name__} found that arrays '
f'along the {vdim.name} dimension do not match.')
stack = dask_array_module().stack if any(is_dask(arr) for arr in arrays) else np.stack
new_data[vdim.name] = stack(arrays, -1)
return new_data
Expand Down Expand Up @@ -570,8 +570,8 @@ def select(cls, dataset, selection_mask=None, **selection):
raise IndexError(f"Index {ind} less than lower bound "
f"of {emin} for {dim} dimension.")
elif ind >= emax:
raise IndexError("Index {} more than or equal to upper bound "
"of {} for {} dimension.".format(ind, emax, dim))
raise IndexError(f"Index {ind} more than or equal to upper bound "
f"of {emax} for {dim} dimension.")
idx = max([np.digitize([ind], edges)[0]-1, 0])
mask = np.zeros(len(values), dtype=np.bool_)
mask[idx] = True
Expand Down
4 changes: 2 additions & 2 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,8 +1790,8 @@ def stream_parameters(streams, no_duplicates=True, exclude=None):
clashes = sorted(clashes)
if clashes:
clashing = ', '.join([repr(c) for c in clash_streams[:-1]])
raise Exception('The supplied stream objects {} and {} '
'clash on the following parameters: {!r}'.format(clashing, clash_streams[-1], clashes))
raise Exception(f'The supplied stream objects {clashing} and {clash_streams[-1]} '
f'clash on the following parameters: {clashes!r}')
return [name for group in param_groups.values() for name in group
if name not in exclude]

Expand Down
4 changes: 2 additions & 2 deletions holoviews/element/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def __init__(self, data=None, kdims=None, vdims=None, **params):
if isinstance(data, MercatorTileSource):
data = data.url
elif data is not None and not isinstance(data, (str, dict)):
raise TypeError('{} data should be a tile service URL or '
'xyzservices.TileProvider not a {} type.'.format(type(self).__name__, type(data).__name__) )
raise TypeError(f'{type(self).__name__} data should be a tile service URL or '
f'xyzservices.TileProvider not a {type(data).__name__} type.' )
super().__init__(data, kdims=kdims, vdims=vdims, **params)

def range(self, dim, data_range=True, dimension_range=True):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def _select(element, selection_expr, cache=None):
except KeyError as e:
key_error = str(e).replace('"', '').replace('.', '')
raise CallbackError("linked_selection aborted because it could not "
"display selection for all elements: {} on '{!r}'.".format(key_error, element))
f"display selection for all elements: {key_error} on '{element!r}'.")
except Exception as e:
raise CallbackError("linked_selection aborted because it could not "
"display selection for all elements: %s." % e)
Expand Down
4 changes: 2 additions & 2 deletions holoviews/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ def _options_error(cls, opt, objtype, backend, valid_options):
return

if matches:
raise ValueError('Unexpected option {!r} for {} type '
raise ValueError(f'Unexpected option {opt!r} for {objtype} type '
'across all extensions. Similar options '
'for current extension ({!r}) are: {}.'.format(opt, objtype, current_backend, matches))
f'for current extension ({current_backend!r}) are: {matches}.')
else:
raise ValueError(f'Unexpected option {opt!r} for {objtype} type '
'across all extensions. No similar options found.')
Expand Down
12 changes: 6 additions & 6 deletions holoviews/util/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,13 @@ def apply(self, dataset, flat=False, expanded=None, ranges=None, all_values=Fals
"present on the supplied object.")
if not self.interface_applies(dataset, coerce=self.coerce):
if self.coerce:
raise ValueError("The expression {!r} assumes a {}-like "
"API but the dataset contains {} data "
"and cannot be coerced.".format(self, self.namespace, dataset.interface.datatype))
raise ValueError(f"The expression {self!r} assumes a {self.namespace}-like "
f"API but the dataset contains {dataset.interface.datatype} data "
"and cannot be coerced.")
else:
raise ValueError("The expression {!r} assumes a {}-like "
"API but the dataset contains {} data "
"and coercion is disabled.".format(self, self.namespace, dataset.interface.datatype))
raise ValueError(f"The expression {self!r} assumes a {self.namespace}-like "
f"API but the dataset contains {dataset.interface.datatype} data "
"and coercion is disabled.")

if isinstance(dataset, Graph):
if dimension in dataset.kdims and all_values:
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import json
import os
import sys
import shutil

from setuptools import setup, find_packages
import sys

import pyct.build
from setuptools import find_packages, setup

setup_args = {}
install_requires = [
Expand Down Expand Up @@ -208,7 +207,7 @@ def get_setup_version(reponame):

extras = "\n".join("holoviews[%s]" % e for e in setup_args["extras_require"])

print("%s\n%s\n%s" % (bars, header, bars))
print(f"{bars}\n{header}\n{bars}")

print("\nHoloViews supports the following installation types:\n")
print("%s\n" % extras)
Expand Down