Skip to content

Commit 633a423

Browse files
fbcode/spdl/examples/benchmark_utils.py
Differential Revision: D106766120 Pull Request resolved: #1495
1 parent fa5e934 commit 633a423

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

examples/benchmark_utils.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
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
1012
This module provides a standardized framework for running benchmarks with:
@@ -51,6 +53,7 @@
5153
from enum import Enum
5254
from functools import partial
5355
from sys import version_info
56+
from types import TracebackType
5457
from typing import Any, Generic, TypeVar
5558

5659
import 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

Comments
 (0)