diff --git a/examples/python/call-external.py b/examples/python/call-external.py index 49b25d6e015780789c5e56af46d47a14e4611cf8..6694daf5e020f513bc1207878cb66ee3f41f2785 100644 --- a/examples/python/call-external.py +++ b/examples/python/call-external.py @@ -77,7 +77,7 @@ class CBLASGEMV(lp.ScalarCallable): def generate_preambles(self, target): assert isinstance(target, CTarget) - yield("99_cblas", "#include ") + yield ("99_cblas", "#include ") return # }}} diff --git a/loopy/kernel/instruction.py b/loopy/kernel/instruction.py index 9a2437bf63feba1fd9114539248ecf889cae5ad2..1f04b549f9fe4e04219d0bf0a3df3beb4117d598 100644 --- a/loopy/kernel/instruction.py +++ b/loopy/kernel/instruction.py @@ -1065,9 +1065,9 @@ class CallInstruction(MultiAssignmentBase): return result def arg_id_to_arg(self): - """:returns: a :class:`dict` mapping argument identifiers (non-negative numbers - for positional arguments and negative numbers - for assignees) to their respective values + """:returns: a :class:`dict` mapping argument identifiers (non-negative + numbers for positional arguments and negative numbers for assignees) to + their respective values """ arg_id_to_arg = dict(enumerate(self.expression.parameters)) for i, arg in enumerate(self.assignees): diff --git a/loopy/symbolic.py b/loopy/symbolic.py index 1c092bf84c46165a747e70907705169359579d66..b6bd1d0094dd7f9b213636207cccfc6927bead47 100644 --- a/loopy/symbolic.py +++ b/loopy/symbolic.py @@ -899,8 +899,8 @@ class EvaluatorWithDeficientContext(PartialEvaluationMapper): class VariableInAnExpression(CombineMapper): def __init__(self, variables_to_search): - assert(all(isinstance(variable, p.Variable) for variable in - variables_to_search)) + assert all(isinstance(variable, p.Variable) for variable in + variables_to_search) self.variables_to_search = variables_to_search def combine(self, values): diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index 9df5da5ca56b1fe3a6d0d5079922fad589a27631..aaa59a1b82e16c67a694fb831826765cd3bb4d60 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -117,13 +117,13 @@ class InfOrNanInExpressionRecorder(IdentityMapper): def c99_preamble_generator(preamble_info): if any(dtype.is_integral() for dtype in preamble_info.seen_dtypes): - yield("10_stdint", "#include ") + yield ("10_stdint", "#include ") if any(dtype.numpy_dtype == np.dtype("bool") for dtype in preamble_info.seen_dtypes if isinstance(dtype, NumpyType)): - yield("10_stdbool", "#include ") + yield ("10_stdbool", "#include ") if any(dtype.is_complex() for dtype in preamble_info.seen_dtypes): - yield("10_complex", "#include ") + yield ("10_complex", "#include ") # {{{ emit math.h @@ -133,7 +133,7 @@ def c99_preamble_generator(preamble_info): insn.with_transformed_expressions(inf_or_nan_recorder) if inf_or_nan_recorder.saw_inf_or_nan: - yield("10_math", "#include ") + yield ("10_math", "#include ") # }}} @@ -235,7 +235,7 @@ def _preamble_generator(preamble_info, func_qualifier="inline"): n = -n; }""") - yield(f"07_{func.c_name}", f""" + yield (f"07_{func.c_name}", f""" inline {res_ctype} {func.c_name}({base_ctype} x, {exp_ctype} n) {{ if (n == 0) return 1; @@ -684,7 +684,7 @@ class CMathCallable(ScalarCallable): "isnani64"}: dtype = self.arg_id_to_dtype[0] ctype = target.dtype_to_typename(dtype) - yield(f"08_c_{self.name_in_target}", f""" + yield (f"08_c_{self.name_in_target}", f""" inline static int {self.name_in_target}({ctype} x) {{ return 0; }}""") @@ -730,7 +730,7 @@ class GNULibcCallable(ScalarCallable): def generate_preambles(self, target): if self.name in ["bessel_yn", "bessel_jn"]: - yield("08_c_math", "#include ") + yield ("08_c_math", "#include ") def get_c_callables(): diff --git a/loopy/target/opencl.py b/loopy/target/opencl.py index d9b23670ea92d7f1576a7a0f313286e3eade4196..710aa667236bef7f1e8301ee1e79af5b1e5140f5 100644 --- a/loopy/target/opencl.py +++ b/loopy/target/opencl.py @@ -497,16 +497,16 @@ def opencl_preamble_generator(preamble_info): for func in preamble_info.seen_functions: if func.name == "pow" and func.c_name == "powf32": - yield("08_clpowf32", """ - inline float powf32(float x, float y) { - return pow(x, y); - }""") + yield ("08_clpowf32", """ + inline float powf32(float x, float y) { + return pow(x, y); + }""") if func.name == "pow" and func.c_name == "powf64": - yield("08_clpowf64", """ - inline double powf64(double x, double y) { - return pow(x, y); - }""") + yield ("08_clpowf64", """ + inline double powf64(double x, double y) { + return pow(x, y); + }""") # }}} diff --git a/loopy/target/pyopencl.py b/loopy/target/pyopencl.py index 66dd9ae3f255981df67f59ec202881f4e8f77928..7b4572708c8c03234a629ec0fbeaf812a9de103a 100644 --- a/loopy/target/pyopencl.py +++ b/loopy/target/pyopencl.py @@ -128,11 +128,11 @@ class PyOpenCLCallable(ScalarCallable): dtype = self.arg_id_to_dtype[-1] ctype = target.dtype_to_typename(dtype) - yield(f"40_{name}", f""" - static inline {ctype} {name}({ctype} x) {{ - return {ret}; - }} - """) + yield (f"40_{name}", f""" + static inline {ctype} {name}({ctype} x) {{ + return {ret}; + }} + """) def get_pyopencl_callables(): diff --git a/test/library_for_test.py b/test/library_for_test.py index 5f83a22aa027402293025877353021573648f578..fe67ace2fcb662c1fc4c760ebdd6c3f6b772b452 100644 --- a/test/library_for_test.py +++ b/test/library_for_test.py @@ -68,4 +68,4 @@ def symbol_x(knl, name): def preamble_for_x(preamble_info): - yield("preamble_ten", r"#define X 10.0") + yield ("preamble_ten", r"#define X 10.0") diff --git a/test/test_callables.py b/test/test_callables.py index 1a1b37f2c70f635cc355d41f6d366a1f554e5b6a..de33063aa448e4467a67e60420c695002884c5ab 100644 --- a/test/test_callables.py +++ b/test/test_callables.py @@ -287,8 +287,8 @@ def test_multi_arg_array_call(ctx_factory): evt, out_dict = knl(queue, b=b) tol = 1e-15 from numpy.linalg import norm - assert(norm(out_dict["min_val"] - np.min(b)) < tol) - assert(norm(out_dict["min_index"] - np.argmin(b)) < tol) + assert norm(out_dict["min_val"] - np.min(b)) < tol + assert norm(out_dict["min_index"] - np.argmin(b)) < tol @pytest.mark.parametrize("inline", [False, True])