Skip to content

Commit

Permalink
ci: new flake8 version fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jul 31, 2023
1 parent 8318b2a commit 718f9e2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion devito/finite_differences/derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Derivative(sympy.Derivative, Differentiable):
__rkwargs__ = ('side', 'deriv_order', 'fd_order', 'transpose', '_ppsubs', 'x0')

def __new__(cls, expr, *dims, **kwargs):
if type(expr) == sympy.Derivative:
if type(expr) is sympy.Derivative:
raise ValueError("Cannot nest sympy.Derivative with devito.Derivative")
if not isinstance(expr, Differentiable):
raise ValueError("`expr` must be a Differentiable object")
Expand Down
2 changes: 1 addition & 1 deletion devito/ir/iet/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class List(Node):

def __init__(self, header=None, body=None, footer=None):
body = as_tuple(body)
if len(body) == 1 and all(type(i) == List for i in [self, body[0]]):
if len(body) == 1 and all(type(i) is List for i in [self, body[0]]):
# De-nest Lists
#
# Note: to avoid disgusting metaclass voodoo (due to
Expand Down
2 changes: 1 addition & 1 deletion devito/ir/support/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, dim, stamp=S0):
self.stamp = stamp

def __eq__(self, o):
return (type(self) == type(o) and
return (type(self) is type(o) and
self.dim is o.dim and
self.stamp == o.stamp)

Expand Down
2 changes: 1 addition & 1 deletion devito/passes/clusters/aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ def pick_best(variants, schedule_strategy, eval_variants_delta):
Return the variant with the best trade-off between operation count
reduction and working set increase. Heuristics may be applied.
"""
if type(schedule_strategy) == int:
if type(schedule_strategy) is int:
try:
return variants[schedule_strategy]
except IndexError:
Expand Down
2 changes: 1 addition & 1 deletion devito/symbolics/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def compare_ops(e1, e2):
>>> compare_ops(u[x] + u[x+1], u[x] + u[y+10])
True
"""
if type(e1) == type(e2) and len(e1.args) == len(e2.args):
if type(e1) is type(e2) and len(e1.args) == len(e2.args):
if e1.is_Atom:
return True if e1 == e2 else False
elif e1.is_Indexed and e2.is_Indexed:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def test_issue_1863(self):
assert v0 == v1
assert v0 == v2
assert v0 == v3
assert type(v0) == np.int16
assert type(v1) == np.int32
assert type(v2) == np.float32
assert type(v3) == np.float64
assert type(v0) is np.int16
assert type(v1) is np.int32
assert type(v2) is np.float32
assert type(v3) is np.float64
4 changes: 2 additions & 2 deletions tests/test_derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_derivatives_space(self, derivative, dim, order):

s_expr = u.diff(dim).as_finite_difference(indices).evalf(_PRECISION)
assert(simplify(expr - s_expr) == 0) # Symbolic equality
assert type(expr) == EvalDerivative
assert type(expr) is EvalDerivative
expr1 = s_expr.func(*expr.args)
assert(expr1 == s_expr) # Exact equality

Expand All @@ -217,7 +217,7 @@ def test_second_derivatives_space(self, derivative, dim, order):
indices = [(dim + i * dim.spacing) for i in range(-width, width + 1)]
s_expr = u.diff(dim, dim).as_finite_difference(indices).evalf(_PRECISION)
assert(simplify(expr - s_expr) == 0) # Symbolic equality
assert type(expr) == EvalDerivative
assert type(expr) is EvalDerivative
expr1 = s_expr.func(*expr.args)
assert(expr1 == s_expr) # Exact equality

Expand Down
4 changes: 2 additions & 2 deletions tests/test_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ def test_subdimmiddle_parallel(self, opt):
thickness_left=thickness, thickness_right=thickness)

# a 5 point stencil that can be computed in parallel
centre = Eq(u[t+1, xi, yi], u[t, xi, yi] + u[t, xi-1, yi]
+ u[t, xi+1, yi] + u[t, xi, yi-1] + u[t, xi, yi+1])
centre = Eq(u[t+1, xi, yi], u[t, xi, yi] + u[t, xi-1, yi] +
u[t, xi+1, yi] + u[t, xi, yi-1] + u[t, xi, yi+1])

u.data[0, 10, 10] = 1.0

Expand Down

0 comments on commit 718f9e2

Please sign in to comment.