@@ -28,13 +28,14 @@ def compute_for(*args, **kwargs):
2828 job_args_idx = None
2929
3030 for i , arg in enumerate (args ):
31- if isinstance (arg , FunctionType ):
31+ if isinstance (arg , FunctionType ) or isinstance ( arg , str ) :
3232 # work function arg separates input from arguments, find indices to hide based on it
3333 if i == 1 : # compute.for(iterableObject, work, args), need to wrap iterable
3434 job_input_idx = 0
3535 if i < len (args ) - 1 : # work function isn't last argument, so last value is args in compute.for
3636 job_args_idx = len (args ) - 1
37- args [i ] = dill .source .getsource (arg )
37+ if isinstance (arg , FunctionType ):
38+ args [i ] = dill .source .getsource (arg )
3839
3940 # Process for ensuring symbols aren't mutated in the python -> js layer:
4041 # 1. Check if symbol is coming from a dcp module/class. If so, set it as the js_ref. Skip next steps.
@@ -50,7 +51,7 @@ def compute_for(*args, **kwargs):
5051 args [job_input_idx ][0 ] = tmp
5152
5253 newArr = args [job_input_idx ]
53- except (ValueError , TypeError ):
54+ except (ValueError , TypeError , IndexError ):
5455 newArr = [ 'placeholder' for i in range (len (args [job_input_idx ]))]
5556
5657 for i , val in enumerate (args [job_input_idx ]):
0 commit comments