Skip to content

Commit b93bf1b

Browse files
authored
Merge pull request optuna#5886 from boringbyte/fix/v3.0.0.d.py
Simplify type annotations for `optuna/storages/_rdb/alembic/versions/v3.0.0.d.py`
2 parents 21eca54 + 59f36b4 commit b93bf1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

optuna/storages/_rdb/alembic/versions/v3.0.0.d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
77
"""
88

9+
from __future__ import annotations
10+
911
import enum
1012

1113
import numpy as np
1214
from alembic import op
1315
import sqlalchemy as sa
1416
from sqlalchemy.exc import SQLAlchemyError
1517
from sqlalchemy import orm
16-
from typing import Optional
17-
from typing import Tuple
1818

1919
try:
2020
from sqlalchemy.orm import declarative_base
@@ -53,7 +53,7 @@ class TrialValueType(enum.Enum):
5353
def value_to_stored_repr(
5454
cls,
5555
value: float,
56-
) -> Tuple[Optional[float], TrialValueType]:
56+
) -> tuple[float | None, TrialValueType]:
5757
if value == float("inf"):
5858
return (None, cls.TrialValueType.INF_POS)
5959
elif value == float("-inf"):
@@ -62,7 +62,7 @@ def value_to_stored_repr(
6262
return (value, cls.TrialValueType.FINITE)
6363

6464
@classmethod
65-
def stored_repr_to_value(cls, value: Optional[float], float_type: TrialValueType) -> float:
65+
def stored_repr_to_value(cls, value: float | None, float_type: TrialValueType) -> float:
6666
if float_type == cls.TrialValueType.INF_POS:
6767
assert value is None
6868
return float("inf")

0 commit comments

Comments
 (0)