Skip to content

Commit

Permalink
Merge pull request optuna#5819 from boringbyte/fix/_random.py
Browse files Browse the repository at this point in the history
Simplify type annotations for `optuna/samplers/_random.py`
  • Loading branch information
not522 authored Dec 3, 2024
2 parents 0b3cb12 + b45b0be commit babf820
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions optuna/samplers/_random.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import annotations

from typing import Any
from typing import Dict
from typing import Optional
from typing import TYPE_CHECKING

from optuna import distributions
Expand Down Expand Up @@ -43,20 +41,20 @@ def objective(trial):
seed: Seed for random number generator.
"""

def __init__(self, seed: Optional[int] = None) -> None:
def __init__(self, seed: int | None = None) -> None:
self._rng = LazyRandomState(seed)

def reseed_rng(self) -> None:
self._rng.rng.seed()

def infer_relative_search_space(
self, study: Study, trial: FrozenTrial
) -> Dict[str, BaseDistribution]:
) -> dict[str, BaseDistribution]:
return {}

def sample_relative(
self, study: Study, trial: FrozenTrial, search_space: Dict[str, BaseDistribution]
) -> Dict[str, Any]:
self, study: Study, trial: FrozenTrial, search_space: dict[str, BaseDistribution]
) -> dict[str, Any]:
return {}

def sample_independent(
Expand Down

0 comments on commit babf820

Please sign in to comment.