'Set the editor used by the %edit magic'

def set_editor(self):

    python = sys.executable
    if DEV:
        spyder_start_directory = get_module_path('spyder')
        bootstrap_script = osp.join(osp.dirname(spyder_start_directory), 'bootstrap.py')
        editor = u'{0}    {1}    --'.format(python, bootstrap_script)
    else:
        import1 = 'import    sys'
        import2 = 'from    spyder.app.start    import    send_args_to_spyder'
        code = 'send_args_to_spyder([sys.argv[-1]])'
        editor = u"{0}    -c    '{1};    {2};    {3}'".format(python, import1, import2, code)
    return to_text_string(editor)
