id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
30,900 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.change_last_focused_widget | 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... | python | 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",
")",
":",
"if",
"(",
"now",
"is",
"None",
"and",
"QApplication",
".",
"activeWindow",
"(",
")",
"is",
"not",
"None",
")",
":",
"QApplication",
".",
"activeWindow",
"(",
")",
".",
... | To keep track of to the last focused widget | [
"To",
"keep",
"track",
"of",
"to",
"the",
"last",
"focused",
"widget"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2301-L2309 |
30,901 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.add_dockwidget | 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... | python | 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",
")",
":",
"dockwidget",
",",
"location",
"=",
"child",
".",
"create_dockwidget",
"(",
")",
"if",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'vertical_dockwidget_titlebars'",
")",
":",
"dockwidget",
".",
"setF... | Add QDockWidget and toggleViewAction | [
"Add",
"QDockWidget",
"and",
"toggleViewAction"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2336-L2343 |
30,902 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.add_to_toolbar | 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) | python | 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",
")",
":",
"actions",
"=",
"widget",
".",
"toolbar_actions",
"if",
"actions",
"is",
"not",
"None",
":",
"add_actions",
"(",
"toolbar",
",",
"actions",
")"
] | Add widget actions to toolbar | [
"Add",
"widget",
"actions",
"to",
"toolbar"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2486-L2490 |
30,903 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.show_dependencies | 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_() | python | 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",
")",
":",
"from",
"spyder",
".",
"widgets",
".",
"dependencies",
"import",
"DependenciesDialog",
"dlg",
"=",
"DependenciesDialog",
"(",
"self",
")",
"dlg",
".",
"set_data",
"(",
"dependencies",
".",
"DEPENDENCIES",
")",
... | Show Spyder's Dependencies dialog box | [
"Show",
"Spyder",
"s",
"Dependencies",
"dialog",
"box"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2593-L2598 |
30,904 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.report_issue | 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)
... | python | 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",
")",
":",
"if",
"body",
"is",
"None",
":",
"from",
"spyder",
".",
"widgets",
".",
"reporterror",
"import",
"SpyderErrorDialog",
"r... | Report a Spyder issue to github, generating body text if needed. | [
"Report",
"a",
"Spyder",
"issue",
"to",
"github",
"generating",
"body",
"text",
"if",
"needed",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2657-L2677 |
30,905 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.open_external_console | 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... | python | 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",
")",
":",
"if",
"systerm",
":",
"# Running script in an e... | Open external console | [
"Open",
"external",
"console"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2711-L2728 |
30,906 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.execute_in_external_console | 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:
... | python | 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",
")",
":",
"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. | [
"Execute",
"lines",
"in",
"IPython",
"console",
"and",
"eventually",
"set",
"focus",
"to",
"the",
"Editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2730-L2739 |
30,907 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.open_external_file | 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)
... | python | 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",
")",
":",
"fname",
"=",
"encoding",
".",
"to_unicode_from_fs",
"(",
"fname",
")",
"if",
"osp",
".",
"isfile",
"(",
"fname",
")",
":",
"self",
".",
"open_file",
"(",
"fname",
",",
"external",
"=",
... | Open external files that can be handled either by the Editor or the
variable explorer inside Spyder. | [
"Open",
"external",
"files",
"that",
"can",
"be",
"handled",
"either",
"by",
"the",
"Editor",
"or",
"the",
"variable",
"explorer",
"inside",
"Spyder",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2757-L2766 |
30,908 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.get_spyder_pythonpath | 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 | python | 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",
")",
":",
"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 | [
"Return",
"Spyder",
"PYTHONPATH"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2769-L2772 |
30,909 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.add_path_to_sys_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) | python | 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",
")",
":",
"for",
"path",
"in",
"reversed",
"(",
"self",
".",
"get_spyder_pythonpath",
"(",
")",
")",
":",
"sys",
".",
"path",
".",
"insert",
"(",
"1",
",",
"path",
")"
] | Add Spyder path to sys.path | [
"Add",
"Spyder",
"path",
"to",
"sys",
".",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2774-L2777 |
30,910 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.remove_path_from_sys_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) | python | 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",
")",
":",
"for",
"path",
"in",
"self",
".",
"path",
"+",
"self",
".",
"project_path",
":",
"while",
"path",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"remove",
"(",
"path",
")"
] | Remove Spyder path from sys.path | [
"Remove",
"Spyder",
"path",
"from",
"sys",
".",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2779-L2783 |
30,911 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.path_manager_callback | 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... | python | 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",
")",
":",
"from",
"spyder",
".",
"widgets",
".",
"pathmanager",
"import",
"PathManager",
"self",
".",
"remove_path_from_sys_path",
"(",
")",
"project_path",
"=",
"self",
".",
"projects",
".",
"get_pythonpath",
"(",
")... | Spyder path manager | [
"Spyder",
"path",
"manager"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2786-L2802 |
30,912 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.pythonpath_changed | 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() | python | 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",
")",
":",
"self",
".",
"remove_path_from_sys_path",
"(",
")",
"self",
".",
"project_path",
"=",
"self",
".",
"projects",
".",
"get_pythonpath",
"(",
")",
"self",
".",
"add_path_to_sys_path",
"(",
")",
"self",
".",
"s... | Projects PYTHONPATH contribution has changed | [
"Projects",
"PYTHONPATH",
"contribution",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2804-L2809 |
30,913 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.apply_settings | 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:
... | python | 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",
")",
":",
"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",
... | Apply settings changed in 'Preferences' dialog box | [
"Apply",
"settings",
"changed",
"in",
"Preferences",
"dialog",
"box"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2817-L2848 |
30,914 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.apply_panes_settings | 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... | python | 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",
")",
":",
"for",
"plugin",
"in",
"(",
"self",
".",
"widgetlist",
"+",
"self",
".",
"thirdparty_plugins",
")",
":",
"features",
"=",
"plugin",
".",
"FEATURES",
"if",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'ver... | Update dockwidgets features settings | [
"Update",
"dockwidgets",
"features",
"settings"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2850-L2857 |
30,915 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.apply_statusbar_settings | 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'),
... | python | 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",
")",
":",
"show_status_bar",
"=",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'show_status_bar'",
")",
"self",
".",
"statusBar",
"(",
")",
".",
"setVisible",
"(",
"show_status_bar",
")",
"if",
"show_status_bar",
":"... | Update status bar widgets settings | [
"Update",
"status",
"bar",
"widgets",
"settings"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2859-L2871 |
30,916 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.edit_preferences | 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)
... | python | 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",
")",
":",
"from",
"spyder",
".",
"preferences",
".",
"configdialog",
"import",
"ConfigDialog",
"dlg",
"=",
"ConfigDialog",
"(",
"self",
")",
"dlg",
".",
"size_change",
".",
"connect",
"(",
"self",
".",
"set_prefs_size",
... | Edit Spyder preferences | [
"Edit",
"Spyder",
"preferences"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2874-L2902 |
30,917 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.reset_spyder | 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... | python | 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",
")",
":",
"answer",
"=",
"QMessageBox",
".",
"warning",
"(",
"self",
",",
"_",
"(",
"\"Warning\"",
")",
",",
"_",
"(",
"\"Spyder will restart and reset to default settings: <br><br>\"",
"\"Do you want to continue?\"",
")",
",",
"Q... | Quit and reset Spyder and then Restart application. | [
"Quit",
"and",
"reset",
"Spyder",
"and",
"then",
"Restart",
"application",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2982-L2991 |
30,918 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.restart | 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_... | python | 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",
")",
":",
"# Get start path to use in restart script\r",
"spyder_start_directory",
"=",
"get_module_path",
"(",
"'spyder'",
")",
"restart_script",
"=",
"osp",
".",
"join",
"(",
"spyder_start_directory",
",",
... | Quit and Restart Spyder application.
If reset True it allows to reset spyder on restart. | [
"Quit",
"and",
"Restart",
"Spyder",
"application",
".",
"If",
"reset",
"True",
"it",
"allows",
"to",
"reset",
"spyder",
"on",
"restart",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2994-L3055 |
30,919 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.show_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() | python | 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",
")",
":",
"self",
".",
"maximize_dockwidget",
"(",
"restore",
"=",
"True",
")",
"frames",
"=",
"self",
".",
"tours_available",
"[",
"index",
"]",
"self",
".",
"tour",
".",
"set_tour",
"(",
"index",
",",
"f... | Show interactive tour. | [
"Show",
"interactive",
"tour",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3058-L3063 |
30,920 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.open_fileswitcher | 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:
... | python | 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",
")",
":",
"if",
"self",
".",
"fileswitcher",
"is",
"not",
"None",
"and",
"self",
".",
"fileswitcher",
".",
"is_visible",
":",
"self",
".",
"fileswitcher",
".",
"hide",
"(",
")",
"self"... | Open file list management dialog box. | [
"Open",
"file",
"list",
"management",
"dialog",
"box",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3066-L3079 |
30,921 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.add_to_fileswitcher | 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... | python | 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",
")",
":",
"if",
"self",
".",
"fileswitcher",
"is",
"None",
":",
"from",
"spyder",
".",
"widgets",
".",
"fileswitcher",
"import",
"FileSwitcher",
"self",
".",
... | Add a plugin to the File Switcher. | [
"Add",
"a",
"plugin",
"to",
"the",
"File",
"Switcher",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3085-L3094 |
30,922 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow._check_updates_ready | 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... | python | 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",
")",
":",
"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"... | Called by WorkerUpdates when ready | [
"Called",
"by",
"WorkerUpdates",
"when",
"ready"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3097-L3173 |
30,923 | spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.check_updates | 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)
... | python | 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",
")",
":",
"from",
"spyder",
".",
"workers",
".",
"updates",
"import",
"WorkerUpdates",
"# Disable check_updates_action while the thread is working\r",
"self",
".",
"check_updates_action",
".",
"setDisabl... | Check for spyder updates on github releases using a QThread. | [
"Check",
"for",
"spyder",
"updates",
"on",
"github",
"releases",
"using",
"a",
"QThread",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3176-L3194 |
30,924 | spyder-ide/spyder | spyder/config/user.py | DefaultsConfig._set | 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' % (... | python | 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",
")",
":",
"if",
"not",
"self",
".",
"has_section",
"(",
"section",
")",
":",
"self",
".",
"add_section",
"(",
"section",
")",
"if",
"not",
"is_text_string",
"(",
... | Private set method | [
"Private",
"set",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L79-L89 |
30,925 | spyder-ide/spyder | spyder/config/user.py | DefaultsConfig._save | 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... | python | 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",
")",
":",
"# 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... | Save config into the associated .ini file | [
"Save",
"config",
"into",
"the",
"associated",
".",
"ini",
"file"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L91-L120 |
30,926 | spyder-ide/spyder | spyder/config/user.py | DefaultsConfig.filename | 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)
... | python | 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",
")",
":",
"# 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... | Defines the name of the configuration file to use. | [
"Defines",
"the",
"name",
"of",
"the",
"configuration",
"file",
"to",
"use",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L122-L132 |
30,927 | spyder-ide/spyder | spyder/config/user.py | DefaultsConfig._filename_global | 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
... | python | 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",
")",
":",
"if",
"self",
".",
"subfolder",
"is",
"None",
":",
"config_file",
"=",
"osp",
".",
"join",
"(",
"get_home_dir",
"(",
")",
",",
"'.%s.ini'",
"%",
"self",
".",
"name",
")",
"return",
"config_file",
"else",
... | Create a .ini filename located in user home directory.
This .ini files stores the global spyder preferences. | [
"Create",
"a",
".",
"ini",
"filename",
"located",
"in",
"user",
"home",
"directory",
".",
"This",
".",
"ini",
"files",
"stores",
"the",
"global",
"spyder",
"preferences",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L141-L156 |
30,928 | spyder-ide/spyder | spyder/config/user.py | UserConfig.load_from_ini | 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, ... | python | 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",
")",
":",
"try",
":",
"if",
"PY2",
":",
"# Python 2\r",
"fname",
"=",
"self",
".",
"filename",
"(",
")",
"if",
"osp",
".",
"isfile",
"(",
"fname",
")",
":",
"try",
":",
"with",
"codecs",
".",
"open",
"(",
"fname... | Load config from the associated .ini file | [
"Load",
"config",
"from",
"the",
"associated",
".",
"ini",
"file"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L243-L261 |
30,929 | spyder-ide/spyder | spyder/config/user.py | UserConfig._load_old_defaults | 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,... | python | 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",
")",
":",
"old_defaults",
"=",
"cp",
".",
"ConfigParser",
"(",
")",
"if",
"check_version",
"(",
"old_version",
",",
"'3.0.0'",
",",
"'<='",
")",
":",
"path",
"=",
"get_module_source_path",
"(",
"'... | Read old defaults | [
"Read",
"old",
"defaults"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L263-L272 |
30,930 | spyder-ide/spyder | spyder/config/user.py | UserConfig._save_new_defaults | 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... | python | 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",
")",
":",
"new_defaults",
"=",
"DefaultsConfig",
"(",
"name",
"=",
"'defaults-'",
"+",
"new_version",
",",
"subfolder",
"=",
"subfolder",
")",
"if",
"not",
"osp",
... | Save new defaults | [
"Save",
"new",
"defaults"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L274-L280 |
30,931 | spyder-ide/spyder | spyder/config/user.py | UserConfig._update_defaults | 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 ]
... | python | 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",
")",
":",
"old_defaults",
"=",
"self",
".",
"_load_old_defaults",
"(",
"old_version",
")",
"for",
"section",
",",
"options",
"in",
"defaults",
":",
"fo... | Update defaults after a change in version | [
"Update",
"defaults",
"after",
"a",
"change",
"in",
"version"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L282-L294 |
30,932 | spyder-ide/spyder | spyder/config/user.py | UserConfig._remove_deprecated_options | 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... | python | 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",
")",
":",
"old_defaults",
"=",
"self",
".",
"_load_old_defaults",
"(",
"old_version",
")",
"for",
"section",
"in",
"old_defaults",
".",
"sections",
"(",
")",
":",
"for",
"option",
",",
"_",
... | Remove options which are present in the .ini file but not in defaults | [
"Remove",
"options",
"which",
"are",
"present",
"in",
"the",
".",
"ini",
"file",
"but",
"not",
"in",
"defaults"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L296-L309 |
30,933 | spyder-ide/spyder | spyder/config/user.py | UserConfig.set_as_defaults | 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... | python | 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",
")",
":",
"self",
".",
"defaults",
"=",
"[",
"]",
"for",
"section",
"in",
"self",
".",
"sections",
"(",
")",
":",
"secdict",
"=",
"{",
"}",
"for",
"option",
",",
"value",
"in",
"self",
".",
"items",
"(",
"sect... | Set defaults from the current config | [
"Set",
"defaults",
"from",
"the",
"current",
"config"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L317-L326 |
30,934 | spyder-ide/spyder | spyder/config/user.py | UserConfig.reset_to_defaults | 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 ]
... | python | 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",
")",
":",
"for",
"sec",
",",
"options",
"in",
"self",
".",
"defaults",
":",
"if",
"section",
"==",
"None",
"or",
"section",
... | Reset config to Default values | [
"Reset",
"config",
"to",
"Default",
"values"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L328-L338 |
30,935 | spyder-ide/spyder | spyder/config/user.py | UserConfig._check_section_option | 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... | python | 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",
")",
":",
"if",
"section",
"is",
"None",
":",
"section",
"=",
"self",
".",
"DEFAULT_SECTION_NAME",
"elif",
"not",
"is_text_string",
"(",
"section",
")",
":",
"raise",
"RuntimeError",
... | Private method to check section and option types | [
"Private",
"method",
"to",
"check",
"section",
"and",
"option",
"types"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L340-L350 |
30,936 | spyder-ide/spyder | spyder/utils/programs.py | get_temp_dir | 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('... | python | 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",
")",
":",
"to_join",
"=",
"[",
"tempfile",
".",
"gettempdir",
"(",
")",
"]",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"to_join",
".",
"append",
"(",
"'spyder'",
")",
"else",
":",
"username",
"=",
... | Return temporary Spyder directory, checking previously that it exists. | [
"Return",
"temporary",
"Spyder",
"directory",
"checking",
"previously",
"that",
"it",
"exists",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L34-L54 |
30,937 | spyder-ide/spyder | spyder/utils/programs.py | is_program_installed | 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 | python | 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",
")",
":",
"for",
"path",
"in",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
":",
"abspath",
"=",
"osp",
".",
"join",
"(",
"path",
",",
"basename",
")",
"if",... | Return program absolute path if installed in PATH.
Otherwise, return None | [
"Return",
"program",
"absolute",
"path",
"if",
"installed",
"in",
"PATH",
".",
"Otherwise",
"return",
"None"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L57-L66 |
30,938 | spyder-ide/spyder | spyder/utils/programs.py | alter_subprocess_kwargs_by_platform | 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.
... | python | 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",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'close_fds'",
",",
"os",
".",
"name",
"==",
"'posix'",
")",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"CONSOLE_CREATION_FLAGS",
"=",
"0",
... | 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... | [
"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... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L88-L107 |
30,939 | spyder-ide/spyder | spyder/utils/programs.py | start_file | 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
... | python | 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",
")",
":",
"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... | Generalized os.startfile for all platforms supported by Qt
This function is simply wrapping QDesktopServices.openUrl
Returns True if successfull, otherwise returns False. | [
"Generalized",
"os",
".",
"startfile",
"for",
"all",
"platforms",
"supported",
"by",
"Qt",
"This",
"function",
"is",
"simply",
"wrapping",
"QDesktopServices",
".",
"openUrl",
"Returns",
"True",
"if",
"successfull",
"otherwise",
"returns",
"False",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L183-L200 |
30,940 | spyder-ide/spyder | spyder/utils/programs.py | get_python_args | 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... | python | 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",
")",
":",
"p_args",
"=",
"[",
"]",
"if",
"python_args",
"is",
"not",
"None",
":",
"p_args",
"+=",
"python_args",
".",
"split",
"(",
")",
"if",
"... | Construct Python interpreter arguments | [
"Construct",
"Python",
"interpreter",
"arguments"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L251-L270 |
30,941 | spyder-ide/spyder | spyder/utils/programs.py | is_python_interpreter_valid_name | 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 | python | 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",
")",
":",
"pattern",
"=",
"r'.*python(\\d\\.?\\d*)?(w)?(.exe)?$'",
"if",
"re",
".",
"match",
"(",
"pattern",
",",
"filename",
",",
"flags",
"=",
"re",
".",
"I",
")",
"is",
"None",
":",
"return",
"Fals... | Check that the python interpreter file has a valid name. | [
"Check",
"that",
"the",
"python",
"interpreter",
"file",
"has",
"a",
"valid",
"name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L478-L484 |
30,942 | spyder-ide/spyder | spyder/utils/programs.py | is_python_interpreter | 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_... | python | 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",
")",
":",
"real_filename",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"filename",
")",
"# To follow symlink if existent\r",
"if",
"(",
"not",
"osp",
".",
"isfile",
"(",
"real_filename",
")",
"or",
"not",
"is_... | Evaluate wether a file is a python interpreter or not. | [
"Evaluate",
"wether",
"a",
"file",
"is",
"a",
"python",
"interpreter",
"or",
"not",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L486-L515 |
30,943 | spyder-ide/spyder | spyder/utils/programs.py | is_pythonw | 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 | python | 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",
")",
":",
"pattern",
"=",
"r'.*python(\\d\\.?\\d*)?w(.exe)?$'",
"if",
"re",
".",
"match",
"(",
"pattern",
",",
"filename",
",",
"flags",
"=",
"re",
".",
"I",
")",
"is",
"None",
":",
"return",
"False",
"else",
":",
"r... | Check that the python interpreter has 'pythonw'. | [
"Check",
"that",
"the",
"python",
"interpreter",
"has",
"pythonw",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L518-L524 |
30,944 | spyder-ide/spyder | spyder/utils/programs.py | check_python_help | 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)")
... | python | 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",
")",
":",
"try",
":",
"proc",
"=",
"run_program",
"(",
"filename",
",",
"[",
"\"-h\"",
"]",
")",
"output",
"=",
"to_text_string",
"(",
"proc",
".",
"communicate",
"(",
")",
"[",
"0",
"]",
")",
"valid",
"=",
... | Check that the python interpreter can execute help. | [
"Check",
"that",
"the",
"python",
"interpreter",
"can",
"execute",
"help",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L527-L539 |
30,945 | spyder-ide/spyder | spyder/plugins/editor/panels/debugger.py | DebuggerPanel._draw_breakpoint_icon | 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, ... | python | 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",
")",
":",
"rect",
"=",
"QRect",
"(",
"0",
",",
"top",
",",
"self",
".",
"sizeHint",
"(",
")",
".",
"width",
"(",
")",
",",
"self",
".",
"sizeHint",
"(",
")",... | 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) | [
"Draw",
"the",
"given",
"breakpoint",
"pixmap",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/debugger.py#L51-L66 |
30,946 | spyder-ide/spyder | spyder/utils/workers.py | sleeping_func | 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 | python | 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",
")",
":",
"import",
"time",
"time",
".",
"sleep",
"(",
"secs",
")",
"if",
"result_queue",
"is",
"not",
"None",
":",
"result_queue",
".",
"put",
"(",
"arg",
... | This methods illustrates how the workers can be used. | [
"This",
"methods",
"illustrates",
"how",
"the",
"workers",
"can",
"be",
"used",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L328-L335 |
30,947 | spyder-ide/spyder | spyder/utils/workers.py | PythonWorker._start | 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... | python | 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",
")",
":",
"error",
"=",
"None",
"output",
"=",
"None",
"try",
":",
"output",
"=",
"self",
".",
"func",
"(",
"*",
"self",
".",
"args",
",",
"*",
"*",
"self",
".",
"kwargs",
")",
"except",
"Exception",
"as",
"err",
":"... | Start process worker for given method args and kwargs. | [
"Start",
"process",
"worker",
"for",
"given",
"method",
"args",
"and",
"kwargs",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L69-L81 |
30,948 | spyder-ide/spyder | spyder/utils/workers.py | ProcessWorker._set_environment | 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) | python | 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",
")",
":",
"if",
"environ",
":",
"q_environ",
"=",
"self",
".",
"_process",
".",
"processEnvironment",
"(",
")",
"for",
"k",
",",
"v",
"in",
"environ",
".",
"items",
"(",
")",
":",
"q_environ",
"."... | Set the environment on the QProcess. | [
"Set",
"the",
"environment",
"on",
"the",
"QProcess",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L131-L137 |
30,949 | spyder-ide/spyder | spyder/utils/workers.py | ProcessWorker._communicate | 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() | python | 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",
")",
":",
"if",
"(",
"not",
"self",
".",
"_communicate_first",
"and",
"self",
".",
"_process",
".",
"state",
"(",
")",
"==",
"QProcess",
".",
"NotRunning",
")",
":",
"self",
".",
"communicate",
"(",
")",
"elif",
"sel... | Callback for communicate. | [
"Callback",
"for",
"communicate",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L151-L157 |
30,950 | spyder-ide/spyder | spyder/utils/workers.py | ProcessWorker.terminate | def terminate(self):
"""Terminate running processes."""
if self._process.state() == QProcess.Running:
try:
self._process.terminate()
except Exception:
pass
self._fired = True | python | 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",
")",
":",
"if",
"self",
".",
"_process",
".",
"state",
"(",
")",
"==",
"QProcess",
".",
"Running",
":",
"try",
":",
"self",
".",
"_process",
".",
"terminate",
"(",
")",
"except",
"Exception",
":",
"pass",
"self",
".",... | Terminate running processes. | [
"Terminate",
"running",
"processes",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L203-L210 |
30,951 | spyder-ide/spyder | spyder/utils/workers.py | WorkerManager._clean_workers | def _clean_workers(self):
"""Delete periodically workers in workers bag."""
while self._bag_collector:
self._bag_collector.popleft()
self._timer_worker_delete.stop() | python | 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",
")",
":",
"while",
"self",
".",
"_bag_collector",
":",
"self",
".",
"_bag_collector",
".",
"popleft",
"(",
")",
"self",
".",
"_timer_worker_delete",
".",
"stop",
"(",
")"
] | Delete periodically workers in workers bag. | [
"Delete",
"periodically",
"workers",
"in",
"workers",
"bag",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L243-L247 |
30,952 | spyder-ide/spyder | spyder/utils/workers.py | WorkerManager._start | 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... | python | 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",
")",
":",
"if",
"worker",
":",
"self",
".",
"_queue_workers",
".",
"append",
"(",
"worker",
")",
"if",
"self",
".",
"_queue_workers",
"and",
"self",
".",
"_running_threads",
"<",
"self",
".",
"_... | Start threads and check for inactive workers. | [
"Start",
"threads",
"and",
"check",
"for",
"inactive",
"workers",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L249-L289 |
30,953 | spyder-ide/spyder | spyder/utils/workers.py | WorkerManager.create_python_worker | def create_python_worker(self, func, *args, **kwargs):
"""Create a new python worker instance."""
worker = PythonWorker(func, args, kwargs)
self._create_worker(worker)
return worker | python | def create_python_worker(self, func, *args, **kwargs):
"""Create a new python worker instance."""
worker = PythonWorker(func, args, kwargs)
self._create_worker(worker)
return worker | [
"def",
"create_python_worker",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"worker",
"=",
"PythonWorker",
"(",
"func",
",",
"args",
",",
"kwargs",
")",
"self",
".",
"_create_worker",
"(",
"worker",
")",
"return",
"wor... | Create a new python worker instance. | [
"Create",
"a",
"new",
"python",
"worker",
"instance",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L291-L295 |
30,954 | spyder-ide/spyder | spyder/utils/workers.py | WorkerManager.create_process_worker | def create_process_worker(self, cmd_list, environ=None):
"""Create a new process worker instance."""
worker = ProcessWorker(cmd_list, environ=environ)
self._create_worker(worker)
return worker | python | def create_process_worker(self, cmd_list, environ=None):
"""Create a new process worker instance."""
worker = ProcessWorker(cmd_list, environ=environ)
self._create_worker(worker)
return worker | [
"def",
"create_process_worker",
"(",
"self",
",",
"cmd_list",
",",
"environ",
"=",
"None",
")",
":",
"worker",
"=",
"ProcessWorker",
"(",
"cmd_list",
",",
"environ",
"=",
"environ",
")",
"self",
".",
"_create_worker",
"(",
"worker",
")",
"return",
"worker"
] | Create a new process worker instance. | [
"Create",
"a",
"new",
"process",
"worker",
"instance",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L297-L301 |
30,955 | spyder-ide/spyder | spyder/utils/workers.py | WorkerManager.terminate_all | def terminate_all(self):
"""Terminate all worker processes."""
for worker in self._workers:
worker.terminate()
# for thread in self._threads:
# try:
# thread.terminate()
# thread.wait()
# except Exception:
# pas... | python | def terminate_all(self):
"""Terminate all worker processes."""
for worker in self._workers:
worker.terminate()
# for thread in self._threads:
# try:
# thread.terminate()
# thread.wait()
# except Exception:
# pas... | [
"def",
"terminate_all",
"(",
"self",
")",
":",
"for",
"worker",
"in",
"self",
".",
"_workers",
":",
"worker",
".",
"terminate",
"(",
")",
"# for thread in self._threads:",
"# try:",
"# thread.terminate()",
"# thread.wait()",
"# except Exception:",
... | Terminate all worker processes. | [
"Terminate",
"all",
"worker",
"processes",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L303-L314 |
30,956 | spyder-ide/spyder | spyder/utils/workers.py | WorkerManager._create_worker | def _create_worker(self, worker):
"""Common worker setup."""
worker.sig_started.connect(self._start)
self._workers.append(worker) | python | def _create_worker(self, worker):
"""Common worker setup."""
worker.sig_started.connect(self._start)
self._workers.append(worker) | [
"def",
"_create_worker",
"(",
"self",
",",
"worker",
")",
":",
"worker",
".",
"sig_started",
".",
"connect",
"(",
"self",
".",
"_start",
")",
"self",
".",
"_workers",
".",
"append",
"(",
"worker",
")"
] | Common worker setup. | [
"Common",
"worker",
"setup",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L316-L319 |
30,957 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | gather_file_data | def gather_file_data(name):
"""
Gather data about a given file.
Returns a dict with fields name, mtime and size, containing the relevant
data for the fiel.
"""
res = {'name': name}
try:
res['mtime'] = osp.getmtime(name)
res['size'] = osp.getsize(name)
except OSError:
... | python | def gather_file_data(name):
"""
Gather data about a given file.
Returns a dict with fields name, mtime and size, containing the relevant
data for the fiel.
"""
res = {'name': name}
try:
res['mtime'] = osp.getmtime(name)
res['size'] = osp.getsize(name)
except OSError:
... | [
"def",
"gather_file_data",
"(",
"name",
")",
":",
"res",
"=",
"{",
"'name'",
":",
"name",
"}",
"try",
":",
"res",
"[",
"'mtime'",
"]",
"=",
"osp",
".",
"getmtime",
"(",
"name",
")",
"res",
"[",
"'size'",
"]",
"=",
"osp",
".",
"getsize",
"(",
"nam... | Gather data about a given file.
Returns a dict with fields name, mtime and size, containing the relevant
data for the fiel. | [
"Gather",
"data",
"about",
"a",
"given",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L26-L39 |
30,958 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | file_data_to_str | def file_data_to_str(data):
"""
Convert file data to a string for display.
This function takes the file data produced by gather_file_data().
"""
if not data:
return _('<i>File name not recorded</i>')
res = data['name']
try:
mtime_as_str = time.strftime('%Y-%m-%d %H:%M:%S',
... | python | def file_data_to_str(data):
"""
Convert file data to a string for display.
This function takes the file data produced by gather_file_data().
"""
if not data:
return _('<i>File name not recorded</i>')
res = data['name']
try:
mtime_as_str = time.strftime('%Y-%m-%d %H:%M:%S',
... | [
"def",
"file_data_to_str",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"_",
"(",
"'<i>File name not recorded</i>'",
")",
"res",
"=",
"data",
"[",
"'name'",
"]",
"try",
":",
"mtime_as_str",
"=",
"time",
".",
"strftime",
"(",
"'%Y-%m-%d %H:%M:%S... | Convert file data to a string for display.
This function takes the file data produced by gather_file_data(). | [
"Convert",
"file",
"data",
"to",
"a",
"string",
"for",
"display",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L42-L59 |
30,959 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | make_temporary_files | def make_temporary_files(tempdir):
"""
Make temporary files to simulate a recovery use case.
Create a directory under tempdir containing some original files and another
directory with autosave files. Return a tuple with the name of the
directory with the original files, the name of the directory wi... | python | def make_temporary_files(tempdir):
"""
Make temporary files to simulate a recovery use case.
Create a directory under tempdir containing some original files and another
directory with autosave files. Return a tuple with the name of the
directory with the original files, the name of the directory wi... | [
"def",
"make_temporary_files",
"(",
"tempdir",
")",
":",
"orig_dir",
"=",
"osp",
".",
"join",
"(",
"tempdir",
",",
"'orig'",
")",
"os",
".",
"mkdir",
"(",
"orig_dir",
")",
"autosave_dir",
"=",
"osp",
".",
"join",
"(",
"tempdir",
",",
"'autosave'",
")",
... | Make temporary files to simulate a recovery use case.
Create a directory under tempdir containing some original files and another
directory with autosave files. Return a tuple with the name of the
directory with the original files, the name of the directory with the
autosave files, and the autosave map... | [
"Make",
"temporary",
"files",
"to",
"simulate",
"a",
"recovery",
"use",
"case",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L278-L321 |
30,960 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | RecoveryDialog.gather_data | def gather_data(self):
"""
Gather data about files which may be recovered.
The data is stored in self.data as a list of tuples with the data
pertaining to the original file and the autosave file. Each element of
the tuple is a dict as returned by gather_file_data().
"""
... | python | def gather_data(self):
"""
Gather data about files which may be recovered.
The data is stored in self.data as a list of tuples with the data
pertaining to the original file and the autosave file. Each element of
the tuple is a dict as returned by gather_file_data().
"""
... | [
"def",
"gather_data",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"[",
"]",
"try",
":",
"FileNotFoundError",
"except",
"NameError",
":",
"# Python 2",
"FileNotFoundError",
"=",
"OSError",
"# In Python 3, easier to use os.scandir()",
"try",
":",
"for",
"name",... | Gather data about files which may be recovered.
The data is stored in self.data as a list of tuples with the data
pertaining to the original file and the autosave file. Each element of
the tuple is a dict as returned by gather_file_data(). | [
"Gather",
"data",
"about",
"files",
"which",
"may",
"be",
"recovered",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L93-L123 |
30,961 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | RecoveryDialog.add_label | def add_label(self):
"""Add label with explanation at top of dialog window."""
txt = _('Autosave files found. What would you like to do?\n\n'
'This dialog will be shown again on next startup if any '
'autosave files are not restored, moved or deleted.')
label = QL... | python | def add_label(self):
"""Add label with explanation at top of dialog window."""
txt = _('Autosave files found. What would you like to do?\n\n'
'This dialog will be shown again on next startup if any '
'autosave files are not restored, moved or deleted.')
label = QL... | [
"def",
"add_label",
"(",
"self",
")",
":",
"txt",
"=",
"_",
"(",
"'Autosave files found. What would you like to do?\\n\\n'",
"'This dialog will be shown again on next startup if any '",
"'autosave files are not restored, moved or deleted.'",
")",
"label",
"=",
"QLabel",
"(",
"txt... | Add label with explanation at top of dialog window. | [
"Add",
"label",
"with",
"explanation",
"at",
"top",
"of",
"dialog",
"window",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L125-L132 |
30,962 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | RecoveryDialog.add_label_to_table | def add_label_to_table(self, row, col, txt):
"""Add a label to specified cell in table."""
label = QLabel(txt)
label.setMargin(5)
label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.table.setCellWidget(row, col, label) | python | def add_label_to_table(self, row, col, txt):
"""Add a label to specified cell in table."""
label = QLabel(txt)
label.setMargin(5)
label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.table.setCellWidget(row, col, label) | [
"def",
"add_label_to_table",
"(",
"self",
",",
"row",
",",
"col",
",",
"txt",
")",
":",
"label",
"=",
"QLabel",
"(",
"txt",
")",
"label",
".",
"setMargin",
"(",
"5",
")",
"label",
".",
"setAlignment",
"(",
"Qt",
".",
"AlignLeft",
"|",
"Qt",
".",
"A... | Add a label to specified cell in table. | [
"Add",
"a",
"label",
"to",
"specified",
"cell",
"in",
"table",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L134-L139 |
30,963 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | RecoveryDialog.add_table | def add_table(self):
"""Add table with info about files to be recovered."""
table = QTableWidget(len(self.data), 3, self)
self.table = table
labels = [_('Original file'), _('Autosave file'), _('Actions')]
table.setHorizontalHeaderLabels(labels)
table.verticalHeader().hid... | python | def add_table(self):
"""Add table with info about files to be recovered."""
table = QTableWidget(len(self.data), 3, self)
self.table = table
labels = [_('Original file'), _('Autosave file'), _('Actions')]
table.setHorizontalHeaderLabels(labels)
table.verticalHeader().hid... | [
"def",
"add_table",
"(",
"self",
")",
":",
"table",
"=",
"QTableWidget",
"(",
"len",
"(",
"self",
".",
"data",
")",
",",
"3",
",",
"self",
")",
"self",
".",
"table",
"=",
"table",
"labels",
"=",
"[",
"_",
"(",
"'Original file'",
")",
",",
"_",
"(... | Add table with info about files to be recovered. | [
"Add",
"table",
"with",
"info",
"about",
"files",
"to",
"be",
"recovered",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L141-L201 |
30,964 | spyder-ide/spyder | spyder/plugins/editor/widgets/recover.py | RecoveryDialog.add_cancel_button | def add_cancel_button(self):
"""Add a cancel button at the bottom of the dialog window."""
button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self)
button_box.rejected.connect(self.reject)
self.layout.addWidget(button_box) | python | def add_cancel_button(self):
"""Add a cancel button at the bottom of the dialog window."""
button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self)
button_box.rejected.connect(self.reject)
self.layout.addWidget(button_box) | [
"def",
"add_cancel_button",
"(",
"self",
")",
":",
"button_box",
"=",
"QDialogButtonBox",
"(",
"QDialogButtonBox",
".",
"Cancel",
",",
"self",
")",
"button_box",
".",
"rejected",
".",
"connect",
"(",
"self",
".",
"reject",
")",
"self",
".",
"layout",
".",
... | Add a cancel button at the bottom of the dialog window. | [
"Add",
"a",
"cancel",
"button",
"at",
"the",
"bottom",
"of",
"the",
"dialog",
"window",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L203-L207 |
30,965 | spyder-ide/spyder | spyder/plugins/workingdirectory/plugin.py | WorkingDirectory.parent_directory | def parent_directory(self):
"""Change working directory to parent directory"""
self.chdir(os.path.join(getcwd_or_home(), os.path.pardir)) | python | def parent_directory(self):
"""Change working directory to parent directory"""
self.chdir(os.path.join(getcwd_or_home(), os.path.pardir)) | [
"def",
"parent_directory",
"(",
"self",
")",
":",
"self",
".",
"chdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"getcwd_or_home",
"(",
")",
",",
"os",
".",
"path",
".",
"pardir",
")",
")"
] | Change working directory to parent directory | [
"Change",
"working",
"directory",
"to",
"parent",
"directory"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L203-L205 |
30,966 | spyder-ide/spyder | spyder/plugins/editor/utils/debugger.py | DebuggerManager.breakpoints_changed | def breakpoints_changed(self):
"""Breakpoint list has changed"""
breakpoints = self.get_breakpoints()
if self.breakpoints != breakpoints:
self.breakpoints = breakpoints
self.save_breakpoints() | python | def breakpoints_changed(self):
"""Breakpoint list has changed"""
breakpoints = self.get_breakpoints()
if self.breakpoints != breakpoints:
self.breakpoints = breakpoints
self.save_breakpoints() | [
"def",
"breakpoints_changed",
"(",
"self",
")",
":",
"breakpoints",
"=",
"self",
".",
"get_breakpoints",
"(",
")",
"if",
"self",
".",
"breakpoints",
"!=",
"breakpoints",
":",
"self",
".",
"breakpoints",
"=",
"breakpoints",
"self",
".",
"save_breakpoints",
"(",... | Breakpoint list has changed | [
"Breakpoint",
"list",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L150-L155 |
30,967 | spyder-ide/spyder | spyder/plugins/editor/extensions/closequotes.py | unmatched_quotes_in_line | def unmatched_quotes_in_line(text):
"""Return whether a string has open quotes.
This simply counts whether the number of quote characters of either
type in the string is odd.
Take from the IPython project (in IPython/core/completer.py in v0.13)
Spyder team: Add some changes to deal with escaped qu... | python | def unmatched_quotes_in_line(text):
"""Return whether a string has open quotes.
This simply counts whether the number of quote characters of either
type in the string is odd.
Take from the IPython project (in IPython/core/completer.py in v0.13)
Spyder team: Add some changes to deal with escaped qu... | [
"def",
"unmatched_quotes_in_line",
"(",
"text",
")",
":",
"# We check \" first, then ', so complex cases with nested quotes will",
"# get the \" to take precedence.",
"text",
"=",
"text",
".",
"replace",
"(",
"\"\\\\'\"",
",",
"\"\"",
")",
"text",
"=",
"text",
".",
"repla... | Return whether a string has open quotes.
This simply counts whether the number of quote characters of either
type in the string is odd.
Take from the IPython project (in IPython/core/completer.py in v0.13)
Spyder team: Add some changes to deal with escaped quotes
- Copyright (C) 2008-2011 IPython... | [
"Return",
"whether",
"a",
"string",
"has",
"open",
"quotes",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L14-L38 |
30,968 | spyder-ide/spyder | spyder/plugins/editor/extensions/closequotes.py | CloseQuotesExtension._autoinsert_quotes | def _autoinsert_quotes(self, key):
"""Control how to automatically insert quotes in various situations."""
char = {Qt.Key_QuoteDbl: '"', Qt.Key_Apostrophe: '\''}[key]
line_text = self.editor.get_text('sol', 'eol')
line_to_cursor = self.editor.get_text('sol', 'cursor')
cursor = s... | python | def _autoinsert_quotes(self, key):
"""Control how to automatically insert quotes in various situations."""
char = {Qt.Key_QuoteDbl: '"', Qt.Key_Apostrophe: '\''}[key]
line_text = self.editor.get_text('sol', 'eol')
line_to_cursor = self.editor.get_text('sol', 'cursor')
cursor = s... | [
"def",
"_autoinsert_quotes",
"(",
"self",
",",
"key",
")",
":",
"char",
"=",
"{",
"Qt",
".",
"Key_QuoteDbl",
":",
"'\"'",
",",
"Qt",
".",
"Key_Apostrophe",
":",
"'\\''",
"}",
"[",
"key",
"]",
"line_text",
"=",
"self",
".",
"editor",
".",
"get_text",
... | Control how to automatically insert quotes in various situations. | [
"Control",
"how",
"to",
"automatically",
"insert",
"quotes",
"in",
"various",
"situations",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L61-L113 |
30,969 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | populate | def populate(combobox, data):
"""
Populate the given ``combobox`` with the class or function names.
Parameters
----------
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
data : list of :class:`FoldScopeHelper`
The data to populate with. There should be one l... | python | def populate(combobox, data):
"""
Populate the given ``combobox`` with the class or function names.
Parameters
----------
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
data : list of :class:`FoldScopeHelper`
The data to populate with. There should be one l... | [
"def",
"populate",
"(",
"combobox",
",",
"data",
")",
":",
"combobox",
".",
"clear",
"(",
")",
"combobox",
".",
"addItem",
"(",
"\"<None>\"",
",",
"0",
")",
"# First create a list of fully-qualified names.",
"cb_data",
"=",
"[",
"]",
"for",
"item",
"in",
"da... | Populate the given ``combobox`` with the class or function names.
Parameters
----------
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
data : list of :class:`FoldScopeHelper`
The data to populate with. There should be one list element per
class or function ... | [
"Populate",
"the",
"given",
"combobox",
"with",
"the",
"class",
"or",
"function",
"names",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L32-L77 |
30,970 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | _adjust_parent_stack | def _adjust_parent_stack(fsh, prev, parents):
"""
Adjust the parent stack in-place as the trigger level changes.
Parameters
----------
fsh : :class:`FoldScopeHelper`
The :class:`FoldScopeHelper` object to act on.
prev : :class:`FoldScopeHelper`
The previous :class:`FoldScopeHelp... | python | def _adjust_parent_stack(fsh, prev, parents):
"""
Adjust the parent stack in-place as the trigger level changes.
Parameters
----------
fsh : :class:`FoldScopeHelper`
The :class:`FoldScopeHelper` object to act on.
prev : :class:`FoldScopeHelper`
The previous :class:`FoldScopeHelp... | [
"def",
"_adjust_parent_stack",
"(",
"fsh",
",",
"prev",
",",
"parents",
")",
":",
"if",
"prev",
"is",
"None",
":",
"return",
"if",
"fsh",
".",
"fold_scope",
".",
"trigger_level",
"<",
"prev",
".",
"fold_scope",
".",
"trigger_level",
":",
"diff",
"=",
"pr... | Adjust the parent stack in-place as the trigger level changes.
Parameters
----------
fsh : :class:`FoldScopeHelper`
The :class:`FoldScopeHelper` object to act on.
prev : :class:`FoldScopeHelper`
The previous :class:`FoldScopeHelper` object.
parents : list of :class:`FoldScopeHelper`... | [
"Adjust",
"the",
"parent",
"stack",
"in",
"-",
"place",
"as",
"the",
"trigger",
"level",
"changes",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L123-L149 |
30,971 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | _split_classes_and_methods | def _split_classes_and_methods(folds):
"""
Split out classes and methods into two separate lists.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
The result of :func:`_get_fold_levels`.
Returns
-------
classes, functions: list of :class:`FoldScopeHelper`
... | python | def _split_classes_and_methods(folds):
"""
Split out classes and methods into two separate lists.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
The result of :func:`_get_fold_levels`.
Returns
-------
classes, functions: list of :class:`FoldScopeHelper`
... | [
"def",
"_split_classes_and_methods",
"(",
"folds",
")",
":",
"classes",
"=",
"[",
"]",
"functions",
"=",
"[",
"]",
"for",
"fold",
"in",
"folds",
":",
"if",
"fold",
".",
"def_type",
"==",
"OED",
".",
"FUNCTION_TOKEN",
":",
"functions",
".",
"append",
"(",... | Split out classes and methods into two separate lists.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
The result of :func:`_get_fold_levels`.
Returns
-------
classes, functions: list of :class:`FoldScopeHelper`
Two separate lists of :class:`FoldScopeHelper` obje... | [
"Split",
"out",
"classes",
"and",
"methods",
"into",
"two",
"separate",
"lists",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L152-L176 |
30,972 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | _get_parents | def _get_parents(folds, linenum):
"""
Get the parents at a given linenum.
If parents is empty, then the linenum belongs to the module.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
linenum : int
The line number to get parents for. Typically this would be the
... | python | def _get_parents(folds, linenum):
"""
Get the parents at a given linenum.
If parents is empty, then the linenum belongs to the module.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
linenum : int
The line number to get parents for. Typically this would be the
... | [
"def",
"_get_parents",
"(",
"folds",
",",
"linenum",
")",
":",
"# Note: this might be able to be sped up by finding some kind of",
"# abort-early condition.",
"parents",
"=",
"[",
"]",
"for",
"fold",
"in",
"folds",
":",
"start",
",",
"end",
"=",
"fold",
".",
"range"... | Get the parents at a given linenum.
If parents is empty, then the linenum belongs to the module.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
linenum : int
The line number to get parents for. Typically this would be the
cursor position.
Returns
-------
... | [
"Get",
"the",
"parents",
"at",
"a",
"given",
"linenum",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L179-L210 |
30,973 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | update_selected_cb | def update_selected_cb(parents, combobox):
"""
Update the combobox with the selected item based on the parents.
Parameters
----------
parents : list of :class:`FoldScopeHelper`
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
Returns
-------
None
"""... | python | def update_selected_cb(parents, combobox):
"""
Update the combobox with the selected item based on the parents.
Parameters
----------
parents : list of :class:`FoldScopeHelper`
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
Returns
-------
None
"""... | [
"def",
"update_selected_cb",
"(",
"parents",
",",
"combobox",
")",
":",
"if",
"parents",
"is",
"not",
"None",
"and",
"len",
"(",
"parents",
")",
"==",
"0",
":",
"combobox",
".",
"setCurrentIndex",
"(",
"0",
")",
"else",
":",
"item",
"=",
"parents",
"["... | Update the combobox with the selected item based on the parents.
Parameters
----------
parents : list of :class:`FoldScopeHelper`
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
Returns
-------
None | [
"Update",
"the",
"combobox",
"with",
"the",
"selected",
"item",
"based",
"on",
"the",
"parents",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L213-L234 |
30,974 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | ClassFunctionDropdown._update_data | def _update_data(self):
"""Update the internal data values."""
_old = self.folds
self.folds = _get_fold_levels(self.editor)
# only update our dropdown lists if the folds have changed.
if self.folds != _old:
self.classes, self.funcs = _split_classes_and_methods(self.f... | python | def _update_data(self):
"""Update the internal data values."""
_old = self.folds
self.folds = _get_fold_levels(self.editor)
# only update our dropdown lists if the folds have changed.
if self.folds != _old:
self.classes, self.funcs = _split_classes_and_methods(self.f... | [
"def",
"_update_data",
"(",
"self",
")",
":",
"_old",
"=",
"self",
".",
"folds",
"self",
".",
"folds",
"=",
"_get_fold_levels",
"(",
"self",
".",
"editor",
")",
"# only update our dropdown lists if the folds have changed.",
"if",
"self",
".",
"folds",
"!=",
"_ol... | Update the internal data values. | [
"Update",
"the",
"internal",
"data",
"values",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L378-L386 |
30,975 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | ClassFunctionDropdown.combobox_activated | def combobox_activated(self):
"""Move the cursor to the selected definition."""
sender = self.sender()
data = sender.itemData(sender.currentIndex())
if isinstance(data, FoldScopeHelper):
self.editor.go_to_line(data.line + 1) | python | def combobox_activated(self):
"""Move the cursor to the selected definition."""
sender = self.sender()
data = sender.itemData(sender.currentIndex())
if isinstance(data, FoldScopeHelper):
self.editor.go_to_line(data.line + 1) | [
"def",
"combobox_activated",
"(",
"self",
")",
":",
"sender",
"=",
"self",
".",
"sender",
"(",
")",
"data",
"=",
"sender",
".",
"itemData",
"(",
"sender",
".",
"currentIndex",
"(",
")",
")",
"if",
"isinstance",
"(",
"data",
",",
"FoldScopeHelper",
")",
... | Move the cursor to the selected definition. | [
"Move",
"the",
"cursor",
"to",
"the",
"selected",
"definition",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L395-L401 |
30,976 | spyder-ide/spyder | spyder/plugins/editor/panels/classfunctiondropdown.py | ClassFunctionDropdown.update_selected | def update_selected(self, linenum):
"""Updates the dropdowns to reflect the current class and function."""
self.parents = _get_parents(self.funcs, linenum)
update_selected_cb(self.parents, self.method_cb)
self.parents = _get_parents(self.classes, linenum)
update_selected_cb(self... | python | def update_selected(self, linenum):
"""Updates the dropdowns to reflect the current class and function."""
self.parents = _get_parents(self.funcs, linenum)
update_selected_cb(self.parents, self.method_cb)
self.parents = _get_parents(self.classes, linenum)
update_selected_cb(self... | [
"def",
"update_selected",
"(",
"self",
",",
"linenum",
")",
":",
"self",
".",
"parents",
"=",
"_get_parents",
"(",
"self",
".",
"funcs",
",",
"linenum",
")",
"update_selected_cb",
"(",
"self",
".",
"parents",
",",
"self",
".",
"method_cb",
")",
"self",
"... | Updates the dropdowns to reflect the current class and function. | [
"Updates",
"the",
"dropdowns",
"to",
"reflect",
"the",
"current",
"class",
"and",
"function",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L403-L409 |
30,977 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.highlight_current_cell | def highlight_current_cell(self):
"""Highlight current cell"""
if self.cell_separators is None or \
not self.highlight_current_cell_enabled:
return
cursor, whole_file_selected, whole_screen_selected =\
self.select_current_cell_in_visible_portion()
... | python | def highlight_current_cell(self):
"""Highlight current cell"""
if self.cell_separators is None or \
not self.highlight_current_cell_enabled:
return
cursor, whole_file_selected, whole_screen_selected =\
self.select_current_cell_in_visible_portion()
... | [
"def",
"highlight_current_cell",
"(",
"self",
")",
":",
"if",
"self",
".",
"cell_separators",
"is",
"None",
"or",
"not",
"self",
".",
"highlight_current_cell_enabled",
":",
"return",
"cursor",
",",
"whole_file_selected",
",",
"whole_screen_selected",
"=",
"self",
... | Highlight current cell | [
"Highlight",
"current",
"cell"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L433-L455 |
30,978 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.select_current_cell | def select_current_cell(self):
"""Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.StartOfBlock)
... | python | def select_current_cell(self):
"""Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.StartOfBlock)
... | [
"def",
"select_current_cell",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"StartOfBlock",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"# M... | Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected | [
"Select",
"cell",
"under",
"cursor",
"cell",
"=",
"group",
"of",
"lines",
"separated",
"by",
"CELL_SEPARATORS",
"returns",
"the",
"textCursor",
"and",
"a",
"boolean",
"indicating",
"if",
"the",
"entire",
"file",
"is",
"selected"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L700-L743 |
30,979 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.select_current_cell_in_visible_portion | def select_current_cell_in_visible_portion(self):
"""Select cell under cursor in the visible portion of the file
cell = group of lines separated by CELL_SEPARATORS
returns
-the textCursor
-a boolean indicating if the entire file is selected
-a boolean indicating ... | python | def select_current_cell_in_visible_portion(self):
"""Select cell under cursor in the visible portion of the file
cell = group of lines separated by CELL_SEPARATORS
returns
-the textCursor
-a boolean indicating if the entire file is selected
-a boolean indicating ... | [
"def",
"select_current_cell_in_visible_portion",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"StartOfBlock",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
... | Select cell under cursor in the visible portion of the file
cell = group of lines separated by CELL_SEPARATORS
returns
-the textCursor
-a boolean indicating if the entire file is selected
-a boolean indicating if the entire visible portion of the file is selected | [
"Select",
"cell",
"under",
"cursor",
"in",
"the",
"visible",
"portion",
"of",
"the",
"file",
"cell",
"=",
"group",
"of",
"lines",
"separated",
"by",
"CELL_SEPARATORS",
"returns",
"-",
"the",
"textCursor",
"-",
"a",
"boolean",
"indicating",
"if",
"the",
"enti... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L745-L806 |
30,980 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.go_to_next_cell | def go_to_next_cell(self):
"""Go to the next cell of lines"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.NextBlock)
cur_pos = prev_pos = cursor.position()
while not self.is_cell_separator(cursor):
# Moving to the next code cell
curso... | python | def go_to_next_cell(self):
"""Go to the next cell of lines"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.NextBlock)
cur_pos = prev_pos = cursor.position()
while not self.is_cell_separator(cursor):
# Moving to the next code cell
curso... | [
"def",
"go_to_next_cell",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"NextBlock",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"while",
... | Go to the next cell of lines | [
"Go",
"to",
"the",
"next",
"cell",
"of",
"lines"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L808-L820 |
30,981 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.go_to_previous_cell | def go_to_previous_cell(self):
"""Go to the previous cell of lines"""
cursor = self.textCursor()
cur_pos = prev_pos = cursor.position()
if self.is_cell_separator(cursor):
# Move to the previous cell
cursor.movePosition(QTextCursor.PreviousBlock)
... | python | def go_to_previous_cell(self):
"""Go to the previous cell of lines"""
cursor = self.textCursor()
cur_pos = prev_pos = cursor.position()
if self.is_cell_separator(cursor):
# Move to the previous cell
cursor.movePosition(QTextCursor.PreviousBlock)
... | [
"def",
"go_to_previous_cell",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"if",
"self",
".",
"is_cell_separator",
"(",
"cursor",
")",
":",
"# Move to the p... | Go to the previous cell of lines | [
"Go",
"to",
"the",
"previous",
"cell",
"of",
"lines"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L822-L840 |
30,982 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.__restore_selection | def __restore_selection(self, start_pos, end_pos):
"""Restore cursor selection from position bounds"""
cursor = self.textCursor()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
self.setTextCursor(cursor) | python | def __restore_selection(self, start_pos, end_pos):
"""Restore cursor selection from position bounds"""
cursor = self.textCursor()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
self.setTextCursor(cursor) | [
"def",
"__restore_selection",
"(",
"self",
",",
"start_pos",
",",
"end_pos",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"setPosition",
"(",
"start_pos",
")",
"cursor",
".",
"setPosition",
"(",
"end_pos",
",",
"QTextCursor",
... | Restore cursor selection from position bounds | [
"Restore",
"cursor",
"selection",
"from",
"position",
"bounds"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L851-L856 |
30,983 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.__duplicate_line_or_selection | def __duplicate_line_or_selection(self, after_current_line=True):
"""Duplicate current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
if to_text_string(cursor.selectedText()):
cursor.setPo... | python | def __duplicate_line_or_selection(self, after_current_line=True):
"""Duplicate current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
if to_text_string(cursor.selectedText()):
cursor.setPo... | [
"def",
"__duplicate_line_or_selection",
"(",
"self",
",",
"after_current_line",
"=",
"True",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"beginEditBlock",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"self",
".",
"__save_selecti... | Duplicate current line or selected text | [
"Duplicate",
"current",
"line",
"or",
"selected",
"text"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L858-L896 |
30,984 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.__move_line_or_selection | def __move_line_or_selection(self, after_current_line=True):
"""Move current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
last_line = False
# ------ Select text
# Get selection ... | python | def __move_line_or_selection(self, after_current_line=True):
"""Move current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
last_line = False
# ------ Select text
# Get selection ... | [
"def",
"__move_line_or_selection",
"(",
"self",
",",
"after_current_line",
"=",
"True",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"beginEditBlock",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"self",
".",
"__save_selection",
... | Move current line or selected text | [
"Move",
"current",
"line",
"or",
"selected",
"text"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L912-L989 |
30,985 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.go_to_new_line | def go_to_new_line(self):
"""Go to the end of the current line and create a new line"""
self.stdkey_end(False, False)
self.insert_text(self.get_line_separator()) | python | def go_to_new_line(self):
"""Go to the end of the current line and create a new line"""
self.stdkey_end(False, False)
self.insert_text(self.get_line_separator()) | [
"def",
"go_to_new_line",
"(",
"self",
")",
":",
"self",
".",
"stdkey_end",
"(",
"False",
",",
"False",
")",
"self",
".",
"insert_text",
"(",
"self",
".",
"get_line_separator",
"(",
")",
")"
] | Go to the end of the current line and create a new line | [
"Go",
"to",
"the",
"end",
"of",
"the",
"current",
"line",
"and",
"create",
"a",
"new",
"line"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L999-L1002 |
30,986 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.extend_selection_to_complete_lines | def extend_selection_to_complete_lines(self):
"""Extend current selection to complete lines"""
cursor = self.textCursor()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
... | python | def extend_selection_to_complete_lines(self):
"""Extend current selection to complete lines"""
cursor = self.textCursor()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
... | [
"def",
"extend_selection_to_complete_lines",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"cursor",
".",
"selectionStart",
"(",
")",
",",
"cursor",
".",
"selectionEnd",
"(",
")",
"cursor",
".",
... | Extend current selection to complete lines | [
"Extend",
"current",
"selection",
"to",
"complete",
"lines"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1004-L1015 |
30,987 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.delete_line | def delete_line(self):
"""Delete current line"""
cursor = self.textCursor()
if self.has_selected_text():
self.extend_selection_to_complete_lines()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
... | python | def delete_line(self):
"""Delete current line"""
cursor = self.textCursor()
if self.has_selected_text():
self.extend_selection_to_complete_lines()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
... | [
"def",
"delete_line",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"if",
"self",
".",
"has_selected_text",
"(",
")",
":",
"self",
".",
"extend_selection_to_complete_lines",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"cursor",
... | Delete current line | [
"Delete",
"current",
"line"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1017-L1036 |
30,988 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.truncate_selection | def truncate_selection(self, position_from):
"""Unselect read-only parts in shell, like prompt"""
position_from = self.get_position(position_from)
cursor = self.textCursor()
start, end = cursor.selectionStart(), cursor.selectionEnd()
if start < end:
start = max(... | python | def truncate_selection(self, position_from):
"""Unselect read-only parts in shell, like prompt"""
position_from = self.get_position(position_from)
cursor = self.textCursor()
start, end = cursor.selectionStart(), cursor.selectionEnd()
if start < end:
start = max(... | [
"def",
"truncate_selection",
"(",
"self",
",",
"position_from",
")",
":",
"position_from",
"=",
"self",
".",
"get_position",
"(",
"position_from",
")",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"start",
",",
"end",
"=",
"cursor",
".",
"selectionSta... | Unselect read-only parts in shell, like prompt | [
"Unselect",
"read",
"-",
"only",
"parts",
"in",
"shell",
"like",
"prompt"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1044-L1053 |
30,989 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.restrict_cursor_position | def restrict_cursor_position(self, position_from, position_to):
"""In shell, avoid editing text except between prompt and EOF"""
position_from = self.get_position(position_from)
position_to = self.get_position(position_to)
cursor = self.textCursor()
cursor_position = cursor.... | python | def restrict_cursor_position(self, position_from, position_to):
"""In shell, avoid editing text except between prompt and EOF"""
position_from = self.get_position(position_from)
position_to = self.get_position(position_to)
cursor = self.textCursor()
cursor_position = cursor.... | [
"def",
"restrict_cursor_position",
"(",
"self",
",",
"position_from",
",",
"position_to",
")",
":",
"position_from",
"=",
"self",
".",
"get_position",
"(",
"position_from",
")",
"position_to",
"=",
"self",
".",
"get_position",
"(",
"position_to",
")",
"cursor",
... | In shell, avoid editing text except between prompt and EOF | [
"In",
"shell",
"avoid",
"editing",
"text",
"except",
"between",
"prompt",
"and",
"EOF"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1055-L1062 |
30,990 | spyder-ide/spyder | spyder/plugins/editor/widgets/base.py | TextEditBaseWidget.hide_tooltip_if_necessary | def hide_tooltip_if_necessary(self, key):
"""Hide calltip when necessary"""
try:
calltip_char = self.get_character(self.calltip_position)
before = self.is_cursor_before(self.calltip_position,
char_offset=1)
other = key ... | python | def hide_tooltip_if_necessary(self, key):
"""Hide calltip when necessary"""
try:
calltip_char = self.get_character(self.calltip_position)
before = self.is_cursor_before(self.calltip_position,
char_offset=1)
other = key ... | [
"def",
"hide_tooltip_if_necessary",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"calltip_char",
"=",
"self",
".",
"get_character",
"(",
"self",
".",
"calltip_position",
")",
"before",
"=",
"self",
".",
"is_cursor_before",
"(",
"self",
".",
"calltip_position... | Hide calltip when necessary | [
"Hide",
"calltip",
"when",
"necessary"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1065-L1075 |
30,991 | spyder-ide/spyder | spyder/app/cli_options.py | get_options | def get_options(argv=None):
"""
Convert options into commands
return commands, message
"""
parser = argparse.ArgumentParser(usage="spyder [options] files")
parser.add_argument('--new-instance', action='store_true', default=False,
help="Run a new instance of Spyder, even if ... | python | def get_options(argv=None):
"""
Convert options into commands
return commands, message
"""
parser = argparse.ArgumentParser(usage="spyder [options] files")
parser.add_argument('--new-instance', action='store_true', default=False,
help="Run a new instance of Spyder, even if ... | [
"def",
"get_options",
"(",
"argv",
"=",
"None",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"usage",
"=",
"\"spyder [options] files\"",
")",
"parser",
".",
"add_argument",
"(",
"'--new-instance'",
",",
"action",
"=",
"'store_true'",
",",
"... | Convert options into commands
return commands, message | [
"Convert",
"options",
"into",
"commands",
"return",
"commands",
"message"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/cli_options.py#L9-L70 |
30,992 | spyder-ide/spyder | spyder/plugins/projects/api.py | BaseProject.set_recent_files | def set_recent_files(self, recent_files):
"""Set a list of files opened by the project."""
for recent_file in recent_files[:]:
if not os.path.isfile(recent_file):
recent_files.remove(recent_file)
try:
self.CONF[WORKSPACE].set('main', 'recent_files',
... | python | def set_recent_files(self, recent_files):
"""Set a list of files opened by the project."""
for recent_file in recent_files[:]:
if not os.path.isfile(recent_file):
recent_files.remove(recent_file)
try:
self.CONF[WORKSPACE].set('main', 'recent_files',
... | [
"def",
"set_recent_files",
"(",
"self",
",",
"recent_files",
")",
":",
"for",
"recent_file",
"in",
"recent_files",
"[",
":",
"]",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"recent_file",
")",
":",
"recent_files",
".",
"remove",
"(",
"recen... | Set a list of files opened by the project. | [
"Set",
"a",
"list",
"of",
"files",
"opened",
"by",
"the",
"project",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L68-L77 |
30,993 | spyder-ide/spyder | spyder/plugins/projects/api.py | BaseProject.get_recent_files | def get_recent_files(self):
"""Return a list of files opened by the project."""
try:
recent_files = self.CONF[WORKSPACE].get('main', 'recent_files',
default=[])
except EnvironmentError:
return []
for rec... | python | def get_recent_files(self):
"""Return a list of files opened by the project."""
try:
recent_files = self.CONF[WORKSPACE].get('main', 'recent_files',
default=[])
except EnvironmentError:
return []
for rec... | [
"def",
"get_recent_files",
"(",
"self",
")",
":",
"try",
":",
"recent_files",
"=",
"self",
".",
"CONF",
"[",
"WORKSPACE",
"]",
".",
"get",
"(",
"'main'",
",",
"'recent_files'",
",",
"default",
"=",
"[",
"]",
")",
"except",
"EnvironmentError",
":",
"retur... | Return a list of files opened by the project. | [
"Return",
"a",
"list",
"of",
"files",
"opened",
"by",
"the",
"project",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L79-L90 |
30,994 | spyder-ide/spyder | spyder/plugins/projects/api.py | BaseProject.set_root_path | def set_root_path(self, root_path):
"""Set project root path."""
if self.name is None:
self.name = osp.basename(root_path)
self.root_path = to_text_string(root_path)
config_path = self.__get_project_config_path()
if osp.exists(config_path):
self.loa... | python | def set_root_path(self, root_path):
"""Set project root path."""
if self.name is None:
self.name = osp.basename(root_path)
self.root_path = to_text_string(root_path)
config_path = self.__get_project_config_path()
if osp.exists(config_path):
self.loa... | [
"def",
"set_root_path",
"(",
"self",
",",
"root_path",
")",
":",
"if",
"self",
".",
"name",
"is",
"None",
":",
"self",
".",
"name",
"=",
"osp",
".",
"basename",
"(",
"root_path",
")",
"self",
".",
"root_path",
"=",
"to_text_string",
"(",
"root_path",
"... | Set project root path. | [
"Set",
"project",
"root",
"path",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L115-L126 |
30,995 | spyder-ide/spyder | spyder/plugins/projects/api.py | BaseProject.rename | def rename(self, new_name):
"""Rename project and rename its root path accordingly."""
old_name = self.name
self.name = new_name
pypath = self.relative_pythonpath # ??
self.root_path = self.root_path[:-len(old_name)]+new_name
self.relative_pythonpath = pypath # ??... | python | def rename(self, new_name):
"""Rename project and rename its root path accordingly."""
old_name = self.name
self.name = new_name
pypath = self.relative_pythonpath # ??
self.root_path = self.root_path[:-len(old_name)]+new_name
self.relative_pythonpath = pypath # ??... | [
"def",
"rename",
"(",
"self",
",",
"new_name",
")",
":",
"old_name",
"=",
"self",
".",
"name",
"self",
".",
"name",
"=",
"new_name",
"pypath",
"=",
"self",
".",
"relative_pythonpath",
"# ??\r",
"self",
".",
"root_path",
"=",
"self",
".",
"root_path",
"["... | Rename project and rename its root path accordingly. | [
"Rename",
"project",
"and",
"rename",
"its",
"root",
"path",
"accordingly",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L128-L135 |
30,996 | spyder-ide/spyder | spyder/plugins/onlinehelp/widgets.py | PydocBrowser.text_to_url | def text_to_url(self, text):
"""Convert text address into QUrl object"""
if text.startswith('/'):
text = text[1:]
return QUrl(self.home_url.toString()+text+'.html') | python | def text_to_url(self, text):
"""Convert text address into QUrl object"""
if text.startswith('/'):
text = text[1:]
return QUrl(self.home_url.toString()+text+'.html') | [
"def",
"text_to_url",
"(",
"self",
",",
"text",
")",
":",
"if",
"text",
".",
"startswith",
"(",
"'/'",
")",
":",
"text",
"=",
"text",
"[",
"1",
":",
"]",
"return",
"QUrl",
"(",
"self",
".",
"home_url",
".",
"toString",
"(",
")",
"+",
"text",
"+",... | Convert text address into QUrl object | [
"Convert",
"text",
"address",
"into",
"QUrl",
"object"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L126-L130 |
30,997 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForPlugin.do_autosave | def do_autosave(self):
"""Instruct current editorstack to autosave files where necessary."""
logger.debug('Autosave triggered')
stack = self.editor.get_current_editorstack()
stack.autosave.autosave_all()
self.start_autosave_timer() | python | def do_autosave(self):
"""Instruct current editorstack to autosave files where necessary."""
logger.debug('Autosave triggered')
stack = self.editor.get_current_editorstack()
stack.autosave.autosave_all()
self.start_autosave_timer() | [
"def",
"do_autosave",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Autosave triggered'",
")",
"stack",
"=",
"self",
".",
"editor",
".",
"get_current_editorstack",
"(",
")",
"stack",
".",
"autosave",
".",
"autosave_all",
"(",
")",
"self",
".",
"sta... | Instruct current editorstack to autosave files where necessary. | [
"Instruct",
"current",
"editorstack",
"to",
"autosave",
"files",
"where",
"necessary",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L99-L104 |
30,998 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForPlugin.try_recover_from_autosave | def try_recover_from_autosave(self):
"""Offer to recover files from autosave."""
autosave_dir = get_conf_path('autosave')
autosave_mapping = CONF.get('editor', 'autosave_mapping', {})
dialog = RecoveryDialog(autosave_dir, autosave_mapping,
parent=self.edit... | python | def try_recover_from_autosave(self):
"""Offer to recover files from autosave."""
autosave_dir = get_conf_path('autosave')
autosave_mapping = CONF.get('editor', 'autosave_mapping', {})
dialog = RecoveryDialog(autosave_dir, autosave_mapping,
parent=self.edit... | [
"def",
"try_recover_from_autosave",
"(",
"self",
")",
":",
"autosave_dir",
"=",
"get_conf_path",
"(",
"'autosave'",
")",
"autosave_mapping",
"=",
"CONF",
".",
"get",
"(",
"'editor'",
",",
"'autosave_mapping'",
",",
"{",
"}",
")",
"dialog",
"=",
"RecoveryDialog",... | Offer to recover files from autosave. | [
"Offer",
"to",
"recover",
"files",
"from",
"autosave",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L106-L113 |
30,999 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForStack.create_unique_autosave_filename | def create_unique_autosave_filename(self, filename, autosave_dir):
"""
Create unique autosave file name for specified file name.
Args:
filename (str): original file name
autosave_dir (str): directory in which autosave files are stored
"""
basename = osp.b... | python | def create_unique_autosave_filename(self, filename, autosave_dir):
"""
Create unique autosave file name for specified file name.
Args:
filename (str): original file name
autosave_dir (str): directory in which autosave files are stored
"""
basename = osp.b... | [
"def",
"create_unique_autosave_filename",
"(",
"self",
",",
"filename",
",",
"autosave_dir",
")",
":",
"basename",
"=",
"osp",
".",
"basename",
"(",
"filename",
")",
"autosave_filename",
"=",
"osp",
".",
"join",
"(",
"autosave_dir",
",",
"basename",
")",
"if",... | Create unique autosave file name for specified file name.
Args:
filename (str): original file name
autosave_dir (str): directory in which autosave files are stored | [
"Create",
"unique",
"autosave",
"file",
"name",
"for",
"specified",
"file",
"name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L135-L152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.