diff --git a/examples/python/call-external.py b/examples/python/call-external.py index 49b25d6e0..6694daf5e 100644 --- a/examples/python/call-external.py +++ b/examples/python/call-external.py @@ -77,7 +77,7 @@ def emit_call_insn(self, insn, target, expression_to_code_mapper): 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 9a2437bf6..1f04b549f 100644 --- a/loopy/kernel/instruction.py +++ b/loopy/kernel/instruction.py @@ -1065,9 +1065,9 @@ def __str__(self): 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 1c092bf84..b6bd1d009 100644 --- a/loopy/symbolic.py +++ b/loopy/symbolic.py @@ -899,8 +899,8 @@ def map_variable(self, expr): 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 9df5da5ca..aaa59a1b8 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -117,13 +117,13 @@ def map_nan(self, expr): 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 @@ def generate_preambles(self, target): "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 @@ def with_types(self, arg_id_to_dtype, callables_table): 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 d9b23670e..710aa6672 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 66dd9ae3f..7b4572708 100644 --- a/loopy/target/pyopencl.py +++ b/loopy/target/pyopencl.py @@ -128,11 +128,11 @@ def generate_preambles(self, target): 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 5f83a22aa..fe67ace2f 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 1a1b37f2c..de33063aa 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])