Skip to content

Commit d5e39cb

Browse files
EdCauntmloubout
authored andcommitted
misc: Tweak avoid_symbolic decorator
1 parent 8022ca3 commit d5e39cb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

devito/tools/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def key(i):
349349
return sorted(items, key=key, reverse=True)
350350

351351

352-
def avoid_symbolic(default_val):
352+
def avoid_symbolic(default=None):
353353
"""
354354
Decorator to avoid calling a function where doing so will result in symbolic
355355
computation being performed. For use if symbolic computation may be slow. In
@@ -360,25 +360,25 @@ def _avoid_symbolic(func):
360360
def wrapper(*args):
361361
if any(isinstance(expr, sympy.Basic) for expr in args):
362362
# An argument is symbolic, so give up and assume default
363-
return default_val
363+
return default
364364

365365
try:
366366
return func(*args)
367367
except TypeError:
368-
return default_val
368+
return default
369369

370370
return wrapper
371371

372372
return _avoid_symbolic
373373

374374

375-
@avoid_symbolic(False)
375+
@avoid_symbolic(default=False)
376376
def smart_lt(a, b):
377377
"""An Lt that gives up and returns False if supplied a symbolic argument"""
378378
return bool(a < b)
379379

380380

381-
@avoid_symbolic(False)
381+
@avoid_symbolic(default=False)
382382
def smart_gt(a, b):
383383
"""A Gt that gives up and returns False if supplied a symbolic argument"""
384384
return bool(a > b)

0 commit comments

Comments
 (0)