Skip to content

Commit 902986c

Browse files
author
Vahid Tavanashad
committed
get rid of double leading underscore
1 parent 1fbc656 commit 902986c

File tree

4 files changed

+38
-38
lines changed

4 files changed

+38
-38
lines changed

mkl_fft/_float_utils.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
import numpy as np
2828

2929
__all__ = [
30-
"__upcast_float16_array",
31-
"__downcast_float128_array",
32-
"__supported_array_or_not_implemented",
30+
"_upcast_float16_array",
31+
"_downcast_float128_array",
32+
"_supported_array_or_not_implemented",
3333
]
3434

3535

36-
def __upcast_float16_array(x):
36+
def _upcast_float16_array(x):
3737
"""
3838
Used in _scipy_fft to upcast float16 to float32,
3939
instead of float64, as mkl_fft would do
@@ -46,18 +46,18 @@ def __upcast_float16_array(x):
4646
if xdt == np.longdouble and not xdt == np.float64:
4747
raise ValueError("type %s is not supported" % xdt)
4848
if not isinstance(x, np.ndarray):
49-
__x = np.asarray(x)
50-
xdt = __x.dtype
49+
_x = np.asarray(x)
50+
xdt = _x.dtype
5151
if xdt == np.half:
5252
# no half-precision routines, so convert to single precision
53-
return np.asarray(__x, dtype=np.float32)
53+
return np.asarray(_x, dtype=np.float32)
5454
if xdt == np.longdouble and not xdt == np.float64:
5555
raise ValueError("type %s is not supported" % xdt)
56-
return __x
56+
return _x
5757
return x
5858

5959

60-
def __downcast_float128_array(x):
60+
def _downcast_float128_array(x):
6161
"""
6262
Used in _numpy_fft to unsafely downcast float128/complex256 to
6363
complex128, instead of raising an error
@@ -69,27 +69,27 @@ def __downcast_float128_array(x):
6969
elif xdt == np.clongdouble and not xdt == np.complex128:
7070
return np.asarray(x, dtype=np.complex128)
7171
if not isinstance(x, np.ndarray):
72-
__x = np.asarray(x)
73-
xdt = __x.dtype
72+
_x = np.asarray(x)
73+
xdt = _x.dtype
7474
if xdt == np.longdouble and not xdt == np.float64:
7575
return np.asarray(x, dtype=np.float64)
7676
elif xdt == np.clongdouble and not xdt == np.complex128:
7777
return np.asarray(x, dtype=np.complex128)
78-
return __x
78+
return _x
7979
return x
8080

8181

82-
def __supported_array_or_not_implemented(x):
82+
def _supported_array_or_not_implemented(x):
8383
"""
8484
Used in _scipy_fft to convert array to float32,
8585
float64, complex64, or complex128 type or raise NotImplementedError
8686
"""
87-
__x = np.asarray(x)
87+
_x = np.asarray(x)
8888
black_list = [np.half]
8989
if hasattr(np, "float128"):
9090
black_list.append(np.float128)
9191
if hasattr(np, "complex256"):
9292
black_list.append(np.complex256)
93-
if __x.dtype in black_list:
93+
if _x.dtype in black_list:
9494
raise NotImplementedError
95-
return __x
95+
return _x

mkl_fft/_numpy_fft.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
from . import _pydfti as mkl_fft # pylint: disable=no-name-in-module
7979
from ._fft_utils import _check_norm, _compute_fwd_scale
80-
from ._float_utils import __downcast_float128_array
80+
from ._float_utils import _downcast_float128_array
8181

8282

8383
# copied with modifications from:
@@ -240,7 +240,7 @@ def fft(a, n=None, axis=-1, norm=None):
240240
241241
"""
242242

243-
x = __downcast_float128_array(a)
243+
x = _downcast_float128_array(a)
244244
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
245245

246246
return trycall(mkl_fft.fft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc})
@@ -333,7 +333,7 @@ def ifft(a, n=None, axis=-1, norm=None):
333333
334334
"""
335335

336-
x = __downcast_float128_array(a)
336+
x = _downcast_float128_array(a)
337337
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
338338

339339
return trycall(mkl_fft.ifft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc})
@@ -424,7 +424,7 @@ def rfft(a, n=None, axis=-1, norm=None):
424424
425425
"""
426426

427-
x = __downcast_float128_array(a)
427+
x = _downcast_float128_array(a)
428428
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
429429

430430
return trycall(mkl_fft.rfft, (x,), {"n": n, "axis": axis, "fwd_scale": fsc})
@@ -517,7 +517,7 @@ def irfft(a, n=None, axis=-1, norm=None):
517517
518518
"""
519519

520-
x = __downcast_float128_array(a)
520+
x = _downcast_float128_array(a)
521521
fsc = _compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
522522

