diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 725015af..0e01f7b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,7 +44,7 @@ repos: - id: detect-private-key - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.2 hooks: - id: codespell additional_dependencies: [tomli] @@ -55,14 +55,14 @@ repos: #args: ["--write-changes"] # uncomment if you want to get automatic fixing - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.10 + rev: v0.15.20 hooks: - - id: ruff + - id: ruff-check args: ["--fix"] - id: ruff-format - repo: https://github.com/executablebooks/mdformat - rev: 0.7.22 + rev: 1.0.0 hooks: - id: mdformat additional_dependencies: @@ -90,6 +90,6 @@ repos: - id: pyproject-fmt additional_dependencies: [tox] - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.24.1 + rev: v0.25 hooks: - id: validate-pyproject diff --git a/tests/streaming/test_dataset.py b/tests/streaming/test_dataset.py index 29e6eb29..ef7d7cc1 100644 --- a/tests/streaming/test_dataset.py +++ b/tests/streaming/test_dataset.py @@ -1616,16 +1616,13 @@ def test_dataset_with_mosaic_mds_data(tmpdir): dataset = StreamingDataset(input_dir=str(tmpdir)) dataloader = DataLoader(dataset, batch_size=4, drop_last=True) - i = 0 - for batch in dataloader: + for i, batch in enumerate(dataloader): assert len(batch["class"]) == 4 assert len(batch["image"]) == 4 assert list(batch["class"]) == [4 * i, 4 * i + 1, 4 * i + 2, 4 * i + 3] - i += 1 dataloader = DataLoader(dataset, batch_size=4, drop_last=False) - i = 0 - for batch in dataloader: + for i, batch in enumerate(dataloader): if i == 2: # last batch is smaller than batch_size assert len(batch["class"]) == 2 @@ -1635,7 +1632,6 @@ def test_dataset_with_mosaic_mds_data(tmpdir): assert len(batch["class"]) == 4 assert len(batch["image"]) == 4 assert list(batch["class"]) == [4 * i, 4 * i + 1, 4 * i + 2, 4 * i + 3] - i += 1 @pytest.mark.parametrize("shuffle", [True, False])