cell2func

Convert desired notebook cells to functions.

bunch_io

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:
            bunch = args[0]
            f_args = {k: kwargs[k] for k in kwargs if k in inspect.signature(f).parameters}
        else:
            f_args = {}
            for k in kwargs:
                if isinstance(kwargs[k], Bunch):
                    bunch = kwargs[k]
                    f_args.update ({k: bunch[k] for k in bunch if k in inspect.signature(f).parameters})
                elif k in inspect.signature(f).parameters:
                    f_args[k] = kwargs[k]
        result = func (**f_args)
        bunch.update (result)
        return bunch
    return bunch_wrapper

get_non_callable

get_non_callable_ipython


source

get_non_callable_ipython

 get_non_callable_ipython (variables_to_inspect, locals_)

Store variables in dictionary entry self.variables_field[function]

get_non_callable


source

get_non_callable

 get_non_callable (variables)

get_ast


source

remove_duplicates_from_list

 remove_duplicates_from_list (list_with_potential_duplicates)

source

get_ast

 get_ast (code)

source

FunctionProcessor

 FunctionProcessor (**kwargs)

Function processor.

update_cell_code


source

update_cell_code

 update_cell_code (cell, defined=False)

add_function_to_list


source

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


source

get_args_and_defaults

 get_args_and_defaults (list_args, list_defaults)

get_args_and_defaults_from_function_in_cell


source

get_args_and_defaults_from_function_in_cell

 get_args_and_defaults_from_function_in_cell ()

source

get_args_and_defaults_from_ast

 get_args_and_defaults_from_ast (root)

CellProcessor


source

CellProcessor

 CellProcessor (tab_size=4, log_level='INFO', restrict_inputs=False,
                **kwargs)

Processes the cell’s code according to the magic command.


source

CellProcessorMagic

 CellProcessorMagic (shell, **kwargs)

Base magic class for converting cells to modular functions.


source

retrieve_function_values_through_disk

 retrieve_function_values_through_disk (filename='variable_values.pk')

Store variables in disk


source

retrieve_function_values_through_memory

 retrieve_function_values_through_memory (field)

Store variables in dictionary entry self[field]


source

retrieve_nb_locals_through_disk

 retrieve_nb_locals_through_disk (variable_values,
                                  filename='variable_values.pk')

Store variables in disk


source

retrieve_nb_locals_through_memory

 retrieve_nb_locals_through_memory (field, variable_values)

Store variables in dictionary entry self[field]


source

acceptable_variable

 acceptable_variable (variable_values, k)

store_variables


source

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]