def override_to_local_variable(enable=True):
    """
    Returns:
        a context where all variables will be created as local.
    """
    if enable:

        def custom_getter(getter, name, *args, **kwargs):
            _replace_global_by_local(kwargs)
            return getter(name, *args, **kwargs)

        with custom_getter_scope(custom_getter):
            yield
    else:
        yield
def override_to_local_variable ( enable = True ) : if enable : def custom_getter ( getter , name , * args , ** kwargs ) : _replace_global_by_local ( kwargs ) return getter ( name , * args , ** kwargs ) with custom_getter_scope ( custom_getter ) : yield else : yield
Returns:
        a context where all variables will be created as local.