File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
optuna/storages/_rdb/alembic/versions Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 66
77"""
88
9+ from __future__ import annotations
10+
911import enum
1012
1113import numpy as np
1214from alembic import op
1315import sqlalchemy as sa
1416from sqlalchemy .exc import SQLAlchemyError
1517from sqlalchemy import orm
16- from typing import Optional
17- from typing import Tuple
1818
1919try :
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" )
You can’t perform that action at this time.
0 commit comments