Skip to content

Commit de0c250

Browse files
committed
ci: pre-commit update
1 parent 30c842e commit de0c250

15 files changed

Lines changed: 80 additions & 80 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ repos:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
77
- repo: https://github.com/astral-sh/ruff-pre-commit
8-
rev: v0.15.21
8+
rev: v0.15.22
99
hooks:
1010
- id: ruff-check
1111
args: [--fix, --preview]
1212
- id: ruff-format
1313
- repo: https://github.com/tox-dev/pyproject-fmt
14-
rev: v2.25.2
14+
rev: v2.25.3
1515
hooks:
1616
- id: pyproject-fmt
1717
- repo: https://github.com/biomejs/pre-commit
18-
rev: v2.5.3
18+
rev: v2.5.4
1919
hooks:
2020
- id: biome-format
2121
- repo: https://github.com/kynan/nbstripout
2222
rev: "0.9.1"
2323
hooks:
2424
- id: nbstripout
2525
- repo: https://github.com/zizmorcore/zizmor-pre-commit
26-
rev: v1.26.1
26+
rev: v1.27.0
2727
hooks:
2828
- id: zizmor

docs/examples/scanpy/Tools.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296
"source": [
297297
"try:\n",
298298
" sc.pl.dpt_groups_pseudotime(adata)\n",
299-
"except Exception: # noqa: BLE001\n",
299+
"except Exception: # ruff:ignore[blind-except]\n",
300300
" import traceback\n",
301301
"\n",
302302
" traceback.print_exc()"
@@ -339,7 +339,7 @@
339339
" dendrogram_key = f\"dendrogram_{groupby}\" # _get_dendrogram_key(...)\n",
340340
" mat = adata.uns[dendrogram_key][\"correlation_matrix\"]\n",
341341
" index = adata.uns[dendrogram_key][\"categories_idx_ordered\"]\n",
342-
" mat = mat[index[::-1], :][:, index] # TODO: why do we have to flip? # noqa: TD003\n",
342+
" mat = mat[index[::-1], :][:, index] # TODO: why do we have to flip? # ruff:ignore[missing-todo-link]\n",
343343
"\n",
344344
" labels = list(adata.obs[groupby].cat.categories)\n",
345345
" labels = np.array(labels).astype(\"str\")[index]\n",
@@ -395,7 +395,7 @@
395395
"name": "python",
396396
"nbconvert_exporter": "python",
397397
"pygments_lexer": "ipython3",
398-
"version": "3.13.7"
398+
"version": "3.13.12"
399399
}
400400
},
401401
"nbformat": 4,

docs/ext/napoleon_attrdoc_fix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ def _consume_inline_attribute(self: GoogleDocstring) -> tuple[str, list[str]]:
3131
def setup(app: Sphinx) -> ExtensionMetadata:
3232
"""Apply the Napoleon monkeypatch."""
3333
del app
34-
GoogleDocstring._consume_inline_attribute = _consume_inline_attribute # noqa: SLF001
34+
GoogleDocstring._consume_inline_attribute = _consume_inline_attribute # ruff:ignore[private-member-access]
3535
return ExtensionMetadata(parallel_read_safe=True)

docs/ext/paramdoc.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ class _Options:
6262
}
6363

6464

