Skip to content

Commit 4333d41

Browse files
migrate to modern type annotation
1 parent e8dc849 commit 4333d41

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

xopt/generators/utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# from xopt.generator import Generator
22
import numpy as np
3-
from typing import List, Optional
43

54

6-
def get_domination(pop_f: np.ndarray, pop_g: Optional[np.ndarray] = None) -> np.ndarray:
5+
def get_domination(pop_f: np.ndarray, pop_g: np.ndarray | None = None) -> np.ndarray:
76
"""
87
Compute domination matrix for a population based on objective values and constraints. Determines domination
98
relationships between all pairs of individuals in a population.
@@ -46,7 +45,7 @@ def get_domination(pop_f: np.ndarray, pop_g: Optional[np.ndarray] = None) -> np.
4645
return dom
4746

4847

49-
def fast_dominated_argsort_internal(dom: np.ndarray) -> List[np.ndarray]:
48+
def fast_dominated_argsort_internal(dom: np.ndarray) -> list[np.ndarray]:
5049
"""
5150
Used inside of `fast_dominated_argsort`. Call that function instead.
5251
@@ -83,8 +82,8 @@ def fast_dominated_argsort_internal(dom: np.ndarray) -> List[np.ndarray]:
8382

8483

8584
def fast_dominated_argsort(
86-
pop_f: np.ndarray, pop_g: Optional[np.ndarray] = None
87-
) -> List[np.ndarray]:
85+
pop_f: np.ndarray, pop_g: np.ndarray | None = None
86+
) -> list[np.ndarray]:
8887
"""
8988
Performs a dominated sort on matrix of objective function values O. This is a numpy implementation of the algorithm
9089
described in [1].

0 commit comments

Comments
 (0)