diff --git a/pyop2/codegen/rep2loopy.py b/pyop2/codegen/rep2loopy.py index d01c6ee76..916eb2f30 100644 --- a/pyop2/codegen/rep2loopy.py +++ b/pyop2/codegen/rep2loopy.py @@ -91,7 +91,7 @@ def with_descrs(self, arg_id_to_descr, callables_table): def generate_preambles(self, target): assert isinstance(target, type(target)) - yield("00_petsc", "#include ") + yield ("00_petsc", "#include ") return diff --git a/pyop2/compilation.py b/pyop2/compilation.py index f1967166f..ecca43187 100644 --- a/pyop2/compilation.py +++ b/pyop2/compilation.py @@ -225,9 +225,9 @@ class Compiler(ABC): _optflags = () _debugflags = () - def __init__(self, extra_compiler_flags=None, extra_linker_flags=None, cpp=False, comm=None): - self._extra_compiler_flags = tuple(extra_compiler_flags) or () - self._extra_linker_flags = tuple(extra_linker_flags) or () + def __init__(self, extra_compiler_flags=(), extra_linker_flags=(), cpp=False, comm=None): + self._extra_compiler_flags = tuple(extra_compiler_flags) + self._extra_linker_flags = tuple(extra_linker_flags) self._cpp = cpp self._debug = configuration["debug"] diff --git a/pyop2/types/dat.py b/pyop2/types/dat.py index bb65db77e..b0f07fa82 100644 --- a/pyop2/types/dat.py +++ b/pyop2/types/dat.py @@ -221,7 +221,7 @@ def load(self, filename): # The np.save method appends a .npy extension to the file name # if the user has not supplied it. However, np.load does not, # so we need to handle this ourselves here. - if(filename[-4:] != ".npy"): + if filename[-4:] != ".npy": filename = filename + ".npy" if isinstance(self.data, tuple): diff --git a/pyop2/utils.py b/pyop2/utils.py index 0fc59901d..11b4ead5b 100644 --- a/pyop2/utils.py +++ b/pyop2/utils.py @@ -237,7 +237,7 @@ def verify_reshape(data, dtype, shape, allow_none=False): a = np.asarray(data, dtype=t) except ValueError: raise DataValueError("Invalid data: cannot convert to %s!" % dtype) - except(TypeError): + except TypeError: raise DataTypeError("Invalid data type: %s" % dtype) try: # Destructively modify shape. Fails if data are not