Skip to content

Commit f70b178

Browse files
Pre commit ci update config (#719)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](pre-commit/pre-commit-hooks@v4.6.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.5 → v0.9.1](astral-sh/ruff-pre-commit@v0.6.5...v0.9.1) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.14.1](pre-commit/mirrors-mypy@v1.11.2...v1.14.1) - [github.com/nbQA-dev/nbQA: 1.8.7 → 1.9.1](nbQA-dev/nbQA@1.8.7...1.9.1) * [pre-commit.ci] Add auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add lint fixes * Update ruff version --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f0275f8 commit f70b178

Some content is hidden

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

44 files changed

+260
-290
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0 # Use the ref you want to point at
3+
rev: v5.0.0 # Use the ref you want to point at
44
hooks:
55
- id: trailing-whitespace
66
- id: check-ast
@@ -16,7 +16,7 @@ repos:
1616
- id: check-toml
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: 'v0.6.5'
19+
rev: 'v0.9.2'
2020
hooks:
2121
- id: ruff
2222
args: [--fix, --exit-non-zero-on-fix]
@@ -25,7 +25,7 @@ repos:
2525
types_or: [python, jupyter]
2626

2727
- repo: https://github.com/pre-commit/mirrors-mypy
28-
rev: v1.11.2
28+
rev: v1.14.1
2929
hooks:
3030
- id: mypy
3131
entry: python3 -m mypy --config-file pyproject.toml
@@ -41,7 +41,7 @@ repos:
4141
entry: python3 -m nbstripout
4242

4343
- repo: https://github.com/nbQA-dev/nbQA
44-
rev: 1.8.7
44+
rev: 1.9.1
4545
hooks:
4646
- id: nbqa-black
4747
- id: nbqa-ruff

cyclops/data/df/feature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self, **kwargs: Any) -> None:
6060
if kwargs[FEATURE_TYPE_ATTR] not in FEATURE_TYPES:
6161
raise ValueError(
6262
f"""Feature type '{kwargs[FEATURE_TYPE_ATTR]}'
63-
not in {', '.join(FEATURE_TYPES)}.""",
63+
not in {", ".join(FEATURE_TYPES)}.""",
6464
)
6565

6666
# Set attributes

cyclops/data/features/medical_image.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,14 @@ def decode_example(
209209
use_auth_token = token_per_repo_id.get(repo_id)
210210
except ValueError:
211211
use_auth_token = None
212-
with xopen(
213-
path,
214-
"rb",
215-
use_auth_token=use_auth_token,
216-
) as file_obj, BytesIO(file_obj.read()) as buffer:
212+
with (
213+
xopen(
214+
path,
215+
"rb",
216+
use_auth_token=use_auth_token,
217+
) as file_obj,
218+
BytesIO(file_obj.read()) as buffer,
219+
):
217220
image, metadata = self._read_file_from_bytes(buffer)
218221
metadata["filename_or_obj"] = path
219222

cyclops/data/impute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def _process_imputefunc(
304304
if imputefunc not in IMPUTEFUNCS:
305305
raise ValueError(
306306
f"""Imputefunc string {imputefunc} not supported.
307-
Supporting: {','.join(IMPUTEFUNCS)}""",
307+
Supporting: {",".join(IMPUTEFUNCS)}""",
308308
)
309309
func = IMPUTEFUNCS[imputefunc]
310310
elif callable(imputefunc):

cyclops/data/slicer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,7 @@ def filter_string_contains(
825825
example_values = pa.array(examples[column_name])
826826
if not pa.types.is_string(example_values.type):
827827
raise ValueError(
828-
"Expected string feature, but got feature of type "
829-
f"{example_values.type}.",
828+
f"Expected string feature, but got feature of type {example_values.type}.",
830829
)
831830

832831
# get all the values that contain the given substring

cyclops/evaluate/evaluator.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ def _load_data(
170170
if split is None:
171171
split = choose_split(dataset, **load_dataset_kwargs)
172172
LOGGER.warning(
173-
"Got `split=None` but `dataset` is a string. "
174-
"Using `split=%s` instead.",
173+
"Got `split=None` but `dataset` is a string. Using `split=%s` instead.",
175174
split,
176175
)
177176

cyclops/evaluate/fairness/evaluator.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def evaluate_fairness( # noqa: PLR0912
150150
# input validation and formatting
151151
if not isinstance(dataset, Dataset):
152152
raise TypeError(
153-
"Expected `dataset` to be of type `Dataset`, but got " f"{type(dataset)}.",
153+
f"Expected `dataset` to be of type `Dataset`, but got {type(dataset)}.",
154154
)
155155
if array_lib not in _SUPPORTED_ARRAY_LIBS:
156156
raise NotImplementedError(f"The array library `{array_lib}` is not supported.")
@@ -520,8 +520,7 @@ def _validate_group_bins(
520520
for group, bins in group_bins.items():
521521
if not isinstance(bins, (list, int)):
522522
raise TypeError(
523-
f"The bins for {group} must be a list or an integer. "
524-
f"Got {type(bins)}.",
523+
f"The bins for {group} must be a list or an integer. Got {type(bins)}.",
525524
)
526525

527526
if isinstance(bins, int) and not 2 <= bins < len(unique_values[group]):

cyclops/evaluate/metrics/accuracy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,19 +339,19 @@ def __new__( # type: ignore # mypy expects a subclass of Accuracy
339339
zero_division=zero_division,
340340
)
341341
if task == "multiclass":
342-
assert (
343-
isinstance(num_classes, int) and num_classes > 0
344-
), "Number of classes must be specified for multiclass classification."
342+
assert isinstance(num_classes, int) and num_classes > 0, (
343+
"Number of classes must be specified for multiclass classification."
344+
)
345345
return MulticlassAccuracy(
346346
num_classes=num_classes,
347347
top_k=top_k,
348348
average=average,
349349
zero_division=zero_division,
350350
)
351351
if task == "multilabel":
352-
assert (
353-
isinstance(num_labels, int) and num_labels > 0
354-
), "Number of labels must be specified for multilabel classification."
352+
assert isinstance(num_labels, int) and num_labels > 0, (
353+
"Number of labels must be specified for multilabel classification."
354+
)
355355
return MultilabelAccuracy(
356356
num_labels=num_labels,
357357
threshold=threshold,

cyclops/evaluate/metrics/auroc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,18 @@ def __new__( # type: ignore # mypy expects a subclass of AUROC
336336
if task == "binary":
337337
return BinaryAUROC(max_fpr=max_fpr, thresholds=thresholds)
338338
if task == "multiclass":
339-
assert (
340-
isinstance(num_classes, int) and num_classes > 0
341-
), "Number of classes must be a positive integer."
339+
assert isinstance(num_classes, int) and num_classes > 0, (
340+
"Number of classes must be a positive integer."
341+
)
342342
return MulticlassAUROC(
343343
num_classes=num_classes,
344344
thresholds=thresholds,
345345
average=average, # type: ignore
346346
)
347347
if task == "multilabel":
348-
assert (
349-
isinstance(num_labels, int) and num_labels > 0
350-
), "Number of labels must be a positive integer."
348+
assert isinstance(num_labels, int) and num_labels > 0, (
349+
"Number of labels must be a positive integer."
350+
)
351351
return MultilabelAUROC(
352352
num_labels=num_labels,
353353
thresholds=thresholds,

cyclops/evaluate/metrics/experimental/utils/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# noqa: A005
2+
13
"""Utilities for array-API compatibility."""
24

35
import builtins

0 commit comments

Comments
 (0)