From e40ca9a1c1361af9e5d88fc62d91de19fa3ebb09 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Tue, 13 Aug 2019 16:26:01 +0200
Subject: [PATCH] Lint

---
 pystencils/backends/cbackend.py       | 6 +++++-
 pystencils/backends/opencl_backend.py | 9 ++++-----
 pystencils/opencl/opencljit.py        | 4 ++--
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/pystencils/backends/cbackend.py b/pystencils/backends/cbackend.py
index 495c0a059..38cba5c35 100644
--- a/pystencils/backends/cbackend.py
+++ b/pystencils/backends/cbackend.py
@@ -213,7 +213,11 @@ class CBackend:
 
     def _print_SympyAssignment(self, node):
         if node.is_declaration:
-            data_type = "const " + self._print(node.lhs.dtype) + " " if node.is_const else self._print(node.lhs.dtype) + " "
+            if node.is_const:
+                prefix = 'const '
+            else:
+                prefix = ''
+            data_type = prefix + self._print(node.lhs.dtype) + " "
             return "%s%s = %s;" % (data_type, self.sympy_printer.doprint(node.lhs),
                                    self.sympy_printer.doprint(node.rhs))
         else:
diff --git a/pystencils/backends/opencl_backend.py b/pystencils/backends/opencl_backend.py
index d44c944dd..ac8a7a78f 100644
--- a/pystencils/backends/opencl_backend.py
+++ b/pystencils/backends/opencl_backend.py
@@ -1,7 +1,8 @@
-from pystencils.backends.cuda_backend import CudaBackend, CudaSympyPrinter
-from pystencils.backends.cbackend import generate_c
-from pystencils.astnodes import Node
 import pystencils.data_types
+from pystencils.astnodes import Node
+from pystencils.backends.cbackend import generate_c
+from pystencils.backends.cuda_backend import CudaBackend, CudaSympyPrinter
+
 
 def generate_opencl(astnode: Node, signature_only: bool = False) -> str:
     """Prints an abstract syntax tree node as CUDA code.
@@ -27,7 +28,6 @@ class OpenClBackend(CudaBackend):
         super().__init__(sympy_printer, signature_only)
         self._dialect = 'opencl'
 
-
     def _print_Type(self, node):
         code = super()._print_Type(node)
         if isinstance(node, pystencils.data_types.PointerType):
@@ -57,4 +57,3 @@ class OpenClSympyPrinter(CudaSympyPrinter):
         dimension = self.DIMENSION_MAPPING[dimension]
         function_name = self.INDEXING_FUNCTION_MAPPING[function_name]
         return f"{function_name}({dimension})"
-
diff --git a/pystencils/opencl/opencljit.py b/pystencils/opencl/opencljit.py
index 7f4bdb659..dd0660667 100644
--- a/pystencils/opencl/opencljit.py
+++ b/pystencils/opencl/opencljit.py
@@ -60,8 +60,8 @@ def make_python_function(kernel_function_node, opencl_queue, opencl_ctx, argumen
             indexing = kernel_function_node.indexing
             block_and_thread_numbers = indexing.call_parameters(shape)
             block_and_thread_numbers['block'] = tuple(int(i) for i in block_and_thread_numbers['block'])
-            block_and_thread_numbers['grid'] = tuple(int(b*g) for (b, g) in zip(block_and_thread_numbers['block'],
-                                                                                block_and_thread_numbers['grid']))
+            block_and_thread_numbers['grid'] = tuple(int(b * g) for (b, g) in zip(block_and_thread_numbers['block'],
+                                                                                  block_and_thread_numbers['grid']))
 
             args = _build_numpy_argument_list(parameters, full_arguments)
             args = [a.data for a in args if hasattr(a, 'data')]
-- 
GitLab