repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
spyder-ide/spyder | spyder/app/mainwindow.py | setup_logging | def setup_logging(cli_options):
"""Setup logging with cli options defined by the user."""
if cli_options.debug_info or get_debug_level() > 0:
levels = {2: logging.INFO, 3: logging.DEBUG}
log_level = levels[get_debug_level()]
log_format = '%(asctime)s [%(levelname)s] [%(name)s] -> %(... | python | def setup_logging(cli_options):
"""Setup logging with cli options defined by the user."""
if cli_options.debug_info or get_debug_level() > 0:
levels = {2: logging.INFO, 3: logging.DEBUG}
log_level = levels[get_debug_level()]
log_format = '%(asctime)s [%(levelname)s] [%(name)s] -> %(... | [
"def",
"setup_logging",
"(",
"cli_options",
")",
":",
"if",
"cli_options",
".",
"debug_info",
"or",
"get_debug_level",
"(",
")",
">",
"0",
":",
"levels",
"=",
"{",
"2",
":",
"logging",
".",
"INFO",
",",
"3",
":",
"logging",
".",
"DEBUG",
"}",
"log_leve... | Setup logging with cli options defined by the user. | [
"Setup",
"logging",
"with",
"cli",
"options",
"defined",
"by",
"the",
"user",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L233-L248 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | qt_message_handler | def qt_message_handler(msg_type, msg_log_context, msg_string):
"""
Qt warning messages are intercepted by this handler.
On some operating systems, warning messages might be displayed
even if the actual message does not apply. This filter adds a
blacklist for messages that are being printed fo... | python | def qt_message_handler(msg_type, msg_log_context, msg_string):
"""
Qt warning messages are intercepted by this handler.
On some operating systems, warning messages might be displayed
even if the actual message does not apply. This filter adds a
blacklist for messages that are being printed fo... | [
"def",
"qt_message_handler",
"(",
"msg_type",
",",
"msg_log_context",
",",
"msg_string",
")",
":",
"BLACKLIST",
"=",
"[",
"'QMainWidget::resizeDocks: all sizes need to be larger than 0'",
",",
"]",
"if",
"DEV",
"or",
"msg_string",
"not",
"in",
"BLACKLIST",
":",
"print... | Qt warning messages are intercepted by this handler.
On some operating systems, warning messages might be displayed
even if the actual message does not apply. This filter adds a
blacklist for messages that are being printed for no apparent
reason. Anything else will get printed in the internal con... | [
"Qt",
"warning",
"messages",
"are",
"intercepted",
"by",
"this",
"handler",
".",
"On",
"some",
"operating",
"systems",
"warning",
"messages",
"might",
"be",
"displayed",
"even",
"if",
"the",
"actual",
"message",
"does",
"not",
"apply",
".",
"This",
"filter",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L251-L266 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | initialize | def initialize():
"""Initialize Qt, patching sys.exit and eventually setting up ETS"""
# This doesn't create our QApplication, just holds a reference to
# MAIN_APP, created above to show our splash screen as early as
# possible
app = qapplication()
# --- Set application icon
app.set... | python | def initialize():
"""Initialize Qt, patching sys.exit and eventually setting up ETS"""
# This doesn't create our QApplication, just holds a reference to
# MAIN_APP, created above to show our splash screen as early as
# possible
app = qapplication()
# --- Set application icon
app.set... | [
"def",
"initialize",
"(",
")",
":",
"# This doesn't create our QApplication, just holds a reference to\r",
"# MAIN_APP, created above to show our splash screen as early as\r",
"# possible\r",
"app",
"=",
"qapplication",
"(",
")",
"# --- Set application icon\r",
"app",
".",
"setWindow... | Initialize Qt, patching sys.exit and eventually setting up ETS | [
"Initialize",
"Qt",
"patching",
"sys",
".",
"exit",
"and",
"eventually",
"setting",
"up",
"ETS"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3210-L3253 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | run_spyder | def run_spyder(app, options, args):
"""
Create and show Spyder's main window
Start QApplication event loop
"""
#TODO: insert here
# Main window
main = MainWindow(options)
try:
main.setup()
except BaseException:
if main.console is not None:
try:... | python | def run_spyder(app, options, args):
"""
Create and show Spyder's main window
Start QApplication event loop
"""
#TODO: insert here
# Main window
main = MainWindow(options)
try:
main.setup()
except BaseException:
if main.console is not None:
try:... | [
"def",
"run_spyder",
"(",
"app",
",",
"options",
",",
"args",
")",
":",
"#TODO: insert here\r",
"# Main window\r",
"main",
"=",
"MainWindow",
"(",
"options",
")",
"try",
":",
"main",
".",
"setup",
"(",
")",
"except",
"BaseException",
":",
"if",
"main",
"."... | Create and show Spyder's main window
Start QApplication event loop | [
"Create",
"and",
"show",
"Spyder",
"s",
"main",
"window",
"Start",
"QApplication",
"event",
"loop"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3274-L3318 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | main | def main():
"""Main function"""
# **** For Pytest ****
# We need to create MainWindow **here** to avoid passing pytest
# options to Spyder
if running_under_pytest():
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock # Pyth... | python | def main():
"""Main function"""
# **** For Pytest ****
# We need to create MainWindow **here** to avoid passing pytest
# options to Spyder
if running_under_pytest():
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock # Pyth... | [
"def",
"main",
"(",
")",
":",
"# **** For Pytest ****\r",
"# We need to create MainWindow **here** to avoid passing pytest\r",
"# options to Spyder\r",
"if",
"running_under_pytest",
"(",
")",
":",
"try",
":",
"from",
"unittest",
".",
"mock",
"import",
"Mock",
"except",
"I... | Main function | [
"Main",
"function"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3324-L3453 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.create_toolbar | def create_toolbar(self, title, object_name, iconsize=24):
"""Create and return toolbar with *title* and *object_name*"""
toolbar = self.addToolBar(title)
toolbar.setObjectName(object_name)
toolbar.setIconSize(QSize(iconsize, iconsize))
self.toolbarslist.append(toolbar)
... | python | def create_toolbar(self, title, object_name, iconsize=24):
"""Create and return toolbar with *title* and *object_name*"""
toolbar = self.addToolBar(title)
toolbar.setObjectName(object_name)
toolbar.setIconSize(QSize(iconsize, iconsize))
self.toolbarslist.append(toolbar)
... | [
"def",
"create_toolbar",
"(",
"self",
",",
"title",
",",
"object_name",
",",
"iconsize",
"=",
"24",
")",
":",
"toolbar",
"=",
"self",
".",
"addToolBar",
"(",
"title",
")",
"toolbar",
".",
"setObjectName",
"(",
"object_name",
")",
"toolbar",
".",
"setIconSi... | Create and return toolbar with *title* and *object_name* | [
"Create",
"and",
"return",
"toolbar",
"with",
"*",
"title",
"*",
"and",
"*",
"object_name",
"*"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L585-L591 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.setup | def setup(self):
"""Setup main window"""
logger.info("*** Start of MainWindow setup ***")
logger.info("Applying theme configuration...")
ui_theme = CONF.get('appearance', 'ui_theme')
color_scheme = CONF.get('appearance', 'selected')
if ui_theme == 'dark':
... | python | def setup(self):
"""Setup main window"""
logger.info("*** Start of MainWindow setup ***")
logger.info("Applying theme configuration...")
ui_theme = CONF.get('appearance', 'ui_theme')
color_scheme = CONF.get('appearance', 'selected')
if ui_theme == 'dark':
... | [
"def",
"setup",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"*** Start of MainWindow setup ***\"",
")",
"logger",
".",
"info",
"(",
"\"Applying theme configuration...\"",
")",
"ui_theme",
"=",
"CONF",
".",
"get",
"(",
"'appearance'",
",",
"'ui_theme'",
... | Setup main window | [
"Setup",
"main",
"window"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L593-L1263 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.post_visible_setup | def post_visible_setup(self):
"""Actions to be performed only after the main window's `show` method
was triggered"""
self.restore_scrollbar_position.emit()
# [Workaround for Issue 880]
# QDockWidget objects are not painted if restored as floating
# windows, so we ... | python | def post_visible_setup(self):
"""Actions to be performed only after the main window's `show` method
was triggered"""
self.restore_scrollbar_position.emit()
# [Workaround for Issue 880]
# QDockWidget objects are not painted if restored as floating
# windows, so we ... | [
"def",
"post_visible_setup",
"(",
"self",
")",
":",
"self",
".",
"restore_scrollbar_position",
".",
"emit",
"(",
")",
"# [Workaround for Issue 880]\r",
"# QDockWidget objects are not painted if restored as floating\r",
"# windows, so we must dock them before showing the mainwindow,\r",... | Actions to be performed only after the main window's `show` method
was triggered | [
"Actions",
"to",
"be",
"performed",
"only",
"after",
"the",
"main",
"window",
"s",
"show",
"method",
"was",
"triggered"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1265-L1349 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.set_window_title | def set_window_title(self):
"""Set window title."""
if DEV is not None:
title = u"Spyder %s (Python %s.%s)" % (__version__,
sys.version_info[0],
sys.version_info[1])
else:
... | python | def set_window_title(self):
"""Set window title."""
if DEV is not None:
title = u"Spyder %s (Python %s.%s)" % (__version__,
sys.version_info[0],
sys.version_info[1])
else:
... | [
"def",
"set_window_title",
"(",
"self",
")",
":",
"if",
"DEV",
"is",
"not",
"None",
":",
"title",
"=",
"u\"Spyder %s (Python %s.%s)\"",
"%",
"(",
"__version__",
",",
"sys",
".",
"version_info",
"[",
"0",
"]",
",",
"sys",
".",
"version_info",
"[",
"1",
"]... | Set window title. | [
"Set",
"window",
"title",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1351-L1374 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.report_missing_dependencies | def report_missing_dependencies(self):
"""Show a QMessageBox with a list of missing hard dependencies"""
missing_deps = dependencies.missing_dependencies()
if missing_deps:
QMessageBox.critical(self, _('Error'),
_("<b>You have missing dependencies!</b>"
... | python | def report_missing_dependencies(self):
"""Show a QMessageBox with a list of missing hard dependencies"""
missing_deps = dependencies.missing_dependencies()
if missing_deps:
QMessageBox.critical(self, _('Error'),
_("<b>You have missing dependencies!</b>"
... | [
"def",
"report_missing_dependencies",
"(",
"self",
")",
":",
"missing_deps",
"=",
"dependencies",
".",
"missing_dependencies",
"(",
")",
"if",
"missing_deps",
":",
"QMessageBox",
".",
"critical",
"(",
"self",
",",
"_",
"(",
"'Error'",
")",
",",
"_",
"(",
"\"... | Show a QMessageBox with a list of missing hard dependencies | [
"Show",
"a",
"QMessageBox",
"with",
"a",
"list",
"of",
"missing",
"hard",
"dependencies"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1376-L1393 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.load_window_settings | def load_window_settings(self, prefix, default=False, section='main'):
"""Load window layout settings from userconfig-based configuration
with *prefix*, under *section*
default: if True, do not restore inner layout"""
get_func = CONF.get_default if default else CONF.get
wind... | python | def load_window_settings(self, prefix, default=False, section='main'):
"""Load window layout settings from userconfig-based configuration
with *prefix*, under *section*
default: if True, do not restore inner layout"""
get_func = CONF.get_default if default else CONF.get
wind... | [
"def",
"load_window_settings",
"(",
"self",
",",
"prefix",
",",
"default",
"=",
"False",
",",
"section",
"=",
"'main'",
")",
":",
"get_func",
"=",
"CONF",
".",
"get_default",
"if",
"default",
"else",
"CONF",
".",
"get",
"window_size",
"=",
"get_func",
"(",... | Load window layout settings from userconfig-based configuration
with *prefix*, under *section*
default: if True, do not restore inner layout | [
"Load",
"window",
"layout",
"settings",
"from",
"userconfig",
"-",
"based",
"configuration",
"with",
"*",
"prefix",
"*",
"under",
"*",
"section",
"*",
"default",
":",
"if",
"True",
"do",
"not",
"restore",
"inner",
"layout"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1395-L1421 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.get_window_settings | def get_window_settings(self):
"""Return current window settings
Symetric to the 'set_window_settings' setter"""
window_size = (self.window_size.width(), self.window_size.height())
is_fullscreen = self.isFullScreen()
if is_fullscreen:
is_maximized = self.maximiz... | python | def get_window_settings(self):
"""Return current window settings
Symetric to the 'set_window_settings' setter"""
window_size = (self.window_size.width(), self.window_size.height())
is_fullscreen = self.isFullScreen()
if is_fullscreen:
is_maximized = self.maximiz... | [
"def",
"get_window_settings",
"(",
"self",
")",
":",
"window_size",
"=",
"(",
"self",
".",
"window_size",
".",
"width",
"(",
")",
",",
"self",
".",
"window_size",
".",
"height",
"(",
")",
")",
"is_fullscreen",
"=",
"self",
".",
"isFullScreen",
"(",
")",
... | Return current window settings
Symetric to the 'set_window_settings' setter | [
"Return",
"current",
"window",
"settings",
"Symetric",
"to",
"the",
"set_window_settings",
"setter"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1423-L1437 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.set_window_settings | def set_window_settings(self, hexstate, window_size, prefs_dialog_size,
pos, is_maximized, is_fullscreen):
"""Set window settings
Symetric to the 'get_window_settings' accessor"""
self.setUpdatesEnabled(False)
self.window_size = QSize(window_size[0], wind... | python | def set_window_settings(self, hexstate, window_size, prefs_dialog_size,
pos, is_maximized, is_fullscreen):
"""Set window settings
Symetric to the 'get_window_settings' accessor"""
self.setUpdatesEnabled(False)
self.window_size = QSize(window_size[0], wind... | [
"def",
"set_window_settings",
"(",
"self",
",",
"hexstate",
",",
"window_size",
",",
"prefs_dialog_size",
",",
"pos",
",",
"is_maximized",
",",
"is_fullscreen",
")",
":",
"self",
".",
"setUpdatesEnabled",
"(",
"False",
")",
"self",
".",
"window_size",
"=",
"QS... | Set window settings
Symetric to the 'get_window_settings' accessor | [
"Set",
"window",
"settings",
"Symetric",
"to",
"the",
"get_window_settings",
"accessor"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1439-L1474 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.save_current_window_settings | def save_current_window_settings(self, prefix, section='main',
none_state=False):
"""Save current window settings with *prefix* in
the userconfig-based configuration, under *section*"""
win_size = self.window_size
prefs_size = self.prefs_dialog_s... | python | def save_current_window_settings(self, prefix, section='main',
none_state=False):
"""Save current window settings with *prefix* in
the userconfig-based configuration, under *section*"""
win_size = self.window_size
prefs_size = self.prefs_dialog_s... | [
"def",
"save_current_window_settings",
"(",
"self",
",",
"prefix",
",",
"section",
"=",
"'main'",
",",
"none_state",
"=",
"False",
")",
":",
"win_size",
"=",
"self",
".",
"window_size",
"prefs_size",
"=",
"self",
".",
"prefs_dialog_size",
"CONF",
".",
"set",
... | Save current window settings with *prefix* in
the userconfig-based configuration, under *section* | [
"Save",
"current",
"window",
"settings",
"with",
"*",
"prefix",
"*",
"in",
"the",
"userconfig",
"-",
"based",
"configuration",
"under",
"*",
"section",
"*"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1476-L1497 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.tabify_plugins | def tabify_plugins(self, first, second):
"""Tabify plugin dockwigdets"""
self.tabifyDockWidget(first.dockwidget, second.dockwidget) | python | def tabify_plugins(self, first, second):
"""Tabify plugin dockwigdets"""
self.tabifyDockWidget(first.dockwidget, second.dockwidget) | [
"def",
"tabify_plugins",
"(",
"self",
",",
"first",
",",
"second",
")",
":",
"self",
".",
"tabifyDockWidget",
"(",
"first",
".",
"dockwidget",
",",
"second",
".",
"dockwidget",
")"
] | Tabify plugin dockwigdets | [
"Tabify",
"plugin",
"dockwigdets"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1499-L1501 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.setup_layout | def setup_layout(self, default=False):
"""Setup window layout"""
prefix = 'window' + '/'
settings = self.load_window_settings(prefix, default)
hexstate = settings[0]
self.first_spyder_run = False
if hexstate is None:
# First Spyder execution:
... | python | def setup_layout(self, default=False):
"""Setup window layout"""
prefix = 'window' + '/'
settings = self.load_window_settings(prefix, default)
hexstate = settings[0]
self.first_spyder_run = False
if hexstate is None:
# First Spyder execution:
... | [
"def",
"setup_layout",
"(",
"self",
",",
"default",
"=",
"False",
")",
":",
"prefix",
"=",
"'window'",
"+",
"'/'",
"settings",
"=",
"self",
".",
"load_window_settings",
"(",
"prefix",
",",
"default",
")",
"hexstate",
"=",
"settings",
"[",
"0",
"]",
"self... | Setup window layout | [
"Setup",
"window",
"layout"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1504-L1551 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.setup_default_layouts | def setup_default_layouts(self, index, settings):
"""Setup default layouts when run for the first time."""
self.setUpdatesEnabled(False)
first_spyder_run = bool(self.first_spyder_run) # Store copy
if first_spyder_run:
self.set_window_settings(*settings)
els... | python | def setup_default_layouts(self, index, settings):
"""Setup default layouts when run for the first time."""
self.setUpdatesEnabled(False)
first_spyder_run = bool(self.first_spyder_run) # Store copy
if first_spyder_run:
self.set_window_settings(*settings)
els... | [
"def",
"setup_default_layouts",
"(",
"self",
",",
"index",
",",
"settings",
")",
":",
"self",
".",
"setUpdatesEnabled",
"(",
"False",
")",
"first_spyder_run",
"=",
"bool",
"(",
"self",
".",
"first_spyder_run",
")",
"# Store copy\r",
"if",
"first_spyder_run",
":"... | Setup default layouts when run for the first time. | [
"Setup",
"default",
"layouts",
"when",
"run",
"for",
"the",
"first",
"time",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1553-L1808 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.reset_window_layout | def reset_window_layout(self):
"""Reset window layout to default"""
answer = QMessageBox.warning(self, _("Warning"),
_("Window layout will be reset to default settings: "
"this affects window position, size and dockwidgets.\n"
"Do y... | python | def reset_window_layout(self):
"""Reset window layout to default"""
answer = QMessageBox.warning(self, _("Warning"),
_("Window layout will be reset to default settings: "
"this affects window position, size and dockwidgets.\n"
"Do y... | [
"def",
"reset_window_layout",
"(",
"self",
")",
":",
"answer",
"=",
"QMessageBox",
".",
"warning",
"(",
"self",
",",
"_",
"(",
"\"Warning\"",
")",
",",
"_",
"(",
"\"Window layout will be reset to default settings: \"",
"\"this affects window position, size and dockwidgets... | Reset window layout to default | [
"Reset",
"window",
"layout",
"to",
"default"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1903-L1911 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.quick_layout_save | def quick_layout_save(self):
"""Save layout dialog"""
get = CONF.get
set_ = CONF.set
names = get('quick_layouts', 'names')
order = get('quick_layouts', 'order')
active = get('quick_layouts', 'active')
dlg = self.dialog_layout_save(self, names)
... | python | def quick_layout_save(self):
"""Save layout dialog"""
get = CONF.get
set_ = CONF.set
names = get('quick_layouts', 'names')
order = get('quick_layouts', 'order')
active = get('quick_layouts', 'active')
dlg = self.dialog_layout_save(self, names)
... | [
"def",
"quick_layout_save",
"(",
"self",
")",
":",
"get",
"=",
"CONF",
".",
"get",
"set_",
"=",
"CONF",
".",
"set",
"names",
"=",
"get",
"(",
"'quick_layouts'",
",",
"'names'",
")",
"order",
"=",
"get",
"(",
"'quick_layouts'",
",",
"'order'",
")",
"act... | Save layout dialog | [
"Save",
"layout",
"dialog"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1913-L1954 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.quick_layout_settings | def quick_layout_settings(self):
"""Layout settings dialog"""
get = CONF.get
set_ = CONF.set
section = 'quick_layouts'
names = get(section, 'names')
order = get(section, 'order')
active = get(section, 'active')
dlg = self.dialog_layout_settin... | python | def quick_layout_settings(self):
"""Layout settings dialog"""
get = CONF.get
set_ = CONF.set
section = 'quick_layouts'
names = get(section, 'names')
order = get(section, 'order')
active = get(section, 'active')
dlg = self.dialog_layout_settin... | [
"def",
"quick_layout_settings",
"(",
"self",
")",
":",
"get",
"=",
"CONF",
".",
"get",
"set_",
"=",
"CONF",
".",
"set",
"section",
"=",
"'quick_layouts'",
"names",
"=",
"get",
"(",
"section",
",",
"'names'",
")",
"order",
"=",
"get",
"(",
"section",
",... | Layout settings dialog | [
"Layout",
"settings",
"dialog"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1956-L1972 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.quick_layout_switch | def quick_layout_switch(self, index):
"""Switch to quick layout number *index*"""
section = 'quick_layouts'
try:
settings = self.load_window_settings('layout_{}/'.format(index),
section=section)
(hexstate, window_si... | python | def quick_layout_switch(self, index):
"""Switch to quick layout number *index*"""
section = 'quick_layouts'
try:
settings = self.load_window_settings('layout_{}/'.format(index),
section=section)
(hexstate, window_si... | [
"def",
"quick_layout_switch",
"(",
"self",
",",
"index",
")",
":",
"section",
"=",
"'quick_layouts'",
"try",
":",
"settings",
"=",
"self",
".",
"load_window_settings",
"(",
"'layout_{}/'",
".",
"format",
"(",
"index",
")",
",",
"section",
"=",
"section",
")"... | Switch to quick layout number *index* | [
"Switch",
"to",
"quick",
"layout",
"number",
"*",
"index",
"*"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1974-L2014 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow._update_show_toolbars_action | def _update_show_toolbars_action(self):
"""Update the text displayed in the menu entry."""
if self.toolbars_visible:
text = _("Hide toolbars")
tip = _("Hide toolbars")
else:
text = _("Show toolbars")
tip = _("Show toolbars")
self.sh... | python | def _update_show_toolbars_action(self):
"""Update the text displayed in the menu entry."""
if self.toolbars_visible:
text = _("Hide toolbars")
tip = _("Hide toolbars")
else:
text = _("Show toolbars")
tip = _("Show toolbars")
self.sh... | [
"def",
"_update_show_toolbars_action",
"(",
"self",
")",
":",
"if",
"self",
".",
"toolbars_visible",
":",
"text",
"=",
"_",
"(",
"\"Hide toolbars\"",
")",
"tip",
"=",
"_",
"(",
"\"Hide toolbars\"",
")",
"else",
":",
"text",
"=",
"_",
"(",
"\"Show toolbars\""... | Update the text displayed in the menu entry. | [
"Update",
"the",
"text",
"displayed",
"in",
"the",
"menu",
"entry",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2017-L2026 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.save_visible_toolbars | def save_visible_toolbars(self):
"""Saves the name of the visible toolbars in the .ini file."""
toolbars = []
for toolbar in self.visible_toolbars:
toolbars.append(toolbar.objectName())
CONF.set('main', 'last_visible_toolbars', toolbars) | python | def save_visible_toolbars(self):
"""Saves the name of the visible toolbars in the .ini file."""
toolbars = []
for toolbar in self.visible_toolbars:
toolbars.append(toolbar.objectName())
CONF.set('main', 'last_visible_toolbars', toolbars) | [
"def",
"save_visible_toolbars",
"(",
"self",
")",
":",
"toolbars",
"=",
"[",
"]",
"for",
"toolbar",
"in",
"self",
".",
"visible_toolbars",
":",
"toolbars",
".",
"append",
"(",
"toolbar",
".",
"objectName",
"(",
")",
")",
"CONF",
".",
"set",
"(",
"'main'"... | Saves the name of the visible toolbars in the .ini file. | [
"Saves",
"the",
"name",
"of",
"the",
"visible",
"toolbars",
"in",
"the",
".",
"ini",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2028-L2033 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.get_visible_toolbars | def get_visible_toolbars(self):
"""Collects the visible toolbars."""
toolbars = []
for toolbar in self.toolbarslist:
if toolbar.toggleViewAction().isChecked():
toolbars.append(toolbar)
self.visible_toolbars = toolbars | python | def get_visible_toolbars(self):
"""Collects the visible toolbars."""
toolbars = []
for toolbar in self.toolbarslist:
if toolbar.toggleViewAction().isChecked():
toolbars.append(toolbar)
self.visible_toolbars = toolbars | [
"def",
"get_visible_toolbars",
"(",
"self",
")",
":",
"toolbars",
"=",
"[",
"]",
"for",
"toolbar",
"in",
"self",
".",
"toolbarslist",
":",
"if",
"toolbar",
".",
"toggleViewAction",
"(",
")",
".",
"isChecked",
"(",
")",
":",
"toolbars",
".",
"append",
"("... | Collects the visible toolbars. | [
"Collects",
"the",
"visible",
"toolbars",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2035-L2041 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.load_last_visible_toolbars | def load_last_visible_toolbars(self):
"""Loads the last visible toolbars from the .ini file."""
toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[])
if toolbars_names:
dic = {}
for toolbar in self.toolbarslist:
dic[toolbar.objectN... | python | def load_last_visible_toolbars(self):
"""Loads the last visible toolbars from the .ini file."""
toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[])
if toolbars_names:
dic = {}
for toolbar in self.toolbarslist:
dic[toolbar.objectN... | [
"def",
"load_last_visible_toolbars",
"(",
"self",
")",
":",
"toolbars_names",
"=",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'last_visible_toolbars'",
",",
"default",
"=",
"[",
"]",
")",
"if",
"toolbars_names",
":",
"dic",
"=",
"{",
"}",
"for",
"toolbar",
"... | Loads the last visible toolbars from the .ini file. | [
"Loads",
"the",
"last",
"visible",
"toolbars",
"from",
"the",
".",
"ini",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2043-L2059 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.show_toolbars | def show_toolbars(self):
"""Show/Hides toolbars."""
value = not self.toolbars_visible
CONF.set('main', 'toolbars_visible', value)
if value:
self.save_visible_toolbars()
else:
self.get_visible_toolbars()
for toolbar in self.visible_toolbar... | python | def show_toolbars(self):
"""Show/Hides toolbars."""
value = not self.toolbars_visible
CONF.set('main', 'toolbars_visible', value)
if value:
self.save_visible_toolbars()
else:
self.get_visible_toolbars()
for toolbar in self.visible_toolbar... | [
"def",
"show_toolbars",
"(",
"self",
")",
":",
"value",
"=",
"not",
"self",
".",
"toolbars_visible",
"CONF",
".",
"set",
"(",
"'main'",
",",
"'toolbars_visible'",
",",
"value",
")",
"if",
"value",
":",
"self",
".",
"save_visible_toolbars",
"(",
")",
"else"... | Show/Hides toolbars. | [
"Show",
"/",
"Hides",
"toolbars",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2062-L2076 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.valid_project | def valid_project(self):
"""Handle an invalid active project."""
try:
path = self.projects.get_active_project_path()
except AttributeError:
return
if bool(path):
if not self.projects.is_valid_project(path):
if path:
... | python | def valid_project(self):
"""Handle an invalid active project."""
try:
path = self.projects.get_active_project_path()
except AttributeError:
return
if bool(path):
if not self.projects.is_valid_project(path):
if path:
... | [
"def",
"valid_project",
"(",
"self",
")",
":",
"try",
":",
"path",
"=",
"self",
".",
"projects",
".",
"get_active_project_path",
"(",
")",
"except",
"AttributeError",
":",
"return",
"if",
"bool",
"(",
"path",
")",
":",
"if",
"not",
"self",
".",
"projects... | Handle an invalid active project. | [
"Handle",
"an",
"invalid",
"active",
"project",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2086-L2102 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.show_shortcuts | def show_shortcuts(self, menu):
"""Show action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(element._shown_shortcut) | python | def show_shortcuts(self, menu):
"""Show action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(element._shown_shortcut) | [
"def",
"show_shortcuts",
"(",
"self",
",",
"menu",
")",
":",
"for",
"element",
"in",
"getattr",
"(",
"self",
",",
"menu",
"+",
"'_menu_actions'",
")",
":",
"if",
"element",
"and",
"isinstance",
"(",
"element",
",",
"QAction",
")",
":",
"if",
"element",
... | Show action shortcuts in menu | [
"Show",
"action",
"shortcuts",
"in",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2113-L2118 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.hide_shortcuts | def hide_shortcuts(self, menu):
"""Hide action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(QKeySequence()) | python | def hide_shortcuts(self, menu):
"""Hide action shortcuts in menu"""
for element in getattr(self, menu + '_menu_actions'):
if element and isinstance(element, QAction):
if element._shown_shortcut is not None:
element.setShortcut(QKeySequence()) | [
"def",
"hide_shortcuts",
"(",
"self",
",",
"menu",
")",
":",
"for",
"element",
"in",
"getattr",
"(",
"self",
",",
"menu",
"+",
"'_menu_actions'",
")",
":",
"if",
"element",
"and",
"isinstance",
"(",
"element",
",",
"QAction",
")",
":",
"if",
"element",
... | Hide action shortcuts in menu | [
"Hide",
"action",
"shortcuts",
"in",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2120-L2125 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.get_focus_widget_properties | def get_focus_widget_properties(self):
"""Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor)"""
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyde... | python | def get_focus_widget_properties(self):
"""Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor)"""
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyde... | [
"def",
"get_focus_widget_properties",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"plugins",
".",
"editor",
".",
"widgets",
".",
"editor",
"import",
"TextEditBaseWidget",
"from",
"spyder",
".",
"plugins",
".",
"ipythonconsole",
".",
"widgets",
"import",
"Contr... | Get properties of focus widget
Returns tuple (widget, properties) where properties is a tuple of
booleans: (is_console, not_readonly, readwrite_editor) | [
"Get",
"properties",
"of",
"focus",
"widget",
"Returns",
"tuple",
"(",
"widget",
"properties",
")",
"where",
"properties",
"is",
"a",
"tuple",
"of",
"booleans",
":",
"(",
"is_console",
"not_readonly",
"readwrite_editor",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2127-L2141 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.update_edit_menu | def update_edit_menu(self):
"""Update edit menu"""
widget, textedit_properties = self.get_focus_widget_properties()
if textedit_properties is None: # widget is not an editor/console
return
# !!! Below this line, widget is expected to be a QPlainTextEdit
# in... | python | def update_edit_menu(self):
"""Update edit menu"""
widget, textedit_properties = self.get_focus_widget_properties()
if textedit_properties is None: # widget is not an editor/console
return
# !!! Below this line, widget is expected to be a QPlainTextEdit
# in... | [
"def",
"update_edit_menu",
"(",
"self",
")",
":",
"widget",
",",
"textedit_properties",
"=",
"self",
".",
"get_focus_widget_properties",
"(",
")",
"if",
"textedit_properties",
"is",
"None",
":",
"# widget is not an editor/console\r",
"return",
"# !!! Below this line, widg... | Update edit menu | [
"Update",
"edit",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2143-L2178 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.update_search_menu | def update_search_menu(self):
"""Update search menu"""
# Disabling all actions except the last one
# (which is Find in files) to begin with
for child in self.search_menu.actions()[:-1]:
child.setEnabled(False)
widget, textedit_properties = self.get_focus_widge... | python | def update_search_menu(self):
"""Update search menu"""
# Disabling all actions except the last one
# (which is Find in files) to begin with
for child in self.search_menu.actions()[:-1]:
child.setEnabled(False)
widget, textedit_properties = self.get_focus_widge... | [
"def",
"update_search_menu",
"(",
"self",
")",
":",
"# Disabling all actions except the last one\r",
"# (which is Find in files) to begin with\r",
"for",
"child",
"in",
"self",
".",
"search_menu",
".",
"actions",
"(",
")",
"[",
":",
"-",
"1",
"]",
":",
"child",
".",... | Update search menu | [
"Update",
"search",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2180-L2204 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.set_splash | def set_splash(self, message):
"""Set splash message"""
if self.splash is None:
return
if message:
logger.info(message)
self.splash.show()
self.splash.showMessage(message, Qt.AlignBottom | Qt.AlignCenter |
Qt.AlignAb... | python | def set_splash(self, message):
"""Set splash message"""
if self.splash is None:
return
if message:
logger.info(message)
self.splash.show()
self.splash.showMessage(message, Qt.AlignBottom | Qt.AlignCenter |
Qt.AlignAb... | [
"def",
"set_splash",
"(",
"self",
",",
"message",
")",
":",
"if",
"self",
".",
"splash",
"is",
"None",
":",
"return",
"if",
"message",
":",
"logger",
".",
"info",
"(",
"message",
")",
"self",
".",
"splash",
".",
"show",
"(",
")",
"self",
".",
"spla... | Set splash message | [
"Set",
"splash",
"message"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2255-L2264 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.closeEvent | def closeEvent(self, event):
"""closeEvent reimplementation"""
if self.closing(True):
event.accept()
else:
event.ignore() | python | def closeEvent(self, event):
"""closeEvent reimplementation"""
if self.closing(True):
event.accept()
else:
event.ignore() | [
"def",
"closeEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"closing",
"(",
"True",
")",
":",
"event",
".",
"accept",
"(",
")",
"else",
":",
"event",
".",
"ignore",
"(",
")"
] | closeEvent reimplementation | [
"closeEvent",
"reimplementation"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2266-L2271 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.resizeEvent | def resizeEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_size = self.size()
QMainWindow.resizeEvent(self, event)
# To be used by the tour to be able to resize
self.sig_resized.emit(event) | python | def resizeEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_size = self.size()
QMainWindow.resizeEvent(self, event)
# To be used by the tour to be able to resize
self.sig_resized.emit(event) | [
"def",
"resizeEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"isMaximized",
"(",
")",
"and",
"not",
"self",
".",
"fullscreen_flag",
":",
"self",
".",
"window_size",
"=",
"self",
".",
"size",
"(",
")",
"QMainWindow",
".",
"resize... | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2273-L2280 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.moveEvent | def moveEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_position = self.pos()
QMainWindow.moveEvent(self, event)
# To be used by the tour to be able to move
self.sig_moved.emit(event) | python | def moveEvent(self, event):
"""Reimplement Qt method"""
if not self.isMaximized() and not self.fullscreen_flag:
self.window_position = self.pos()
QMainWindow.moveEvent(self, event)
# To be used by the tour to be able to move
self.sig_moved.emit(event) | [
"def",
"moveEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"self",
".",
"isMaximized",
"(",
")",
"and",
"not",
"self",
".",
"fullscreen_flag",
":",
"self",
".",
"window_position",
"=",
"self",
".",
"pos",
"(",
")",
"QMainWindow",
".",
"moveE... | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2282-L2289 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.hideEvent | def hideEvent(self, event):
"""Reimplement Qt method"""
try:
for plugin in (self.widgetlist + self.thirdparty_plugins):
if plugin.isAncestorOf(self.last_focused_widget):
plugin.visibility_changed(True)
QMainWindow.hideEvent(self, event)
... | python | def hideEvent(self, event):
"""Reimplement Qt method"""
try:
for plugin in (self.widgetlist + self.thirdparty_plugins):
if plugin.isAncestorOf(self.last_focused_widget):
plugin.visibility_changed(True)
QMainWindow.hideEvent(self, event)
... | [
"def",
"hideEvent",
"(",
"self",
",",
"event",
")",
":",
"try",
":",
"for",
"plugin",
"in",
"(",
"self",
".",
"widgetlist",
"+",
"self",
".",
"thirdparty_plugins",
")",
":",
"if",
"plugin",
".",
"isAncestorOf",
"(",
"self",
".",
"last_focused_widget",
")... | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2291-L2299 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.closing | def closing(self, cancelable=False):
"""Exit tasks"""
if self.already_closed or self.is_starting_up:
return True
if cancelable and CONF.get('main', 'prompt_on_exit'):
reply = QMessageBox.critical(self, 'Spyder',
'Do you reall... | python | def closing(self, cancelable=False):
"""Exit tasks"""
if self.already_closed or self.is_starting_up:
return True
if cancelable and CONF.get('main', 'prompt_on_exit'):
reply = QMessageBox.critical(self, 'Spyder',
'Do you reall... | [
"def",
"closing",
"(",
"self",
",",
"cancelable",
"=",
"False",
")",
":",
"if",
"self",
".",
"already_closed",
"or",
"self",
".",
"is_starting_up",
":",
"return",
"True",
"if",
"cancelable",
"and",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'prompt_on_exit'"... | Exit tasks | [
"Exit",
"tasks"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2311-L2334 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.toggle_lock | def toggle_lock(self, value):
"""Lock/Unlock dockwidgets and toolbars"""
self.interface_locked = value
CONF.set('main', 'panes_locked', value)
# Apply lock to panes
for plugin in (self.widgetlist + self.thirdparty_plugins):
if self.interface_locked:
... | python | def toggle_lock(self, value):
"""Lock/Unlock dockwidgets and toolbars"""
self.interface_locked = value
CONF.set('main', 'panes_locked', value)
# Apply lock to panes
for plugin in (self.widgetlist + self.thirdparty_plugins):
if self.interface_locked:
... | [
"def",
"toggle_lock",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"interface_locked",
"=",
"value",
"CONF",
".",
"set",
"(",
"'main'",
",",
"'panes_locked'",
",",
"value",
")",
"# Apply lock to panes\r",
"for",
"plugin",
"in",
"(",
"self",
".",
"widg... | Lock/Unlock dockwidgets and toolbars | [
"Lock",
"/",
"Unlock",
"dockwidgets",
"and",
"toolbars"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2353-L2372 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.maximize_dockwidget | def maximize_dockwidget(self, restore=False):
"""Shortcut: Ctrl+Alt+Shift+M
First call: maximize current dockwidget
Second call (or restore=True): restore original window layout"""
if self.state_before_maximizing is None:
if restore:
return
... | python | def maximize_dockwidget(self, restore=False):
"""Shortcut: Ctrl+Alt+Shift+M
First call: maximize current dockwidget
Second call (or restore=True): restore original window layout"""
if self.state_before_maximizing is None:
if restore:
return
... | [
"def",
"maximize_dockwidget",
"(",
"self",
",",
"restore",
"=",
"False",
")",
":",
"if",
"self",
".",
"state_before_maximizing",
"is",
"None",
":",
"if",
"restore",
":",
"return",
"# Select plugin to maximize\r",
"self",
".",
"state_before_maximizing",
"=",
"self"... | Shortcut: Ctrl+Alt+Shift+M
First call: maximize current dockwidget
Second call (or restore=True): restore original window layout | [
"Shortcut",
":",
"Ctrl",
"+",
"Alt",
"+",
"Shift",
"+",
"M",
"First",
"call",
":",
"maximize",
"current",
"dockwidget",
"Second",
"call",
"(",
"or",
"restore",
"=",
"True",
")",
":",
"restore",
"original",
"window",
"layout"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2389-L2438 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.about | def about(self):
"""Create About Spyder dialog with general information."""
versions = get_versions()
# Show Git revision for development version
revlink = ''
if versions['revision']:
rev = versions['revision']
revlink = " (<a href='https://github.c... | python | def about(self):
"""Create About Spyder dialog with general information."""
versions = get_versions()
# Show Git revision for development version
revlink = ''
if versions['revision']:
rev = versions['revision']
revlink = " (<a href='https://github.c... | [
"def",
"about",
"(",
"self",
")",
":",
"versions",
"=",
"get_versions",
"(",
")",
"# Show Git revision for development version\r",
"revlink",
"=",
"''",
"if",
"versions",
"[",
"'revision'",
"]",
":",
"rev",
"=",
"versions",
"[",
"'revision'",
"]",
"revlink",
"... | Create About Spyder dialog with general information. | [
"Create",
"About",
"Spyder",
"dialog",
"with",
"general",
"information",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2493-L2590 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.render_issue | def render_issue(self, description='', traceback=''):
"""Render issue before sending it to Github"""
# Get component versions
versions = get_versions()
# Get git revision for development version
revision = ''
if versions['revision']:
revision = versio... | python | def render_issue(self, description='', traceback=''):
"""Render issue before sending it to Github"""
# Get component versions
versions = get_versions()
# Get git revision for development version
revision = ''
if versions['revision']:
revision = versio... | [
"def",
"render_issue",
"(",
"self",
",",
"description",
"=",
"''",
",",
"traceback",
"=",
"''",
")",
":",
"# Get component versions\r",
"versions",
"=",
"get_versions",
"(",
")",
"# Get git revision for development version\r",
"revision",
"=",
"''",
"if",
"versions"... | Render issue before sending it to Github | [
"Render",
"issue",
"before",
"sending",
"it",
"to",
"Github"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2600-L2654 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.global_callback | def global_callback(self):
"""Global callback"""
widget = QApplication.focusWidget()
action = self.sender()
callback = from_qvariant(action.data(), to_text_string)
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyder.plugins.ipythonconsole... | python | def global_callback(self):
"""Global callback"""
widget = QApplication.focusWidget()
action = self.sender()
callback = from_qvariant(action.data(), to_text_string)
from spyder.plugins.editor.widgets.editor import TextEditBaseWidget
from spyder.plugins.ipythonconsole... | [
"def",
"global_callback",
"(",
"self",
")",
":",
"widget",
"=",
"QApplication",
".",
"focusWidget",
"(",
")",
"action",
"=",
"self",
".",
"sender",
"(",
")",
"callback",
"=",
"from_qvariant",
"(",
"action",
".",
"data",
"(",
")",
",",
"to_text_string",
"... | Global callback | [
"Global",
"callback"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2692-L2703 | train |
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 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.open_file | def open_file(self, fname, external=False):
"""
Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported)
"""
fname = to_text_string(fname)
... | python | def open_file(self, fname, external=False):
"""
Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported)
"""
fname = to_text_string(fname)
... | [
"def",
"open_file",
"(",
"self",
",",
"fname",
",",
"external",
"=",
"False",
")",
":",
"fname",
"=",
"to_text_string",
"(",
"fname",
")",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
"if",
"encoding",
".",
"is_text_file",
"(... | Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported) | [
"Open",
"filename",
"with",
"the",
"appropriate",
"application",
"Redirect",
"to",
"the",
"right",
"widget",
"(",
"txt",
"-",
">",
"editor",
"spydata",
"-",
">",
"workspace",
"...",
")",
"or",
"open",
"file",
"outside",
"Spyder",
"(",
"if",
"extension",
"i... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2741-L2755 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.register_shortcut | def register_shortcut(self, qaction_or_qshortcut, context, name,
add_sc_to_tip=False):
"""
Register QAction or QShortcut to Spyder main application,
with shortcut (context, name, default)
"""
self.shortcut_data.append( (qaction_or_qshortcut, contex... | python | def register_shortcut(self, qaction_or_qshortcut, context, name,
add_sc_to_tip=False):
"""
Register QAction or QShortcut to Spyder main application,
with shortcut (context, name, default)
"""
self.shortcut_data.append( (qaction_or_qshortcut, contex... | [
"def",
"register_shortcut",
"(",
"self",
",",
"qaction_or_qshortcut",
",",
"context",
",",
"name",
",",
"add_sc_to_tip",
"=",
"False",
")",
":",
"self",
".",
"shortcut_data",
".",
"append",
"(",
"(",
"qaction_or_qshortcut",
",",
"context",
",",
"name",
",",
... | Register QAction or QShortcut to Spyder main application,
with shortcut (context, name, default) | [
"Register",
"QAction",
"or",
"QShortcut",
"to",
"Spyder",
"main",
"application",
"with",
"shortcut",
"(",
"context",
"name",
"default",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2913-L2920 | train |
spyder-ide/spyder | spyder/app/mainwindow.py | MainWindow.apply_shortcuts | def apply_shortcuts(self):
"""Apply shortcuts settings to all widgets/plugins"""
toberemoved = []
for index, (qobject, context, name,
add_sc_to_tip) in enumerate(self.shortcut_data):
keyseq = QKeySequence( get_shortcut(context, name) )
try:
... | python | def apply_shortcuts(self):
"""Apply shortcuts settings to all widgets/plugins"""
toberemoved = []
for index, (qobject, context, name,
add_sc_to_tip) in enumerate(self.shortcut_data):
keyseq = QKeySequence( get_shortcut(context, name) )
try:
... | [
"def",
"apply_shortcuts",
"(",
"self",
")",
":",
"toberemoved",
"=",
"[",
"]",
"for",
"index",
",",
"(",
"qobject",
",",
"context",
",",
"name",
",",
"add_sc_to_tip",
")",
"in",
"enumerate",
"(",
"self",
".",
"shortcut_data",
")",
":",
"keyseq",
"=",
"... | Apply shortcuts settings to all widgets/plugins | [
"Apply",
"shortcuts",
"settings",
"to",
"all",
"widgets",
"/",
"plugins"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2922-L2943 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
spyder-ide/spyder | spyder/config/user.py | UserConfig.set_version | def set_version(self, version='0.0.0', save=True):
"""Set configuration (not application!) version"""
self.set(self.DEFAULT_SECTION_NAME, 'version', version, save=save) | python | def set_version(self, version='0.0.0', save=True):
"""Set configuration (not application!) version"""
self.set(self.DEFAULT_SECTION_NAME, 'version', version, save=save) | [
"def",
"set_version",
"(",
"self",
",",
"version",
"=",
"'0.0.0'",
",",
"save",
"=",
"True",
")",
":",
"self",
".",
"set",
"(",
"self",
".",
"DEFAULT_SECTION_NAME",
",",
"'version'",
",",
"version",
",",
"save",
"=",
"save",
")"
] | Set configuration (not application!) version | [
"Set",
"configuration",
"(",
"not",
"application!",
")",
"version"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L239-L241 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
spyder-ide/spyder | spyder/config/user.py | UserConfig.get_default | def get_default(self, section, option):
"""
Get Default value for a given (section, option)
-> useful for type checking in 'get' method
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults:
if sec == section:
... | python | def get_default(self, section, option):
"""
Get Default value for a given (section, option)
-> useful for type checking in 'get' method
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults:
if sec == section:
... | [
"def",
"get_default",
"(",
"self",
",",
"section",
",",
"option",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"for",
"sec",
",",
"options",
"in",
"self",
".",
"defaults",
":",
"if",
"sec",
"==",
"... | Get Default value for a given (section, option)
-> useful for type checking in 'get' method | [
"Get",
"Default",
"value",
"for",
"a",
"given",
"(",
"section",
"option",
")",
"-",
">",
"useful",
"for",
"type",
"checking",
"in",
"get",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L352-L363 | train |
spyder-ide/spyder | spyder/config/user.py | UserConfig.get | def get(self, section, option, default=NoDefault):
"""
Get an option
section=None: attribute a default section name
default: default value (if not specified, an exception
will be raised if option doesn't exist)
"""
section = self._check_section_option(secti... | python | def get(self, section, option, default=NoDefault):
"""
Get an option
section=None: attribute a default section name
default: default value (if not specified, an exception
will be raised if option doesn't exist)
"""
section = self._check_section_option(secti... | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
"=",
"NoDefault",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"if",
"not",
"self",
".",
"has_section",
"(",
"section",
")",
... | Get an option
section=None: attribute a default section name
default: default value (if not specified, an exception
will be raised if option doesn't exist) | [
"Get",
"an",
"option",
"section",
"=",
"None",
":",
"attribute",
"a",
"default",
"section",
"name",
"default",
":",
"default",
"value",
"(",
"if",
"not",
"specified",
"an",
"exception",
"will",
"be",
"raised",
"if",
"option",
"doesn",
"t",
"exist",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L365-L415 | train |
spyder-ide/spyder | spyder/config/user.py | UserConfig.set_default | def set_default(self, section, option, default_value):
"""
Set Default value for a given (section, option)
-> called when a new (section, option) is set and no default exists
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults... | python | def set_default(self, section, option, default_value):
"""
Set Default value for a given (section, option)
-> called when a new (section, option) is set and no default exists
"""
section = self._check_section_option(section, option)
for sec, options in self.defaults... | [
"def",
"set_default",
"(",
"self",
",",
"section",
",",
"option",
",",
"default_value",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"for",
"sec",
",",
"options",
"in",
"self",
".",
"defaults",
":",
... | Set Default value for a given (section, option)
-> called when a new (section, option) is set and no default exists | [
"Set",
"Default",
"value",
"for",
"a",
"given",
"(",
"section",
"option",
")",
"-",
">",
"called",
"when",
"a",
"new",
"(",
"section",
"option",
")",
"is",
"set",
"and",
"no",
"default",
"exists"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L417-L425 | train |
spyder-ide/spyder | spyder/config/user.py | UserConfig.set | def set(self, section, option, value, verbose=False, save=True):
"""
Set an option
section=None: attribute a default section name
"""
section = self._check_section_option(section, option)
default_value = self.get_default(section, option)
if default_value is... | python | def set(self, section, option, value, verbose=False, save=True):
"""
Set an option
section=None: attribute a default section name
"""
section = self._check_section_option(section, option)
default_value = self.get_default(section, option)
if default_value is... | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
",",
"verbose",
"=",
"False",
",",
"save",
"=",
"True",
")",
":",
"section",
"=",
"self",
".",
"_check_section_option",
"(",
"section",
",",
"option",
")",
"default_value",
"=",
"s... | Set an option
section=None: attribute a default section name | [
"Set",
"an",
"option",
"section",
"=",
"None",
":",
"attribute",
"a",
"default",
"section",
"name"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/user.py#L427-L452 | train |
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 | train |
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 | train |
spyder-ide/spyder | spyder/utils/programs.py | find_program | def find_program(basename):
"""
Find program in PATH and return absolute path
Try adding .exe or .bat to basename on Windows platforms
(return None if not found)
"""
names = [basename]
if os.name == 'nt':
# Windows platforms
extensions = ('.exe', '.bat', '.cmd')
... | python | def find_program(basename):
"""
Find program in PATH and return absolute path
Try adding .exe or .bat to basename on Windows platforms
(return None if not found)
"""
names = [basename]
if os.name == 'nt':
# Windows platforms
extensions = ('.exe', '.bat', '.cmd')
... | [
"def",
"find_program",
"(",
"basename",
")",
":",
"names",
"=",
"[",
"basename",
"]",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"# Windows platforms\r",
"extensions",
"=",
"(",
"'.exe'",
",",
"'.bat'",
",",
"'.cmd'",
")",
"if",
"not",
"basename",
".",
... | Find program in PATH and return absolute path
Try adding .exe or .bat to basename on Windows platforms
(return None if not found) | [
"Find",
"program",
"in",
"PATH",
"and",
"return",
"absolute",
"path",
"Try",
"adding",
".",
"exe",
"or",
".",
"bat",
"to",
"basename",
"on",
"Windows",
"platforms",
"(",
"return",
"None",
"if",
"not",
"found",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L69-L85 | train |
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 | train |
spyder-ide/spyder | spyder/utils/programs.py | run_shell_command | def run_shell_command(cmdstr, **subprocess_kwargs):
"""
Execute the given shell command.
Note that *args and **kwargs will be passed to the subprocess call.
If 'shell' is given in subprocess_kwargs it must be True,
otherwise ProgramError will be raised.
.
If 'executable' is no... | python | def run_shell_command(cmdstr, **subprocess_kwargs):
"""
Execute the given shell command.
Note that *args and **kwargs will be passed to the subprocess call.
If 'shell' is given in subprocess_kwargs it must be True,
otherwise ProgramError will be raised.
.
If 'executable' is no... | [
"def",
"run_shell_command",
"(",
"cmdstr",
",",
"*",
"*",
"subprocess_kwargs",
")",
":",
"if",
"'shell'",
"in",
"subprocess_kwargs",
"and",
"not",
"subprocess_kwargs",
"[",
"'shell'",
"]",
":",
"raise",
"ProgramError",
"(",
"'The \"shell\" kwarg may be omitted, but if... | Execute the given shell command.
Note that *args and **kwargs will be passed to the subprocess call.
If 'shell' is given in subprocess_kwargs it must be True,
otherwise ProgramError will be raised.
.
If 'executable' is not given in subprocess_kwargs, it will
be set to the value of ... | [
"Execute",
"the",
"given",
"shell",
"command",
".",
"Note",
"that",
"*",
"args",
"and",
"**",
"kwargs",
"will",
"be",
"passed",
"to",
"the",
"subprocess",
"call",
".",
"If",
"shell",
"is",
"given",
"in",
"subprocess_kwargs",
"it",
"must",
"be",
"True",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L110-L142 | train |
spyder-ide/spyder | spyder/utils/programs.py | run_program | def run_program(program, args=None, **subprocess_kwargs):
"""
Run program in a separate process.
NOTE: returns the process object created by
`subprocess.Popen()`. This can be used with
`proc.communicate()` for example.
If 'shell' appears in the kwargs, it must be False,
otherwise ... | python | def run_program(program, args=None, **subprocess_kwargs):
"""
Run program in a separate process.
NOTE: returns the process object created by
`subprocess.Popen()`. This can be used with
`proc.communicate()` for example.
If 'shell' appears in the kwargs, it must be False,
otherwise ... | [
"def",
"run_program",
"(",
"program",
",",
"args",
"=",
"None",
",",
"*",
"*",
"subprocess_kwargs",
")",
":",
"if",
"'shell'",
"in",
"subprocess_kwargs",
"and",
"subprocess_kwargs",
"[",
"'shell'",
"]",
":",
"raise",
"ProgramError",
"(",
"\"This function is only... | Run program in a separate process.
NOTE: returns the process object created by
`subprocess.Popen()`. This can be used with
`proc.communicate()` for example.
If 'shell' appears in the kwargs, it must be False,
otherwise ProgramError will be raised.
If only the program name is given an... | [
"Run",
"program",
"in",
"a",
"separate",
"process",
".",
"NOTE",
":",
"returns",
"the",
"process",
"object",
"created",
"by",
"subprocess",
".",
"Popen",
"()",
".",
"This",
"can",
"be",
"used",
"with",
"proc",
".",
"communicate",
"()",
"for",
"example",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L145-L180 | train |
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 | train |
spyder-ide/spyder | spyder/utils/programs.py | python_script_exists | def python_script_exists(package=None, module=None):
"""
Return absolute path if Python script exists (otherwise, return None)
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
try:
if package is None:
path = imp.find_modul... | python | def python_script_exists(package=None, module=None):
"""
Return absolute path if Python script exists (otherwise, return None)
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
try:
if package is None:
path = imp.find_modul... | [
"def",
"python_script_exists",
"(",
"package",
"=",
"None",
",",
"module",
"=",
"None",
")",
":",
"assert",
"module",
"is",
"not",
"None",
"try",
":",
"if",
"package",
"is",
"None",
":",
"path",
"=",
"imp",
".",
"find_module",
"(",
"module",
")",
"[",
... | Return absolute path if Python script exists (otherwise, return None)
package=None -> module is in sys.path (standard library modules) | [
"Return",
"absolute",
"path",
"if",
"Python",
"script",
"exists",
"(",
"otherwise",
"return",
"None",
")",
"package",
"=",
"None",
"-",
">",
"module",
"is",
"in",
"sys",
".",
"path",
"(",
"standard",
"library",
"modules",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L203-L219 | train |
spyder-ide/spyder | spyder/utils/programs.py | run_python_script | def run_python_script(package=None, module=None, args=[], p_args=[]):
"""
Run Python script in a separate process
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
assert isinstance(args, (tuple, list)) and isinstance(p_args, (tuple, list))
... | python | def run_python_script(package=None, module=None, args=[], p_args=[]):
"""
Run Python script in a separate process
package=None -> module is in sys.path (standard library modules)
"""
assert module is not None
assert isinstance(args, (tuple, list)) and isinstance(p_args, (tuple, list))
... | [
"def",
"run_python_script",
"(",
"package",
"=",
"None",
",",
"module",
"=",
"None",
",",
"args",
"=",
"[",
"]",
",",
"p_args",
"=",
"[",
"]",
")",
":",
"assert",
"module",
"is",
"not",
"None",
"assert",
"isinstance",
"(",
"args",
",",
"(",
"tuple",
... | Run Python script in a separate process
package=None -> module is in sys.path (standard library modules) | [
"Run",
"Python",
"script",
"in",
"a",
"separate",
"process",
"package",
"=",
"None",
"-",
">",
"module",
"is",
"in",
"sys",
".",
"path",
"(",
"standard",
"library",
"modules",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L222-L230 | train |
spyder-ide/spyder | spyder/utils/programs.py | shell_split | def shell_split(text):
"""
Split the string `text` using shell-like syntax
This avoids breaking single/double-quoted strings (e.g. containing
strings with spaces). This function is almost equivalent to the shlex.split
function (see standard library `shlex`) except that it is supporting
u... | python | def shell_split(text):
"""
Split the string `text` using shell-like syntax
This avoids breaking single/double-quoted strings (e.g. containing
strings with spaces). This function is almost equivalent to the shlex.split
function (see standard library `shlex`) except that it is supporting
u... | [
"def",
"shell_split",
"(",
"text",
")",
":",
"assert",
"is_text_string",
"(",
"text",
")",
"# in case a QString is passed...\r",
"pattern",
"=",
"r'(\\s+|(?<!\\\\)\".*?(?<!\\\\)\"|(?<!\\\\)\\'.*?(?<!\\\\)\\')'",
"out",
"=",
"[",
"]",
"for",
"token",
"in",
"re",
".",
"... | Split the string `text` using shell-like syntax
This avoids breaking single/double-quoted strings (e.g. containing
strings with spaces). This function is almost equivalent to the shlex.split
function (see standard library `shlex`) except that it is supporting
unicode strings (shlex does not suppor... | [
"Split",
"the",
"string",
"text",
"using",
"shell",
"-",
"like",
"syntax",
"This",
"avoids",
"breaking",
"single",
"/",
"double",
"-",
"quoted",
"strings",
"(",
"e",
".",
"g",
".",
"containing",
"strings",
"with",
"spaces",
")",
".",
"This",
"function",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L233-L248 | train |
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 | train |
spyder-ide/spyder | spyder/utils/programs.py | run_python_script_in_terminal | def run_python_script_in_terminal(fname, wdir, args, interact,
debug, python_args, executable=None):
"""
Run Python script in an external system terminal.
:str wdir: working directory, may be empty.
"""
if executable is None:
executable = get_python... | python | def run_python_script_in_terminal(fname, wdir, args, interact,
debug, python_args, executable=None):
"""
Run Python script in an external system terminal.
:str wdir: working directory, may be empty.
"""
if executable is None:
executable = get_python... | [
"def",
"run_python_script_in_terminal",
"(",
"fname",
",",
"wdir",
",",
"args",
",",
"interact",
",",
"debug",
",",
"python_args",
",",
"executable",
"=",
"None",
")",
":",
"if",
"executable",
"is",
"None",
":",
"executable",
"=",
"get_python_executable",
"(",... | Run Python script in an external system terminal.
:str wdir: working directory, may be empty. | [
"Run",
"Python",
"script",
"in",
"an",
"external",
"system",
"terminal",
".",
":",
"str",
"wdir",
":",
"working",
"directory",
"may",
"be",
"empty",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L273-L339 | train |
spyder-ide/spyder | spyder/utils/programs.py | check_version | def check_version(actver, version, cmp_op):
"""
Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their... | python | def check_version(actver, version, cmp_op):
"""
Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their... | [
"def",
"check_version",
"(",
"actver",
",",
"version",
",",
"cmp_op",
")",
":",
"if",
"isinstance",
"(",
"actver",
",",
"tuple",
")",
":",
"actver",
"=",
"'.'",
".",
"join",
"(",
"[",
"str",
"(",
"i",
")",
"for",
"i",
"in",
"actver",
"]",
")",
"#... | Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their own packages up to
date.
Copyright (C) 20... | [
"Check",
"version",
"string",
"of",
"an",
"active",
"module",
"against",
"a",
"required",
"version",
".",
"If",
"dev",
"/",
"prerelease",
"tags",
"result",
"in",
"TypeError",
"for",
"string",
"-",
"number",
"comparison",
"it",
"is",
"assumed",
"that",
"the",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/programs.py#L342-L381 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.