Skip to content

Commit

Permalink
fix type-hint
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBlanke committed Dec 7, 2024
1 parent 8bd9a34 commit 540fcf0
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import BayesianOptimizer as _BayesianOptimizer
Expand Down Expand Up @@ -50,7 +50,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import (
Expand Down Expand Up @@ -45,7 +45,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import DirectAlgorithm as _DirectAlgorithm
Expand Down Expand Up @@ -45,7 +45,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import DownhillSimplexOptimizer as _DownhillSimplexOptimizer
Expand Down Expand Up @@ -45,7 +45,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import EnsembleOptimizer as _EnsembleOptimizer
Expand All @@ -13,7 +13,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import (
Expand Down Expand Up @@ -51,7 +51,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import ForestOptimizer as _ForestOptimizer
Expand Down Expand Up @@ -51,7 +51,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import GeneticAlgorithmOptimizer as _GeneticAlgorithmOptimizer
Expand Down Expand Up @@ -49,7 +49,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
5 changes: 3 additions & 2 deletions src/gradient_free_optimizers/optimizer_search/grid_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import GridSearchOptimizer as _GridSearchOptimizer
Expand Down Expand Up @@ -41,7 +41,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import HillClimbingOptimizer as _HillClimbingOptimizer
Expand Down Expand Up @@ -44,7 +44,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import LipschitzOptimizer as _LipschitzOptimizer
Expand Down Expand Up @@ -45,7 +45,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import (
Expand Down Expand Up @@ -46,7 +46,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import ParticleSwarmOptimizer as _ParticleSwarmOptimizer
Expand Down Expand Up @@ -47,7 +47,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import PatternSearch as _PatternSearch
Expand Down Expand Up @@ -43,7 +43,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import PowellsMethod as _PowellsMethod
Expand Down Expand Up @@ -44,7 +44,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import RandomAnnealingOptimizer as _RandomAnnealingOptimizer
Expand Down Expand Up @@ -48,7 +48,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import (
Expand Down Expand Up @@ -50,7 +50,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import RandomSearchOptimizer as _RandomSearchOptimizer
Expand Down Expand Up @@ -35,7 +35,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import (
Expand Down Expand Up @@ -48,7 +48,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import (
Expand Down Expand Up @@ -50,7 +50,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Email: [email protected]
# License: MIT License

from typing import List, Dict, Literal, Literal
from typing import List, Dict, Literal, Union

from ..search import Search
from ..optimizers import SpiralOptimization as _SpiralOptimization
Expand Down Expand Up @@ -42,7 +42,8 @@ def __init__(
self,
search_space: Dict[str, list],
initialize: Dict[
Literal["grid", "vertices", "random", "warm_start"], int | List
Literal["grid", "vertices", "random", "warm_start"],
Union[int, list[dict]],
] = {"grid": 4, "random": 2, "vertices": 4},
constraints: List[callable] = [],
random_state: int = None,
Expand Down
Loading

0 comments on commit 540fcf0

Please sign in to comment.