Skip to content

Commit

Permalink
Fix _record_sig to avoid recording nested function calls in history (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
amnona authored and RNAer committed May 8, 2019
1 parent 463816c commit b784e23
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions calour/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ def inner(*args, **kwargs):
log = exp._log
try:
logger.debug('Run func {}'.format(fn))
exp._log = False
new_exp = func(*args, **kwargs)
if exp._log is True:
new_exp._log = log
if log is True:
# do not use `'%r' % i` because it causes error when i is a tuple
param = ['{!r}'.format(i) for i in args[1:]] + ['{0!s}={1!r}'.format(k, v) for k, v in kwargs.items()]
param = ', '.join(param)
new_exp._call_history.append('{0}({1})'.format(fn, param))
exp._log = False
logger.debug('Current object: {}'.format(new_exp))
finally:
# set log status back
Expand Down

0 comments on commit b784e23

Please sign in to comment.