From e7f4fd0d8ba964c9a08ee8376d7ff69b8d3820d5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 23:14:17 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/benchmark.py | 12 ++++-------- examples/pde.py | 8 +++----- install.py | 8 +++++--- sparse/coverage.py | 3 +-- src/sparse/array/csc/spmm_template.inl | 6 ++---- src/sparse/array/csc/spmv_template.inl | 6 ++---- src/sparse/array/csr/add.cu | 6 ++---- 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/examples/benchmark.py b/examples/benchmark.py index 0545b131..bc164e41 100644 --- a/examples/benchmark.py +++ b/examples/benchmark.py @@ -4,8 +4,7 @@ class Timer(Protocol): - def start(self): - ... + def start(self): ... def stop(self): """ @@ -70,14 +69,11 @@ def stop(self): # manager so that we can run both CuPy and SciPy # programs with resource scoping. class DummyScope: - def __init__(self): - ... + def __init__(self): ... - def __enter__(self): - ... + def __enter__(self): ... - def __exit__(self, _, __, ___): - ... + def __exit__(self, _, __, ___): ... def __getitem__(self, item): return self diff --git a/examples/pde.py b/examples/pde.py index fd2dbf4e..507e5638 100644 --- a/examples/pde.py +++ b/examples/pde.py @@ -75,9 +75,9 @@ # Compute the rhs. Note that we non-dimensionalize the coordinates # x and y with the size of the domain in their respective dire- # ctions. - b = np.sin(np.pi * X) * np.cos(np.pi * Y) + np.sin(5.0 * np.pi * X) * np.cos( - 5.0 * np.pi * Y - ) + b = np.sin(np.pi * X) * np.cos(np.pi * Y) + np.sin( + 5.0 * np.pi * X + ) * np.cos(5.0 * np.pi * Y) # b is currently a 2D array. We need to convert it to a column-major # ordered 1D array. This is done with the flatten numpy function. @@ -98,7 +98,6 @@ # Allocate array for the (full) solution, including boundary values p = np.empty((nx, ny)) - def d2_mat_dirichlet_2d(nx, ny, dx, dy): """ Constructs the matrix for the centered second-order accurate @@ -165,7 +164,6 @@ def d2_mat_dirichlet_2d(nx, ny, dx, dy): # Return the final array return d2mat - def p_exact_2d(X, Y): """Computes the exact solution of the Poisson equation in the domain [0, 1]x[-0.5, 0.5] with rhs: diff --git a/install.py b/install.py index 0c8a9660..8f3b04d3 100755 --- a/install.py +++ b/install.py @@ -53,9 +53,11 @@ def flatten(list): option_strings = flatten( [ - [opt, "--no-" + opt[2:], "--no" + opt[2:]] - if opt.startswith("--") - else [opt] + ( + [opt, "--no-" + opt[2:], "--no" + opt[2:]] + if opt.startswith("--") + else [opt] + ) for opt in option_strings ] ) diff --git a/sparse/coverage.py b/sparse/coverage.py index 359a153b..6cfb8a21 100644 --- a/sparse/coverage.py +++ b/sparse/coverage.py @@ -43,8 +43,7 @@ def should_wrap(obj: object) -> bool: class AnyCallable(Protocol): - def __call__(self, *args: Any, **kwargs: Any) -> Any: - ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def wrap(func: AnyCallable) -> Any: diff --git a/src/sparse/array/csc/spmm_template.inl b/src/sparse/array/csc/spmm_template.inl index e7e90bfc..f94a9e0e 100644 --- a/src/sparse/array/csc/spmm_template.inl +++ b/src/sparse/array/csc/spmm_template.inl @@ -37,15 +37,13 @@ struct SpMMCSCImpl { // If we're running with OMP's, then we need to use an non-exclusive // accessor instead of an exclusive one. - auto A_vals = [&args]() -> auto - { + auto A_vals = [&args]() -> auto { if constexpr (KIND == VariantKind::CPU) { return args.A_vals.reduce_accessor, true, 2>(); } else { return args.A_vals.reduce_accessor, false, 2>(); } - } - (); + }(); auto B_pos = args.B_pos.read_accessor, 1>(); auto B_crd = args.B_crd.read_accessor(); auto B_vals = args.B_vals.read_accessor(); diff --git a/src/sparse/array/csc/spmv_template.inl b/src/sparse/array/csc/spmv_template.inl index 15590d97..70b8108e 100644 --- a/src/sparse/array/csc/spmv_template.inl +++ b/src/sparse/array/csc/spmv_template.inl @@ -35,8 +35,7 @@ struct CSCSpMVColSplitImpl { using INDEX_TY = legate_type_of; using VAL_TY = legate_type_of; - auto y = [&args]() -> auto - { + auto y = [&args]() -> auto { if constexpr (KIND == VariantKind::CPU) { return args.y.reduce_accessor, true /* exclusive */, 1>(); } else { @@ -50,8 +49,7 @@ struct CSCSpMVColSplitImpl { // back into CSR up front. return args.y.reduce_accessor, false /* exclusive */, 1>(); } - } - (); + }(); auto A_pos = args.A_pos.read_accessor, 1>(); auto A_crd = args.A_crd.read_accessor(); auto A_vals = args.A_vals.read_accessor(); diff --git a/src/sparse/array/csr/add.cu b/src/sparse/array/csr/add.cu index 613f16ca..b29d95fc 100644 --- a/src/sparse/array/csr/add.cu +++ b/src/sparse/array/csr/add.cu @@ -278,8 +278,7 @@ struct AddCSRCSRImpl { CHECK_CUSPARSE(cusparseSetMatIndexBase(C, index_base)); CHECK_CUSPARSE(cusparseSetMatType(C, CUSPARSE_MATRIX_TYPE_GENERAL)); - auto funcs = []() -> auto - { + auto funcs = []() -> auto { if constexpr (VAL_CODE == Type::Code::FLOAT32) { return std::make_pair(cusparseScsrgeam2_bufferSizeExt, cusparseScsrgeam2); } else if constexpr (VAL_CODE == Type::Code::FLOAT64) { @@ -289,8 +288,7 @@ struct AddCSRCSRImpl { } else { return std::make_pair(cusparseZcsrgeam2_bufferSizeExt, cusparseZcsrgeam2); } - } - (); + }(); using cusparse_val_ty = old_cusparse_type_of;