65-
def param_formatter( # noqa: PLR0917
66-
app: Sphinx, # noqa: ARG001
65+
def param_formatter( # ruff:ignore[too-many-positional-arguments]
66+
app: Sphinx, # ruff:ignore[unused-function-argument]
6767
what: Literal["module", "class", "exception", "function", "method", "attribute"],
68-
name: str, # noqa: ARG001
68+
name: str, # ruff:ignore[unused-function-argument]
6969
obj: object,
70-
options: _Options, # noqa: ARG001
70+
options: _Options, # ruff:ignore[unused-function-argument]
7171
lines: list[str],
7272
) -> None:
7373
"""Format parameter documentation."""
@@ -140,12 +140,12 @@ def _format_child(
140140
]
141141

142142

143-
def param_skip( # noqa: PLR0917
144-
app: Sphinx, # noqa: ARG001
143+
def param_skip( # ruff:ignore[too-many-positional-arguments]
144+
app: Sphinx, # ruff:ignore[unused-function-argument]
145145
what: Literal["module", "class", "exception", "function", "method", "attribute"],
146-
name: str, # noqa: ARG001
146+
name: str, # ruff:ignore[unused-function-argument]
147147
obj: object,
148-
skip: bool, # noqa: FBT001
148+
skip: bool, # ruff:ignore[boolean-type-hint-positional-argument]
149149
options: _Options,
150150
) -> bool | None:
151151
"""Skip undocumentable parameters."""
@@ -168,7 +168,7 @@ def param_skip( # noqa: PLR0917
168168
and isinstance(obj, type)
169169
and issubclass(obj, param.Parameterized)
170170
):
171-
# HACK: Sphinx incorrectly labels this as a module level discovery # noqa: FIX004
171+
# HACK: Sphinx incorrectly labels this as a module level discovery # ruff:ignore[line-contains-hack]
172172
# We abuse this skip callback to exclude parameters and
173173
# include all methods
174174
members = [

src/hv_anndata/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
register,
1414
)
1515

16-
A = A # noqa: PLW0127, RUF067
16+
A = A # ruff:ignore[self-assigning-variable, non-empty-init-module]
1717
"""Accessor for anndata.
1818
1919
>>> from hv_anndata import A
@@ -31,7 +31,7 @@
3131
"register",
3232
]
3333

34-
with suppress(ImportError): # noqa: RUF067
34+
with suppress(ImportError): # ruff:ignore[non-empty-init-module]
3535
from .components import GeneSelector
3636
from .plotting import (
3737
ClusterMap,

src/hv_anndata/components.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, **params: object) -> None:
7171
super().__init__(**params)
7272

7373
self.w_key_input = pmui.AutocompleteInput.from_param(
74-
self.param._input_key, # noqa: SLF001
74+
self.param._input_key, # ruff:ignore[private-member-access]
7575
name="Active Group",
7676
placeholder="Enter/select group name",
7777
restrict=False,
@@ -87,12 +87,12 @@ def w_value_input_disabled(value: dict | list, _input_key: str) -> bool:
8787
)
8888

8989
self.w_value_input = pmui.TextInput.from_param(
90-
self.param._input_value, # noqa: SLF001
90+
self.param._input_value, # ruff:ignore[private-member-access]
9191
name="New Marker Gene",
9292
disabled=param.bind(
9393
w_value_input_disabled,
9494
self.param.value,
95-
self.param._input_key, # noqa: SLF001
95+
self.param._input_key, # ruff:ignore[private-member-access]
9696
),
9797
description="",
9898
sizing_mode="stretch_width",
@@ -101,7 +101,7 @@ def w_value_input_disabled(value: dict | list, _input_key: str) -> bool:
101101
pre = "Selected Group " if isinstance(self.value, dict) else ""
102102
mc_name = f"{pre}Marker Genes"
103103
self.w_multi_choice = pmui.MultiChoice.from_param(
104-
self.param._current_selection, # noqa: SLF001
104+
self.param._current_selection, # ruff:ignore[private-member-access]
105105
options=self.param.options,
106106
name=mc_name,
107107
searchable=True,
@@ -127,7 +127,7 @@ def w_value_input_disabled(value: dict | list, _input_key: str) -> bool:
127127
if self.value:
128128
if isinstance(self.value, dict):
129129
keys = list(self.value)
130-
self.param._input_key.objects = keys # noqa: SLF001
130+
self.param._input_key.objects = keys # ruff:ignore[private-member-access]
131131
self._input_key = keys[0]
132132
if not self.options:
133133
self.options = list(

src/hv_anndata/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def pbmc68k_processed() -> AnnData:
1818
1919
- ``.layers["counts"]`` instead of ``raw``.
2020
- UMAP computed.
21-
""" # noqa: DOC201
21+
""" # ruff:ignore[docstring-missing-returns]
2222
return _pbmc68k_processed().copy()
2323

2424

src/hv_anndata/interface.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class AnnDataInterface(hv.core.Interface):
7070
@classmethod
7171
def init(
7272
cls,
73-
eltype: hv.Element, # noqa: ARG003
73+
eltype: hv.Element, # ruff:ignore[unused-class-method-argument]
7474
data: AnnData,
7575
kdims: list[Dimension] | None,
7676
vdims: list[Dimension] | None,
@@ -93,7 +93,7 @@ def init(
9393

9494
@classmethod
9595
def dims(cls, dataset: Dataset) -> tuple[Literal["obs", "var"], ...]:
96-
"""Detect if the data is gridded or columnar and which anndata dimensions it spans.""" # noqa: E501
96+
"""Detect if the data is gridded or columnar and which anndata dimensions it spans.""" # ruff:ignore[line-too-long]
9797
vdim = cls._dim(dataset, dataset.vdims[0]) if dataset.vdims else None
9898
if len(dataset.kdims) == 0 and vdim:
9999
# e.g. Violin plot doesn’t have kdims
@@ -147,7 +147,7 @@ def _dim(dataset: Dataset, k: Dimension | str | int) -> AdDim:
147147
)
148148

149149
@classmethod
150-
def validate(cls, dataset: Dataset, vdims: bool = True) -> None: # noqa: FBT001, FBT002
150+
def validate(cls, dataset: Dataset, vdims: bool = True) -> None: # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
151151
"""Check if all dimensions (or key dimensions if `vdims==False`) are present."""
152152
dims = "all" if vdims else "key"
153153
not_found = [
@@ -173,7 +173,7 @@ def validate_selection_dim(
173173
if len(ref.dims) > 1:
174174
raise DataError(MSG_1D)
175175
[dim] = ref.dims
176-
# TODO: support ranges and sequences # noqa: TD003
176+
# TODO: support ranges and sequences # ruff:ignore[missing-todo-link]
177177
if dim not in {"obs", "var"}: # pragma: no cover
178178
msg = f"Cannot {action} along unknown dim: {dim}"
179179
raise AssertionError(msg)
@@ -255,8 +255,8 @@ def select(
255255
def reindex(
256256
cls,
257257
dataset: Dataset,
258-
kdims: list[Dimension] | None = None, # noqa: ARG003
259-
vdims: list[Dimension] | None = None, # noqa: ARG003
258+
kdims: list[Dimension] | None = None, # ruff:ignore[unused-class-method-argument]
259+
vdims: list[Dimension] | None = None, # ruff:ignore[unused-class-method-argument]
260260
) -> AnnData:
261261
"""Reindex the data (a no-op)."""
262262
return dataset.data
@@ -267,18 +267,18 @@ def values(
267267
data: Dataset,
268268
ref: Dimension | str,
269269
/,
270-
expanded: bool = True, # noqa: FBT001, FBT002, ARG003
271-
flat: bool = True, # noqa: FBT001, FBT002
270+
expanded: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument, unused-class-method-argument]
271+
flat: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
272272
*,
273-
compute: bool = True, # noqa: ARG003
274-
keep_index: bool = False, # noqa: ARG003
273+
compute: bool = True, # ruff:ignore[unused-class-method-argument]
274+
keep_index: bool = False, # ruff:ignore[unused-class-method-argument]
275275
) -> ValueType:
276276
"""Retrieve values for a dimension."""
277277
ref = cls._dim(data, ref)
278278
adata = cast("AnnData", data.data)
279279
values = adata[ref]
280280
if flat and values.ndim > 1:
281-
assert not isinstance(values, ExtensionArray) # noqa: S101
281+
assert not isinstance(values, ExtensionArray) # ruff:ignore[assert]
282282
values = values.flatten()
283283
return _simplify_numpy(values)
284284

@@ -332,7 +332,7 @@ def iloc(
332332
def _iloc_2d(
333333
cls,
334334
dims: tuple[Literal["obs", "var"], ...],
335-
rows: slice[int | None], # noqa: ARG003
335+
rows: slice[int | None], # ruff:ignore[unused-class-method-argument]
336336
cols: slice[None],
337337
) -> tuple[slice[int | None], slice[int | None]] | None:
338338
"""Validate indexing. Overridden in `AnnDataGriddedInterface`."""
@@ -351,7 +351,7 @@ def aggregate(
351351
dataset: Dataset,
352352
kdims: list[Dimension | str],
353353
function: Callable[[ValueType], ValueType],
354-
**kwargs: Any, # noqa: ANN401
354+
**kwargs: Any, # ruff:ignore[any-type]
355355
) -> tuple[pd.DataFrame, list[Dimension]]:
356356
"""Aggregate the current view."""
357357
agg = Dataset(
@@ -364,9 +364,9 @@ def aggregate(
364364
@classmethod
365365
def unpack_scalar(
366366
cls,
367-
dataset: Dataset, # noqa: ARG003
367+
dataset: Dataset, # ruff:ignore[unused-class-method-argument]
368368
data: AnnData | pd.DataFrame,
369-
) -> Any: # noqa: ANN401
369+
) -> Any: # ruff:ignore[any-type]
370370
"""Unpacks scalar data if it is a DataFrame containing a single value."""
371371
if isinstance(data, AnnData):
372372
return data
@@ -381,7 +381,7 @@ def groupby(
381381
dimensions: Sequence[str | AdDim],
382382
container_type: type[T],
383383
group_type: type[Dataset | dict] | Literal["raw"],
384-
**kwargs: Any, # noqa: ANN401
384+
**kwargs: Any, # ruff:ignore[any-type]
385385
) -> T:
386386
"""Group the dataset along the provided dimensions."""
387387
values = {}
@@ -464,7 +464,7 @@ def coords(
464464
dataset: Dataset,
465465
ref: Dimension | str,
466466
/,
467-
ordered: bool = False, # noqa: FBT001, FBT002
467+
ordered: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
468468
*,
469469
expanded: bool = False,
470470
edges: bool = False,
@@ -473,14 +473,14 @@ def coords(
473473
474474
Ordered ensures coordinates are in ascending order and expanded creates
475475
ND-array matching the dimensionality of the dataset.
476-
""" # noqa: DOC201
476+
""" # ruff:ignore[docstring-missing-returns]
477477
ref = cls._dim(dataset, ref)
478478
vdim = dataset.vdims[0]
479479
if expanded:
480480
data = expand_grid_coords(dataset, ref)
481481
if edges and data.shape == vdim(dataset.data).shape:
482-
data = GridInterface._infer_interval_breaks(data, axis=1) # noqa: SLF001
483-
data = GridInterface._infer_interval_breaks(data, axis=0) # noqa: SLF001
482+
data = GridInterface._infer_interval_breaks(data, axis=1) # ruff:ignore[private-member-access]
483+
data = GridInterface._infer_interval_breaks(data, axis=0) # ruff:ignore[private-member-access]
484484
return data
485485

486486
data = ref(dataset.data)
@@ -489,7 +489,7 @@ def coords(
489489
shape = cls.shape(dataset, gridded=True)
490490
if ref in dataset.kdims:
491491
idx = dataset.get_dimension_index(ref)
492-
# TODO: don’t do this, it’s broken if diff(shape) == 1 # noqa: TD003
492+
# TODO: don’t do this, it’s broken if diff(shape) == 1 # ruff:ignore[missing-todo-link]
493493
is_edges = (
494494
ref in dataset.kdims
495495
and len(shape) == dataset.ndims
@@ -498,7 +498,7 @@ def coords(
498498
else:
499499
is_edges = False
500500
if edges and not is_edges:
501-
data = GridInterface._infer_interval_breaks(data) # noqa: SLF001
501+
data = GridInterface._infer_interval_breaks(data) # ruff:ignore[private-member-access]
502502
elif not edges and is_edges:
503503
data = data[:-1] + np.diff(data) / 2.0
504504
return data
@@ -508,11 +508,11 @@ def values(
508508
cls,
509509
data: Dataset,
510510
ref: Dimension | str,
511-
expanded: bool = True, # noqa: FBT001, FBT002
512-
flat: bool = True, # noqa: FBT001, FBT002
511+
expanded: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
512+
flat: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
513513
*,
514-
compute: bool = True, # noqa: ARG003
515-
keep_index: bool = False, # noqa: ARG003
514+
compute: bool = True, # ruff:ignore[unused-class-method-argument]
515+
keep_index: bool = False, # ruff:ignore[unused-class-method-argument]
516516
) -> ValueType:
517517
"""Retrieve values for a dimension."""
518518
ref = cls._dim(data, ref)
@@ -544,7 +544,7 @@ def values(
544544
if transpose != flat:
545545
values = values.T
546546
case _:
547-
assert ref in data.vdims, "test_init_errors[tab-x_2d] prevents 2D kdims" # noqa: S101
547+
assert ref in data.vdims, "test_init_errors[tab-x_2d] prevents 2D kdims" # ruff:ignore[assert]
548548
error = (
549549
"When requesting data for a value dimension, "
550550
"it is invalid to request expanded=False. "

0 commit comments

Comments
 (0)