Skip to content

Commit 451bada

Browse files
committed
fix typing for <=3.8
1 parent 15d0772 commit 451bada

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

modcma/c_maes/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import warnings
22
from enum import Enum
3+
from typing import Union
34

45
import numpy as np
56
from ConfigSpace import (
@@ -66,7 +67,7 @@ def get_all_module_options() -> dict:
6667

6768
def _make_numeric_parameter(
6869
name: str, dim: int, lb: float, ub: float
69-
) -> UniformIntegerHyperparameter | NormalFloatHyperparameter:
70+
) -> Union[UniformIntegerHyperparameter | NormalFloatHyperparameter]:
7071

7172
settings = Parameters(Settings(dim))
7273
default = getattr(settings.weights, name, None)

tests/test_c_mutation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ def test_adapt_xnes(self):
113113

114114
def test_adapt_lpxnes(self):
115115
cma = self.get_cma(options.StepSizeAdaptation.LPXNES)
116-
117116
w = cma.p.weights.weights.clip(0)[: cma.p.pop.n]
118-
119117
z = np.exp(cma.p.weights.cs * (w @ np.log(cma.p.pop.s)))
120118
sigma = np.power(cma.p.settings.sigma0, 1 - cma.p.weights.cs) * z
121119
self.assertTrue(np.isclose(cma.p.mutation.sigma, sigma))

0 commit comments

Comments
 (0)