From 827fe5c9304d95277b3ed70b18331c0a34f0f450 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Sat, 7 May 2022 02:10:47 -0500 Subject: [PATCH] Ignore a NumPy 1.22 warning in Numba and fix the flake8-print T001 --> T201 change. (#1464) * Ignore NumPy 1.22 warning in Numba, they're fixing it. * Fix the T001 --> T201 code change. --- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 + src/awkward/_connect/_numba/arrayview.py | 4 +- src/awkward/_v2/_connect/numba/arrayview.py | 4 +- src/awkward/config.py | 99 --------------------- 5 files changed, 6 insertions(+), 104 deletions(-) delete mode 100644 src/awkward/config.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 44013bf021..9054c46387 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: rev: 4.0.1 hooks: - id: flake8 - additional_dependencies: [flake8-bugbear, flake8-print] + additional_dependencies: [flake8-bugbear, flake8-print>=5] - repo: https://github.com/mgedmin/check-manifest rev: "0.48" diff --git a/pyproject.toml b/pyproject.toml index 8128aa4fa6..a136a2a942 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,6 +73,7 @@ filterwarnings = [ "error", "ignore:the imp module is deprecated in favour of importlib:DeprecationWarning", # move to importlib to fix (setuptools issue) "ignore:The NumPy module was reloaded:UserWarning", + "ignore:.*np\\.MachAr.*:DeprecationWarning", # until https://github.com/numba/numba/issues/7758 is fixed ] log_cli_level = "info" diff --git a/src/awkward/_connect/_numba/arrayview.py b/src/awkward/_connect/_numba/arrayview.py index 859ac0f57d..e3ad00aae1 100644 --- a/src/awkward/_connect/_numba/arrayview.py +++ b/src/awkward/_connect/_numba/arrayview.py @@ -17,8 +17,8 @@ def code_to_function(code, function_name, externals=None, debug=False): if debug: - print("################### " + function_name) # noqa: T001 - print(code) # noqa: T001 + print("################### " + function_name) # noqa: T201 + print(code) # noqa: T201 namespace = {} if externals is None else dict(externals) exec(code, namespace) return namespace[function_name] diff --git a/src/awkward/_v2/_connect/numba/arrayview.py b/src/awkward/_v2/_connect/numba/arrayview.py index 4fc39616d6..92bc505460 100644 --- a/src/awkward/_v2/_connect/numba/arrayview.py +++ b/src/awkward/_v2/_connect/numba/arrayview.py @@ -13,8 +13,8 @@ def code_to_function(code, function_name, externals=None, debug=False): if debug: - print("################### " + function_name) # noqa: T001 - print(code) # noqa: T001 + print("################### " + function_name) # noqa: T201 + print(code) # noqa: T201 namespace = {} if externals is None else dict(externals) exec(code, namespace) return namespace[function_name] diff --git a/src/awkward/config.py b/src/awkward/config.py deleted file mode 100644 index 5f96791ce7..0000000000 --- a/src/awkward/config.py +++ /dev/null @@ -1,99 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: no change; keep this file. - -import sys -import argparse -import pkg_resources - -if __name__ == "__main__": - argparser = argparse.ArgumentParser( - description="Print out compilation arguments to use Awkward Array as a C++ dependency" - ) - argparser.add_argument( - "--cflags", - action="store_true", - help="output compiler flags and Awkward include path", - ) - argparser.add_argument( - "--libs", action="store_true", help="output Awkward libraries with path" - ) - argparser.add_argument( - "--libs-only-L", action="store_true", help="output Awkward library path" - ) - argparser.add_argument( - "--libs-only-l", - action="store_true", - help="output Awkward libraries without path", - ) - argparser.add_argument( - "--static-libs", - action="store_true", - help="output Awkward static libraries with path", - ) - argparser.add_argument( - "--static-libs-only-L", - action="store_true", - help="output Awkward static library path", - ) - argparser.add_argument( - "--static-libs-only-l", - action="store_true", - help="output Awkward static libraries without path", - ) - argparser.add_argument( - "--cflags-only-I", action="store_true", help="output Awkward include path" - ) - argparser.add_argument( - "--incdir", action="store_true", help="output Awkward include directory name" - ) - argparser.add_argument( - "--libdir", action="store_true", help="output Awkward library directory name" - ) - - # only used in validating the arguments - args = argparser.parse_args() - - output = [] - incdir = pkg_resources.resource_filename("awkward", "include") - libdir = pkg_resources.resource_filename("awkward", "") - cpu_kernels = "awkward-cpu-kernels" - libawkward = "awkward" - - # loop over original sys.argv to get optional arguments in order - for arg in sys.argv: - if arg == "--cflags": - output.append(f"-std=c++11 -I{incdir}") - - if arg == "--libs": - output.append(f"-L{libdir} -l{libawkward} -l{cpu_kernels} -ldl") - - if arg == "--libs-only-L": - output.append(f"-L{libdir}") - - if arg == "--libs-only-l": - output.append(f"-l{libawkward} -l{cpu_kernels} -ldl") - - if arg == "--static-libs": - output.append( - "-L{} -l{}-static -l{}-static -ldl".format( - libdir, libawkward, cpu_kernels - ) - ) - - if arg == "--static-libs-only-L": - output.append(f"-L{libdir}") - - if arg == "--static-libs-only-l": - output.append(f"-l{libawkward}-static -l{cpu_kernels}-static -ldl") - - if arg == "--cflags-only-I": - output.append(f"-I{incdir}") - - if arg == "--incdir": - output.append(incdir) - - if arg == "--libdir": - output.append(libdir) - - print(" ".join(output)) # noqa: T001