Skip to content

Commit d8d5b1d

Browse files
committed
replace all | by Optional
1 parent df30e1c commit d8d5b1d

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/deterministic_gaussian_sampling/approximation/base_approximation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _map_ctypes_numpy(self, ctype) -> type:
2222
raise TypeError("Unsupported ctype for mapping to numpy dtype")
2323

2424
def _check_numpy_ndarray(
25-
self, arr: numpy.ndarray | None, L: int, N: int
25+
self, arr: Optional[numpy.ndarray], L: int, N: int
2626
) -> ctypes.Array:
2727
if arr is None:
2828
return None

src/deterministic_gaussian_sampling/approximation/dirac_to_dirac.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ctypes
22
import numpy
3+
from typing import Optional
34
import deterministic_gaussian_sampling.type_wrapper.python_variant as python_variant
45
import deterministic_gaussian_sampling.type_wrapper.ctypes_wrapper as ctypes_wrapper
56
from .base_approximation import BaseApproximation
@@ -30,9 +31,9 @@ def approximate_double(
3031
L: int,
3132
N: int,
3233
x: numpy.ndarray,
33-
wX: numpy.ndarray | None = None,
34-
wY: numpy.ndarray | None = None,
35-
options: python_variant.ApproximateOptionsPy | None = None,
34+
wX: Optional[numpy.ndarray] = None,
35+
wY: Optional[numpy.ndarray] = None,
36+
options: Optional[python_variant.ApproximateOptionsPy] = None,
3637
) -> python_variant.ApproximationResultPy:
3738
cdll = self.__class__.cdll
3839
if cdll is None:
@@ -68,9 +69,9 @@ def approximate_function_double(
6869
L: int,
6970
N: int,
7071
x: numpy.ndarray,
71-
wX: numpy.ndarray | None = None,
72-
wY: numpy.ndarray | None = None,
73-
options: python_variant.ApproximateOptionsPy | None = None,
72+
wX: Optional[numpy.ndarray] = None,
73+
wY: Optional[numpy.ndarray] = None,
74+
options: Optional[python_variant.ApproximateOptionsPy] = None,
7475
) -> python_variant.ApproximationResultPy:
7576
cdll = self.__class__.cdll
7677
if cdll is None:
@@ -106,9 +107,9 @@ def approximate_thread_double(
106107
L: int,
107108
N: int,
108109
x: numpy.ndarray,
109-
wX: numpy.ndarray | None = None,
110-
wY: numpy.ndarray | None = None,
111-
options: python_variant.ApproximateOptionsPy | None = None,
110+
wX: Optional[numpy.ndarray] = None,
111+
wY: Optional[numpy.ndarray] = None,
112+
options: Optional[python_variant.ApproximateOptionsPy] = None,
112113
) -> python_variant.ApproximationResultPy:
113114
cdll = self.__class__.cdll
114115
if cdll is None:

src/deterministic_gaussian_sampling/approximation/gaussian_to_dirac.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import deterministic_gaussian_sampling.type_wrapper.python_variant as python_variant
33
import ctypes
44
import numpy
5+
from typing import Optional
56
from .base_approximation import BaseApproximation
67

78

@@ -30,8 +31,8 @@ def approximate_double(
3031
L: int,
3132
N: int,
3233
x: numpy.ndarray,
33-
wX: numpy.ndarray | None = None,
34-
options: python_variant.ApproximateOptionsPy | None = None,
34+
wX: Optional[numpy.ndarray] = None,
35+
options: Optional[python_variant.ApproximateOptionsPy] = None,
3536
) -> python_variant.ApproximationResultPy:
3637
cdll = self.__class__.cdll
3738
if cdll is None:
@@ -61,8 +62,8 @@ def approximate_snd_double(
6162
L: int,
6263
N: int,
6364
x: numpy.ndarray,
64-
wX: numpy.ndarray | None = None,
65-
options: python_variant.ApproximateOptionsPy | None = None,
65+
wX: Optional[numpy.ndarray] = None,
66+
options: Optional[python_variant.ApproximateOptionsPy] = None,
6667
) -> python_variant.ApproximationResultPy:
6768
cdll = self.__class__.cdll
6869
if cdll is None:

0 commit comments

Comments
 (0)