Skip to content

Commit d0319ac

Browse files
committed
run isort
1 parent d5ed2bb commit d0319ac

17 files changed

+67
-61
lines changed

setup.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ parentdir_prefix=suitesparse_graphblas-
3535
[tool:pytest]
3636
testpaths = suitesparse_graphblas/tests
3737

38+
[isort]
39+
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
40+
profile = black
41+
skip_gitignore = true
42+
float_to_top = true
43+
default_section = THIRDPARTY
44+
known_first_party = suitesparse_graphblas

setup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
from setuptools import setup, find_packages, Extension
1+
import os
2+
import sys
23
from glob import glob
34

5+
import numpy as np
6+
from setuptools import Extension, find_packages, setup
7+
8+
import versioneer
9+
410
try:
511
from Cython.Build import cythonize
612
from Cython.Compiler.Options import get_directive_defaults
713

814
use_cython = True
915
except ImportError:
1016
use_cython = False
11-
import numpy as np
12-
import os
13-
import sys
14-
import versioneer
17+
1518

1619
is_win = sys.platform.startswith("win")
1720
define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]

suitesparse_graphblas/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from ._graphblas import ffi, lib # noqa
1+
from . import exceptions as ex
22
from . import utils
3+
from ._graphblas import ffi, lib # noqa
34
from ._version import get_versions
4-
from . import exceptions as ex
55

66

77
def is_initialized():

suitesparse_graphblas/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
34
from cffi import FFI
45

56
is_win = sys.platform.startswith("win")

suitesparse_graphblas/create_headers.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import shutil
2828
import subprocess
2929
import sys
30+
3031
import pycparser
3132
from pycparser import c_ast, c_generator, parse_file
3233

@@ -579,7 +580,7 @@ def handle_function_node(node):
579580
group = "matrix"
580581
elif "GrB_Vector" in text:
581582
group = "vector"
582-
elif "GxB_Scalar" in text:
583+
elif "GxB_Scalar" in text or "GrB_Scalar" in text:
583584
group = "scalar"
584585
else:
585586
group = node.name.split("_", 2)[1]
@@ -596,13 +597,15 @@ def handle_function_node(node):
596597
"Semiring": "semiring",
597598
"Type": "type",
598599
"UnaryOp": "unary",
600+
"IndexUnaryOp": "indexunary",
599601
# "everything else" is "core"
600602
"getVersion": "core",
601603
"Global": "core",
602604
"cuda": "core",
603605
"finalize": "core",
604606
"init": "core",
605607
"wait": "core",
608+
"deserialize": "core",
606609
}[group]
607610
return {
608611
"name": node.name,
@@ -807,8 +810,12 @@ def main():
807810
print("Step 6: check #define definitions")
808811
with open(graphblas_h) as f:
809812
text = f.read()
813+
define_lines = re.compile(r".*?#define\s+\w+\s+")
810814
define_pattern = re.compile(r"#define\s+\w+\s+")
811-
defines = {x[len("#define") :].strip() for x in define_pattern.findall(text)}
815+
defines = set()
816+
for line in define_lines.findall(text):
817+
line = line.split("//")[0].split("/*")[0]
818+
defines.update(x[len("#define") :].strip() for x in define_pattern.findall(line))
812819
extra_defines = (DEFINES | CHAR_DEFINES) - defines
813820
if extra_defines:
814821
# Should this raise? If it's a problem, it will raise when compiling.

suitesparse_graphblas/io/binary.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from pathlib import Path
21
from ctypes.util import find_library
3-
from suitesparse_graphblas import ffi, lib, check_status, matrix, __version__
2+
from pathlib import Path
3+
44
from cffi import FFI
55

6+
from suitesparse_graphblas import __version__, check_status, ffi, lib, matrix
67

78
stdffi = FFI()
89
stdffi.cdef(

suitesparse_graphblas/matrix.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
from suitesparse_graphblas import (
2-
lib,
3-
ffi,
4-
check_status,
5-
)
1+
from suitesparse_graphblas import check_status, ffi, lib
62

73

84
def free(A):

suitesparse_graphblas/scalar.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from suitesparse_graphblas import (
2-
lib,
3-
ffi,
4-
check_status,
5-
exceptions,
6-
)
1+
from suitesparse_graphblas import check_status, exceptions, ffi, lib
72

83

94
def free(v):

suitesparse_graphblas/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from suitesparse_graphblas import initialize
34

45

suitesparse_graphblas/tests/test_doctest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
def test_run_doctests():
22
import doctest
3-
from suitesparse_graphblas import (
4-
matrix,
5-
vector,
6-
scalar,
7-
)
3+
4+
from suitesparse_graphblas import matrix, scalar, vector
85

96
for mod in (
107
matrix,

0 commit comments

Comments
 (0)