Skip to content

Commit d29f1ef

Browse files
authored
Code quality updates (#1738)
1 parent 0bb3827 commit d29f1ef

90 files changed

Lines changed: 1030 additions & 699 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ repos:
1414
exclude: (\.min\.js$|\.svg$)
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: b969e2851312ca2b24bbec879ba4954341d1bd12 # frozen: v0.15.5
17+
rev: 01a675ea018f2fb714478a5ffb83fcea8374bb06 # frozen: v0.15.21
1818
hooks:
1919
- id: ruff-check
2020
- id: ruff-format
2121
- repo: https://github.com/hoxbro/clean_notebook
22-
rev: 2e6f506fab3cdfbe16bc18fd0d24e828db773b74 # frozen: v0.2.1
22+
rev: ba97036e6f0408aa318165535665c35a9423c352 # frozen: v0.2.1
2323
hooks:
2424
- id: clean-notebook
2525
args: [-i, tags]

doc/_ext/backend_styling_options.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1+
import holoviews as hv
12
from docutils import nodes
23
from docutils.statemachine import StringList
34
from sphinx.util.docutils import SphinxDirective
45

5-
import holoviews as hv
6-
76
from hvplot.util import _get_backend_style_options
87

9-
108
hv.extension('bokeh', 'matplotlib')
119

1210

doc/_ext/plotting_options_table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"""
99

1010
import sys
11-
1211
from textwrap import indent
1312

14-
from hvplot.util import _get_docstring_group_parameters
1513
from sphinx.util.docutils import SphinxDirective
1614

15+
from hvplot.util import _get_docstring_group_parameters
16+
1717

1818
class PlottingOptionsTableDirective(SphinxDirective):
1919
"""

doc/conf.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,38 @@
55
sys.path.insert(0, os.path.abspath('_ext'))
66

77
import os
8+
89
import param
910
import pydata_sphinx_theme
1011

1112
param.parameterized.docstring_signature = False
1213
param.parameterized.docstring_describe_params = False
1314

14-
import hvplot # noqa
15-
from nbsite.shared_conf import * # noqa
15+
from nbsite.shared_conf import * # noqa: E402, F403
16+
17+
import hvplot # noqa: E402
1618

1719
project = 'hvPlot'
1820
authors = 'HoloViz developers'
19-
copyright_years['start_year'] = '2016' # noqa
20-
copyright = copyright_fmt.format(**copyright_years) # noqa
21+
copyright_years['start_year'] = '2016' # noqa: F405
22+
copyright = copyright_fmt.format(**copyright_years) # noqa: F405
2123
description = 'A high-level plotting API for the PyData ecosystem built on HoloViews'
2224

23-
version = release = base_version(hvplot.__version__) # noqa
25+
version = release = base_version(hvplot.__version__) # noqa: F405
2426
nbbuild_cell_timeout = 600
2527

2628
# Useful for SEO on a versioned site
2729
html_baseurl = 'https://hvplot.holoviz.org/en/docs/latest/'
2830

2931
exclude_patterns = ['governance']
3032

31-
html_static_path += ['_static'] # noqa
33+
html_static_path += ['_static'] # noqa: F405
3234

3335
if pydata_sphinx_theme.__version__ == '0.16.1':
3436
# See https://github.com/pydata/pydata-sphinx-theme/issues/2088
35-
templates_path.append('_static/patch_templates') # noqa
37+
templates_path.append('_static/patch_templates') # noqa: F405
3638

37-
html_css_files += ['custom.css'] # noqa
39+
html_css_files += ['custom.css'] # noqa: F405
3840

3941
html_js_files = [
4042
'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js',
@@ -44,7 +46,7 @@
4446
if any(pr in hvplot.__version__ for pr in ('a', 'b', 'rc', 'dev'))
4547
else version
4648
)
47-
html_theme_options.update( # noqa
49+
html_theme_options.update( # noqa: F405
4850
{
4951
'navbar_start': ['navbar-logo', 'version-switcher'],
5052
'use_edit_page_button': True,
@@ -67,7 +69,7 @@
6769
},
6870
],
6971
'pygments_dark_style': 'material',
70-
'announcement': "hvPlot 0.12 has just been released! Checkout the <a href='https://blog.holoviz.org/posts/hvplot_release_0.12/'>blog post</a> and support hvPlot by giving it a 🌟 on <a href='https://github.com/holoviz/hvplot'>Github</a>.",
72+
'announcement': "hvPlot 0.12 has just been released! Checkout the <a href='https://blog.holoviz.org/posts/hvplot_release_0.12/'>blog post</a> and support hvPlot by giving it a 🌟 on <a href='https://github.com/holoviz/hvplot'>Github</a>.", # noqa: E501
7173
'switcher': {
7274
'json_url': 'https://hvplot.holoviz.org/switcher.json',
7375
'version_match': switcher_version,
@@ -83,7 +85,7 @@
8385
html_logo = '_static/logo_horizontal.svg'
8486
html_favicon = '_static/favicon.ico'
8587

86-
extensions += [ # noqa
88+
extensions += [ # noqa: F405
8789
'sphinx.ext.autosummary',
8890
'nbsite.gallery',
8991
'nbsite.analytics',
@@ -175,7 +177,7 @@
175177

176178
html_extra_path = ['topics.html']
177179

178-
html_context.update( # noqa
180+
html_context.update( # noqa: F405
179181
{
180182
'last_release': f'v{release}',
181183
'default_mode': 'light',
@@ -216,7 +218,7 @@
216218
'reference/tabular/lagplot': 'ref/api/manual/hvplot.plotting.lag_plot',
217219
'reference/tabular/line': 'ref/api/manual/hvplot.hvPlot.line',
218220
'reference/tabular/ohlc': 'ref/api/manual/hvplot.hvPlot.ohlc',
219-
'reference/tabular/parallelcoordinates': 'ref/api/manual/hvplot.plotting.parallel_coordinates',
221+
'reference/tabular/parallelcoordinates': 'ref/api/manual/hvplot.plotting.parallel_coordinates', # noqa: E501
220222
'reference/tabular/scatter': 'ref/api/manual/hvplot.hvPlot.scatter',
221223
'reference/tabular/scattermatrix': 'ref/api/manual/hvplot.plotting.scatter_matrix',
222224
'reference/tabular/step': 'ref/api/manual/hvplot.hvPlot.step',
@@ -294,7 +296,7 @@
294296
}
295297

296298
# To avoid this warning
297-
# hvplot/ui.py:docstring of hvplot.ui.hvPlotExplorer:43: WARNING: autosummary: stub file not found 'hvplot.ui.hvPlotExplorer.hvplot'. Check your autosummary_generate setting.
299+
# hvplot/ui.py:docstring of hvplot.ui.hvPlotExplorer:43: WARNING: autosummary: stub file not found 'hvplot.ui.hvPlotExplorer.hvplot'. Check your autosummary_generate setting. # noqa: E501
298300
# See https://stackoverflow.com/a/73294408
299301
numpydoc_class_members_toctree = False
300302

doc/conftest.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
2-
32
from importlib.util import find_spec
43

54
import dask
6-
7-
from packaging.version import Version, parse
85
from bokeh.io.webdriver import webdriver_control
6+
from packaging.version import Version, parse
7+
98
from hvplot.util import _PD_GE_3_0_0
109

1110
# Examples that are slow to run and/or download large files.
@@ -57,8 +56,8 @@
5756
collect_ignore_glob += ['ref/data_libraries.ipynb']
5857

5958
try:
60-
import ibis
6159
import duckdb
60+
import ibis
6261

6362
# 'Ibis <= 10.8.0 is incompatible with DuckDB >= 1.4')
6463
if parse(ibis.__version__) <= parse('10.8.0') and parse(duckdb.__version__) >= parse('1.4'):
@@ -81,13 +80,13 @@
8180
pygraphviz = None
8281

8382
try:
84-
import pygraphviz # noqa
83+
import pygraphviz
8584
except ImportError:
8685
pass
8786

8887
pydot = None
8988
try:
90-
import pydot # noqa
89+
import pydot
9190
except ImportError:
9291
pass
9392

doc/gallery/big-data/large_vectorfield_downsampled.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@
6565
"source": [
6666
"def downsample_quiver(x_range=None, y_range=None, nmax=10):\n",
6767
" \"\"\"\n",
68-
" Creates a HoloViews vector field plot from a dataset, dynamically downsampling \n",
68+
" Creates a HoloViews vector field plot from a dataset, dynamically downsampling\n",
6969
" data based on the visible range to optimize memory usage.\n",
7070
"\n",
7171
" Args:\n",
7272
" x_range (tuple, optional): Range of x values to include. Defaults to None (full range).\n",
7373
" y_range (tuple, optional): Range of y values to include. Defaults to None (full range).\n",
74-
" nmax (int, optional): Maximum number of points along each axis after coarsening. \n",
74+
" nmax (int, optional): Maximum number of points along each axis after coarsening.\n",
7575
" Defaults to 10.\n",
7676
"\n",
7777
" Returns:\n",

doc/gallery/categorical/category_heatmap.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
" y='depth_class',\n",
2828
" C='mag',\n",
2929
" reduce_function=np.size,\n",
30-
" fields={'mag': 'count'}, # for the tooltip to display count instead of mag \n",
30+
" fields={'mag': 'count'}, # for the tooltip to display count instead of mag\n",
3131
" logz=True,\n",
3232
" title='Category Heatmap (Bokeh)',\n",
3333
" xlabel='Magnitude Class',\n",
@@ -53,7 +53,7 @@
5353
" y='depth_class',\n",
5454
" C='mag',\n",
5555
" reduce_function=np.size,\n",
56-
" fields={'mag': 'count'}, # for the tooltip to display count instead of mag \n",
56+
" fields={'mag': 'count'}, # for the tooltip to display count instead of mag\n",
5757
" logz=True,\n",
5858
" title='Category Heatmap (Matplotlib)',\n",
5959
" xlabel='Magnitude Class',\n",

doc/gallery/categorical/lollipop_plot.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"\n",
3030
"# Create line segments for each stem\n",
3131
"segments = hv.Segments(\n",
32-
" [(xv, 0, xv, yv) for xv, yv in zip(df['type'], df['value'])]\n",
32+
" [(xv, 0, xv, yv) for xv, yv in zip(df['type'], df['value'], strict=True)]\n",
3333
").opts(line_width=4, color='lightgrey')\n",
3434
"# Markers at the top\n",
3535
"markers = df.hvplot.scatter(x='type', y='value', size=200)\n",
@@ -61,7 +61,7 @@
6161
"\n",
6262
"# Create line segments for each stem\n",
6363
"segments = hv.Segments(\n",
64-
" [(xv, 0, xv, yv) for xv, yv in zip(df['type'], df['value'])]\n",
64+
" [(xv, 0, xv, yv) for xv, yv in zip(df['type'], df['value'], strict=True)]\n",
6565
").opts(linewidth=4, color='lightgrey')\n",
6666
"# Markers at the top\n",
6767
"markers = df.hvplot.scatter(x='type', y='value').opts(s=250)\n",

doc/ref/api/manual/hvplot.hvPlot.bar.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@
9898
"}).set_index(['Project', 'Source'])\n",
9999
"print(multi_index_df.head(3))\n",
100100
"\n",
101-
"multi_index_df.hvplot.bar(title='Project downloads (stacked multi-index)', stacked=True, yformatter='%i')"
101+
"multi_index_df.hvplot.bar(\n",
102+
" title='Project downloads (stacked multi-index)',\n",
103+
" stacked=True, yformatter='%i'\n",
104+
")"
102105
]
103106
},
104107
{

doc/ref/api/manual/hvplot.hvPlot.barh.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
" stacked=True,\n",
104104
" width=500,\n",
105105
" legend='bottom_right',\n",
106-
" xformatter='%i', \n",
106+
" xformatter='%i',\n",
107107
")"
108108
]
109109
},

0 commit comments

Comments
 (0)