-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathautopep8.js
38 lines (31 loc) · 1.12 KB
/
autopep8.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Jupyter-Contrib Team.
// Distributed under the terms of the Modified BSD License.
// Authors: @kenkoooo, @jfbercher and @jcb91
define(function(require, exports, module) {
'use strict';
var kernel_exec_on_cell = require('./kernel_exec_on_cell');
var mod_name = 'autopep8';
// gives default settings
var cfg = {
add_toolbar_button: true,
hotkeys: {
process_selected: 'Alt-A',
process_all: 'Alt-Shift-A',
},
register_hotkey: true,
show_alerts_for_errors: true,
button_icon: 'fa-cog',
button_label: 'Prettify (using autopep8)',
kbd_shortcut_text: 'Prettify' // ' current cell(s)'
};
cfg.kernel_config_map = { // map of parameters for supported kernels
"python": {
"library": "import json\nimport autopep8",
"prefix": "print(json.dumps(autopep8.fix_code(u",
"postfix": ")))"
}
};
var prettifier = new kernel_exec_on_cell.define_plugin(mod_name, cfg);
prettifier.load_ipython_extension = prettifier.initialize_plugin;
return prettifier;
});