diff --git a/niprov/recording.py b/niprov/recording.py index 7a9329e..56d9672 100644 --- a/niprov/recording.py +++ b/niprov/recording.py @@ -10,7 +10,9 @@ def record(command, new=None, parents=None, transient=False, args=[], kwargs={}, """Execute a command and log it as provenance for the newly created file. Args: - command (list or str or callable): Commands to be executed + command (list or str or callable): Command to be executed. Either a + string of executable system code, a list of components thereof, or + a python function object. new (str, optional): Override path to the new file, i.e. if it cannot be parsed from the command. parents (list, optional): Override paths to parent files, i.e. if they @@ -37,7 +39,7 @@ def record(command, new=None, parents=None, transient=False, args=[], kwargs={}, _parents = [command[c+1]] else: transformation = command.func_name - code = '' + code = None if parents is not None: _parents = parents @@ -50,7 +52,7 @@ def record(command, new=None, parents=None, transient=False, args=[], kwargs={}, output = result.output else: command(*args, **kwargs) - output = '' + output = None return log(_new, transformation, _parents, code=code, transient=transient, logtext=output) diff --git a/tests/recording.py b/tests/recording.py index bda4943..9f278cd 100644 --- a/tests/recording.py +++ b/tests/recording.py @@ -62,7 +62,7 @@ def test_Python_code(self): self.record(myfunc, args=args, kwargs=kwargs, new='new.f', parents=['old.f']) myfunc.assert_called_with(*args, **kwargs) self.log.assert_called_with('new.f',myfunc.func_name,['old.f'], - transient=False, code='', logtext='') + transient=False, code=None, logtext=None) # myfunc.func_code.co_filename