Skip to content

Commit

Permalink
Merge branch 'master' into clustering_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 authored Oct 21, 2024
2 parents c10b1c0 + a63df75 commit 66b415b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 10 additions & 7 deletions ignite/handlers/time_profilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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): |
----------------------------------------------------
Expand All @@ -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}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ignite/metrics/fbeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/run_code_style.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/run_code_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 66b415b

Please sign in to comment.