Skip to content

Commit cd508d5

Browse files
committed
Add isort to pre-commit and add to pyproject.toml
1 parent 193774c commit cd508d5

14 files changed

+69
-35
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ repos:
2929
- flake8-docstrings==1.7.0
3030
- flake8-bugbear==24.4.26
3131

32+
- repo: https://github.com/pycqa/isort
33+
rev: 5.13.2
34+
hooks:
35+
- id: isort
36+
name: isort (python)
37+
- id: isort
38+
name: isort (cython)
39+
types: [cython]
40+
- id: isort
41+
name: isort (pyi)
42+
types: [pyi]
43+
3244
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
3345
rev: v2.14.0
3446
hooks:

_vendored/conv_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
__all__ = ["process_str", "process_file"]
7878

7979
import os
80-
import sys
8180
import re
81+
import sys
8282

8383
# names for replacement that are already global.
8484
global_names = {}

mkl_fft/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@
2424
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27+
import mkl_fft.interfaces
28+
2729
from . import _init_helper
2830
from ._pydfti import (
2931
fft,
30-
ifft,
3132
fft2,
32-
ifft2,
3333
fftn,
34+
ifft,
35+
ifft2,
3436
ifftn,
35-
rfftpack,
37+
irfft,
38+
irfft2,
39+
irfftn,
3640
irfftpack,
3741
rfft,
38-
irfft,
3942
rfft2,
40-
irfft2,
4143
rfftn,
42-
irfftn,
44+
rfftpack,
4345
)
44-
4546
from ._version import __version__
46-
import mkl_fft.interfaces
4747

4848
__all__ = [
4949
"fft",

mkl_fft/_numpy_fft.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@
7070
"ifftn",
7171
]
7272

73-
from numpy import array, asanyarray, conjugate, take, sqrt, prod
73+
import re
74+
75+
from numpy import array, asanyarray, conjugate, prod, sqrt, take
7476

75-
from . import _pydfti as mkl_fft
7677
from . import _float_utils
77-
import re
78+
from . import _pydfti as mkl_fft
7879

7980

8081
def _check_norm(norm):

mkl_fft/_pydfti.pyx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,23 @@
2828

2929
# imports
3030
import sys
31+
3132
import numpy as np
33+
3234
if np.lib.NumpyVersion(np.__version__) >= "2.0.0a0":
3335
from numpy._core._multiarray_tests import internal_overlap
3436
else:
3537
from numpy.core._multiarray_tests import internal_overlap
38+
3639
from threading import local as threading_local
3740

3841
# cimports
42+
43+
cimport cpython.pycapsule
3944
cimport numpy as cnp
45+
from cpython.exc cimport PyErr_Clear, PyErr_Occurred
46+
from cpython.mem cimport PyMem_Free, PyMem_Malloc
4047
from libc.string cimport memcpy
41-
cimport cpython.pycapsule
42-
from cpython.exc cimport (PyErr_Occurred, PyErr_Clear)
43-
from cpython.mem cimport (PyMem_Malloc, PyMem_Free)
44-
4548

4649
# thread-local storage
4750
_tls = threading_local()

mkl_fft/_scipy_fft.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27-
from . import _pydfti as mkl_fft
28-
from . import _float_utils
29-
import mkl
30-
31-
from numpy import take, sqrt, prod
32-
import contextvars
3327
import contextlib
28+
import contextvars
3429
import operator
3530
import os
3631

32+
import mkl
33+
from numpy import prod, sqrt, take
34+
35+
from . import _float_utils
36+
from . import _pydfti as mkl_fft
3737

3838
__doc__ = """
3939
This module implements interfaces mimicing `scipy.fft` module.

mkl_fft/_scipy_fftpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27-
from . import _pydfti as mkl_fft
2827
from . import _float_utils
28+
from . import _pydfti as mkl_fft
2929

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

mkl_fft/interfaces/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@
2323
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2424
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

26-
from . import numpy_fft
27-
from . import scipy_fft
26+
from . import numpy_fft, scipy_fft

mkl_fft/tests/test_fft1d.py

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

2727
import numpy as np
28-
from numpy.testing import TestCase, assert_, assert_allclose
2928
from numpy import random as rnd
29+
from numpy.testing import TestCase, assert_, assert_allclose
30+
3031
import mkl_fft
3132

3233

mkl_fft/tests/test_fftnd.py

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

2727
import numpy as np
28-
from numpy.testing import TestCase, assert_allclose
29-
from numpy import random as rnd
3028
import pytest
29+
from numpy import random as rnd
30+
from numpy.testing import TestCase, assert_allclose
31+
3132
import mkl_fft
3233

3334
reps_64 = (2**11) * np.finfo(np.float64).eps

mkl_fft/tests/test_interfaces.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2424
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

26-
import mkl_fft.interfaces as mfi
27-
import pytest
2826
import numpy as np
27+
import pytest
28+
29+
import mkl_fft.interfaces as mfi
2930

3031

3132
@pytest.mark.parametrize("norm", [None, "forward", "backward", "ortho"])

mkl_fft/tests/test_pocketfft.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# This file includes tests from numpy.fft module:
22
# https://github.com/numpy/numpy/blob/main/numpy/fft/tests/test_pocketfft.py
33

4+
import queue
5+
import threading
6+
47
import numpy as np
58
import pytest
69
from numpy.random import random
7-
from numpy.testing import assert_array_equal, assert_raises, assert_allclose, IS_WASM
8-
import threading
9-
import queue
10+
from numpy.testing import (
11+
IS_WASM,
12+
assert_allclose,
13+
assert_array_equal,
14+
assert_raises,
15+
)
1016

1117
import mkl_fft.interfaces.numpy_fft as mkl_fft
1218

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ test = ["pytest"]
6666
Download = "http://github.com/IntelPython/mkl_fft"
6767
Homepage = "http://github.com/IntelPython/mkl_fft"
6868

69+
[tool.isort]
70+
ensure_newline_before_comments = true
71+
force_grid_wrap = 0
72+
include_trailing_comma = true
73+
line_length = 80
74+
multi_line_output = 3
75+
skip = []
76+
use_parentheses = true
77+
6978
[tool.setuptools]
7079
include-package-data = true
7180
packages = ["mkl_fft", "mkl_fft.interfaces"]

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2525
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27-
import sys
2827
import os
28+
import sys
2929
from os.path import join
30+
3031
import Cython.Build
31-
from setuptools import setup, Extension
3232
import numpy as np
33+
from setuptools import Extension, setup
3334

3435
sys.path.insert(0, os.path.dirname(__file__)) # Ensures local imports work
3536
from _vendored.conv_template import process_file as process_c_file # noqa: E402

0 commit comments

Comments
 (0)