Skip to content

Commit 33559da

Browse files
fix: Add type hint for callable_obj parameter
1 parent 922fc4c commit 33559da

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/ml_benchmarks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515
import random
1616
import time
17+
from collections.abc import Callable
1718
from dataclasses import dataclass
1819
from statistics import mean
20+
from typing import Any
1921

2022
from machine_learning.gaussian_naive_bayes import GaussianNaiveBayes
2123
from machine_learning.gradient_boosting_regressor import GradientBoostingRegressor
@@ -31,7 +33,7 @@ class TimingResult:
3133
predict_seconds: float
3234

3335

34-
def _time_call(callable_obj) -> float:
36+
def _time_call(callable_obj: Callable[[], Any]) -> float:
3537
start = time.perf_counter()
3638
callable_obj()
3739
return time.perf_counter() - start
@@ -159,4 +161,4 @@ def main() -> None:
159161

160162

161163
if __name__ == "__main__":
162-
main()
164+
main()

0 commit comments

Comments
 (0)