diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 83b075db73c..19c667a5077 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,15 +15,15 @@ repos: exclude_types: ["python", "jupyter", "shell", "gitignore"] - repo: https://github.com/omnilib/ufmt - rev: v2.5.1 + rev: v2.7.3 hooks: - id: ufmt additional_dependencies: - - black == 24.3.0 + - black == 24.10.0 - usort == 1.0.8.post1 - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 args: ["--config", "setup.cfg"] diff --git a/ignite/handlers/time_profilers.py b/ignite/handlers/time_profilers.py index 38427aab0e4..4399a61ed01 100644 --- a/ignite/handlers/time_profilers.py +++ b/ignite/handlers/time_profilers.py @@ -400,7 +400,7 @@ def print_results(results: Dict) -> str: """ - def to_str(v: Union[str, tuple]) -> str: + def to_str(v: Union[str, tuple, int, float]) -> str: if isinstance(v, str): return v elif isinstance(v, tuple): @@ -412,12 +412,14 @@ def odict_to_str(d: Mapping) -> str: return out others = { - k: odict_to_str(v) if isinstance(v, OrderedDict) else v for k, v in results["event_handlers_stats"].items() + k: odict_to_str(v) if isinstance(v, OrderedDict) else to_str(v) + for k, v in results["event_handlers_stats"].items() } others.update(results["event_handlers_names"]) - output_message = """ + output_message: str = ( + """ ---------------------------------------------------- | Time profiling stats (in seconds): | ---------------------------------------------------- @@ -430,7 +432,7 @@ def odict_to_str(d: Mapping) -> str: {dataflow_stats} Event handlers: -{total_time:.5f} +{total_time} - Events.STARTED: {STARTED_names} {STARTED} @@ -450,9 +452,10 @@ def odict_to_str(d: Mapping) -> str: - Events.COMPLETED: {COMPLETED_names} {COMPLETED} """.format( - processing_stats=odict_to_str(results["processing_stats"]), - dataflow_stats=odict_to_str(results["dataflow_stats"]), - **others, + processing_stats=odict_to_str(results["processing_stats"]), + dataflow_stats=odict_to_str(results["dataflow_stats"]), + **others, + ) ) print(output_message) return output_message diff --git a/ignite/metrics/fbeta.py b/ignite/metrics/fbeta.py index 6522efc6423..63f822fe3a5 100644 --- a/ignite/metrics/fbeta.py +++ b/ignite/metrics/fbeta.py @@ -151,7 +151,7 @@ def thresholded_output_transform(output): if precision is None: precision = Precision( - output_transform=(lambda x: x) if output_transform is None else output_transform, # type: ignore[arg-type] + output_transform=(lambda x: x) if output_transform is None else output_transform, average=False, device=device, ) @@ -160,7 +160,7 @@ def thresholded_output_transform(output): if recall is None: recall = Recall( - output_transform=(lambda x: x) if output_transform is None else output_transform, # type: ignore[arg-type] + output_transform=(lambda x: x) if output_transform is None else output_transform, average=False, device=device, ) diff --git a/tests/run_code_style.bat b/tests/run_code_style.bat index 1d1e9938abb..b4784f41675 100644 --- a/tests/run_code_style.bat +++ b/tests/run_code_style.bat @@ -20,7 +20,7 @@ mypy --config-file mypy.ini goto end :install -pip install --upgrade flake8 "black==24.3.0" "usort==1.0.8.post1" "ufmt==2.5.1" "mypy" +pip install --upgrade flake8 "black==24.10.0" "usort==1.0.8.post1" "ufmt==2.7.3" "mypy" goto end :end diff --git a/tests/run_code_style.sh b/tests/run_code_style.sh index fe82464d0bb..e94a652fbeb 100755 --- a/tests/run_code_style.sh +++ b/tests/run_code_style.sh @@ -10,5 +10,5 @@ elif [ $1 = "fmt" ]; then elif [ $1 = "mypy" ]; then mypy --config-file mypy.ini elif [ $1 = "install" ]; then - pip install --upgrade flake8 "black==24.3.0" "usort==1.0.8.post1" "ufmt==2.5.1" "mypy" + pip install --upgrade flake8 "black==24.10.0" "usort==1.0.8.post1" "ufmt==2.7.3" "mypy" fi