523523
return trycall(
@@ -603,7 +603,7 @@ def hfft(a, n=None, axis=-1, norm=None):
603603
"""
604604

605605
norm = _swap_direction(norm)
606-
x = __downcast_float128_array(a)
606+
x = _downcast_float128_array(a)
607607
x = np.array(x, copy=True, dtype=complex)
608608
np.conjugate(x, out=x)
609609
fsc = _compute_fwd_scale(norm, n, 2 * (x.shape[axis] - 1))
@@ -673,7 +673,7 @@ def ihfft(a, n=None, axis=-1, norm=None):
673673

674674
# The copy may be required for multithreading.
675675
norm = _swap_direction(norm)
676-
x = __downcast_float128_array(a)
676+
x = _downcast_float128_array(a)
677677
x = np.array(x, copy=True, dtype=float)
678678
fsc = _compute_fwd_scale(norm, n, x.shape[axis])
679679

@@ -785,7 +785,7 @@ def fftn(a, s=None, axes=None, norm=None):
785785
786786
"""
787787

788-
x = __downcast_float128_array(a)
788+
x = _downcast_float128_array(a)
789789
s, axes = _cook_nd_args(x, s, axes)
790790
fsc = _compute_fwd_scale(norm, s, x.shape)
791791

@@ -892,7 +892,7 @@ def ifftn(a, s=None, axes=None, norm=None):
892892
893893
"""
894894

895-
x = __downcast_float128_array(a)
895+
x = _downcast_float128_array(a)
896896
s, axes = _cook_nd_args(x, s, axes)
897897
fsc = _compute_fwd_scale(norm, s, x.shape)
898898

@@ -1180,7 +1180,7 @@ def rfftn(a, s=None, axes=None, norm=None):
11801180
11811181
"""
11821182

1183-
x = __downcast_float128_array(a)
1183+
x = _downcast_float128_array(a)
11841184
s, axes = _cook_nd_args(x, s, axes)
11851185
fsc = _compute_fwd_scale(norm, s, x.shape)
11861186

@@ -1324,7 +1324,7 @@ def irfftn(a, s=None, axes=None, norm=None):
13241324
13251325
"""
13261326

1327-
x = __downcast_float128_array(a)
1327+
x = _downcast_float128_array(a)
13281328
s, axes = _cook_nd_args(x, s, axes, invreal=True)
13291329
fsc = _compute_fwd_scale(norm, s, x.shape)
13301330

mkl_fft/_scipy_fft.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
from . import _pydfti as mkl_fft # pylint: disable=no-name-in-module
3636
from ._fft_utils import _compute_fwd_scale
37-
from ._float_utils import __supported_array_or_not_implemented
37+
from ._float_utils import _supported_array_or_not_implemented
3838

3939
__doc__ = """
4040
This module implements interfaces mimicing `scipy.fft` module.
@@ -223,7 +223,7 @@ def _cook_nd_args(a, s=None, axes=None, invreal=False):
223223

224224
def _validate_input(a):
225225
try:
226-
x = __supported_array_or_not_implemented(a)
226+
x = _supported_array_or_not_implemented(a)
227227
except ValueError:
228228
raise NotImplementedError
229229

mkl_fft/_scipy_fftpack.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,46 @@
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
from . import _pydfti as mkl_fft # pylint: disable=no-name-in-module
28-
from ._float_utils import __upcast_float16_array
28+
from ._float_utils import _upcast_float16_array
2929

3030
__all__ = ["fft", "ifft", "fftn", "ifftn", "fft2", "ifft2", "rfft", "irfft"]
3131

3232

3333
def fft(a, n=None, axis=-1, overwrite_x=False):
34-
x = __upcast_float16_array(a)
34+
x = _upcast_float16_array(a)
3535
return mkl_fft.fft(x, n=n, axis=axis, overwrite_x=overwrite_x)
3636

3737

3838
def ifft(a, n=None, axis=-1, overwrite_x=False):
39-
x = __upcast_float16_array(a)
39+
x = _upcast_float16_array(a)
4040
return mkl_fft.ifft(x, n=n, axis=axis, overwrite_x=overwrite_x)
4141

4242

4343
def fftn(a, shape=None, axes=None, overwrite_x=False):
44-
x = __upcast_float16_array(a)
44+
x = _upcast_float16_array(a)
4545
return mkl_fft.fftn(x, s=shape, axes=axes, overwrite_x=overwrite_x)
4646

4747

4848
def ifftn(a, shape=None, axes=None, overwrite_x=False):
49-
x = __upcast_float16_array(a)
49+
x = _upcast_float16_array(a)
5050
return mkl_fft.ifftn(x, s=shape, axes=axes, overwrite_x=overwrite_x)
5151

5252

5353
def fft2(a, shape=None, axes=(-2, -1), overwrite_x=False):
54-
x = __upcast_float16_array(a)
54+
x = _upcast_float16_array(a)
5555
return mkl_fft.fftn(x, s=shape, axes=axes, overwrite_x=overwrite_x)
5656

5757

5858
def ifft2(a, shape=None, axes=(-2, -1), overwrite_x=False):
59-
x = __upcast_float16_array(a)
59+
x = _upcast_float16_array(a)
6060
return mkl_fft.ifftn(x, s=shape, axes=axes, overwrite_x=overwrite_x)
6161

6262

6363
def rfft(a, n=None, axis=-1, overwrite_x=False):
64-
x = __upcast_float16_array(a)
64+
x = _upcast_float16_array(a)
6565
return mkl_fft.rfftpack(x, n=n, axis=axis, overwrite_x=overwrite_x)
6666

6767

6868
def irfft(a, n=None, axis=-1, overwrite_x=False):
69-
x = __upcast_float16_array(a)
69+
x = _upcast_float16_array(a)
7070
return mkl_fft.irfftpack(x, n=n, axis=axis, overwrite_x=overwrite_x)

0 commit comments

Comments
 (0)