Skip to content

Commit c38c64a

Browse files
committed
compiler: Comply with ruff
1 parent 432538c commit c38c64a

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

devito/ir/iet/nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from collections import OrderedDict, namedtuple
77
from collections.abc import Iterable
88
from contextlib import suppress
9-
from functools import cached_property, lru_cache
9+
from functools import cached_property, cache
1010

1111
import cgen as c
1212
from sympy import IndexedBase, sympify
@@ -1646,7 +1646,7 @@ def functions(self):
16461646
# *** Utils
16471647

16481648

1649-
@lru_cache(maxsize=None)
1649+
@cache
16501650
def _constructor_args(cls):
16511651
"""
16521652
Return cached constructor argument names and default values for an IET type.

devito/ir/support/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ def d_output_gen(self, writes=None):
12771277
12781278
If ``writes`` is provided, restrict the analysis to those Functions.
12791279
"""
1280-
for k, v in writes.items():
1280+
for v in writes.values():
12811281
for w1 in v:
12821282
for w2 in v:
12831283
if any(not rule(w2, w1) for rule in self.rules):

devito/symbolics/manipulation.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ def xreplace_indices(exprs, mapper, key=None):
331331
replaced = [uxreplace(i, mapper) for i in exprs0]
332332

333333
if isinstance(exprs, Iterable):
334-
if len(replaced) == len(exprs0) and all(i is j for i, j in zip(replaced, exprs0)):
334+
if len(replaced) == len(exprs0) and \
335+
all(i is j for i, j in zip(replaced, exprs0, strict=True)):
335336
return exprs
336337
return replaced
337338
else:
@@ -462,11 +463,13 @@ def reuse_if_untouched(expr, args, evaluate=False):
462463
args = tuple(args)
463464

464465
if type(expr) is tuple:
465-
if len(args) == len(expr) and all(a is b for a, b in zip(expr, args)):
466+
if len(args) == len(expr) and \
467+
all(a is b for a, b in zip(expr, args, strict=True)):
466468
return expr
467469
return args
468470
elif type(expr) is list:
469-
if len(args) == len(expr) and all(a is b for a, b in zip(expr, args)):
471+
if len(args) == len(expr) and \
472+
all(a is b for a, b in zip(expr, args, strict=True)):
470473
return expr
471474
return list(args)
472475
elif all(a is b for a, b in zip(expr.args, args, strict=False)):

devito/symbolics/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from devito.tools import as_tuple, memoized_func
1212

1313
__all__ = [
14+
'retrieve_accesses',
1415
'retrieve_derivatives',
1516
'retrieve_dimensions',
1617
'retrieve_function_carriers',
1718
'retrieve_functions',
18-
'retrieve_accesses',
1919
'retrieve_indexed',
2020
'retrieve_symbols',
2121
'retrieve_terminals',

0 commit comments

Comments
 (0)