Skip to content

Commit

Permalink
Fix lint missed by flake8<5
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jul 31, 2022
1 parent 4598673 commit e769843
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion examples/python/call-external.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cblas.h>")
yield ("99_cblas", "#include <cblas.h>")
return

# }}}
Expand Down
6 changes: 3 additions & 3 deletions loopy/kernel/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions loopy/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions loopy/target/c/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdint.h>")
yield ("10_stdint", "#include <stdint.h>")
if any(dtype.numpy_dtype == np.dtype("bool")
for dtype in preamble_info.seen_dtypes
if isinstance(dtype, NumpyType)):
yield("10_stdbool", "#include <stdbool.h>")
yield ("10_stdbool", "#include <stdbool.h>")
if any(dtype.is_complex() for dtype in preamble_info.seen_dtypes):
yield("10_complex", "#include <complex.h>")
yield ("10_complex", "#include <complex.h>")

# {{{ emit math.h

Expand All @@ -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 <math.h>")
yield ("10_math", "#include <math.h>")

# }}}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}}""")
Expand Down Expand Up @@ -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 <math.h>")
yield ("08_c_math", "#include <math.h>")


def get_c_callables():
Expand Down
16 changes: 8 additions & 8 deletions loopy/target/opencl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}""")

# }}}

Expand Down
10 changes: 5 additions & 5 deletions loopy/target/pyopencl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion test/library_for_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions test/test_callables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit e769843

Please sign in to comment.