Skip to content

Commit cd785a4

Browse files
[pre-commit.ci] pre-commit suggestions (#20703)
* [pre-commit.ci] pre-commit suggestions updates: - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](codespell-project/codespell@v2.3.0...v2.4.1) - [github.com/PyCQA/docformatter: 06907d0267368b49b9180eed423fae5697c1e909 → v1.7.5](PyCQA/docformatter@06907d0...v1.7.5) - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.11.4](astral-sh/ruff-pre-commit@v0.8.6...v0.11.4) - [github.com/executablebooks/mdformat: 0.7.21 → 0.7.22](hukkin/mdformat@0.7.21...0.7.22) - [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.8](pre-commit/mirrors-prettier@v3.1.0...v4.0.0-alpha.8) * Apply suggestions from code review --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
1 parent 02311d0 commit cd785a4

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ repos:
5151
- id: detect-private-key
5252

5353
- repo: https://github.com/codespell-project/codespell
54-
rev: v2.3.0
54+
rev: v2.4.1
5555
hooks:
5656
- id: codespell
5757
additional_dependencies: [tomli]
@@ -70,7 +70,7 @@ repos:
7070
- id: sphinx-lint
7171

7272
- repo: https://github.com/astral-sh/ruff-pre-commit
73-
rev: v0.8.6
73+
rev: v0.11.4
7474
hooks:
7575
# try to fix what is possible
7676
- id: ruff
@@ -81,7 +81,7 @@ repos:
8181
- id: ruff
8282

8383
- repo: https://github.com/executablebooks/mdformat
84-
rev: 0.7.21
84+
rev: 0.7.22
8585
hooks:
8686
- id: mdformat
8787
additional_dependencies:

src/lightning/pytorch/callbacks/timer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def __init__(
111111
self._duration = duration.total_seconds() if duration is not None else None
112112
self._interval = interval
113113
self._verbose = verbose
114-
self._start_time: dict[RunningStage, Optional[float]] = {stage: None for stage in RunningStage}
115-
self._end_time: dict[RunningStage, Optional[float]] = {stage: None for stage in RunningStage}
114+
self._start_time: dict[RunningStage, Optional[float]] = dict.fromkeys(RunningStage)
115+
self._end_time: dict[RunningStage, Optional[float]] = dict.fromkeys(RunningStage)
116116
self._offset = 0
117117

118118
def start_time(self, stage: str = RunningStage.TRAINING) -> Optional[float]:

tests/tests_pytorch/helpers/datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def __init__(self, root: str, num_samples: int = 100, digits: Optional[Sequence]
148148

149149
@staticmethod
150150
def _prepare_subset(full_data: Tensor, full_targets: Tensor, num_samples: int, digits: Sequence):
151-
classes = {d: 0 for d in digits}
151+
classes = dict.fromkeys(digits, 0)
152152
indexes = []
153153
for idx, target in enumerate(full_targets):
154154
label = target.item()

tests/tests_pytorch/trainer/connectors/test_data_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def test_dataloader_source_request_from_module():
497497

498498

499499
@pytest.mark.parametrize(
500-
"hook_name", ("on_before_batch_transfer", "transfer_batch_to_device", "on_after_batch_transfer")
500+
"hook_name", ["on_before_batch_transfer", "transfer_batch_to_device", "on_after_batch_transfer"]
501501
)
502502
class TestDataHookSelector:
503503
def overridden_func(self, batch, *args, **kwargs):

tests/tests_pytorch/trainer/logging_/test_logger_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def test_fx_validator_integration(tmp_path):
246246
})
247247
trainer.test(model, verbose=False)
248248

249-
not_supported.update({k: "result collection is not registered yet" for k in not_supported})
249+
not_supported.update(dict.fromkeys(not_supported, "result collection is not registered yet"))
250250
not_supported.update({
251251
"predict_dataloader": "result collection is not registered yet",
252252
"on_predict_model_eval": "result collection is not registered yet",

0 commit comments

Comments
 (0)