55# This source code is licensed under the BSD-style license found in the
66# LICENSE file in the root directory of this source tree.
77
8+ # pyre-strict
9+
810"""Common utilities for benchmark scripts.
911
1012This module provides a standardized framework for running benchmarks with:
5153from enum import Enum
5254from functools import partial
5355from sys import version_info
56+ from types import TracebackType
5457from typing import Any , Generic , TypeVar
5558
5659import numpy as np
@@ -69,8 +72,8 @@ def _is_free_threaded() -> bool:
6972 return False
7073
7174
72- _PYTHON_VERSION = f"{ version_info .major } .{ version_info .minor } .{ version_info .micro } "
73- _FREE_THREADED = _is_free_threaded ()
75+ _PYTHON_VERSION : str = f"{ version_info .major } .{ version_info .minor } .{ version_info .micro } "
76+ _FREE_THREADED : bool = _is_free_threaded ()
7477
7578
7679@dataclass
@@ -246,7 +249,12 @@ def __enter__(self) -> "BenchmarkRunner":
246249 """Enter context manager."""
247250 return self
248251
249- def __exit__ (self , exc_type : Any , exc_val : Any , exc_tb : Any ) -> None :
252+ def __exit__ (
253+ self ,
254+ exc_type : type [BaseException ] | None ,
255+ exc_val : BaseException | None ,
256+ exc_tb : TracebackType | None ,
257+ ) -> None :
250258 """Exit context manager and shutdown executor."""
251259 self ._executor .shutdown (wait = True )
252260
0 commit comments