From 3e440ad677848d7d079e1343f27e5e27a2875235 Mon Sep 17 00:00:00 2001
From: Frederik Hennig <frederik.hennig@fau.de>
Date: Mon, 15 Jan 2024 11:01:33 +0100
Subject: [PATCH] fix flake8

---
 lbmpy/__init__.py                         | 67 +++++++++++++++++------
 lbmpy/advanced_streaming/communication.py |  2 +-
 lbmpy/oldroydb.py                         |  6 +-
 3 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/lbmpy/__init__.py b/lbmpy/__init__.py
index 26d7778f..542e736a 100644
--- a/lbmpy/__init__.py
+++ b/lbmpy/__init__.py
@@ -1,29 +1,60 @@
-from .creationfunctions import create_lb_ast, create_lb_collision_rule, create_lb_function,\
-    create_lb_method, create_lb_update_rule, LBMConfig, LBMOptimisation
+from .creationfunctions import (
+    create_lb_ast,
+    create_lb_collision_rule,
+    create_lb_function,
+    create_lb_method,
+    create_lb_update_rule,
+    LBMConfig,
+    LBMOptimisation,
+)
 from .enums import Stencil, Method, ForceModel, CollisionSpace
 from .lbstep import LatticeBoltzmannStep
-from .macroscopic_value_kernels import pdf_initialization_assignments, macroscopic_values_getter,\
-    compile_macroscopic_values_getter, compile_macroscopic_values_setter, create_advanced_velocity_setter_collision_rule
+from .macroscopic_value_kernels import (
+    pdf_initialization_assignments,
+    macroscopic_values_getter,
+    compile_macroscopic_values_getter,
+    compile_macroscopic_values_setter,
+    create_advanced_velocity_setter_collision_rule,
+)
 from .maxwellian_equilibrium import get_weights
-from .relaxationrates import relaxation_rate_from_lattice_viscosity, lattice_viscosity_from_relaxation_rate,\
-    relaxation_rate_from_magic_number
+from .relaxationrates import (
+    relaxation_rate_from_lattice_viscosity,
+    lattice_viscosity_from_relaxation_rate,
+    relaxation_rate_from_magic_number,
+)
 from .scenarios import create_lid_driven_cavity, create_fully_periodic_flow
 from .stencils import LBStencil
 
 
-__all__ = ['create_lb_ast', 'create_lb_collision_rule', 'create_lb_function', 'create_lb_method',
-           'create_lb_update_rule', 'LBMConfig', 'LBMOptimisation',
-           'Stencil', 'Method', 'ForceModel', 'CollisionSpace',
-           'LatticeBoltzmannStep',
-           'pdf_initialization_assignments', 'macroscopic_values_getter', 'compile_macroscopic_values_getter',
-           'compile_macroscopic_values_setter', 'create_advanced_velocity_setter_collision_rule',
-           'get_weights',
-           'relaxation_rate_from_lattice_viscosity', 'lattice_viscosity_from_relaxation_rate',
-           'relaxation_rate_from_magic_number',
-           'create_lid_driven_cavity', 'create_fully_periodic_flow',
-           'LBStencil']
+__all__ = [
+    "create_lb_ast",
+    "create_lb_collision_rule",
+    "create_lb_function",
+    "create_lb_method",
+    "create_lb_update_rule",
+    "LBMConfig",
+    "LBMOptimisation",
+    "Stencil",
+    "Method",
+    "ForceModel",
+    "CollisionSpace",
+    "LatticeBoltzmannStep",
+    "pdf_initialization_assignments",
+    "macroscopic_values_getter",
+    "compile_macroscopic_values_getter",
+    "compile_macroscopic_values_setter",
+    "create_advanced_velocity_setter_collision_rule",
+    "get_weights",
+    "relaxation_rate_from_lattice_viscosity",
+    "lattice_viscosity_from_relaxation_rate",
+    "relaxation_rate_from_magic_number",
+    "create_lid_driven_cavity",
+    "create_fully_periodic_flow",
+    "LBStencil",
+]
 
 
 from ._version import get_versions
-__version__ = get_versions()['version']
+
+__version__ = get_versions()["version"]
 del get_versions
diff --git a/lbmpy/advanced_streaming/communication.py b/lbmpy/advanced_streaming/communication.py
index aa12f5d4..412247bb 100644
--- a/lbmpy/advanced_streaming/communication.py
+++ b/lbmpy/advanced_streaming/communication.py
@@ -1,7 +1,7 @@
 import itertools
 from pystencils import CreateKernelConfig, Field, Assignment, AssignmentCollection
 from pystencils.slicing import shift_slice, get_slice_before_ghost_layer, normalize_slice
-from lbmpy.advanced_streaming.utility import is_inplace, get_accessor, numeric_index,\
+from lbmpy.advanced_streaming.utility import is_inplace, get_accessor, numeric_index, \
     Timestep, get_timesteps, numeric_offsets
 from pystencils.datahandling import SerialDataHandling
 from pystencils.enums import Target
diff --git a/lbmpy/oldroydb.py b/lbmpy/oldroydb.py
index 99ea24ea..88b869cb 100644
--- a/lbmpy/oldroydb.py
+++ b/lbmpy/oldroydb.py
@@ -118,7 +118,7 @@ class Flux(Boundary):
         return hash((Flux, self.stencil, self.value))
 
     def __eq__(self, other):
-        return type(other) == Flux and other.stencil == self.stencil and self.value == other.value
+        return type(other) is Flux and other.stencil == self.stencil and self.value == other.value
 
 
 class Extrapolation(Boundary):
@@ -169,7 +169,7 @@ class Extrapolation(Boundary):
         return hash((Extrapolation, self.stencil, self.src, self.weights))
 
     def __eq__(self, other):
-        return type(other) == Extrapolation and other.stencil == self.stencil and \
+        return type(other) is Extrapolation and other.stencil == self.stencil and \
             other.src == self.src and other.weights == self.weights
 
 
@@ -205,5 +205,5 @@ class ForceOnBoundary(Boundary):
         return hash((ForceOnBoundary, self.stencil, self.force_field))
 
     def __eq__(self, other):
-        return type(other) == ForceOnBoundary and other.stencil == self.stencil and \
+        return type(other) is ForceOnBoundary and other.stencil == self.stencil and \
             other.force_field == self.force_field
-- 
GitLab