From 38b4f23b490e178a87f64ffe23fc2b6e5b07ba02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 05:36:03 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/amrex/Array4.py | 14 +++++++------- src/amrex/PODVector.py | 14 +++++++------- src/amrex/StructOfArrays.py | 26 ++++++++++---------------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/src/amrex/Array4.py b/src/amrex/Array4.py index 11ad7d62..5bc28448 100644 --- a/src/amrex/Array4.py +++ b/src/amrex/Array4.py @@ -84,15 +84,15 @@ def array4_to_cupy(self, copy=False, order="F"): def register_Array4_extension(amr): """Array4 helper methods""" - import inspect, sys + import inspect + import sys # register member functions for every Array4_* type for _, Array4_type in inspect.getmembers( - sys.modules[amr.__name__], - lambda member: - inspect.isclass(member) and - member.__module__ == amr.__name__ and - member.__name__.startswith("Array4_") - ): + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("Array4_"), + ): Array4_type.to_numpy = array4_to_numpy Array4_type.to_cupy = array4_to_cupy diff --git a/src/amrex/PODVector.py b/src/amrex/PODVector.py index 6c46ca98..ac807182 100644 --- a/src/amrex/PODVector.py +++ b/src/amrex/PODVector.py @@ -62,15 +62,15 @@ def podvector_to_cupy(self, copy=False): def register_PODVector_extension(amr): """PODVector helper methods""" - import inspect, sys + import inspect + import sys # register member functions for every PODVector_* type for _, POD_type in inspect.getmembers( - sys.modules[amr.__name__], - lambda member: - inspect.isclass(member) and - member.__module__ == amr.__name__ and - member.__name__.startswith("PODVector_") - ): + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("PODVector_"), + ): POD_type.to_numpy = podvector_to_numpy POD_type.to_cupy = podvector_to_cupy diff --git a/src/amrex/StructOfArrays.py b/src/amrex/StructOfArrays.py index 4a56186a..3926932c 100644 --- a/src/amrex/StructOfArrays.py +++ b/src/amrex/StructOfArrays.py @@ -26,11 +26,8 @@ def soa_to_numpy(self, copy=False): of 1D numpy arrays. """ import numpy as np - - SoA_np = namedtuple( - type(self).__name__ + "_np", - ['real', 'int'] - ) + + SoA_np = namedtuple(type(self).__name__ + "_np", ["real", "int"]) soa_view = SoA_np([], []) @@ -70,10 +67,7 @@ def soa_to_cupy(self, copy=False): """ import cupy as cp - SoA_cp = namedtuple( - type(self).__name__ + "_cp", - ['real', 'int'] - ) + SoA_cp = namedtuple(type(self).__name__ + "_cp", ["real", "int"]) soa_view = SoA_cp([], []) @@ -91,15 +85,15 @@ def soa_to_cupy(self, copy=False): def register_SoA_extension(amr): """StructOfArrays helper methods""" - import inspect, sys + import inspect + import sys # register member functions for every StructOfArrays_* type for _, SoA_type in inspect.getmembers( - sys.modules[amr.__name__], - lambda member: - inspect.isclass(member) and - member.__module__ == amr.__name__ and - member.__name__.startswith("StructOfArrays_") - ): + sys.modules[amr.__name__], + lambda member: inspect.isclass(member) + and member.__module__ == amr.__name__ + and member.__name__.startswith("StructOfArrays_"), + ): SoA_type.to_numpy = soa_to_numpy SoA_type.to_cupy = soa_to_cupy