def bunch_io(func):
def bunch_wrapper (*args, **kwargs):
if (len(args)>1) or ((len(args)==1) and not isinstance(args[0], Bunch)):
raise ValueError ('can only accept Bunch as positional argument')
if len(args)==1:
= args[0]
bunch = {k: kwargs[k] for k in kwargs if k in inspect.signature(f).parameters}
f_args else:
= {}
f_args for k in kwargs:
if isinstance(kwargs[k], Bunch):
= kwargs[k]
bunch for k in bunch if k in inspect.signature(f).parameters})
f_args.update ({k: bunch[k] elif k in inspect.signature(f).parameters:
= kwargs[k]
f_args[k] = func (**f_args)
result
bunch.update (result)return bunch
return bunch_wrapper
cell2func
Convert desired notebook cells to functions.
bunch_io
get_non_callable
get_non_callable_ipython
get_non_callable_ipython
get_non_callable_ipython (variables_to_inspect, locals_)
Store variables
in dictionary entry self.variables_field[function]
get_non_callable
get_non_callable
get_non_callable (variables)
get_ast
remove_duplicates_from_list
remove_duplicates_from_list (list_with_potential_duplicates)
get_ast
get_ast (code)
FunctionProcessor
FunctionProcessor (**kwargs)
Function processor.
update_cell_code
update_cell_code
update_cell_code (cell, defined=False)
add_function_to_list
add_function_to_list
add_function_to_list (function, function_list, idx=None, position=None)
get_args_and_defaults_from_function_in_cell
get_args_and_defaults
get_args_and_defaults
get_args_and_defaults (list_args, list_defaults)
get_args_and_defaults_from_function_in_cell
get_args_and_defaults_from_function_in_cell
get_args_and_defaults_from_function_in_cell ()
get_args_and_defaults_from_ast
get_args_and_defaults_from_ast (root)
CellProcessor
CellProcessor
CellProcessor (tab_size=4, log_level='INFO', restrict_inputs=False, **kwargs)
Processes the cell’s code according to the magic command.
CellProcessorMagic
CellProcessorMagic (shell, **kwargs)
Base magic class for converting cells to modular functions.
retrieve_function_values_through_disk
retrieve_function_values_through_disk (filename='variable_values.pk')
Store variables
in disk
retrieve_function_values_through_memory
retrieve_function_values_through_memory (field)
Store variables
in dictionary entry self[field]
retrieve_nb_locals_through_disk
retrieve_nb_locals_through_disk (variable_values, filename='variable_values.pk')
Store variables
in disk
retrieve_nb_locals_through_memory
retrieve_nb_locals_through_memory (field, variable_values)
Store variables
in dictionary entry self[field]
acceptable_variable
acceptable_variable (variable_values, k)
store_variables
store_variables
store_variables (path_variables, locals_, io_type=None, io_locals=False, load_args=None, return_values=[])
Store variables
in dictionary entry self.variables_field[function]