Skip to content

Commit 1070406

Browse files
committed
FIX: compatibility with numba 0.43 (overload function)
1 parent 845f047 commit 1070406

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: python
22

33
python:
44
- "3.6"
5-
- "3.7"
65

76
sudo: false
87

interpolation/multilinear/fungen.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
from numba.extending import overload
88
from numba.types.containers import Tuple, UniTuple
99

10+
from distutils.version import LooseVersion
11+
from numba import __version__
12+
if LooseVersion(__version__)>='0.43':
13+
overload_options = {'strict': False}
14+
else:
15+
overload_options = {}
16+
1017
# from math import max, min
1118

1219
####################
@@ -83,7 +90,7 @@ def fun(gc):
8390
def fmap():
8491
pass
8592

86-
@overload(fmap)
93+
@overload(fmap, **overload_options)
8794
def _map(*args):
8895

8996
if len(args)==2 and isinstance(args[1], (Tuple, UniTuple)):

interpolation/splines/eval_splines.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
from numba import prange
77
from .codegen import get_code_linear, get_code_cubic, source_to_function
88

9+
from distutils.version import LooseVersion
10+
from numba import __version__
11+
if LooseVersion(__version__)>='0.43':
12+
overload_options = {'strict': False}
13+
else:
14+
overload_options = {}
15+
916
#
1017

1118
Ad = np.array([
@@ -81,7 +88,7 @@ def _eval_linear():
8188

8289
from .option_types import options, t_CONSTANT, t_LINEAR, t_NEAREST
8390

84-
@overload(_eval_linear)
91+
@overload(_eval_linear, **overload_options)
8592
def __eval_linear(grid,C,points):
8693
# print("We allocate with default extrapolation.")
8794
d = len(grid)
@@ -97,7 +104,7 @@ def __eval_linear(grid,C,points):
97104
f = source_to_function(code, context)
98105
return f
99106

100-
@overload(_eval_linear)
107+
@overload(_eval_linear, **overload_options)
101108
def __eval_linear(grid,C,points,extrap_mode):
102109

103110
d = len(grid)
@@ -124,7 +131,7 @@ def __eval_linear(grid,C,points,extrap_mode):
124131

125132

126133

127-
@overload(_eval_linear)
134+
@overload(_eval_linear, **overload_options)
128135
def __eval_linear(grid,C,points,out,extrap_mode):
129136

130137
# print(f"We are going to do inplace, with {extrap_mode} extrapolation")
@@ -148,7 +155,7 @@ def __eval_linear(grid,C,points,out,extrap_mode):
148155
return f
149156

150157

151-
@overload(_eval_linear)
158+
@overload(_eval_linear, **overload_options)
152159
def __eval_linear(grid,C,points,out):
153160

154161
# print("We are going to do inplace, with default extrapolation")
@@ -178,7 +185,7 @@ def _eval_cubic():
178185

179186
from .option_types import options, t_CONSTANT, t_LINEAR, t_NEAREST
180187

181-
@overload(_eval_cubic)
188+
@overload(_eval_cubic, **overload_options)
182189
def __eval_cubic(grid,C,points):
183190
# print("We allocate with default extrapolation.")
184191
d = len(grid)
@@ -194,7 +201,7 @@ def __eval_cubic(grid,C,points):
194201
f = source_to_function(code, context)
195202
return f
196203

197-
@overload(_eval_cubic)
204+
@overload(_eval_cubic, **overload_options)
198205
def __eval_cubic(grid,C,points,extrap_mode):
199206

200207
d = len(grid)
@@ -222,7 +229,7 @@ def __eval_cubic(grid,C,points,extrap_mode):
222229

223230

224231

225-
@overload(_eval_cubic)
232+
@overload(_eval_cubic, **overload_options)
226233
def __eval_cubic(grid,C,points,out,extrap_mode):
227234

228235
# print(f"We are going to do inplace, with {extrap_mode} extrapolation")
@@ -246,7 +253,7 @@ def __eval_cubic(grid,C,points,out,extrap_mode):
246253
return f
247254

248255

249-
@overload(_eval_cubic)
256+
@overload(_eval_cubic, **overload_options)
250257
def __eval_cubic(grid,C,points,out):
251258

252259
# print("We are going to do inplace, with default extrapolation")

interpolation/splines/prefilter_cubic.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
from numba import generated_jit
44
from numba.extending import overload
55

6+
7+
from distutils.version import LooseVersion
8+
from numba import __version__
9+
if LooseVersion(__version__)>='0.43':
10+
overload_options = {'strict': False}
11+
else:
12+
overload_options = {}
13+
614
# used by njitted routines (frozen)
715
basis = (1.0 / 6.0, 2.0 / 3.0, 1.0 / 6.0, 0.0)
816

@@ -92,7 +100,7 @@ def _filter_cubic():
92100

93101

94102
# non allocating version
95-
@overload(_filter_cubic)
103+
@overload(_filter_cubic, **overload_options)
96104
def __filter_cubic(grid, D, C):
97105

98106
d = len(grid.types)

0 commit comments

Comments
 (0)