Skip to content

Commit

Permalink
Merge pull request optuna#5692 from Prabhat-Thapa45/fix/simplify-type…
Browse files Browse the repository at this point in the history
…-annotations

Simplify type annontaitions to  _imports.py
  • Loading branch information
toshihikoyanase authored Oct 4, 2024
2 parents e185938 + e178889 commit 71914f3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions optuna/_imports.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

import importlib
import types
from types import TracebackType
from typing import Any
from typing import Optional
from typing import Tuple
from typing import Type


Expand All @@ -22,7 +22,7 @@ class _DeferredImportExceptionContextManager:
"""

def __init__(self) -> None:
self._deferred: Optional[Tuple[Exception, str]] = None
self._deferred: tuple[Exception, str] | None = None

def __enter__(self) -> "_DeferredImportExceptionContextManager":
"""Enter the context manager.
Expand All @@ -35,10 +35,10 @@ def __enter__(self) -> "_DeferredImportExceptionContextManager":

def __exit__(
self,
exc_type: Optional[Type[Exception]],
exc_value: Optional[Exception],
traceback: Optional[TracebackType],
) -> Optional[bool]:
exc_type: Type[Exception] | None,
exc_value: Exception | None,
traceback: TracebackType | None,
) -> bool | None:
"""Exit the context manager.
Args:
Expand Down

0 comments on commit 71914f3

Please sign in to comment.