partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | MainWindow.load_last_visible_toolbars | Loads the last visible toolbars from the .ini file. | spyder/app/mainwindow.py | def load_last_visible_toolbars(self):
"""Loads the last visible toolbars from the .ini file."""
toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[])
if toolbars_names:
dic = {}
for toolbar in self.toolbarslist:
dic[toolbar.objectN... | def load_last_visible_toolbars(self):
"""Loads the last visible toolbars from the .ini file."""
toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[])
if toolbars_names:
dic = {}
for toolbar in self.toolbarslist:
dic[toolbar.objectN... | [
"Loads",
"the",
"last",
"visible",
"toolbars",
"from",
"the",
".",
"ini",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2043-L2059 | [
"def",
"load_last_visible_toolbars",
"(",
"self",
")",
":",
"toolbars_names",
"=",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'last_visible_toolbars'",
",",
"default",
"=",
"[",
"]",
")",
"if",
"toolbars_names",
":",
"dic",
"=",
"{",
"}",
"for",
"toolbar",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.show_toolbars | Show/Hides toolbars. | spyder/app/mainwindow.py | def show_toolbars(self):
"""Show/Hides toolbars."""
value = not self.toolbars_visible
CONF.set('main', 'toolbars_visible', value)
if value:
self.save_visible_toolbars()
else:
self.get_visible_toolbars()
for toolbar in self.visible_toolbar... | def show_toolbars(self):
"""Show/Hides toolbars."""
value = not self.toolbars_visible
CONF.set('main', 'toolbars_visible', value)
if value:
self.save_visible_toolbars()
else:
self.get_visible_toolbars()
for toolbar in self.visible_toolbar... | [
"Show",
"/",
"Hides",
"toolbars",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2062-L2076 | [
"def",
"show_toolbars",
"(",
"self",
")",
":",
"value",
"=",
"not",
"self",
".",
"toolbars_visible",
"CONF",
".",
"set",
"(",
"'main'",
",",
"'toolbars_visible'",
",",
"value",
")",
"if",
"value",
":",
"self",
".",
"save_visible_toolbars",
"(",
")",
"else"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.valid_project | Handle an invalid active project. | spyder/app/mainwindow.py | def valid_project(self):
"""Handle an invalid active project."""
try:
path = self.projects.get_active_project_path()
except AttributeError:
return
if bool(path):
if not self.projects.is_valid_project(path):
if path:
... | def valid_project(self):
"""Handle an invalid active project."""
try:
path = self.projects.get_active_project_path()
except AttributeError:
return
if bool(path):
if not self.projects.is_valid_project(path):
if path:
... | [
"Handle",
"an",
"invalid",
"active",
"project",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2086-L2102 | [
"def",
"valid_project",
"(",
"self",
")",
":",
"try",
":",
"path",
"=",
"self",
".",
"projects",
".",
"get_active_project_path",
"(",
")",
"except",
"AttributeError",
":",
"return",
"if",
"bool",
"(",
"path",
")",
":",
"if",
"not",
"self",
".",
"projects... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.show_shortcuts | Show action shortcuts in menu | spyder/app/mainwindow.py | def show_shortcuts(self, menu):
"""Show action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(element._shown_shortcut) | def show_shortcuts(self, menu):
"""Show action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(element._shown_shortcut) | [
"Show",
"action",
"shortcuts",
"in",
"menu"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2113-L2118 | [
"def",
"show_shortcuts",
"(",
"self",
",",
"menu",
")",
":",
"for",
"element",
"in",
"getattr",
"(",
"self",
",",
"menu",
"+",
"'_menu_actions'",
")",
":",
"if",
"element",
"and",
"isinstance",
"(",
"element",
",",
"QAction",
")",
":",
"if",
"element",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.hide_shortcuts | Hide action shortcuts in menu | spyder/app/mainwindow.py | def hide_shortcuts(self, menu):
"""Hide action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(QKeySequence()) | def hide_shortcuts(self, menu):
"""Hide action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(QKeySequence()) | [
"Hide",
"action",
"shortcuts",
"in",
"menu"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2120-L2125 | [
"def",
"hide_shortcuts",
"(",
"self",
",",
"menu",
")",
":",
"for",
"element",
"in",
"getattr",
"(",
"self",
",",
"menu",
"+",
"'_menu_actions'",
")",
":",
"if",
"element",
"and",
"isinstance",
"(",
"element",
",",
"QAction",
")",
":",
"if",
"element",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.get_focus_widget_properties | Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor) | spyder/app/mainwindow.py | def get_focus_widget_properties(self):
"""Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor)"""
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyde... | def get_focus_widget_properties(self):
"""Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor)"""
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyde... | [
"Get",
"properties",
"of",
"focus",
"widget",
"Returns",
"tuple",
"(",
"widget",
"properties",
")",
"where",
"properties",
"is",
"a",
"tuple",
"of",
"booleans",
":",
"(",
"is_console",
"not_readonly",
"readwrite_editor",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2127-L2141 | [
"def",
"get_focus_widget_properties",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"plugins",
".",
"editor",
".",
"widgets",
".",
"editor",
"import",
"TextEditBaseWidget",
"from",
"spyder",
".",
"plugins",
".",
"ipythonconsole",
".",
"widgets",
"import",
"Contr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.update_edit_menu | Update edit menu | spyder/app/mainwindow.py | def update_edit_menu(self):
"""Update edit menu"""
widget, textedit_properties = self.get_focus_widget_properties()
if textedit_properties is None: # widget is not an editor/console
return
# !!! Below this line, widget is expected to be a QPlainTextEdit
# in... | def update_edit_menu(self):
"""Update edit menu"""
widget, textedit_properties = self.get_focus_widget_properties()
if textedit_properties is None: # widget is not an editor/console
return
# !!! Below this line, widget is expected to be a QPlainTextEdit
# in... | [
"Update",
"edit",
"menu"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2143-L2178 | [
"def",
"update_edit_menu",
"(",
"self",
")",
":",
"widget",
",",
"textedit_properties",
"=",
"self",
".",
"get_focus_widget_properties",
"(",
")",
"if",
"textedit_properties",
"is",
"None",
":",
"# widget is not an editor/console\r",
"return",
"# !!! Below this line, widg... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.update_search_menu | Update search menu | spyder/app/mainwindow.py | def update_search_menu(self):
"""Update search menu"""
# Disabling all actions except the last one
# (which is Find in files) to begin with
for child in self.search_menu.actions()[:-1]:
child.setEnabled(False)
widget, textedit_properties = self.get_focus_widge... | def update_search_menu(self):
"""Update search menu"""
# Disabling all actions except the last one
# (which is Find in files) to begin with
for child in self.search_menu.actions()[:-1]:
child.setEnabled(False)
widget, textedit_properties = self.get_focus_widge... | [
"Update",
"search",
"menu"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2180-L2204 | [
"def",
"update_search_menu",
"(",
"self",
")",
":",
"# Disabling all actions except the last one\r",
"# (which is Find in files) to begin with\r",
"for",
"child",
"in",
"self",
".",
"search_menu",
".",
"actions",
"(",
")",
"[",
":",
"-",
"1",
"]",
":",
"child",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.set_splash | Set splash message | spyder/app/mainwindow.py | def set_splash(self, message):
"""Set splash message"""
if self.splash is None:
return
if message:
logger.info(message)
self.splash.show()
self.splash.showMessage(message, Qt.AlignBottom | Qt.AlignCenter |
Qt.AlignAb... | def set_splash(self, message):
"""Set splash message"""
if self.splash is None:
return
if message:
logger.info(message)
self.splash.show()
self.splash.showMessage(message, Qt.AlignBottom | Qt.AlignCenter |
Qt.AlignAb... | [
"Set",
"splash",
"message"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2255-L2264 | [
"def",
"set_splash",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"splash",
"is",
"None",
":",
"return",
"if",
"message",
":",
"logger",
".",
"info",
"(",
"message",
")",
"self",
".",
"splash",
".",
"show",
"(",
")",
"self",
".",
"spla... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.closeEvent | closeEvent reimplementation | spyder/app/mainwindow.py | def closeEvent(self, event):
"""closeEvent reimplementation"""
if self.closing(True):
event.accept()
else:
event.ignore() | def closeEvent(self, event):
"""closeEvent reimplementation"""
if self.closing(True):
event.accept()
else:
event.ignore() | [
"closeEvent",
"reimplementation"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2266-L2271 | [
"def",
"closeEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"closing",
"(",
"True",
")",
":",
"event",
".",
"accept",
"(",
")",
"else",
":",
"event",
".",
"ignore",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.resizeEvent | Reimplement Qt method | spyder/app/mainwindow.py | def resizeEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_size = self.size()
QMainWindow.resizeEvent(self, event)
# To be used by the tour to be able to resize
self.sig_resized.emit(event) | def resizeEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_size = self.size()
QMainWindow.resizeEvent(self, event)
# To be used by the tour to be able to resize
self.sig_resized.emit(event) | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2273-L2280 | [
"def",
"resizeEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"isMaximized",
"(",
")",
"and",
"not",
"self",
".",
"fullscreen_flag",
":",
"self",
".",
"window_size",
"=",
"self",
".",
"size",
"(",
")",
"QMainWindow",
".",
"resize... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.moveEvent | Reimplement Qt method | spyder/app/mainwindow.py | def moveEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_position = self.pos()
QMainWindow.moveEvent(self, event)
# To be used by the tour to be able to move
self.sig_moved.emit(event) | def moveEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_position = self.pos()
QMainWindow.moveEvent(self, event)
# To be used by the tour to be able to move
self.sig_moved.emit(event) | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2282-L2289 | [
"def",
"moveEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"isMaximized",
"(",
")",
"and",
"not",
"self",
".",
"fullscreen_flag",
":",
"self",
".",
"window_position",
"=",
"self",
".",
"pos",
"(",
")",
"QMainWindow",
".",
"moveE... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.hideEvent | Reimplement Qt method | spyder/app/mainwindow.py | def hideEvent(self, event):
"""Reimplement Qt method"""
try:
for plugin in (self.widgetlist + self.thirdparty_plugins):
if plugin.isAncestorOf(self.last_focused_widget):
plugin.visibility_changed(True)
QMainWindow.hideEvent(self, event)
... | def hideEvent(self, event):
"""Reimplement Qt method"""
try:
for plugin in (self.widgetlist + self.thirdparty_plugins):
if plugin.isAncestorOf(self.last_focused_widget):
plugin.visibility_changed(True)
QMainWindow.hideEvent(self, event)
... | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2291-L2299 | [
"def",
"hideEvent",
"(",
"self",
",",
"event",
")",
":",
"try",
":",
"for",
"plugin",
"in",
"(",
"self",
".",
"widgetlist",
"+",
"self",
".",
"thirdparty_plugins",
")",
":",
"if",
"plugin",
".",
"isAncestorOf",
"(",
"self",
".",
"last_focused_widget",
")... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.change_last_focused_widget | To keep track of to the last focused widget | spyder/app/mainwindow.py | def change_last_focused_widget(self, old, now):
"""To keep track of to the last focused widget"""
if (now is None and QApplication.activeWindow() is not None):
QApplication.activeWindow().setFocus()
self.last_focused_widget = QApplication.focusWidget()
elif now is no... | def change_last_focused_widget(self, old, now):
"""To keep track of to the last focused widget"""
if (now is None and QApplication.activeWindow() is not None):
QApplication.activeWindow().setFocus()
self.last_focused_widget = QApplication.focusWidget()
elif now is no... | [
"To",
"keep",
"track",
"of",
"to",
"the",
"last",
"focused",
"widget"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2301-L2309 | [
"def",
"change_last_focused_widget",
"(",
"self",
",",
"old",
",",
"now",
")",
":",
"if",
"(",
"now",
"is",
"None",
"and",
"QApplication",
".",
"activeWindow",
"(",
")",
"is",
"not",
"None",
")",
":",
"QApplication",
".",
"activeWindow",
"(",
")",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.closing | Exit tasks | spyder/app/mainwindow.py | def closing(self, cancelable=False):
"""Exit tasks"""
if self.already_closed or self.is_starting_up:
return True
if cancelable and CONF.get('main', 'prompt_on_exit'):
reply = QMessageBox.critical(self, 'Spyder',
'Do you reall... | def closing(self, cancelable=False):
"""Exit tasks"""
if self.already_closed or self.is_starting_up:
return True
if cancelable and CONF.get('main', 'prompt_on_exit'):
reply = QMessageBox.critical(self, 'Spyder',
'Do you reall... | [
"Exit",
"tasks"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2311-L2334 | [
"def",
"closing",
"(",
"self",
",",
"cancelable",
"=",
"False",
")",
":",
"if",
"self",
".",
"already_closed",
"or",
"self",
".",
"is_starting_up",
":",
"return",
"True",
"if",
"cancelable",
"and",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'prompt_on_exit'"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.add_dockwidget | Add QDockWidget and toggleViewAction | spyder/app/mainwindow.py | def add_dockwidget(self, child):
"""Add QDockWidget and toggleViewAction"""
dockwidget, location = child.create_dockwidget()
if CONF.get('main', 'vertical_dockwidget_titlebars'):
dockwidget.setFeatures(dockwidget.features()|
QDockWidget.DockWid... | def add_dockwidget(self, child):
"""Add QDockWidget and toggleViewAction"""
dockwidget, location = child.create_dockwidget()
if CONF.get('main', 'vertical_dockwidget_titlebars'):
dockwidget.setFeatures(dockwidget.features()|
QDockWidget.DockWid... | [
"Add",
"QDockWidget",
"and",
"toggleViewAction"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2336-L2343 | [
"def",
"add_dockwidget",
"(",
"self",
",",
"child",
")",
":",
"dockwidget",
",",
"location",
"=",
"child",
".",
"create_dockwidget",
"(",
")",
"if",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'vertical_dockwidget_titlebars'",
")",
":",
"dockwidget",
".",
"setF... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.toggle_lock | Lock/Unlock dockwidgets and toolbars | spyder/app/mainwindow.py | def toggle_lock(self, value):
"""Lock/Unlock dockwidgets and toolbars"""
self.interface_locked = value
CONF.set('main', 'panes_locked', value)
# Apply lock to panes
for plugin in (self.widgetlist + self.thirdparty_plugins):
if self.interface_locked:
... | def toggle_lock(self, value):
"""Lock/Unlock dockwidgets and toolbars"""
self.interface_locked = value
CONF.set('main', 'panes_locked', value)
# Apply lock to panes
for plugin in (self.widgetlist + self.thirdparty_plugins):
if self.interface_locked:
... | [
"Lock",
"/",
"Unlock",
"dockwidgets",
"and",
"toolbars"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2353-L2372 | [
"def",
"toggle_lock",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"interface_locked",
"=",
"value",
"CONF",
".",
"set",
"(",
"'main'",
",",
"'panes_locked'",
",",
"value",
")",
"# Apply lock to panes\r",
"for",
"plugin",
"in",
"(",
"self",
".",
"widg... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.maximize_dockwidget | Shortcut: Ctrl+Alt+Shift+M
First call: maximize current dockwidget
Second call (or restore=True): restore original window layout | spyder/app/mainwindow.py | def maximize_dockwidget(self, restore=False):
"""Shortcut: Ctrl+Alt+Shift+M
First call: maximize current dockwidget
Second call (or restore=True): restore original window layout"""
if self.state_before_maximizing is None:
if restore:
return
... | def maximize_dockwidget(self, restore=False):
"""Shortcut: Ctrl+Alt+Shift+M
First call: maximize current dockwidget
Second call (or restore=True): restore original window layout"""
if self.state_before_maximizing is None:
if restore:
return
... | [
"Shortcut",
":",
"Ctrl",
"+",
"Alt",
"+",
"Shift",
"+",
"M",
"First",
"call",
":",
"maximize",
"current",
"dockwidget",
"Second",
"call",
"(",
"or",
"restore",
"=",
"True",
")",
":",
"restore",
"original",
"window",
"layout"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2389-L2438 | [
"def",
"maximize_dockwidget",
"(",
"self",
",",
"restore",
"=",
"False",
")",
":",
"if",
"self",
".",
"state_before_maximizing",
"is",
"None",
":",
"if",
"restore",
":",
"return",
"# Select plugin to maximize\r",
"self",
".",
"state_before_maximizing",
"=",
"self"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.add_to_toolbar | Add widget actions to toolbar | spyder/app/mainwindow.py | def add_to_toolbar(self, toolbar, widget):
"""Add widget actions to toolbar"""
actions = widget.toolbar_actions
if actions is not None:
add_actions(toolbar, actions) | def add_to_toolbar(self, toolbar, widget):
"""Add widget actions to toolbar"""
actions = widget.toolbar_actions
if actions is not None:
add_actions(toolbar, actions) | [
"Add",
"widget",
"actions",
"to",
"toolbar"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2486-L2490 | [
"def",
"add_to_toolbar",
"(",
"self",
",",
"toolbar",
",",
"widget",
")",
":",
"actions",
"=",
"widget",
".",
"toolbar_actions",
"if",
"actions",
"is",
"not",
"None",
":",
"add_actions",
"(",
"toolbar",
",",
"actions",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.about | Create About Spyder dialog with general information. | spyder/app/mainwindow.py | def about(self):
"""Create About Spyder dialog with general information."""
versions = get_versions()
# Show Git revision for development version
revlink = ''
if versions['revision']:
rev = versions['revision']
revlink = " (<a href='https://github.c... | def about(self):
"""Create About Spyder dialog with general information."""
versions = get_versions()
# Show Git revision for development version
revlink = ''
if versions['revision']:
rev = versions['revision']
revlink = " (<a href='https://github.c... | [
"Create",
"About",
"Spyder",
"dialog",
"with",
"general",
"information",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2493-L2590 | [
"def",
"about",
"(",
"self",
")",
":",
"versions",
"=",
"get_versions",
"(",
")",
"# Show Git revision for development version\r",
"revlink",
"=",
"''",
"if",
"versions",
"[",
"'revision'",
"]",
":",
"rev",
"=",
"versions",
"[",
"'revision'",
"]",
"revlink",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.show_dependencies | Show Spyder's Dependencies dialog box | spyder/app/mainwindow.py | def show_dependencies(self):
"""Show Spyder's Dependencies dialog box"""
from spyder.widgets.dependencies import DependenciesDialog
dlg = DependenciesDialog(self)
dlg.set_data(dependencies.DEPENDENCIES)
dlg.exec_() | def show_dependencies(self):
"""Show Spyder's Dependencies dialog box"""
from spyder.widgets.dependencies import DependenciesDialog
dlg = DependenciesDialog(self)
dlg.set_data(dependencies.DEPENDENCIES)
dlg.exec_() | [
"Show",
"Spyder",
"s",
"Dependencies",
"dialog",
"box"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2593-L2598 | [
"def",
"show_dependencies",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"widgets",
".",
"dependencies",
"import",
"DependenciesDialog",
"dlg",
"=",
"DependenciesDialog",
"(",
"self",
")",
"dlg",
".",
"set_data",
"(",
"dependencies",
".",
"DEPENDENCIES",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.render_issue | Render issue before sending it to Github | spyder/app/mainwindow.py | def render_issue(self, description='', traceback=''):
"""Render issue before sending it to Github"""
# Get component versions
versions = get_versions()
# Get git revision for development version
revision = ''
if versions['revision']:
revision = versio... | def render_issue(self, description='', traceback=''):
"""Render issue before sending it to Github"""
# Get component versions
versions = get_versions()
# Get git revision for development version
revision = ''
if versions['revision']:
revision = versio... | [
"Render",
"issue",
"before",
"sending",
"it",
"to",
"Github"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2600-L2654 | [
"def",
"render_issue",
"(",
"self",
",",
"description",
"=",
"''",
",",
"traceback",
"=",
"''",
")",
":",
"# Get component versions\r",
"versions",
"=",
"get_versions",
"(",
")",
"# Get git revision for development version\r",
"revision",
"=",
"''",
"if",
"versions"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.report_issue | Report a Spyder issue to github, generating body text if needed. | spyder/app/mainwindow.py | def report_issue(self, body=None, title=None, open_webpage=False):
"""Report a Spyder issue to github, generating body text if needed."""
if body is None:
from spyder.widgets.reporterror import SpyderErrorDialog
report_dlg = SpyderErrorDialog(self, is_report=True)
... | def report_issue(self, body=None, title=None, open_webpage=False):
"""Report a Spyder issue to github, generating body text if needed."""
if body is None:
from spyder.widgets.reporterror import SpyderErrorDialog
report_dlg = SpyderErrorDialog(self, is_report=True)
... | [
"Report",
"a",
"Spyder",
"issue",
"to",
"github",
"generating",
"body",
"text",
"if",
"needed",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2657-L2677 | [
"def",
"report_issue",
"(",
"self",
",",
"body",
"=",
"None",
",",
"title",
"=",
"None",
",",
"open_webpage",
"=",
"False",
")",
":",
"if",
"body",
"is",
"None",
":",
"from",
"spyder",
".",
"widgets",
".",
"reporterror",
"import",
"SpyderErrorDialog",
"r... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.global_callback | Global callback | spyder/app/mainwindow.py | def global_callback(self):
"""Global callback"""
widget = QApplication.focusWidget()
action = self.sender()
callback = from_qvariant(action.data(), to_text_string)
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyder.plugins.ipythonconsole... | def global_callback(self):
"""Global callback"""
widget = QApplication.focusWidget()
action = self.sender()
callback = from_qvariant(action.data(), to_text_string)
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyder.plugins.ipythonconsole... | [
"Global",
"callback"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2692-L2703 | [
"def",
"global_callback",
"(",
"self",
")",
":",
"widget",
"=",
"QApplication",
".",
"focusWidget",
"(",
")",
"action",
"=",
"self",
".",
"sender",
"(",
")",
"callback",
"=",
"from_qvariant",
"(",
"action",
".",
"data",
"(",
")",
",",
"to_text_string",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.open_external_console | Open external console | spyder/app/mainwindow.py | def open_external_console(self, fname, wdir, args, interact, debug, python,
python_args, systerm, post_mortem=False):
"""Open external console"""
if systerm:
# Running script in an external system terminal
try:
if CONF.get('main... | def open_external_console(self, fname, wdir, args, interact, debug, python,
python_args, systerm, post_mortem=False):
"""Open external console"""
if systerm:
# Running script in an external system terminal
try:
if CONF.get('main... | [
"Open",
"external",
"console"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2711-L2728 | [
"def",
"open_external_console",
"(",
"self",
",",
"fname",
",",
"wdir",
",",
"args",
",",
"interact",
",",
"debug",
",",
"python",
",",
"python_args",
",",
"systerm",
",",
"post_mortem",
"=",
"False",
")",
":",
"if",
"systerm",
":",
"# Running script in an e... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.execute_in_external_console | Execute lines in IPython console and eventually set focus
to the Editor. | spyder/app/mainwindow.py | def execute_in_external_console(self, lines, focus_to_editor):
"""
Execute lines in IPython console and eventually set focus
to the Editor.
"""
console = self.ipyconsole
console.switch_to_plugin()
console.execute_code(lines)
if focus_to_editor:
... | def execute_in_external_console(self, lines, focus_to_editor):
"""
Execute lines in IPython console and eventually set focus
to the Editor.
"""
console = self.ipyconsole
console.switch_to_plugin()
console.execute_code(lines)
if focus_to_editor:
... | [
"Execute",
"lines",
"in",
"IPython",
"console",
"and",
"eventually",
"set",
"focus",
"to",
"the",
"Editor",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2730-L2739 | [
"def",
"execute_in_external_console",
"(",
"self",
",",
"lines",
",",
"focus_to_editor",
")",
":",
"console",
"=",
"self",
".",
"ipyconsole",
"console",
".",
"switch_to_plugin",
"(",
")",
"console",
".",
"execute_code",
"(",
"lines",
")",
"if",
"focus_to_editor"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.open_file | Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported) | spyder/app/mainwindow.py | def open_file(self, fname, external=False):
"""
Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported)
"""
fname = to_text_string(fname)
... | def open_file(self, fname, external=False):
"""
Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported)
"""
fname = to_text_string(fname)
... | [
"Open",
"filename",
"with",
"the",
"appropriate",
"application",
"Redirect",
"to",
"the",
"right",
"widget",
"(",
"txt",
"-",
">",
"editor",
"spydata",
"-",
">",
"workspace",
"...",
")",
"or",
"open",
"file",
"outside",
"Spyder",
"(",
"if",
"extension",
"i... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2741-L2755 | [
"def",
"open_file",
"(",
"self",
",",
"fname",
",",
"external",
"=",
"False",
")",
":",
"fname",
"=",
"to_text_string",
"(",
"fname",
")",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
"if",
"encoding",
".",
"is_text_file",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.open_external_file | Open external files that can be handled either by the Editor or the
variable explorer inside Spyder. | spyder/app/mainwindow.py | def open_external_file(self, fname):
"""
Open external files that can be handled either by the Editor or the
variable explorer inside Spyder.
"""
fname = encoding.to_unicode_from_fs(fname)
if osp.isfile(fname):
self.open_file(fname, external=True)
... | def open_external_file(self, fname):
"""
Open external files that can be handled either by the Editor or the
variable explorer inside Spyder.
"""
fname = encoding.to_unicode_from_fs(fname)
if osp.isfile(fname):
self.open_file(fname, external=True)
... | [
"Open",
"external",
"files",
"that",
"can",
"be",
"handled",
"either",
"by",
"the",
"Editor",
"or",
"the",
"variable",
"explorer",
"inside",
"Spyder",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2757-L2766 | [
"def",
"open_external_file",
"(",
"self",
",",
"fname",
")",
":",
"fname",
"=",
"encoding",
".",
"to_unicode_from_fs",
"(",
"fname",
")",
"if",
"osp",
".",
"isfile",
"(",
"fname",
")",
":",
"self",
".",
"open_file",
"(",
"fname",
",",
"external",
"=",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.get_spyder_pythonpath | Return Spyder PYTHONPATH | spyder/app/mainwindow.py | def get_spyder_pythonpath(self):
"""Return Spyder PYTHONPATH"""
active_path = [p for p in self.path if p not in self.not_active_path]
return active_path + self.project_path | def get_spyder_pythonpath(self):
"""Return Spyder PYTHONPATH"""
active_path = [p for p in self.path if p not in self.not_active_path]
return active_path + self.project_path | [
"Return",
"Spyder",
"PYTHONPATH"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2769-L2772 | [
"def",
"get_spyder_pythonpath",
"(",
"self",
")",
":",
"active_path",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"path",
"if",
"p",
"not",
"in",
"self",
".",
"not_active_path",
"]",
"return",
"active_path",
"+",
"self",
".",
"project_path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.add_path_to_sys_path | Add Spyder path to sys.path | spyder/app/mainwindow.py | def add_path_to_sys_path(self):
"""Add Spyder path to sys.path"""
for path in reversed(self.get_spyder_pythonpath()):
sys.path.insert(1, path) | def add_path_to_sys_path(self):
"""Add Spyder path to sys.path"""
for path in reversed(self.get_spyder_pythonpath()):
sys.path.insert(1, path) | [
"Add",
"Spyder",
"path",
"to",
"sys",
".",
"path"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2774-L2777 | [
"def",
"add_path_to_sys_path",
"(",
"self",
")",
":",
"for",
"path",
"in",
"reversed",
"(",
"self",
".",
"get_spyder_pythonpath",
"(",
")",
")",
":",
"sys",
".",
"path",
".",
"insert",
"(",
"1",
",",
"path",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.remove_path_from_sys_path | Remove Spyder path from sys.path | spyder/app/mainwindow.py | def remove_path_from_sys_path(self):
"""Remove Spyder path from sys.path"""
for path in self.path + self.project_path:
while path in sys.path:
sys.path.remove(path) | def remove_path_from_sys_path(self):
"""Remove Spyder path from sys.path"""
for path in self.path + self.project_path:
while path in sys.path:
sys.path.remove(path) | [
"Remove",
"Spyder",
"path",
"from",
"sys",
".",
"path"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2779-L2783 | [
"def",
"remove_path_from_sys_path",
"(",
"self",
")",
":",
"for",
"path",
"in",
"self",
".",
"path",
"+",
"self",
".",
"project_path",
":",
"while",
"path",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"remove",
"(",
"path",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.path_manager_callback | Spyder path manager | spyder/app/mainwindow.py | def path_manager_callback(self):
"""Spyder path manager"""
from spyder.widgets.pathmanager import PathManager
self.remove_path_from_sys_path()
project_path = self.projects.get_pythonpath()
dialog = PathManager(self, self.path, project_path,
self... | def path_manager_callback(self):
"""Spyder path manager"""
from spyder.widgets.pathmanager import PathManager
self.remove_path_from_sys_path()
project_path = self.projects.get_pythonpath()
dialog = PathManager(self, self.path, project_path,
self... | [
"Spyder",
"path",
"manager"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2786-L2802 | [
"def",
"path_manager_callback",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"widgets",
".",
"pathmanager",
"import",
"PathManager",
"self",
".",
"remove_path_from_sys_path",
"(",
")",
"project_path",
"=",
"self",
".",
"projects",
".",
"get_pythonpath",
"(",
")... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.pythonpath_changed | Projects PYTHONPATH contribution has changed | spyder/app/mainwindow.py | def pythonpath_changed(self):
"""Projects PYTHONPATH contribution has changed"""
self.remove_path_from_sys_path()
self.project_path = self.projects.get_pythonpath()
self.add_path_to_sys_path()
self.sig_pythonpath_changed.emit() | def pythonpath_changed(self):
"""Projects PYTHONPATH contribution has changed"""
self.remove_path_from_sys_path()
self.project_path = self.projects.get_pythonpath()
self.add_path_to_sys_path()
self.sig_pythonpath_changed.emit() | [
"Projects",
"PYTHONPATH",
"contribution",
"has",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2804-L2809 | [
"def",
"pythonpath_changed",
"(",
"self",
")",
":",
"self",
".",
"remove_path_from_sys_path",
"(",
")",
"self",
".",
"project_path",
"=",
"self",
".",
"projects",
".",
"get_pythonpath",
"(",
")",
"self",
".",
"add_path_to_sys_path",
"(",
")",
"self",
".",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.apply_settings | Apply settings changed in 'Preferences' dialog box | spyder/app/mainwindow.py | def apply_settings(self):
"""Apply settings changed in 'Preferences' dialog box"""
qapp = QApplication.instance()
# Set 'gtk+' as the default theme in Gtk-based desktops
# Fixes Issue 2036
if is_gtk_desktop() and ('GTK+' in QStyleFactory.keys()):
try:
... | def apply_settings(self):
"""Apply settings changed in 'Preferences' dialog box"""
qapp = QApplication.instance()
# Set 'gtk+' as the default theme in Gtk-based desktops
# Fixes Issue 2036
if is_gtk_desktop() and ('GTK+' in QStyleFactory.keys()):
try:
... | [
"Apply",
"settings",
"changed",
"in",
"Preferences",
"dialog",
"box"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2817-L2848 | [
"def",
"apply_settings",
"(",
"self",
")",
":",
"qapp",
"=",
"QApplication",
".",
"instance",
"(",
")",
"# Set 'gtk+' as the default theme in Gtk-based desktops\r",
"# Fixes Issue 2036\r",
"if",
"is_gtk_desktop",
"(",
")",
"and",
"(",
"'GTK+'",
"in",
"QStyleFactory",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.apply_panes_settings | Update dockwidgets features settings | spyder/app/mainwindow.py | def apply_panes_settings(self):
"""Update dockwidgets features settings"""
for plugin in (self.widgetlist + self.thirdparty_plugins):
features = plugin.FEATURES
if CONF.get('main', 'vertical_dockwidget_titlebars'):
features = features | QDockWidget.DockWidget... | def apply_panes_settings(self):
"""Update dockwidgets features settings"""
for plugin in (self.widgetlist + self.thirdparty_plugins):
features = plugin.FEATURES
if CONF.get('main', 'vertical_dockwidget_titlebars'):
features = features | QDockWidget.DockWidget... | [
"Update",
"dockwidgets",
"features",
"settings"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2850-L2857 | [
"def",
"apply_panes_settings",
"(",
"self",
")",
":",
"for",
"plugin",
"in",
"(",
"self",
".",
"widgetlist",
"+",
"self",
".",
"thirdparty_plugins",
")",
":",
"features",
"=",
"plugin",
".",
"FEATURES",
"if",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'ver... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.apply_statusbar_settings | Update status bar widgets settings | spyder/app/mainwindow.py | def apply_statusbar_settings(self):
"""Update status bar widgets settings"""
show_status_bar = CONF.get('main', 'show_status_bar')
self.statusBar().setVisible(show_status_bar)
if show_status_bar:
for widget, name in ((self.mem_status, 'memory_usage'),
... | def apply_statusbar_settings(self):
"""Update status bar widgets settings"""
show_status_bar = CONF.get('main', 'show_status_bar')
self.statusBar().setVisible(show_status_bar)
if show_status_bar:
for widget, name in ((self.mem_status, 'memory_usage'),
... | [
"Update",
"status",
"bar",
"widgets",
"settings"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2859-L2871 | [
"def",
"apply_statusbar_settings",
"(",
"self",
")",
":",
"show_status_bar",
"=",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'show_status_bar'",
")",
"self",
".",
"statusBar",
"(",
")",
".",
"setVisible",
"(",
"show_status_bar",
")",
"if",
"show_status_bar",
":"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.edit_preferences | Edit Spyder preferences | spyder/app/mainwindow.py | def edit_preferences(self):
"""Edit Spyder preferences"""
from spyder.preferences.configdialog import ConfigDialog
dlg = ConfigDialog(self)
dlg.size_change.connect(self.set_prefs_size)
if self.prefs_dialog_size is not None:
dlg.resize(self.prefs_dialog_size)
... | def edit_preferences(self):
"""Edit Spyder preferences"""
from spyder.preferences.configdialog import ConfigDialog
dlg = ConfigDialog(self)
dlg.size_change.connect(self.set_prefs_size)
if self.prefs_dialog_size is not None:
dlg.resize(self.prefs_dialog_size)
... | [
"Edit",
"Spyder",
"preferences"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2874-L2902 | [
"def",
"edit_preferences",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"preferences",
".",
"configdialog",
"import",
"ConfigDialog",
"dlg",
"=",
"ConfigDialog",
"(",
"self",
")",
"dlg",
".",
"size_change",
".",
"connect",
"(",
"self",
".",
"set_prefs_size",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.register_shortcut | Register QAction or QShortcut to Spyder main application,
with shortcut (context, name, default) | spyder/app/mainwindow.py | def register_shortcut(self, qaction_or_qshortcut, context, name,
add_sc_to_tip=False):
"""
Register QAction or QShortcut to Spyder main application,
with shortcut (context, name, default)
"""
self.shortcut_data.append( (qaction_or_qshortcut, contex... | def register_shortcut(self, qaction_or_qshortcut, context, name,
add_sc_to_tip=False):
"""
Register QAction or QShortcut to Spyder main application,
with shortcut (context, name, default)
"""
self.shortcut_data.append( (qaction_or_qshortcut, contex... | [
"Register",
"QAction",
"or",
"QShortcut",
"to",
"Spyder",
"main",
"application",
"with",
"shortcut",
"(",
"context",
"name",
"default",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2913-L2920 | [
"def",
"register_shortcut",
"(",
"self",
",",
"qaction_or_qshortcut",
",",
"context",
",",
"name",
",",
"add_sc_to_tip",
"=",
"False",
")",
":",
"self",
".",
"shortcut_data",
".",
"append",
"(",
"(",
"qaction_or_qshortcut",
",",
"context",
",",
"name",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.apply_shortcuts | Apply shortcuts settings to all widgets/plugins | spyder/app/mainwindow.py | def apply_shortcuts(self):
"""Apply shortcuts settings to all widgets/plugins"""
toberemoved = []
for index, (qobject, context, name,
add_sc_to_tip) in enumerate(self.shortcut_data):
keyseq = QKeySequence( get_shortcut(context, name) )
try:
... | def apply_shortcuts(self):
"""Apply shortcuts settings to all widgets/plugins"""
toberemoved = []
for index, (qobject, context, name,
add_sc_to_tip) in enumerate(self.shortcut_data):
keyseq = QKeySequence( get_shortcut(context, name) )
try:
... | [
"Apply",
"shortcuts",
"settings",
"to",
"all",
"widgets",
"/",
"plugins"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2922-L2943 | [
"def",
"apply_shortcuts",
"(",
"self",
")",
":",
"toberemoved",
"=",
"[",
"]",
"for",
"index",
",",
"(",
"qobject",
",",
"context",
",",
"name",
",",
"add_sc_to_tip",
")",
"in",
"enumerate",
"(",
"self",
".",
"shortcut_data",
")",
":",
"keyseq",
"=",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.reset_spyder | Quit and reset Spyder and then Restart application. | spyder/app/mainwindow.py | def reset_spyder(self):
"""
Quit and reset Spyder and then Restart application.
"""
answer = QMessageBox.warning(self, _("Warning"),
_("Spyder will restart and reset to default settings: <br><br>"
"Do you want to continue?"),
QMessageBox.Ye... | def reset_spyder(self):
"""
Quit and reset Spyder and then Restart application.
"""
answer = QMessageBox.warning(self, _("Warning"),
_("Spyder will restart and reset to default settings: <br><br>"
"Do you want to continue?"),
QMessageBox.Ye... | [
"Quit",
"and",
"reset",
"Spyder",
"and",
"then",
"Restart",
"application",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2982-L2991 | [
"def",
"reset_spyder",
"(",
"self",
")",
":",
"answer",
"=",
"QMessageBox",
".",
"warning",
"(",
"self",
",",
"_",
"(",
"\"Warning\"",
")",
",",
"_",
"(",
"\"Spyder will restart and reset to default settings: <br><br>\"",
"\"Do you want to continue?\"",
")",
",",
"Q... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.restart | Quit and Restart Spyder application.
If reset True it allows to reset spyder on restart. | spyder/app/mainwindow.py | def restart(self, reset=False):
"""
Quit and Restart Spyder application.
If reset True it allows to reset spyder on restart.
"""
# Get start path to use in restart script
spyder_start_directory = get_module_path('spyder')
restart_script = osp.join(spyder_... | def restart(self, reset=False):
"""
Quit and Restart Spyder application.
If reset True it allows to reset spyder on restart.
"""
# Get start path to use in restart script
spyder_start_directory = get_module_path('spyder')
restart_script = osp.join(spyder_... | [
"Quit",
"and",
"Restart",
"Spyder",
"application",
".",
"If",
"reset",
"True",
"it",
"allows",
"to",
"reset",
"spyder",
"on",
"restart",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2994-L3055 | [
"def",
"restart",
"(",
"self",
",",
"reset",
"=",
"False",
")",
":",
"# Get start path to use in restart script\r",
"spyder_start_directory",
"=",
"get_module_path",
"(",
"'spyder'",
")",
"restart_script",
"=",
"osp",
".",
"join",
"(",
"spyder_start_directory",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.show_tour | Show interactive tour. | spyder/app/mainwindow.py | def show_tour(self, index):
"""Show interactive tour."""
self.maximize_dockwidget(restore=True)
frames = self.tours_available[index]
self.tour.set_tour(index, frames, self)
self.tour.start_tour() | def show_tour(self, index):
"""Show interactive tour."""
self.maximize_dockwidget(restore=True)
frames = self.tours_available[index]
self.tour.set_tour(index, frames, self)
self.tour.start_tour() | [
"Show",
"interactive",
"tour",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3058-L3063 | [
"def",
"show_tour",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"maximize_dockwidget",
"(",
"restore",
"=",
"True",
")",
"frames",
"=",
"self",
".",
"tours_available",
"[",
"index",
"]",
"self",
".",
"tour",
".",
"set_tour",
"(",
"index",
",",
"f... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.open_fileswitcher | Open file list management dialog box. | spyder/app/mainwindow.py | def open_fileswitcher(self, symbol=False):
"""Open file list management dialog box."""
if self.fileswitcher is not None and \
self.fileswitcher.is_visible:
self.fileswitcher.hide()
self.fileswitcher.is_visible = False
return
if symbol:
... | def open_fileswitcher(self, symbol=False):
"""Open file list management dialog box."""
if self.fileswitcher is not None and \
self.fileswitcher.is_visible:
self.fileswitcher.hide()
self.fileswitcher.is_visible = False
return
if symbol:
... | [
"Open",
"file",
"list",
"management",
"dialog",
"box",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3066-L3079 | [
"def",
"open_fileswitcher",
"(",
"self",
",",
"symbol",
"=",
"False",
")",
":",
"if",
"self",
".",
"fileswitcher",
"is",
"not",
"None",
"and",
"self",
".",
"fileswitcher",
".",
"is_visible",
":",
"self",
".",
"fileswitcher",
".",
"hide",
"(",
")",
"self"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.add_to_fileswitcher | Add a plugin to the File Switcher. | spyder/app/mainwindow.py | def add_to_fileswitcher(self, plugin, tabs, data, icon):
"""Add a plugin to the File Switcher."""
if self.fileswitcher is None:
from spyder.widgets.fileswitcher import FileSwitcher
self.fileswitcher = FileSwitcher(self, plugin, tabs, data, icon)
else:
se... | def add_to_fileswitcher(self, plugin, tabs, data, icon):
"""Add a plugin to the File Switcher."""
if self.fileswitcher is None:
from spyder.widgets.fileswitcher import FileSwitcher
self.fileswitcher = FileSwitcher(self, plugin, tabs, data, icon)
else:
se... | [
"Add",
"a",
"plugin",
"to",
"the",
"File",
"Switcher",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3085-L3094 | [
"def",
"add_to_fileswitcher",
"(",
"self",
",",
"plugin",
",",
"tabs",
",",
"data",
",",
"icon",
")",
":",
"if",
"self",
".",
"fileswitcher",
"is",
"None",
":",
"from",
"spyder",
".",
"widgets",
".",
"fileswitcher",
"import",
"FileSwitcher",
"self",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow._check_updates_ready | Called by WorkerUpdates when ready | spyder/app/mainwindow.py | def _check_updates_ready(self):
"""Called by WorkerUpdates when ready"""
from spyder.widgets.helperwidgets import MessageCheckBox
# feedback` = False is used on startup, so only positive feedback is
# given. `feedback` = True is used when after startup (when using the
# me... | def _check_updates_ready(self):
"""Called by WorkerUpdates when ready"""
from spyder.widgets.helperwidgets import MessageCheckBox
# feedback` = False is used on startup, so only positive feedback is
# given. `feedback` = True is used when after startup (when using the
# me... | [
"Called",
"by",
"WorkerUpdates",
"when",
"ready"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3097-L3173 | [
"def",
"_check_updates_ready",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"widgets",
".",
"helperwidgets",
"import",
"MessageCheckBox",
"# feedback` = False is used on startup, so only positive feedback is\r",
"# given. `feedback` = True is used when after startup (when using the\r"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.check_updates | Check for spyder updates on github releases using a QThread. | spyder/app/mainwindow.py | def check_updates(self, startup=False):
"""
Check for spyder updates on github releases using a QThread.
"""
from spyder.workers.updates import WorkerUpdates
# Disable check_updates_action while the thread is working
self.check_updates_action.setDisabled(True)
... | def check_updates(self, startup=False):
"""
Check for spyder updates on github releases using a QThread.
"""
from spyder.workers.updates import WorkerUpdates
# Disable check_updates_action while the thread is working
self.check_updates_action.setDisabled(True)
... | [
"Check",
"for",
"spyder",
"updates",
"on",
"github",
"releases",
"using",
"a",
"QThread",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3176-L3194 | [
"def",
"check_updates",
"(",
"self",
",",
"startup",
"=",
"False",
")",
":",
"from",
"spyder",
".",
"workers",
".",
"updates",
"import",
"WorkerUpdates",
"# Disable check_updates_action while the thread is working\r",
"self",
".",
"check_updates_action",
".",
"setDisabl... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DefaultsConfig._set | Private set method | spyder/config/user.py | def _set(self, section, option, value, verbose):
"""
Private set method
"""
if not self.has_section(section):
self.add_section( section )
if not is_text_string(value):
value = repr( value )
if verbose:
print('%s[ %s ] = %s' % (... | def _set(self, section, option, value, verbose):
"""
Private set method
"""
if not self.has_section(section):
self.add_section( section )
if not is_text_string(value):
value = repr( value )
if verbose:
print('%s[ %s ] = %s' % (... | [
"Private",
"set",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L79-L89 | [
"def",
"_set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
",",
"verbose",
")",
":",
"if",
"not",
"self",
".",
"has_section",
"(",
"section",
")",
":",
"self",
".",
"add_section",
"(",
"section",
")",
"if",
"not",
"is_text_string",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DefaultsConfig._save | Save config into the associated .ini file | spyder/config/user.py | def _save(self):
"""
Save config into the associated .ini file
"""
# See Issue 1086 and 1242 for background on why this
# method contains all the exception handling.
fname = self.filename()
def _write_file(fname):
if PY2:
# P... | def _save(self):
"""
Save config into the associated .ini file
"""
# See Issue 1086 and 1242 for background on why this
# method contains all the exception handling.
fname = self.filename()
def _write_file(fname):
if PY2:
# P... | [
"Save",
"config",
"into",
"the",
"associated",
".",
"ini",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L91-L120 | [
"def",
"_save",
"(",
"self",
")",
":",
"# See Issue 1086 and 1242 for background on why this\r",
"# method contains all the exception handling.\r",
"fname",
"=",
"self",
".",
"filename",
"(",
")",
"def",
"_write_file",
"(",
"fname",
")",
":",
"if",
"PY2",
":",
"# Pyth... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DefaultsConfig.filename | Defines the name of the configuration file to use. | spyder/config/user.py | def filename(self):
"""Defines the name of the configuration file to use."""
# Needs to be done this way to be used by the project config.
# To fix on a later PR
self._filename = getattr(self, '_filename', None)
self._root_path = getattr(self, '_root_path', None)
... | def filename(self):
"""Defines the name of the configuration file to use."""
# Needs to be done this way to be used by the project config.
# To fix on a later PR
self._filename = getattr(self, '_filename', None)
self._root_path = getattr(self, '_root_path', None)
... | [
"Defines",
"the",
"name",
"of",
"the",
"configuration",
"file",
"to",
"use",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L122-L132 | [
"def",
"filename",
"(",
"self",
")",
":",
"# Needs to be done this way to be used by the project config.\r",
"# To fix on a later PR\r",
"self",
".",
"_filename",
"=",
"getattr",
"(",
"self",
",",
"'_filename'",
",",
"None",
")",
"self",
".",
"_root_path",
"=",
"getat... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DefaultsConfig._filename_global | Create a .ini filename located in user home directory.
This .ini files stores the global spyder preferences. | spyder/config/user.py | def _filename_global(self):
"""Create a .ini filename located in user home directory.
This .ini files stores the global spyder preferences.
"""
if self.subfolder is None:
config_file = osp.join(get_home_dir(), '.%s.ini' % self.name)
return config_file
... | def _filename_global(self):
"""Create a .ini filename located in user home directory.
This .ini files stores the global spyder preferences.
"""
if self.subfolder is None:
config_file = osp.join(get_home_dir(), '.%s.ini' % self.name)
return config_file
... | [
"Create",
"a",
".",
"ini",
"filename",
"located",
"in",
"user",
"home",
"directory",
".",
"This",
".",
"ini",
"files",
"stores",
"the",
"global",
"spyder",
"preferences",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L141-L156 | [
"def",
"_filename_global",
"(",
"self",
")",
":",
"if",
"self",
".",
"subfolder",
"is",
"None",
":",
"config_file",
"=",
"osp",
".",
"join",
"(",
"get_home_dir",
"(",
")",
",",
"'.%s.ini'",
"%",
"self",
".",
"name",
")",
"return",
"config_file",
"else",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.set_version | Set configuration (not application!) version | spyder/config/user.py | def set_version(self, version='0.0.0', save=True):
"""Set configuration (not application!) version"""
self.set(self.DEFAULT_SECTION_NAME, 'version', version, save=save) | def set_version(self, version='0.0.0', save=True):
"""Set configuration (not application!) version"""
self.set(self.DEFAULT_SECTION_NAME, 'version', version, save=save) | [
"Set",
"configuration",
"(",
"not",
"application!",
")",
"version"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L239-L241 | [
"def",
"set_version",
"(",
"self",
",",
"version",
"=",
"'0.0.0'",
",",
"save",
"=",
"True",
")",
":",
"self",
".",
"set",
"(",
"self",
".",
"DEFAULT_SECTION_NAME",
",",
"'version'",
",",
"version",
",",
"save",
"=",
"save",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.load_from_ini | Load config from the associated .ini file | spyder/config/user.py | def load_from_ini(self):
"""
Load config from the associated .ini file
"""
try:
if PY2:
# Python 2
fname = self.filename()
if osp.isfile(fname):
try:
with codecs.open(fname, ... | def load_from_ini(self):
"""
Load config from the associated .ini file
"""
try:
if PY2:
# Python 2
fname = self.filename()
if osp.isfile(fname):
try:
with codecs.open(fname, ... | [
"Load",
"config",
"from",
"the",
"associated",
".",
"ini",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L243-L261 | [
"def",
"load_from_ini",
"(",
"self",
")",
":",
"try",
":",
"if",
"PY2",
":",
"# Python 2\r",
"fname",
"=",
"self",
".",
"filename",
"(",
")",
"if",
"osp",
".",
"isfile",
"(",
"fname",
")",
":",
"try",
":",
"with",
"codecs",
".",
"open",
"(",
"fname... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig._load_old_defaults | Read old defaults | spyder/config/user.py | def _load_old_defaults(self, old_version):
"""Read old defaults"""
old_defaults = cp.ConfigParser()
if check_version(old_version, '3.0.0', '<='):
path = get_module_source_path('spyder')
else:
path = osp.dirname(self.filename())
path = osp.join(path,... | def _load_old_defaults(self, old_version):
"""Read old defaults"""
old_defaults = cp.ConfigParser()
if check_version(old_version, '3.0.0', '<='):
path = get_module_source_path('spyder')
else:
path = osp.dirname(self.filename())
path = osp.join(path,... | [
"Read",
"old",
"defaults"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L263-L272 | [
"def",
"_load_old_defaults",
"(",
"self",
",",
"old_version",
")",
":",
"old_defaults",
"=",
"cp",
".",
"ConfigParser",
"(",
")",
"if",
"check_version",
"(",
"old_version",
",",
"'3.0.0'",
",",
"'<='",
")",
":",
"path",
"=",
"get_module_source_path",
"(",
"'... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig._save_new_defaults | Save new defaults | spyder/config/user.py | def _save_new_defaults(self, defaults, new_version, subfolder):
"""Save new defaults"""
new_defaults = DefaultsConfig(name='defaults-'+new_version,
subfolder=subfolder)
if not osp.isfile(new_defaults.filename()):
new_defaults.set_defaults(de... | def _save_new_defaults(self, defaults, new_version, subfolder):
"""Save new defaults"""
new_defaults = DefaultsConfig(name='defaults-'+new_version,
subfolder=subfolder)
if not osp.isfile(new_defaults.filename()):
new_defaults.set_defaults(de... | [
"Save",
"new",
"defaults"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L274-L280 | [
"def",
"_save_new_defaults",
"(",
"self",
",",
"defaults",
",",
"new_version",
",",
"subfolder",
")",
":",
"new_defaults",
"=",
"DefaultsConfig",
"(",
"name",
"=",
"'defaults-'",
"+",
"new_version",
",",
"subfolder",
"=",
"subfolder",
")",
"if",
"not",
"osp",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig._update_defaults | Update defaults after a change in version | spyder/config/user.py | def _update_defaults(self, defaults, old_version, verbose=False):
"""Update defaults after a change in version"""
old_defaults = self._load_old_defaults(old_version)
for section, options in defaults:
for option in options:
new_value = options[ option ]
... | def _update_defaults(self, defaults, old_version, verbose=False):
"""Update defaults after a change in version"""
old_defaults = self._load_old_defaults(old_version)
for section, options in defaults:
for option in options:
new_value = options[ option ]
... | [
"Update",
"defaults",
"after",
"a",
"change",
"in",
"version"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L282-L294 | [
"def",
"_update_defaults",
"(",
"self",
",",
"defaults",
",",
"old_version",
",",
"verbose",
"=",
"False",
")",
":",
"old_defaults",
"=",
"self",
".",
"_load_old_defaults",
"(",
"old_version",
")",
"for",
"section",
",",
"options",
"in",
"defaults",
":",
"fo... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig._remove_deprecated_options | Remove options which are present in the .ini file but not in defaults | spyder/config/user.py | def _remove_deprecated_options(self, old_version):
"""
Remove options which are present in the .ini file but not in defaults
"""
old_defaults = self._load_old_defaults(old_version)
for section in old_defaults.sections():
for option, _ in old_defaults.items(secti... | def _remove_deprecated_options(self, old_version):
"""
Remove options which are present in the .ini file but not in defaults
"""
old_defaults = self._load_old_defaults(old_version)
for section in old_defaults.sections():
for option, _ in old_defaults.items(secti... | [
"Remove",
"options",
"which",
"are",
"present",
"in",
"the",
".",
"ini",
"file",
"but",
"not",
"in",
"defaults"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L296-L309 | [
"def",
"_remove_deprecated_options",
"(",
"self",
",",
"old_version",
")",
":",
"old_defaults",
"=",
"self",
".",
"_load_old_defaults",
"(",
"old_version",
")",
"for",
"section",
"in",
"old_defaults",
".",
"sections",
"(",
")",
":",
"for",
"option",
",",
"_",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.set_as_defaults | Set defaults from the current config | spyder/config/user.py | def set_as_defaults(self):
"""
Set defaults from the current config
"""
self.defaults = []
for section in self.sections():
secdict = {}
for option, value in self.items(section, raw=self.raw):
secdict[option] = value
sel... | def set_as_defaults(self):
"""
Set defaults from the current config
"""
self.defaults = []
for section in self.sections():
secdict = {}
for option, value in self.items(section, raw=self.raw):
secdict[option] = value
sel... | [
"Set",
"defaults",
"from",
"the",
"current",
"config"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L317-L326 | [
"def",
"set_as_defaults",
"(",
"self",
")",
":",
"self",
".",
"defaults",
"=",
"[",
"]",
"for",
"section",
"in",
"self",
".",
"sections",
"(",
")",
":",
"secdict",
"=",
"{",
"}",
"for",
"option",
",",
"value",
"in",
"self",
".",
"items",
"(",
"sect... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.reset_to_defaults | Reset config to Default values | spyder/config/user.py | def reset_to_defaults(self, save=True, verbose=False, section=None):
"""
Reset config to Default values
"""
for sec, options in self.defaults:
if section == None or section == sec:
for option in options:
value = options[ option ]
... | def reset_to_defaults(self, save=True, verbose=False, section=None):
"""
Reset config to Default values
"""
for sec, options in self.defaults:
if section == None or section == sec:
for option in options:
value = options[ option ]
... | [
"Reset",
"config",
"to",
"Default",
"values"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L328-L338 | [
"def",
"reset_to_defaults",
"(",
"self",
",",
"save",
"=",
"True",
",",
"verbose",
"=",
"False",
",",
"section",
"=",
"None",
")",
":",
"for",
"sec",
",",
"options",
"in",
"self",
".",
"defaults",
":",
"if",
"section",
"==",
"None",
"or",
"section",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig._check_section_option | Private method to check section and option types | spyder/config/user.py | def _check_section_option(self, section, option):
"""
Private method to check section and option types
"""
if section is None:
section = self.DEFAULT_SECTION_NAME
elif not is_text_string(section):
raise RuntimeError("Argument 'section' must be a str... | def _check_section_option(self, section, option):
"""
Private method to check section and option types
"""
if section is None:
section = self.DEFAULT_SECTION_NAME
elif not is_text_string(section):
raise RuntimeError("Argument 'section' must be a str... | [
"Private",
"method",
"to",
"check",
"section",
"and",
"option",
"types"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L340-L350 | [
"def",
"_check_section_option",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"if",
"section",
"is",
"None",
":",
"section",
"=",
"self",
".",
"DEFAULT_SECTION_NAME",
"elif",
"not",
"is_text_string",
"(",
"section",
")",
":",
"raise",
"RuntimeError",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.get_default | Get Default value for a given (section, option)
-> useful for type checking in 'get' method | spyder/config/user.py | def get_default(self, section, option):
"""
Get Default value for a given (section, option)
-> useful for type checking in 'get' method
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults:
if sec == section:
... | def get_default(self, section, option):
"""
Get Default value for a given (section, option)
-> useful for type checking in 'get' method
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults:
if sec == section:
... | [
"Get",
"Default",
"value",
"for",
"a",
"given",
"(",
"section",
"option",
")",
"-",
">",
"useful",
"for",
"type",
"checking",
"in",
"get",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L352-L363 | [
"def",
"get_default",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"for",
"sec",
",",
"options",
"in",
"self",
".",
"defaults",
":",
"if",
"sec",
"==",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.get | Get an option
section=None: attribute a default section name
default: default value (if not specified, an exception
will be raised if option doesn't exist) | spyder/config/user.py | def get(self, section, option, default=NoDefault):
"""
Get an option
section=None: attribute a default section name
default: default value (if not specified, an exception
will be raised if option doesn't exist)
"""
section = self._check_section_option(secti... | def get(self, section, option, default=NoDefault):
"""
Get an option
section=None: attribute a default section name
default: default value (if not specified, an exception
will be raised if option doesn't exist)
"""
section = self._check_section_option(secti... | [
"Get",
"an",
"option",
"section",
"=",
"None",
":",
"attribute",
"a",
"default",
"section",
"name",
"default",
":",
"default",
"value",
"(",
"if",
"not",
"specified",
"an",
"exception",
"will",
"be",
"raised",
"if",
"option",
"doesn",
"t",
"exist",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L365-L415 | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
"=",
"NoDefault",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"if",
"not",
"self",
".",
"has_section",
"(",
"section",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.set_default | Set Default value for a given (section, option)
-> called when a new (section, option) is set and no default exists | spyder/config/user.py | def set_default(self, section, option, default_value):
"""
Set Default value for a given (section, option)
-> called when a new (section, option) is set and no default exists
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults... | def set_default(self, section, option, default_value):
"""
Set Default value for a given (section, option)
-> called when a new (section, option) is set and no default exists
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults... | [
"Set",
"Default",
"value",
"for",
"a",
"given",
"(",
"section",
"option",
")",
"-",
">",
"called",
"when",
"a",
"new",
"(",
"section",
"option",
")",
"is",
"set",
"and",
"no",
"default",
"exists"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L417-L425 | [
"def",
"set_default",
"(",
"self",
",",
"section",
",",
"option",
",",
"default_value",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"for",
"sec",
",",
"options",
"in",
"self",
".",
"defaults",
":",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UserConfig.set | Set an option
section=None: attribute a default section name | spyder/config/user.py | def set(self, section, option, value, verbose=False, save=True):
"""
Set an option
section=None: attribute a default section name
"""
section = self._check_section_option(section, option)
default_value = self.get_default(section, option)
if default_value is... | def set(self, section, option, value, verbose=False, save=True):
"""
Set an option
section=None: attribute a default section name
"""
section = self._check_section_option(section, option)
default_value = self.get_default(section, option)
if default_value is... | [
"Set",
"an",
"option",
"section",
"=",
"None",
":",
"attribute",
"a",
"default",
"section",
"name"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L427-L452 | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
",",
"verbose",
"=",
"False",
",",
"save",
"=",
"True",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"default_value",
"=",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_temp_dir | Return temporary Spyder directory, checking previously that it exists. | spyder/utils/programs.py | def get_temp_dir(suffix=None):
"""
Return temporary Spyder directory, checking previously that it exists.
"""
to_join = [tempfile.gettempdir()]
if os.name == 'nt':
to_join.append('spyder')
else:
username = encoding.to_unicode_from_fs(getuser())
to_join.append('... | def get_temp_dir(suffix=None):
"""
Return temporary Spyder directory, checking previously that it exists.
"""
to_join = [tempfile.gettempdir()]
if os.name == 'nt':
to_join.append('spyder')
else:
username = encoding.to_unicode_from_fs(getuser())
to_join.append('... | [
"Return",
"temporary",
"Spyder",
"directory",
"checking",
"previously",
"that",
"it",
"exists",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L34-L54 | [
"def",
"get_temp_dir",
"(",
"suffix",
"=",
"None",
")",
":",
"to_join",
"=",
"[",
"tempfile",
".",
"gettempdir",
"(",
")",
"]",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"to_join",
".",
"append",
"(",
"'spyder'",
")",
"else",
":",
"username",
"=",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_program_installed | Return program absolute path if installed in PATH.
Otherwise, return None | spyder/utils/programs.py | def is_program_installed(basename):
"""
Return program absolute path if installed in PATH.
Otherwise, return None
"""
for path in os.environ["PATH"].split(os.pathsep):
abspath = osp.join(path, basename)
if osp.isfile(abspath):
return abspath | def is_program_installed(basename):
"""
Return program absolute path if installed in PATH.
Otherwise, return None
"""
for path in os.environ["PATH"].split(os.pathsep):
abspath = osp.join(path, basename)
if osp.isfile(abspath):
return abspath | [
"Return",
"program",
"absolute",
"path",
"if",
"installed",
"in",
"PATH",
".",
"Otherwise",
"return",
"None"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L57-L66 | [
"def",
"is_program_installed",
"(",
"basename",
")",
":",
"for",
"path",
"in",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
":",
"abspath",
"=",
"osp",
".",
"join",
"(",
"path",
",",
"basename",
")",
"if",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | find_program | Find program in PATH and return absolute path
Try adding .exe or .bat to basename on Windows platforms
(return None if not found) | spyder/utils/programs.py | def find_program(basename):
"""
Find program in PATH and return absolute path
Try adding .exe or .bat to basename on Windows platforms
(return None if not found)
"""
names = [basename]
if os.name == 'nt':
# Windows platforms
extensions = ('.exe', '.bat', '.cmd')
... | def find_program(basename):
"""
Find program in PATH and return absolute path
Try adding .exe or .bat to basename on Windows platforms
(return None if not found)
"""
names = [basename]
if os.name == 'nt':
# Windows platforms
extensions = ('.exe', '.bat', '.cmd')
... | [
"Find",
"program",
"in",
"PATH",
"and",
"return",
"absolute",
"path",
"Try",
"adding",
".",
"exe",
"or",
".",
"bat",
"to",
"basename",
"on",
"Windows",
"platforms",
"(",
"return",
"None",
"if",
"not",
"found",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L69-L85 | [
"def",
"find_program",
"(",
"basename",
")",
":",
"names",
"=",
"[",
"basename",
"]",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"# Windows platforms\r",
"extensions",
"=",
"(",
"'.exe'",
",",
"'.bat'",
",",
"'.cmd'",
")",
"if",
"not",
"basename",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | alter_subprocess_kwargs_by_platform | Given a dict, populate kwargs to create a generally
useful default setup for running subprocess processes
on different platforms. For example, `close_fds` is
set on posix and creation of a new console window is
disabled on Windows.
This function will alter the given kwargs and return
the... | spyder/utils/programs.py | def alter_subprocess_kwargs_by_platform(**kwargs):
"""
Given a dict, populate kwargs to create a generally
useful default setup for running subprocess processes
on different platforms. For example, `close_fds` is
set on posix and creation of a new console window is
disabled on Windows.
... | def alter_subprocess_kwargs_by_platform(**kwargs):
"""
Given a dict, populate kwargs to create a generally
useful default setup for running subprocess processes
on different platforms. For example, `close_fds` is
set on posix and creation of a new console window is
disabled on Windows.
... | [
"Given",
"a",
"dict",
"populate",
"kwargs",
"to",
"create",
"a",
"generally",
"useful",
"default",
"setup",
"for",
"running",
"subprocess",
"processes",
"on",
"different",
"platforms",
".",
"For",
"example",
"close_fds",
"is",
"set",
"on",
"posix",
"and",
"cre... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L88-L107 | [
"def",
"alter_subprocess_kwargs_by_platform",
"(",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'close_fds'",
",",
"os",
".",
"name",
"==",
"'posix'",
")",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"CONSOLE_CREATION_FLAGS",
"=",
"0",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | run_shell_command | Execute the given shell command.
Note that *args and **kwargs will be passed to the subprocess call.
If 'shell' is given in subprocess_kwargs it must be True,
otherwise ProgramError will be raised.
.
If 'executable' is not given in subprocess_kwargs, it will
be set to the value of ... | spyder/utils/programs.py | def run_shell_command(cmdstr, **subprocess_kwargs):
"""
Execute the given shell command.
Note that *args and **kwargs will be passed to the subprocess call.
If 'shell' is given in subprocess_kwargs it must be True,
otherwise ProgramError will be raised.
.
If 'executable' is no... | def run_shell_command(cmdstr, **subprocess_kwargs):
"""
Execute the given shell command.
Note that *args and **kwargs will be passed to the subprocess call.
If 'shell' is given in subprocess_kwargs it must be True,
otherwise ProgramError will be raised.
.
If 'executable' is no... | [
"Execute",
"the",
"given",
"shell",
"command",
".",
"Note",
"that",
"*",
"args",
"and",
"**",
"kwargs",
"will",
"be",
"passed",
"to",
"the",
"subprocess",
"call",
".",
"If",
"shell",
"is",
"given",
"in",
"subprocess_kwargs",
"it",
"must",
"be",
"True",
"... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L110-L142 | [
"def",
"run_shell_command",
"(",
"cmdstr",
",",
"*",
"*",
"subprocess_kwargs",
")",
":",
"if",
"'shell'",
"in",
"subprocess_kwargs",
"and",
"not",
"subprocess_kwargs",
"[",
"'shell'",
"]",
":",
"raise",
"ProgramError",
"(",
"'The \"shell\" kwarg may be omitted, but if... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | run_program | Run program in a separate process.
NOTE: returns the process object created by
`subprocess.Popen()`. This can be used with
`proc.communicate()` for example.
If 'shell' appears in the kwargs, it must be False,
otherwise ProgramError will be raised.
If only the program name is given an... | spyder/utils/programs.py | def run_program(program, args=None, **subprocess_kwargs):
"""
Run program in a separate process.
NOTE: returns the process object created by
`subprocess.Popen()`. This can be used with
`proc.communicate()` for example.
If 'shell' appears in the kwargs, it must be False,
otherwise ... | def run_program(program, args=None, **subprocess_kwargs):
"""
Run program in a separate process.
NOTE: returns the process object created by
`subprocess.Popen()`. This can be used with
`proc.communicate()` for example.
If 'shell' appears in the kwargs, it must be False,
otherwise ... | [
"Run",
"program",
"in",
"a",
"separate",
"process",
".",
"NOTE",
":",
"returns",
"the",
"process",
"object",
"created",
"by",
"subprocess",
".",
"Popen",
"()",
".",
"This",
"can",
"be",
"used",
"with",
"proc",
".",
"communicate",
"()",
"for",
"example",
... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L145-L180 | [
"def",
"run_program",
"(",
"program",
",",
"args",
"=",
"None",
",",
"*",
"*",
"subprocess_kwargs",
")",
":",
"if",
"'shell'",
"in",
"subprocess_kwargs",
"and",
"subprocess_kwargs",
"[",
"'shell'",
"]",
":",
"raise",
"ProgramError",
"(",
"\"This function is only... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | start_file | Generalized os.startfile for all platforms supported by Qt
This function is simply wrapping QDesktopServices.openUrl
Returns True if successfull, otherwise returns False. | spyder/utils/programs.py | def start_file(filename):
"""
Generalized os.startfile for all platforms supported by Qt
This function is simply wrapping QDesktopServices.openUrl
Returns True if successfull, otherwise returns False.
"""
from qtpy.QtCore import QUrl
from qtpy.QtGui import QDesktopServices
... | def start_file(filename):
"""
Generalized os.startfile for all platforms supported by Qt
This function is simply wrapping QDesktopServices.openUrl
Returns True if successfull, otherwise returns False.
"""
from qtpy.QtCore import QUrl
from qtpy.QtGui import QDesktopServices
... | [
"Generalized",
"os",
".",
"startfile",
"for",
"all",
"platforms",
"supported",
"by",
"Qt",
"This",
"function",
"is",
"simply",
"wrapping",
"QDesktopServices",
".",
"openUrl",
"Returns",
"True",
"if",
"successfull",
"otherwise",
"returns",
"False",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L183-L200 | [
"def",
"start_file",
"(",
"filename",
")",
":",
"from",
"qtpy",
".",
"QtCore",
"import",
"QUrl",
"from",
"qtpy",
".",
"QtGui",
"import",
"QDesktopServices",
"# We need to use setUrl instead of setPath because this is the only\r",
"# cross-platform way to open external files. se... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | python_script_exists | Return absolute path if Python script exists (otherwise, return None)
package=None -> module is in sys.path (standard library modules) | spyder/utils/programs.py | def python_script_exists(package=None, module=None):
"""
Return absolute path if Python script exists (otherwise, return None)
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
try:
if package is None:
path = imp.find_modul... | def python_script_exists(package=None, module=None):
"""
Return absolute path if Python script exists (otherwise, return None)
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
try:
if package is None:
path = imp.find_modul... | [
"Return",
"absolute",
"path",
"if",
"Python",
"script",
"exists",
"(",
"otherwise",
"return",
"None",
")",
"package",
"=",
"None",
"-",
">",
"module",
"is",
"in",
"sys",
".",
"path",
"(",
"standard",
"library",
"modules",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L203-L219 | [
"def",
"python_script_exists",
"(",
"package",
"=",
"None",
",",
"module",
"=",
"None",
")",
":",
"assert",
"module",
"is",
"not",
"None",
"try",
":",
"if",
"package",
"is",
"None",
":",
"path",
"=",
"imp",
".",
"find_module",
"(",
"module",
")",
"[",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | run_python_script | Run Python script in a separate process
package=None -> module is in sys.path (standard library modules) | spyder/utils/programs.py | def run_python_script(package=None, module=None, args=[], p_args=[]):
"""
Run Python script in a separate process
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
assert isinstance(args, (tuple, list)) and isinstance(p_args, (tuple, list))
... | def run_python_script(package=None, module=None, args=[], p_args=[]):
"""
Run Python script in a separate process
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
assert isinstance(args, (tuple, list)) and isinstance(p_args, (tuple, list))
... | [
"Run",
"Python",
"script",
"in",
"a",
"separate",
"process",
"package",
"=",
"None",
"-",
">",
"module",
"is",
"in",
"sys",
".",
"path",
"(",
"standard",
"library",
"modules",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L222-L230 | [
"def",
"run_python_script",
"(",
"package",
"=",
"None",
",",
"module",
"=",
"None",
",",
"args",
"=",
"[",
"]",
",",
"p_args",
"=",
"[",
"]",
")",
":",
"assert",
"module",
"is",
"not",
"None",
"assert",
"isinstance",
"(",
"args",
",",
"(",
"tuple",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | shell_split | Split the string `text` using shell-like syntax
This avoids breaking single/double-quoted strings (e.g. containing
strings with spaces). This function is almost equivalent to the shlex.split
function (see standard library `shlex`) except that it is supporting
unicode strings (shlex does not suppor... | spyder/utils/programs.py | def shell_split(text):
"""
Split the string `text` using shell-like syntax
This avoids breaking single/double-quoted strings (e.g. containing
strings with spaces). This function is almost equivalent to the shlex.split
function (see standard library `shlex`) except that it is supporting
u... | def shell_split(text):
"""
Split the string `text` using shell-like syntax
This avoids breaking single/double-quoted strings (e.g. containing
strings with spaces). This function is almost equivalent to the shlex.split
function (see standard library `shlex`) except that it is supporting
u... | [
"Split",
"the",
"string",
"text",
"using",
"shell",
"-",
"like",
"syntax",
"This",
"avoids",
"breaking",
"single",
"/",
"double",
"-",
"quoted",
"strings",
"(",
"e",
".",
"g",
".",
"containing",
"strings",
"with",
"spaces",
")",
".",
"This",
"function",
... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L233-L248 | [
"def",
"shell_split",
"(",
"text",
")",
":",
"assert",
"is_text_string",
"(",
"text",
")",
"# in case a QString is passed...\r",
"pattern",
"=",
"r'(\\s+|(?<!\\\\)\".*?(?<!\\\\)\"|(?<!\\\\)\\'.*?(?<!\\\\)\\')'",
"out",
"=",
"[",
"]",
"for",
"token",
"in",
"re",
".",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_python_args | Construct Python interpreter arguments | spyder/utils/programs.py | def get_python_args(fname, python_args, interact, debug, end_args):
"""Construct Python interpreter arguments"""
p_args = []
if python_args is not None:
p_args += python_args.split()
if interact:
p_args.append('-i')
if debug:
p_args.extend(['-m', 'pdb'])
if fname... | def get_python_args(fname, python_args, interact, debug, end_args):
"""Construct Python interpreter arguments"""
p_args = []
if python_args is not None:
p_args += python_args.split()
if interact:
p_args.append('-i')
if debug:
p_args.extend(['-m', 'pdb'])
if fname... | [
"Construct",
"Python",
"interpreter",
"arguments"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L251-L270 | [
"def",
"get_python_args",
"(",
"fname",
",",
"python_args",
",",
"interact",
",",
"debug",
",",
"end_args",
")",
":",
"p_args",
"=",
"[",
"]",
"if",
"python_args",
"is",
"not",
"None",
":",
"p_args",
"+=",
"python_args",
".",
"split",
"(",
")",
"if",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | run_python_script_in_terminal | Run Python script in an external system terminal.
:str wdir: working directory, may be empty. | spyder/utils/programs.py | def run_python_script_in_terminal(fname, wdir, args, interact,
debug, python_args, executable=None):
"""
Run Python script in an external system terminal.
:str wdir: working directory, may be empty.
"""
if executable is None:
executable = get_python... | def run_python_script_in_terminal(fname, wdir, args, interact,
debug, python_args, executable=None):
"""
Run Python script in an external system terminal.
:str wdir: working directory, may be empty.
"""
if executable is None:
executable = get_python... | [
"Run",
"Python",
"script",
"in",
"an",
"external",
"system",
"terminal",
".",
":",
"str",
"wdir",
":",
"working",
"directory",
"may",
"be",
"empty",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L273-L339 | [
"def",
"run_python_script_in_terminal",
"(",
"fname",
",",
"wdir",
",",
"args",
",",
"interact",
",",
"debug",
",",
"python_args",
",",
"executable",
"=",
"None",
")",
":",
"if",
"executable",
"is",
"None",
":",
"executable",
"=",
"get_python_executable",
"(",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | check_version | Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their own packages up to
date.
Copyright (C) 20... | spyder/utils/programs.py | def check_version(actver, version, cmp_op):
"""
Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their... | def check_version(actver, version, cmp_op):
"""
Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their... | [
"Check",
"version",
"string",
"of",
"an",
"active",
"module",
"against",
"a",
"required",
"version",
".",
"If",
"dev",
"/",
"prerelease",
"tags",
"result",
"in",
"TypeError",
"for",
"string",
"-",
"number",
"comparison",
"it",
"is",
"assumed",
"that",
"the",... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L342-L381 | [
"def",
"check_version",
"(",
"actver",
",",
"version",
",",
"cmp_op",
")",
":",
"if",
"isinstance",
"(",
"actver",
",",
"tuple",
")",
":",
"actver",
"=",
"'.'",
".",
"join",
"(",
"[",
"str",
"(",
"i",
")",
"for",
"i",
"in",
"actver",
"]",
")",
"#... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_module_installed | Return True if module *module_name* is installed
If version is not None, checking module version
(module must have an attribute named '__version__')
version may starts with =, >=, > or < to specify the exact requirement ;
multiple conditions may be separated by ';' (e.g. '>=0.13;<1.0')
in... | spyder/utils/programs.py | def is_module_installed(module_name, version=None, installed_version=None,
interpreter=None):
"""
Return True if module *module_name* is installed
If version is not None, checking module version
(module must have an attribute named '__version__')
version may starts ... | def is_module_installed(module_name, version=None, installed_version=None,
interpreter=None):
"""
Return True if module *module_name* is installed
If version is not None, checking module version
(module must have an attribute named '__version__')
version may starts ... | [
"Return",
"True",
"if",
"module",
"*",
"module_name",
"*",
"is",
"installed",
"If",
"version",
"is",
"not",
"None",
"checking",
"module",
"version",
"(",
"module",
"must",
"have",
"an",
"attribute",
"named",
"__version__",
")",
"version",
"may",
"starts",
"w... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L390-L476 | [
"def",
"is_module_installed",
"(",
"module_name",
",",
"version",
"=",
"None",
",",
"installed_version",
"=",
"None",
",",
"interpreter",
"=",
"None",
")",
":",
"if",
"interpreter",
":",
"if",
"osp",
".",
"isfile",
"(",
"interpreter",
")",
"and",
"(",
"'py... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_python_interpreter_valid_name | Check that the python interpreter file has a valid name. | spyder/utils/programs.py | def is_python_interpreter_valid_name(filename):
"""Check that the python interpreter file has a valid name."""
pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$'
if re.match(pattern, filename, flags=re.I) is None:
return False
else:
return True | def is_python_interpreter_valid_name(filename):
"""Check that the python interpreter file has a valid name."""
pattern = r'.*python(\d\.?\d*)?(w)?(.exe)?$'
if re.match(pattern, filename, flags=re.I) is None:
return False
else:
return True | [
"Check",
"that",
"the",
"python",
"interpreter",
"file",
"has",
"a",
"valid",
"name",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L478-L484 | [
"def",
"is_python_interpreter_valid_name",
"(",
"filename",
")",
":",
"pattern",
"=",
"r'.*python(\\d\\.?\\d*)?(w)?(.exe)?$'",
"if",
"re",
".",
"match",
"(",
"pattern",
",",
"filename",
",",
"flags",
"=",
"re",
".",
"I",
")",
"is",
"None",
":",
"return",
"Fals... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_python_interpreter | Evaluate wether a file is a python interpreter or not. | spyder/utils/programs.py | def is_python_interpreter(filename):
"""Evaluate wether a file is a python interpreter or not."""
real_filename = os.path.realpath(filename) # To follow symlink if existent
if (not osp.isfile(real_filename) or
not is_python_interpreter_valid_name(filename)):
return False
elif is_... | def is_python_interpreter(filename):
"""Evaluate wether a file is a python interpreter or not."""
real_filename = os.path.realpath(filename) # To follow symlink if existent
if (not osp.isfile(real_filename) or
not is_python_interpreter_valid_name(filename)):
return False
elif is_... | [
"Evaluate",
"wether",
"a",
"file",
"is",
"a",
"python",
"interpreter",
"or",
"not",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L486-L515 | [
"def",
"is_python_interpreter",
"(",
"filename",
")",
":",
"real_filename",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"filename",
")",
"# To follow symlink if existent\r",
"if",
"(",
"not",
"osp",
".",
"isfile",
"(",
"real_filename",
")",
"or",
"not",
"is_... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_pythonw | Check that the python interpreter has 'pythonw'. | spyder/utils/programs.py | def is_pythonw(filename):
"""Check that the python interpreter has 'pythonw'."""
pattern = r'.*python(\d\.?\d*)?w(.exe)?$'
if re.match(pattern, filename, flags=re.I) is None:
return False
else:
return True | def is_pythonw(filename):
"""Check that the python interpreter has 'pythonw'."""
pattern = r'.*python(\d\.?\d*)?w(.exe)?$'
if re.match(pattern, filename, flags=re.I) is None:
return False
else:
return True | [
"Check",
"that",
"the",
"python",
"interpreter",
"has",
"pythonw",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L518-L524 | [
"def",
"is_pythonw",
"(",
"filename",
")",
":",
"pattern",
"=",
"r'.*python(\\d\\.?\\d*)?w(.exe)?$'",
"if",
"re",
".",
"match",
"(",
"pattern",
",",
"filename",
",",
"flags",
"=",
"re",
".",
"I",
")",
"is",
"None",
":",
"return",
"False",
"else",
":",
"r... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | check_python_help | Check that the python interpreter can execute help. | spyder/utils/programs.py | def check_python_help(filename):
"""Check that the python interpreter can execute help."""
try:
proc = run_program(filename, ["-h"])
output = to_text_string(proc.communicate()[0])
valid = ("Options and arguments (and corresponding environment "
"variables)")
... | def check_python_help(filename):
"""Check that the python interpreter can execute help."""
try:
proc = run_program(filename, ["-h"])
output = to_text_string(proc.communicate()[0])
valid = ("Options and arguments (and corresponding environment "
"variables)")
... | [
"Check",
"that",
"the",
"python",
"interpreter",
"can",
"execute",
"help",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L527-L539 | [
"def",
"check_python_help",
"(",
"filename",
")",
":",
"try",
":",
"proc",
"=",
"run_program",
"(",
"filename",
",",
"[",
"\"-h\"",
"]",
")",
"output",
"=",
"to_text_string",
"(",
"proc",
".",
"communicate",
"(",
")",
"[",
"0",
"]",
")",
"valid",
"=",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerPanel.sizeHint | Override Qt method.
Returns the widget size hint (based on the editor font size). | spyder/plugins/editor/panels/debugger.py | def sizeHint(self):
"""Override Qt method.
Returns the widget size hint (based on the editor font size).
"""
fm = QFontMetrics(self.editor.font())
size_hint = QSize(fm.height(), fm.height())
if size_hint.width() > 16:
size_hint.setWidth(16)
return siz... | def sizeHint(self):
"""Override Qt method.
Returns the widget size hint (based on the editor font size).
"""
fm = QFontMetrics(self.editor.font())
size_hint = QSize(fm.height(), fm.height())
if size_hint.width() > 16:
size_hint.setWidth(16)
return siz... | [
"Override",
"Qt",
"method",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L40-L49 | [
"def",
"sizeHint",
"(",
"self",
")",
":",
"fm",
"=",
"QFontMetrics",
"(",
"self",
".",
"editor",
".",
"font",
"(",
")",
")",
"size_hint",
"=",
"QSize",
"(",
"fm",
".",
"height",
"(",
")",
",",
"fm",
".",
"height",
"(",
")",
")",
"if",
"size_hint"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerPanel._draw_breakpoint_icon | Draw the given breakpoint pixmap.
Args:
top (int): top of the line to draw the breakpoint icon.
painter (QPainter)
icon_name (srt): key of icon to draw (see: self.icons) | spyder/plugins/editor/panels/debugger.py | def _draw_breakpoint_icon(self, top, painter, icon_name):
"""Draw the given breakpoint pixmap.
Args:
top (int): top of the line to draw the breakpoint icon.
painter (QPainter)
icon_name (srt): key of icon to draw (see: self.icons)
"""
rect = QRect(0, ... | def _draw_breakpoint_icon(self, top, painter, icon_name):
"""Draw the given breakpoint pixmap.
Args:
top (int): top of the line to draw the breakpoint icon.
painter (QPainter)
icon_name (srt): key of icon to draw (see: self.icons)
"""
rect = QRect(0, ... | [
"Draw",
"the",
"given",
"breakpoint",
"pixmap",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L51-L66 | [
"def",
"_draw_breakpoint_icon",
"(",
"self",
",",
"top",
",",
"painter",
",",
"icon_name",
")",
":",
"rect",
"=",
"QRect",
"(",
"0",
",",
"top",
",",
"self",
".",
"sizeHint",
"(",
")",
".",
"width",
"(",
")",
",",
"self",
".",
"sizeHint",
"(",
")",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerPanel.paintEvent | Override Qt method.
Paint breakpoints icons. | spyder/plugins/editor/panels/debugger.py | def paintEvent(self, event):
"""Override Qt method.
Paint breakpoints icons.
"""
super(DebuggerPanel, self).paintEvent(event)
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
for top, line_number, block in self.editor.visible_... | def paintEvent(self, event):
"""Override Qt method.
Paint breakpoints icons.
"""
super(DebuggerPanel, self).paintEvent(event)
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
for top, line_number, block in self.editor.visible_... | [
"Override",
"Qt",
"method",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L80-L102 | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"DebuggerPanel",
",",
"self",
")",
".",
"paintEvent",
"(",
"event",
")",
"painter",
"=",
"QPainter",
"(",
"self",
")",
"painter",
".",
"fillRect",
"(",
"event",
".",
"rect",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerPanel.mousePressEvent | Override Qt method
Add/remove breakpoints by single click. | spyder/plugins/editor/panels/debugger.py | def mousePressEvent(self, event):
"""Override Qt method
Add/remove breakpoints by single click.
"""
line_number = self.editor.get_linenumber_from_mouse_event(event)
shift = event.modifiers() & Qt.ShiftModifier
self.editor.debugger.toogle_breakpoint(line_number,
... | def mousePressEvent(self, event):
"""Override Qt method
Add/remove breakpoints by single click.
"""
line_number = self.editor.get_linenumber_from_mouse_event(event)
shift = event.modifiers() & Qt.ShiftModifier
self.editor.debugger.toogle_breakpoint(line_number,
... | [
"Override",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L104-L112 | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"line_number",
"=",
"self",
".",
"editor",
".",
"get_linenumber_from_mouse_event",
"(",
"event",
")",
"shift",
"=",
"event",
".",
"modifiers",
"(",
")",
"&",
"Qt",
".",
"ShiftModifier",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerPanel.mouseMoveEvent | Override Qt method.
Draw semitransparent breakpoint hint. | spyder/plugins/editor/panels/debugger.py | def mouseMoveEvent(self, event):
"""Override Qt method.
Draw semitransparent breakpoint hint.
"""
self.line_number_hint = self.editor.get_linenumber_from_mouse_event(
event)
self.update() | def mouseMoveEvent(self, event):
"""Override Qt method.
Draw semitransparent breakpoint hint.
"""
self.line_number_hint = self.editor.get_linenumber_from_mouse_event(
event)
self.update() | [
"Override",
"Qt",
"method",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L114-L121 | [
"def",
"mouseMoveEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"line_number_hint",
"=",
"self",
".",
"editor",
".",
"get_linenumber_from_mouse_event",
"(",
"event",
")",
"self",
".",
"update",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerPanel.on_state_changed | Change visibility and connect/disconnect signal.
Args:
state (bool): Activate/deactivate. | spyder/plugins/editor/panels/debugger.py | def on_state_changed(self, state):
"""Change visibility and connect/disconnect signal.
Args:
state (bool): Activate/deactivate.
"""
if state:
self.editor.sig_breakpoints_changed.connect(self.repaint)
self.editor.sig_debug_stop.connect(self.set_current... | def on_state_changed(self, state):
"""Change visibility and connect/disconnect signal.
Args:
state (bool): Activate/deactivate.
"""
if state:
self.editor.sig_breakpoints_changed.connect(self.repaint)
self.editor.sig_debug_stop.connect(self.set_current... | [
"Change",
"visibility",
"and",
"connect",
"/",
"disconnect",
"signal",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L138-L153 | [
"def",
"on_state_changed",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
":",
"self",
".",
"editor",
".",
"sig_breakpoints_changed",
".",
"connect",
"(",
"self",
".",
"repaint",
")",
"self",
".",
"editor",
".",
"sig_debug_stop",
".",
"connect",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | handle_qbytearray | Qt/Python2/3 compatibility helper. | spyder/utils/workers.py | def handle_qbytearray(obj, encoding):
"""Qt/Python2/3 compatibility helper."""
if isinstance(obj, QByteArray):
obj = obj.data()
return to_text_string(obj, encoding=encoding) | def handle_qbytearray(obj, encoding):
"""Qt/Python2/3 compatibility helper."""
if isinstance(obj, QByteArray):
obj = obj.data()
return to_text_string(obj, encoding=encoding) | [
"Qt",
"/",
"Python2",
"/",
"3",
"compatibility",
"helper",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L29-L34 | [
"def",
"handle_qbytearray",
"(",
"obj",
",",
"encoding",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"QByteArray",
")",
":",
"obj",
"=",
"obj",
".",
"data",
"(",
")",
"return",
"to_text_string",
"(",
"obj",
",",
"encoding",
"=",
"encoding",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | sleeping_func | This methods illustrates how the workers can be used. | spyder/utils/workers.py | def sleeping_func(arg, secs=10, result_queue=None):
"""This methods illustrates how the workers can be used."""
import time
time.sleep(secs)
if result_queue is not None:
result_queue.put(arg)
else:
return arg | def sleeping_func(arg, secs=10, result_queue=None):
"""This methods illustrates how the workers can be used."""
import time
time.sleep(secs)
if result_queue is not None:
result_queue.put(arg)
else:
return arg | [
"This",
"methods",
"illustrates",
"how",
"the",
"workers",
"can",
"be",
"used",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L328-L335 | [
"def",
"sleeping_func",
"(",
"arg",
",",
"secs",
"=",
"10",
",",
"result_queue",
"=",
"None",
")",
":",
"import",
"time",
"time",
".",
"sleep",
"(",
"secs",
")",
"if",
"result_queue",
"is",
"not",
"None",
":",
"result_queue",
".",
"put",
"(",
"arg",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonWorker.start | Start the worker (emits sig_started signal with worker as arg). | spyder/utils/workers.py | def start(self):
"""Start the worker (emits sig_started signal with worker as arg)."""
if not self._started:
self.sig_started.emit(self)
self._started = True | def start(self):
"""Start the worker (emits sig_started signal with worker as arg)."""
if not self._started:
self.sig_started.emit(self)
self._started = True | [
"Start",
"the",
"worker",
"(",
"emits",
"sig_started",
"signal",
"with",
"worker",
"as",
"arg",
")",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L59-L63 | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_started",
":",
"self",
".",
"sig_started",
".",
"emit",
"(",
"self",
")",
"self",
".",
"_started",
"=",
"True"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonWorker._start | Start process worker for given method args and kwargs. | spyder/utils/workers.py | def _start(self):
"""Start process worker for given method args and kwargs."""
error = None
output = None
try:
output = self.func(*self.args, **self.kwargs)
except Exception as err:
error = err
if not self._is_finished:
self.sig_finis... | def _start(self):
"""Start process worker for given method args and kwargs."""
error = None
output = None
try:
output = self.func(*self.args, **self.kwargs)
except Exception as err:
error = err
if not self._is_finished:
self.sig_finis... | [
"Start",
"process",
"worker",
"for",
"given",
"method",
"args",
"and",
"kwargs",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L69-L81 | [
"def",
"_start",
"(",
"self",
")",
":",
"error",
"=",
"None",
"output",
"=",
"None",
"try",
":",
"output",
"=",
"self",
".",
"func",
"(",
"*",
"self",
".",
"args",
",",
"*",
"*",
"self",
".",
"kwargs",
")",
"except",
"Exception",
"as",
"err",
":"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker._get_encoding | Return the encoding/codepage to use. | spyder/utils/workers.py | def _get_encoding(self):
"""Return the encoding/codepage to use."""
enco = 'utf-8'
# Currently only cp1252 is allowed?
if WIN:
import ctypes
codepage = to_text_string(ctypes.cdll.kernel32.GetACP())
# import locale
# locale.getpreferredenc... | def _get_encoding(self):
"""Return the encoding/codepage to use."""
enco = 'utf-8'
# Currently only cp1252 is allowed?
if WIN:
import ctypes
codepage = to_text_string(ctypes.cdll.kernel32.GetACP())
# import locale
# locale.getpreferredenc... | [
"Return",
"the",
"encoding",
"/",
"codepage",
"to",
"use",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L118-L129 | [
"def",
"_get_encoding",
"(",
"self",
")",
":",
"enco",
"=",
"'utf-8'",
"# Currently only cp1252 is allowed?",
"if",
"WIN",
":",
"import",
"ctypes",
"codepage",
"=",
"to_text_string",
"(",
"ctypes",
".",
"cdll",
".",
"kernel32",
".",
"GetACP",
"(",
")",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker._set_environment | Set the environment on the QProcess. | spyder/utils/workers.py | def _set_environment(self, environ):
"""Set the environment on the QProcess."""
if environ:
q_environ = self._process.processEnvironment()
for k, v in environ.items():
q_environ.insert(k, v)
self._process.setProcessEnvironment(q_environ) | def _set_environment(self, environ):
"""Set the environment on the QProcess."""
if environ:
q_environ = self._process.processEnvironment()
for k, v in environ.items():
q_environ.insert(k, v)
self._process.setProcessEnvironment(q_environ) | [
"Set",
"the",
"environment",
"on",
"the",
"QProcess",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L131-L137 | [
"def",
"_set_environment",
"(",
"self",
",",
"environ",
")",
":",
"if",
"environ",
":",
"q_environ",
"=",
"self",
".",
"_process",
".",
"processEnvironment",
"(",
")",
"for",
"k",
",",
"v",
"in",
"environ",
".",
"items",
"(",
")",
":",
"q_environ",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker._partial | Callback for partial output. | spyder/utils/workers.py | def _partial(self):
"""Callback for partial output."""
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, self._get_encoding())
if self._partial_stdout is None:
self._partial_stdout = stdout
else:
self._partial_stdou... | def _partial(self):
"""Callback for partial output."""
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(raw_stdout, self._get_encoding())
if self._partial_stdout is None:
self._partial_stdout = stdout
else:
self._partial_stdou... | [
"Callback",
"for",
"partial",
"output",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L139-L149 | [
"def",
"_partial",
"(",
"self",
")",
":",
"raw_stdout",
"=",
"self",
".",
"_process",
".",
"readAllStandardOutput",
"(",
")",
"stdout",
"=",
"handle_qbytearray",
"(",
"raw_stdout",
",",
"self",
".",
"_get_encoding",
"(",
")",
")",
"if",
"self",
".",
"_part... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker._communicate | Callback for communicate. | spyder/utils/workers.py | def _communicate(self):
"""Callback for communicate."""
if (not self._communicate_first and
self._process.state() == QProcess.NotRunning):
self.communicate()
elif self._fired:
self._timer.stop() | def _communicate(self):
"""Callback for communicate."""
if (not self._communicate_first and
self._process.state() == QProcess.NotRunning):
self.communicate()
elif self._fired:
self._timer.stop() | [
"Callback",
"for",
"communicate",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L151-L157 | [
"def",
"_communicate",
"(",
"self",
")",
":",
"if",
"(",
"not",
"self",
".",
"_communicate_first",
"and",
"self",
".",
"_process",
".",
"state",
"(",
")",
"==",
"QProcess",
".",
"NotRunning",
")",
":",
"self",
".",
"communicate",
"(",
")",
"elif",
"sel... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker.communicate | Retrieve information. | spyder/utils/workers.py | def communicate(self):
"""Retrieve information."""
self._communicate_first = True
self._process.waitForFinished()
enco = self._get_encoding()
if self._partial_stdout is None:
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(ra... | def communicate(self):
"""Retrieve information."""
self._communicate_first = True
self._process.waitForFinished()
enco = self._get_encoding()
if self._partial_stdout is None:
raw_stdout = self._process.readAllStandardOutput()
stdout = handle_qbytearray(ra... | [
"Retrieve",
"information",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L159-L186 | [
"def",
"communicate",
"(",
"self",
")",
":",
"self",
".",
"_communicate_first",
"=",
"True",
"self",
".",
"_process",
".",
"waitForFinished",
"(",
")",
"enco",
"=",
"self",
".",
"_get_encoding",
"(",
")",
"if",
"self",
".",
"_partial_stdout",
"is",
"None",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker._start | Start process. | spyder/utils/workers.py | def _start(self):
"""Start process."""
if not self._fired:
self._partial_ouput = None
self._process.start(self._cmd_list[0], self._cmd_list[1:])
self._timer.start() | def _start(self):
"""Start process."""
if not self._fired:
self._partial_ouput = None
self._process.start(self._cmd_list[0], self._cmd_list[1:])
self._timer.start() | [
"Start",
"process",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L196-L201 | [
"def",
"_start",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_fired",
":",
"self",
".",
"_partial_ouput",
"=",
"None",
"self",
".",
"_process",
".",
"start",
"(",
"self",
".",
"_cmd_list",
"[",
"0",
"]",
",",
"self",
".",
"_cmd_list",
"[",
"1... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProcessWorker.terminate | Terminate running processes. | spyder/utils/workers.py | def terminate(self):
"""Terminate running processes."""
if self._process.state() == QProcess.Running:
try:
self._process.terminate()
except Exception:
pass
self._fired = True | def terminate(self):
"""Terminate running processes."""
if self._process.state() == QProcess.Running:
try:
self._process.terminate()
except Exception:
pass
self._fired = True | [
"Terminate",
"running",
"processes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L203-L210 | [
"def",
"terminate",
"(",
"self",
")",
":",
"if",
"self",
".",
"_process",
".",
"state",
"(",
")",
"==",
"QProcess",
".",
"Running",
":",
"try",
":",
"self",
".",
"_process",
".",
"terminate",
"(",
")",
"except",
"Exception",
":",
"pass",
"self",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkerManager._clean_workers | Delete periodically workers in workers bag. | spyder/utils/workers.py | def _clean_workers(self):
"""Delete periodically workers in workers bag."""
while self._bag_collector:
self._bag_collector.popleft()
self._timer_worker_delete.stop() | def _clean_workers(self):
"""Delete periodically workers in workers bag."""
while self._bag_collector:
self._bag_collector.popleft()
self._timer_worker_delete.stop() | [
"Delete",
"periodically",
"workers",
"in",
"workers",
"bag",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L243-L247 | [
"def",
"_clean_workers",
"(",
"self",
")",
":",
"while",
"self",
".",
"_bag_collector",
":",
"self",
".",
"_bag_collector",
".",
"popleft",
"(",
")",
"self",
".",
"_timer_worker_delete",
".",
"stop",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkerManager._start | Start threads and check for inactive workers. | spyder/utils/workers.py | def _start(self, worker=None):
"""Start threads and check for inactive workers."""
if worker:
self._queue_workers.append(worker)
if self._queue_workers and self._running_threads < self._max_threads:
#print('Queue: {0} Running: {1} Workers: {2} '
# 'Thre... | def _start(self, worker=None):
"""Start threads and check for inactive workers."""
if worker:
self._queue_workers.append(worker)
if self._queue_workers and self._running_threads < self._max_threads:
#print('Queue: {0} Running: {1} Workers: {2} '
# 'Thre... | [
"Start",
"threads",
"and",
"check",
"for",
"inactive",
"workers",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L249-L289 | [
"def",
"_start",
"(",
"self",
",",
"worker",
"=",
"None",
")",
":",
"if",
"worker",
":",
"self",
".",
"_queue_workers",
".",
"append",
"(",
"worker",
")",
"if",
"self",
".",
"_queue_workers",
"and",
"self",
".",
"_running_threads",
"<",
"self",
".",
"_... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.