partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | DirView.convert_notebooks | Convert IPython notebooks to Python scripts in editor | spyder/plugins/explorer/widgets.py | def convert_notebooks(self):
"""Convert IPython notebooks to Python scripts in editor"""
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.convert_notebook(fname) | def convert_notebooks(self):
"""Convert IPython notebooks to Python scripts in editor"""
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.convert_notebook(fname) | [
"Convert",
"IPython",
"notebooks",
"to",
"Python",
"scripts",
"in",
"editor"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L674-L680 | [
"def",
"convert_notebooks",
"(",
"self",
")",
":",
"fnames",
"=",
"self",
".",
"get_selected_filenames",
"(",
")",
"if",
"not",
"isinstance",
"(",
"fnames",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"fnames",
"=",
"[",
"fnames",
"]",
"for",
"fname... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.rename_file | Rename file | spyder/plugins/explorer/widgets.py | def rename_file(self, fname):
"""Rename file"""
path, valid = QInputDialog.getText(self, _('Rename'),
_('New name:'), QLineEdit.Normal,
osp.basename(fname))
if valid:
path = osp.join(osp.dirname(fname), to_text_string(... | def rename_file(self, fname):
"""Rename file"""
path, valid = QInputDialog.getText(self, _('Rename'),
_('New name:'), QLineEdit.Normal,
osp.basename(fname))
if valid:
path = osp.join(osp.dirname(fname), to_text_string(... | [
"Rename",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L682-L709 | [
"def",
"rename_file",
"(",
"self",
",",
"fname",
")",
":",
"path",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'Rename'",
")",
",",
"_",
"(",
"'New name:'",
")",
",",
"QLineEdit",
".",
"Normal",
",",
"osp",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.rename | Rename files | spyder/plugins/explorer/widgets.py | def rename(self, fnames=None):
"""Rename files"""
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.rename_file(fname) | def rename(self, fnames=None):
"""Rename files"""
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.rename_file(fname) | [
"Rename",
"files"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L719-L726 | [
"def",
"rename",
"(",
"self",
",",
"fnames",
"=",
"None",
")",
":",
"if",
"fnames",
"is",
"None",
":",
"fnames",
"=",
"self",
".",
"get_selected_filenames",
"(",
")",
"if",
"not",
"isinstance",
"(",
"fnames",
",",
"(",
"tuple",
",",
"list",
")",
")",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.move | Move files/directories | spyder/plugins/explorer/widgets.py | def move(self, fnames=None, directory=None):
"""Move files/directories"""
if fnames is None:
fnames = self.get_selected_filenames()
orig = fixpath(osp.dirname(fnames[0]))
while True:
self.redirect_stdio.emit(False)
if directory is None:
... | def move(self, fnames=None, directory=None):
"""Move files/directories"""
if fnames is None:
fnames = self.get_selected_filenames()
orig = fixpath(osp.dirname(fnames[0]))
while True:
self.redirect_stdio.emit(False)
if directory is None:
... | [
"Move",
"files",
"/",
"directories"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L729-L756 | [
"def",
"move",
"(",
"self",
",",
"fnames",
"=",
"None",
",",
"directory",
"=",
"None",
")",
":",
"if",
"fnames",
"is",
"None",
":",
"fnames",
"=",
"self",
".",
"get_selected_filenames",
"(",
")",
"orig",
"=",
"fixpath",
"(",
"osp",
".",
"dirname",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.create_new_folder | Create new folder | spyder/plugins/explorer/widgets.py | def create_new_folder(self, current_path, title, subtitle, is_package):
"""Create new folder"""
if current_path is None:
current_path = ''
if osp.isfile(current_path):
current_path = osp.dirname(current_path)
name, valid = QInputDialog.getText(self, title, s... | def create_new_folder(self, current_path, title, subtitle, is_package):
"""Create new folder"""
if current_path is None:
current_path = ''
if osp.isfile(current_path):
current_path = osp.dirname(current_path)
name, valid = QInputDialog.getText(self, title, s... | [
"Create",
"new",
"folder"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L758-L789 | [
"def",
"create_new_folder",
"(",
"self",
",",
"current_path",
",",
"title",
",",
"subtitle",
",",
"is_package",
")",
":",
"if",
"current_path",
"is",
"None",
":",
"current_path",
"=",
"''",
"if",
"osp",
".",
"isfile",
"(",
"current_path",
")",
":",
"curren... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.new_folder | New folder | spyder/plugins/explorer/widgets.py | def new_folder(self, basedir):
"""New folder"""
title = _('New folder')
subtitle = _('Folder name:')
self.create_new_folder(basedir, title, subtitle, is_package=False) | def new_folder(self, basedir):
"""New folder"""
title = _('New folder')
subtitle = _('Folder name:')
self.create_new_folder(basedir, title, subtitle, is_package=False) | [
"New",
"folder"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L791-L795 | [
"def",
"new_folder",
"(",
"self",
",",
"basedir",
")",
":",
"title",
"=",
"_",
"(",
"'New folder'",
")",
"subtitle",
"=",
"_",
"(",
"'Folder name:'",
")",
"self",
".",
"create_new_folder",
"(",
"basedir",
",",
"title",
",",
"subtitle",
",",
"is_package",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.new_package | New package | spyder/plugins/explorer/widgets.py | def new_package(self, basedir):
"""New package"""
title = _('New package')
subtitle = _('Package name:')
self.create_new_folder(basedir, title, subtitle, is_package=True) | def new_package(self, basedir):
"""New package"""
title = _('New package')
subtitle = _('Package name:')
self.create_new_folder(basedir, title, subtitle, is_package=True) | [
"New",
"package"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L797-L801 | [
"def",
"new_package",
"(",
"self",
",",
"basedir",
")",
":",
"title",
"=",
"_",
"(",
"'New package'",
")",
"subtitle",
"=",
"_",
"(",
"'Package name:'",
")",
"self",
".",
"create_new_folder",
"(",
"basedir",
",",
"title",
",",
"subtitle",
",",
"is_package"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.create_new_file | Create new file
Returns True if successful | spyder/plugins/explorer/widgets.py | def create_new_file(self, current_path, title, filters, create_func):
"""Create new file
Returns True if successful"""
if current_path is None:
current_path = ''
if osp.isfile(current_path):
current_path = osp.dirname(current_path)
self.redirect_std... | def create_new_file(self, current_path, title, filters, create_func):
"""Create new file
Returns True if successful"""
if current_path is None:
current_path = ''
if osp.isfile(current_path):
current_path = osp.dirname(current_path)
self.redirect_std... | [
"Create",
"new",
"file",
"Returns",
"True",
"if",
"successful"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L803-L821 | [
"def",
"create_new_file",
"(",
"self",
",",
"current_path",
",",
"title",
",",
"filters",
",",
"create_func",
")",
":",
"if",
"current_path",
"is",
"None",
":",
"current_path",
"=",
"''",
"if",
"osp",
".",
"isfile",
"(",
"current_path",
")",
":",
"current_... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.new_file | New file | spyder/plugins/explorer/widgets.py | def new_file(self, basedir):
"""New file"""
title = _("New file")
filters = _("All files")+" (*)"
def create_func(fname):
"""File creation callback"""
if osp.splitext(fname)[1] in ('.py', '.pyw', '.ipy'):
create_script(fname)
el... | def new_file(self, basedir):
"""New file"""
title = _("New file")
filters = _("All files")+" (*)"
def create_func(fname):
"""File creation callback"""
if osp.splitext(fname)[1] in ('.py', '.pyw', '.ipy'):
create_script(fname)
el... | [
"New",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L823-L836 | [
"def",
"new_file",
"(",
"self",
",",
"basedir",
")",
":",
"title",
"=",
"_",
"(",
"\"New file\"",
")",
"filters",
"=",
"_",
"(",
"\"All files\"",
")",
"+",
"\" (*)\"",
"def",
"create_func",
"(",
"fname",
")",
":",
"\"\"\"File creation callback\"\"\"",
"if",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.new_module | New module | spyder/plugins/explorer/widgets.py | def new_module(self, basedir):
"""New module"""
title = _("New module")
filters = _("Python scripts")+" (*.py *.pyw *.ipy)"
def create_func(fname):
self.sig_create_module.emit(fname)
self.create_new_file(basedir, title, filters, create_func) | def new_module(self, basedir):
"""New module"""
title = _("New module")
filters = _("Python scripts")+" (*.py *.pyw *.ipy)"
def create_func(fname):
self.sig_create_module.emit(fname)
self.create_new_file(basedir, title, filters, create_func) | [
"New",
"module"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L838-L846 | [
"def",
"new_module",
"(",
"self",
",",
"basedir",
")",
":",
"title",
"=",
"_",
"(",
"\"New module\"",
")",
"filters",
"=",
"_",
"(",
"\"Python scripts\"",
")",
"+",
"\" (*.py *.pyw *.ipy)\"",
"def",
"create_func",
"(",
"fname",
")",
":",
"self",
".",
"sig_... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.copy_path | Copy absolute or relative path to given file(s)/folders(s). | spyder/plugins/explorer/widgets.py | def copy_path(self, fnames=None, method="absolute"):
"""Copy absolute or relative path to given file(s)/folders(s)."""
cb = QApplication.clipboard()
explorer_dir = self.fsmodel.rootPath()
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstanc... | def copy_path(self, fnames=None, method="absolute"):
"""Copy absolute or relative path to given file(s)/folders(s)."""
cb = QApplication.clipboard()
explorer_dir = self.fsmodel.rootPath()
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstanc... | [
"Copy",
"absolute",
"or",
"relative",
"path",
"to",
"given",
"file",
"(",
"s",
")",
"/",
"folders",
"(",
"s",
")",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L851-L885 | [
"def",
"copy_path",
"(",
"self",
",",
"fnames",
"=",
"None",
",",
"method",
"=",
"\"absolute\"",
")",
":",
"cb",
"=",
"QApplication",
".",
"clipboard",
"(",
")",
"explorer_dir",
"=",
"self",
".",
"fsmodel",
".",
"rootPath",
"(",
")",
"if",
"fnames",
"i... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.copy_file_clipboard | Copy file(s)/folders(s) to clipboard. | spyder/plugins/explorer/widgets.py | def copy_file_clipboard(self, fnames=None):
"""Copy file(s)/folders(s) to clipboard."""
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
try:
file_content = QMimeData()
... | def copy_file_clipboard(self, fnames=None):
"""Copy file(s)/folders(s) to clipboard."""
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
try:
file_content = QMimeData()
... | [
"Copy",
"file",
"(",
"s",
")",
"/",
"folders",
"(",
"s",
")",
"to",
"clipboard",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L898-L914 | [
"def",
"copy_file_clipboard",
"(",
"self",
",",
"fnames",
"=",
"None",
")",
":",
"if",
"fnames",
"is",
"None",
":",
"fnames",
"=",
"self",
".",
"get_selected_filenames",
"(",
")",
"if",
"not",
"isinstance",
"(",
"fnames",
",",
"(",
"tuple",
",",
"list",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.save_file_clipboard | Paste file from clipboard into file/project explorer directory. | spyder/plugins/explorer/widgets.py | def save_file_clipboard(self, fnames=None):
"""Paste file from clipboard into file/project explorer directory."""
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
if len(fnames) >= 1:
... | def save_file_clipboard(self, fnames=None):
"""Paste file from clipboard into file/project explorer directory."""
if fnames is None:
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
if len(fnames) >= 1:
... | [
"Paste",
"file",
"from",
"clipboard",
"into",
"file",
"/",
"project",
"explorer",
"directory",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L917-L1001 | [
"def",
"save_file_clipboard",
"(",
"self",
",",
"fnames",
"=",
"None",
")",
":",
"if",
"fnames",
"is",
"None",
":",
"fnames",
"=",
"self",
".",
"get_selected_filenames",
"(",
")",
"if",
"not",
"isinstance",
"(",
"fnames",
",",
"(",
"tuple",
",",
"list",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.create_shortcuts | Create shortcuts for this file explorer. | spyder/plugins/explorer/widgets.py | def create_shortcuts(self):
"""Create shortcuts for this file explorer."""
# Configurable
copy_clipboard_file = config_shortcut(self.copy_file_clipboard,
context='explorer',
name='copy file', parent=... | def create_shortcuts(self):
"""Create shortcuts for this file explorer."""
# Configurable
copy_clipboard_file = config_shortcut(self.copy_file_clipboard,
context='explorer',
name='copy file', parent=... | [
"Create",
"shortcuts",
"for",
"this",
"file",
"explorer",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1003-L1021 | [
"def",
"create_shortcuts",
"(",
"self",
")",
":",
"# Configurable\r",
"copy_clipboard_file",
"=",
"config_shortcut",
"(",
"self",
".",
"copy_file_clipboard",
",",
"context",
"=",
"'explorer'",
",",
"name",
"=",
"'copy file'",
",",
"parent",
"=",
"self",
")",
"pa... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.vcs_command | VCS action (commit, browse) | spyder/plugins/explorer/widgets.py | def vcs_command(self, fnames, action):
"""VCS action (commit, browse)"""
try:
for path in sorted(fnames):
vcs.run_vcs_tool(path, action)
except vcs.ActionToolNotFound as error:
msg = _("For %s support, please install one of the<br/> "
... | def vcs_command(self, fnames, action):
"""VCS action (commit, browse)"""
try:
for path in sorted(fnames):
vcs.run_vcs_tool(path, action)
except vcs.ActionToolNotFound as error:
msg = _("For %s support, please install one of the<br/> "
... | [
"VCS",
"action",
"(",
"commit",
"browse",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1033-L1044 | [
"def",
"vcs_command",
"(",
"self",
",",
"fnames",
",",
"action",
")",
":",
"try",
":",
"for",
"path",
"in",
"sorted",
"(",
"fnames",
")",
":",
"vcs",
".",
"run_vcs_tool",
"(",
"path",
",",
"action",
")",
"except",
"vcs",
".",
"ActionToolNotFound",
"as"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.set_scrollbar_position | Set scrollbar positions | spyder/plugins/explorer/widgets.py | def set_scrollbar_position(self, position):
"""Set scrollbar positions"""
# Scrollbars will be restored after the expanded state
self._scrollbar_positions = position
if self._to_be_loaded is not None and len(self._to_be_loaded) == 0:
self.restore_scrollbar_positions() | def set_scrollbar_position(self, position):
"""Set scrollbar positions"""
# Scrollbars will be restored after the expanded state
self._scrollbar_positions = position
if self._to_be_loaded is not None and len(self._to_be_loaded) == 0:
self.restore_scrollbar_positions() | [
"Set",
"scrollbar",
"positions"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1052-L1057 | [
"def",
"set_scrollbar_position",
"(",
"self",
",",
"position",
")",
":",
"# Scrollbars will be restored after the expanded state\r",
"self",
".",
"_scrollbar_positions",
"=",
"position",
"if",
"self",
".",
"_to_be_loaded",
"is",
"not",
"None",
"and",
"len",
"(",
"self... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.restore_scrollbar_positions | Restore scrollbar positions once tree is loaded | spyder/plugins/explorer/widgets.py | def restore_scrollbar_positions(self):
"""Restore scrollbar positions once tree is loaded"""
hor, ver = self._scrollbar_positions
self.horizontalScrollBar().setValue(hor)
self.verticalScrollBar().setValue(ver) | def restore_scrollbar_positions(self):
"""Restore scrollbar positions once tree is loaded"""
hor, ver = self._scrollbar_positions
self.horizontalScrollBar().setValue(hor)
self.verticalScrollBar().setValue(ver) | [
"Restore",
"scrollbar",
"positions",
"once",
"tree",
"is",
"loaded"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1059-L1063 | [
"def",
"restore_scrollbar_positions",
"(",
"self",
")",
":",
"hor",
",",
"ver",
"=",
"self",
".",
"_scrollbar_positions",
"self",
".",
"horizontalScrollBar",
"(",
")",
".",
"setValue",
"(",
"hor",
")",
"self",
".",
"verticalScrollBar",
"(",
")",
".",
"setVal... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.save_expanded_state | Save all items expanded state | spyder/plugins/explorer/widgets.py | def save_expanded_state(self):
"""Save all items expanded state"""
model = self.model()
# If model is not installed, 'model' will be None: this happens when
# using the Project Explorer without having selected a workspace yet
if model is not None:
self.__expande... | def save_expanded_state(self):
"""Save all items expanded state"""
model = self.model()
# If model is not installed, 'model' will be None: this happens when
# using the Project Explorer without having selected a workspace yet
if model is not None:
self.__expande... | [
"Save",
"all",
"items",
"expanded",
"state"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1075-L1084 | [
"def",
"save_expanded_state",
"(",
"self",
")",
":",
"model",
"=",
"self",
".",
"model",
"(",
")",
"# If model is not installed, 'model' will be None: this happens when\r",
"# using the Project Explorer without having selected a workspace yet\r",
"if",
"model",
"is",
"not",
"No... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.restore_directory_state | Restore directory expanded state | spyder/plugins/explorer/widgets.py | def restore_directory_state(self, fname):
"""Restore directory expanded state"""
root = osp.normpath(to_text_string(fname))
if not osp.exists(root):
# Directory has been (re)moved outside Spyder
return
for basename in os.listdir(root):
path = os... | def restore_directory_state(self, fname):
"""Restore directory expanded state"""
root = osp.normpath(to_text_string(fname))
if not osp.exists(root):
# Directory has been (re)moved outside Spyder
return
for basename in os.listdir(root):
path = os... | [
"Restore",
"directory",
"expanded",
"state"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1086-L1101 | [
"def",
"restore_directory_state",
"(",
"self",
",",
"fname",
")",
":",
"root",
"=",
"osp",
".",
"normpath",
"(",
"to_text_string",
"(",
"fname",
")",
")",
"if",
"not",
"osp",
".",
"exists",
"(",
"root",
")",
":",
"# Directory has been (re)moved outside Spyder\... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.follow_directories_loaded | Follow directories loaded during startup | spyder/plugins/explorer/widgets.py | def follow_directories_loaded(self, fname):
"""Follow directories loaded during startup"""
if self._to_be_loaded is None:
return
path = osp.normpath(to_text_string(fname))
if path in self._to_be_loaded:
self._to_be_loaded.remove(path)
if self._to_be... | def follow_directories_loaded(self, fname):
"""Follow directories loaded during startup"""
if self._to_be_loaded is None:
return
path = osp.normpath(to_text_string(fname))
if path in self._to_be_loaded:
self._to_be_loaded.remove(path)
if self._to_be... | [
"Follow",
"directories",
"loaded",
"during",
"startup"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1103-L1115 | [
"def",
"follow_directories_loaded",
"(",
"self",
",",
"fname",
")",
":",
"if",
"self",
".",
"_to_be_loaded",
"is",
"None",
":",
"return",
"path",
"=",
"osp",
".",
"normpath",
"(",
"to_text_string",
"(",
"fname",
")",
")",
"if",
"path",
"in",
"self",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.restore_expanded_state | Restore all items expanded state | spyder/plugins/explorer/widgets.py | def restore_expanded_state(self):
"""Restore all items expanded state"""
if self.__expanded_state is not None:
# In the old project explorer, the expanded state was a dictionnary:
if isinstance(self.__expanded_state, list):
self.fsmodel.directoryLoaded.connec... | def restore_expanded_state(self):
"""Restore all items expanded state"""
if self.__expanded_state is not None:
# In the old project explorer, the expanded state was a dictionnary:
if isinstance(self.__expanded_state, list):
self.fsmodel.directoryLoaded.connec... | [
"Restore",
"all",
"items",
"expanded",
"state"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1117-L1125 | [
"def",
"restore_expanded_state",
"(",
"self",
")",
":",
"if",
"self",
".",
"__expanded_state",
"is",
"not",
"None",
":",
"# In the old project explorer, the expanded state was a dictionnary:\r",
"if",
"isinstance",
"(",
"self",
".",
"__expanded_state",
",",
"list",
")",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DirView.filter_directories | Filter the directories to show | spyder/plugins/explorer/widgets.py | def filter_directories(self):
"""Filter the directories to show"""
index = self.get_index('.spyproject')
if index is not None:
self.setRowHidden(index.row(), index.parent(), True) | def filter_directories(self):
"""Filter the directories to show"""
index = self.get_index('.spyproject')
if index is not None:
self.setRowHidden(index.row(), index.parent(), True) | [
"Filter",
"the",
"directories",
"to",
"show"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1127-L1131 | [
"def",
"filter_directories",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"get_index",
"(",
"'.spyproject'",
")",
"if",
"index",
"is",
"not",
"None",
":",
"self",
".",
"setRowHidden",
"(",
"index",
".",
"row",
"(",
")",
",",
"index",
".",
"parent"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProxyModel.setup_filter | Setup proxy model filter parameters | spyder/plugins/explorer/widgets.py | def setup_filter(self, root_path, path_list):
"""Setup proxy model filter parameters"""
self.root_path = osp.normpath(to_text_string(root_path))
self.path_list = [osp.normpath(to_text_string(p)) for p in path_list]
self.invalidateFilter() | def setup_filter(self, root_path, path_list):
"""Setup proxy model filter parameters"""
self.root_path = osp.normpath(to_text_string(root_path))
self.path_list = [osp.normpath(to_text_string(p)) for p in path_list]
self.invalidateFilter() | [
"Setup",
"proxy",
"model",
"filter",
"parameters"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1141-L1145 | [
"def",
"setup_filter",
"(",
"self",
",",
"root_path",
",",
"path_list",
")",
":",
"self",
".",
"root_path",
"=",
"osp",
".",
"normpath",
"(",
"to_text_string",
"(",
"root_path",
")",
")",
"self",
".",
"path_list",
"=",
"[",
"osp",
".",
"normpath",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProxyModel.sort | Reimplement Qt method | spyder/plugins/explorer/widgets.py | def sort(self, column, order=Qt.AscendingOrder):
"""Reimplement Qt method"""
self.sourceModel().sort(column, order) | def sort(self, column, order=Qt.AscendingOrder):
"""Reimplement Qt method"""
self.sourceModel().sort(column, order) | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1147-L1149 | [
"def",
"sort",
"(",
"self",
",",
"column",
",",
"order",
"=",
"Qt",
".",
"AscendingOrder",
")",
":",
"self",
".",
"sourceModel",
"(",
")",
".",
"sort",
"(",
"column",
",",
"order",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProxyModel.filterAcceptsRow | Reimplement Qt method | spyder/plugins/explorer/widgets.py | def filterAcceptsRow(self, row, parent_index):
"""Reimplement Qt method"""
if self.root_path is None:
return True
index = self.sourceModel().index(row, 0, parent_index)
path = osp.normcase(osp.normpath(
to_text_string(self.sourceModel().filePath(index))))
... | def filterAcceptsRow(self, row, parent_index):
"""Reimplement Qt method"""
if self.root_path is None:
return True
index = self.sourceModel().index(row, 0, parent_index)
path = osp.normcase(osp.normpath(
to_text_string(self.sourceModel().filePath(index))))
... | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1151-L1166 | [
"def",
"filterAcceptsRow",
"(",
"self",
",",
"row",
",",
"parent_index",
")",
":",
"if",
"self",
".",
"root_path",
"is",
"None",
":",
"return",
"True",
"index",
"=",
"self",
".",
"sourceModel",
"(",
")",
".",
"index",
"(",
"row",
",",
"0",
",",
"pare... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ProxyModel.data | Show tooltip with full path only for the root directory | spyder/plugins/explorer/widgets.py | def data(self, index, role):
"""Show tooltip with full path only for the root directory"""
if role == Qt.ToolTipRole:
root_dir = self.path_list[0].split(osp.sep)[-1]
if index.data() == root_dir:
return osp.join(self.root_path, root_dir)
return QSortF... | def data(self, index, role):
"""Show tooltip with full path only for the root directory"""
if role == Qt.ToolTipRole:
root_dir = self.path_list[0].split(osp.sep)[-1]
if index.data() == root_dir:
return osp.join(self.root_path, root_dir)
return QSortF... | [
"Show",
"tooltip",
"with",
"full",
"path",
"only",
"for",
"the",
"root",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1168-L1174 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"ToolTipRole",
":",
"root_dir",
"=",
"self",
".",
"path_list",
"[",
"0",
"]",
".",
"split",
"(",
"osp",
".",
"sep",
")",
"[",
"-",
"1",
"]",
"if",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilteredDirView.setup_proxy_model | Setup proxy model | spyder/plugins/explorer/widgets.py | def setup_proxy_model(self):
"""Setup proxy model"""
self.proxymodel = ProxyModel(self)
self.proxymodel.setSourceModel(self.fsmodel) | def setup_proxy_model(self):
"""Setup proxy model"""
self.proxymodel = ProxyModel(self)
self.proxymodel.setSourceModel(self.fsmodel) | [
"Setup",
"proxy",
"model"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1185-L1188 | [
"def",
"setup_proxy_model",
"(",
"self",
")",
":",
"self",
".",
"proxymodel",
"=",
"ProxyModel",
"(",
"self",
")",
"self",
".",
"proxymodel",
".",
"setSourceModel",
"(",
"self",
".",
"fsmodel",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilteredDirView.set_root_path | Set root path | spyder/plugins/explorer/widgets.py | def set_root_path(self, root_path):
"""Set root path"""
self.root_path = root_path
self.install_model()
index = self.fsmodel.setRootPath(root_path)
self.proxymodel.setup_filter(self.root_path, [])
self.setRootIndex(self.proxymodel.mapFromSource(index)) | def set_root_path(self, root_path):
"""Set root path"""
self.root_path = root_path
self.install_model()
index = self.fsmodel.setRootPath(root_path)
self.proxymodel.setup_filter(self.root_path, [])
self.setRootIndex(self.proxymodel.mapFromSource(index)) | [
"Set",
"root",
"path"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1195-L1201 | [
"def",
"set_root_path",
"(",
"self",
",",
"root_path",
")",
":",
"self",
".",
"root_path",
"=",
"root_path",
"self",
".",
"install_model",
"(",
")",
"index",
"=",
"self",
".",
"fsmodel",
".",
"setRootPath",
"(",
"root_path",
")",
"self",
".",
"proxymodel",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilteredDirView.get_index | Return index associated with filename | spyder/plugins/explorer/widgets.py | def get_index(self, filename):
"""Return index associated with filename"""
index = self.fsmodel.index(filename)
if index.isValid() and index.model() is self.fsmodel:
return self.proxymodel.mapFromSource(index) | def get_index(self, filename):
"""Return index associated with filename"""
index = self.fsmodel.index(filename)
if index.isValid() and index.model() is self.fsmodel:
return self.proxymodel.mapFromSource(index) | [
"Return",
"index",
"associated",
"with",
"filename"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1203-L1207 | [
"def",
"get_index",
"(",
"self",
",",
"filename",
")",
":",
"index",
"=",
"self",
".",
"fsmodel",
".",
"index",
"(",
"filename",
")",
"if",
"index",
".",
"isValid",
"(",
")",
"and",
"index",
".",
"model",
"(",
")",
"is",
"self",
".",
"fsmodel",
":"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilteredDirView.set_folder_names | Set folder names | spyder/plugins/explorer/widgets.py | def set_folder_names(self, folder_names):
"""Set folder names"""
assert self.root_path is not None
path_list = [osp.join(self.root_path, dirname)
for dirname in folder_names]
self.proxymodel.setup_filter(self.root_path, path_list) | def set_folder_names(self, folder_names):
"""Set folder names"""
assert self.root_path is not None
path_list = [osp.join(self.root_path, dirname)
for dirname in folder_names]
self.proxymodel.setup_filter(self.root_path, path_list) | [
"Set",
"folder",
"names"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1209-L1214 | [
"def",
"set_folder_names",
"(",
"self",
",",
"folder_names",
")",
":",
"assert",
"self",
".",
"root_path",
"is",
"not",
"None",
"path_list",
"=",
"[",
"osp",
".",
"join",
"(",
"self",
".",
"root_path",
",",
"dirname",
")",
"for",
"dirname",
"in",
"folder... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilteredDirView.get_filename | Return filename from index | spyder/plugins/explorer/widgets.py | def get_filename(self, index):
"""Return filename from index"""
if index:
path = self.fsmodel.filePath(self.proxymodel.mapToSource(index))
return osp.normpath(to_text_string(path)) | def get_filename(self, index):
"""Return filename from index"""
if index:
path = self.fsmodel.filePath(self.proxymodel.mapToSource(index))
return osp.normpath(to_text_string(path)) | [
"Return",
"filename",
"from",
"index"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1216-L1220 | [
"def",
"get_filename",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
":",
"path",
"=",
"self",
".",
"fsmodel",
".",
"filePath",
"(",
"self",
".",
"proxymodel",
".",
"mapToSource",
"(",
"index",
")",
")",
"return",
"osp",
".",
"normpath",
"(",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilteredDirView.setup_project_view | Setup view for projects | spyder/plugins/explorer/widgets.py | def setup_project_view(self):
"""Setup view for projects"""
for i in [1, 2, 3]:
self.hideColumn(i)
self.setHeaderHidden(True)
# Disable the view of .spyproject.
self.filter_directories() | def setup_project_view(self):
"""Setup view for projects"""
for i in [1, 2, 3]:
self.hideColumn(i)
self.setHeaderHidden(True)
# Disable the view of .spyproject.
self.filter_directories() | [
"Setup",
"view",
"for",
"projects"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1222-L1228 | [
"def",
"setup_project_view",
"(",
"self",
")",
":",
"for",
"i",
"in",
"[",
"1",
",",
"2",
",",
"3",
"]",
":",
"self",
".",
"hideColumn",
"(",
"i",
")",
"self",
".",
"setHeaderHidden",
"(",
"True",
")",
"# Disable the view of .spyproject. \r",
"self",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.setup_common_actions | Setup context menu common actions | spyder/plugins/explorer/widgets.py | def setup_common_actions(self):
"""Setup context menu common actions"""
actions = super(ExplorerTreeWidget, self).setup_common_actions()
if self.show_cd_only is None:
# Enabling the 'show current directory only' option but do not
# allow the user to disable it
... | def setup_common_actions(self):
"""Setup context menu common actions"""
actions = super(ExplorerTreeWidget, self).setup_common_actions()
if self.show_cd_only is None:
# Enabling the 'show current directory only' option but do not
# allow the user to disable it
... | [
"Setup",
"context",
"menu",
"common",
"actions"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1257-L1272 | [
"def",
"setup_common_actions",
"(",
"self",
")",
":",
"actions",
"=",
"super",
"(",
"ExplorerTreeWidget",
",",
"self",
")",
".",
"setup_common_actions",
"(",
")",
"if",
"self",
".",
"show_cd_only",
"is",
"None",
":",
"# Enabling the 'show current directory only' opt... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.toggle_show_cd_only | Toggle show current directory only mode | spyder/plugins/explorer/widgets.py | def toggle_show_cd_only(self, checked):
"""Toggle show current directory only mode"""
self.parent_widget.sig_option_changed.emit('show_cd_only', checked)
self.show_cd_only = checked
if checked:
if self.__last_folder is not None:
self.set_current_folder(s... | def toggle_show_cd_only(self, checked):
"""Toggle show current directory only mode"""
self.parent_widget.sig_option_changed.emit('show_cd_only', checked)
self.show_cd_only = checked
if checked:
if self.__last_folder is not None:
self.set_current_folder(s... | [
"Toggle",
"show",
"current",
"directory",
"only",
"mode"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1275-L1283 | [
"def",
"toggle_show_cd_only",
"(",
"self",
",",
"checked",
")",
":",
"self",
".",
"parent_widget",
".",
"sig_option_changed",
".",
"emit",
"(",
"'show_cd_only'",
",",
"checked",
")",
"self",
".",
"show_cd_only",
"=",
"checked",
"if",
"checked",
":",
"if",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.set_current_folder | Set current folder and return associated model index | spyder/plugins/explorer/widgets.py | def set_current_folder(self, folder):
"""Set current folder and return associated model index"""
index = self.fsmodel.setRootPath(folder)
self.__last_folder = folder
if self.show_cd_only:
if self.__original_root_index is None:
self.__original_root_index ... | def set_current_folder(self, folder):
"""Set current folder and return associated model index"""
index = self.fsmodel.setRootPath(folder)
self.__last_folder = folder
if self.show_cd_only:
if self.__original_root_index is None:
self.__original_root_index ... | [
"Set",
"current",
"folder",
"and",
"return",
"associated",
"model",
"index"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1286-L1294 | [
"def",
"set_current_folder",
"(",
"self",
",",
"folder",
")",
":",
"index",
"=",
"self",
".",
"fsmodel",
".",
"setRootPath",
"(",
"folder",
")",
"self",
".",
"__last_folder",
"=",
"folder",
"if",
"self",
".",
"show_cd_only",
":",
"if",
"self",
".",
"__or... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.refresh | Refresh widget
force=False: won't refresh widget if path has not changed | spyder/plugins/explorer/widgets.py | def refresh(self, new_path=None, force_current=False):
"""Refresh widget
force=False: won't refresh widget if path has not changed"""
if new_path is None:
new_path = getcwd_or_home()
if force_current:
index = self.set_current_folder(new_path)
se... | def refresh(self, new_path=None, force_current=False):
"""Refresh widget
force=False: won't refresh widget if path has not changed"""
if new_path is None:
new_path = getcwd_or_home()
if force_current:
index = self.set_current_folder(new_path)
se... | [
"Refresh",
"widget",
"force",
"=",
"False",
":",
"won",
"t",
"refresh",
"widget",
"if",
"path",
"has",
"not",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1299-L1313 | [
"def",
"refresh",
"(",
"self",
",",
"new_path",
"=",
"None",
",",
"force_current",
"=",
"False",
")",
":",
"if",
"new_path",
"is",
"None",
":",
"new_path",
"=",
"getcwd_or_home",
"(",
")",
"if",
"force_current",
":",
"index",
"=",
"self",
".",
"set_curre... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.go_to_parent_directory | Go to parent directory | spyder/plugins/explorer/widgets.py | def go_to_parent_directory(self):
"""Go to parent directory"""
self.chdir(osp.abspath(osp.join(getcwd_or_home(), os.pardir))) | def go_to_parent_directory(self):
"""Go to parent directory"""
self.chdir(osp.abspath(osp.join(getcwd_or_home(), os.pardir))) | [
"Go",
"to",
"parent",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1322-L1324 | [
"def",
"go_to_parent_directory",
"(",
"self",
")",
":",
"self",
".",
"chdir",
"(",
"osp",
".",
"abspath",
"(",
"osp",
".",
"join",
"(",
"getcwd_or_home",
"(",
")",
",",
"os",
".",
"pardir",
")",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.update_history | Update browse history | spyder/plugins/explorer/widgets.py | def update_history(self, directory):
"""Update browse history"""
try:
directory = osp.abspath(to_text_string(directory))
if directory in self.history:
self.histindex = self.history.index(directory)
except Exception:
user_directory = get_... | def update_history(self, directory):
"""Update browse history"""
try:
directory = osp.abspath(to_text_string(directory))
if directory in self.history:
self.histindex = self.history.index(directory)
except Exception:
user_directory = get_... | [
"Update",
"browse",
"history"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1338-L1346 | [
"def",
"update_history",
"(",
"self",
",",
"directory",
")",
":",
"try",
":",
"directory",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",
"(",
"directory",
")",
")",
"if",
"directory",
"in",
"self",
".",
"history",
":",
"self",
".",
"histindex",
"=",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerTreeWidget.chdir | Set directory as working directory | spyder/plugins/explorer/widgets.py | def chdir(self, directory=None, browsing_history=False):
"""Set directory as working directory"""
if directory is not None:
directory = osp.abspath(to_text_string(directory))
if browsing_history:
directory = self.history[self.histindex]
elif directory in sel... | def chdir(self, directory=None, browsing_history=False):
"""Set directory as working directory"""
if directory is not None:
directory = osp.abspath(to_text_string(directory))
if browsing_history:
directory = self.history[self.histindex]
elif directory in sel... | [
"Set",
"directory",
"as",
"working",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1348-L1385 | [
"def",
"chdir",
"(",
"self",
",",
"directory",
"=",
"None",
",",
"browsing_history",
"=",
"False",
")",
":",
"if",
"directory",
"is",
"not",
"None",
":",
"directory",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",
"(",
"directory",
")",
")",
"if",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ExplorerWidget.toggle_icontext | Toggle icon text | spyder/plugins/explorer/widgets.py | def toggle_icontext(self, state):
"""Toggle icon text"""
self.sig_option_changed.emit('show_icontext', state)
for widget in self.action_widgets:
if widget is not self.button_menu:
if state:
widget.setToolButtonStyle(Qt.ToolButtonTextBesideIco... | def toggle_icontext(self, state):
"""Toggle icon text"""
self.sig_option_changed.emit('show_icontext', state)
for widget in self.action_widgets:
if widget is not self.button_menu:
if state:
widget.setToolButtonStyle(Qt.ToolButtonTextBesideIco... | [
"Toggle",
"icon",
"text"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L1463-L1471 | [
"def",
"toggle_icontext",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"sig_option_changed",
".",
"emit",
"(",
"'show_icontext'",
",",
"state",
")",
"for",
"widget",
"in",
"self",
".",
"action_widgets",
":",
"if",
"widget",
"is",
"not",
"self",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BreakpointTableModel.set_data | Set model data | spyder/plugins/breakpoints/widgets/breakpointsgui.py | def set_data(self, data):
"""Set model data"""
self._data = data
keys = list(data.keys())
self.breakpoints = []
for key in keys:
bp_list = data[key]
if bp_list:
for item in data[key]:
self.breakpoints.append((ke... | def set_data(self, data):
"""Set model data"""
self._data = data
keys = list(data.keys())
self.breakpoints = []
for key in keys:
bp_list = data[key]
if bp_list:
for item in data[key]:
self.breakpoints.append((ke... | [
"Set",
"model",
"data"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/breakpoints/widgets/breakpointsgui.py#L57-L67 | [
"def",
"set_data",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_data",
"=",
"data",
"keys",
"=",
"list",
"(",
"data",
".",
"keys",
"(",
")",
")",
"self",
".",
"breakpoints",
"=",
"[",
"]",
"for",
"key",
"in",
"keys",
":",
"bp_list",
"=",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BreakpointTableModel.sort | Overriding sort method | spyder/plugins/breakpoints/widgets/breakpointsgui.py | def sort(self, column, order=Qt.DescendingOrder):
"""Overriding sort method"""
if column == 0:
self.breakpoints.sort(
key=lambda breakpoint: breakpoint[1])
self.breakpoints.sort(
key=lambda breakpoint: osp.basename(breakpoint[0]))
el... | def sort(self, column, order=Qt.DescendingOrder):
"""Overriding sort method"""
if column == 0:
self.breakpoints.sort(
key=lambda breakpoint: breakpoint[1])
self.breakpoints.sort(
key=lambda breakpoint: osp.basename(breakpoint[0]))
el... | [
"Overriding",
"sort",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/breakpoints/widgets/breakpointsgui.py#L77-L90 | [
"def",
"sort",
"(",
"self",
",",
"column",
",",
"order",
"=",
"Qt",
".",
"DescendingOrder",
")",
":",
"if",
"column",
"==",
"0",
":",
"self",
".",
"breakpoints",
".",
"sort",
"(",
"key",
"=",
"lambda",
"breakpoint",
":",
"breakpoint",
"[",
"1",
"]",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BreakpointTableModel.data | Return data at table index | spyder/plugins/breakpoints/widgets/breakpointsgui.py | def data(self, index, role=Qt.DisplayRole):
"""Return data at table index"""
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole:
if index.column() == 0:
value = osp.basename(self.get_value(index))
return to_qvaria... | def data(self, index, role=Qt.DisplayRole):
"""Return data at table index"""
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole:
if index.column() == 0:
value = osp.basename(self.get_value(index))
return to_qvaria... | [
"Return",
"data",
"at",
"table",
"index"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/breakpoints/widgets/breakpointsgui.py#L107-L125 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"to_qvariant",
"(",
")",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
":",
"if",
"index"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BreakpointTableView.setup_table | Setup table | spyder/plugins/breakpoints/widgets/breakpointsgui.py | def setup_table(self):
"""Setup table"""
self.horizontalHeader().setStretchLastSection(True)
self.adjust_columns()
self.columnAt(0)
# Sorting columns
self.setSortingEnabled(False)
self.sortByColumn(0, Qt.DescendingOrder) | def setup_table(self):
"""Setup table"""
self.horizontalHeader().setStretchLastSection(True)
self.adjust_columns()
self.columnAt(0)
# Sorting columns
self.setSortingEnabled(False)
self.sortByColumn(0, Qt.DescendingOrder) | [
"Setup",
"table"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/breakpoints/widgets/breakpointsgui.py#L152-L159 | [
"def",
"setup_table",
"(",
"self",
")",
":",
"self",
".",
"horizontalHeader",
"(",
")",
".",
"setStretchLastSection",
"(",
"True",
")",
"self",
".",
"adjust_columns",
"(",
")",
"self",
".",
"columnAt",
"(",
"0",
")",
"# Sorting columns\r",
"self",
".",
"se... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BreakpointTableView.mouseDoubleClickEvent | Reimplement Qt method | spyder/plugins/breakpoints/widgets/breakpointsgui.py | def mouseDoubleClickEvent(self, event):
"""Reimplement Qt method"""
index_clicked = self.indexAt(event.pos())
if self.model.breakpoints:
filename = self.model.breakpoints[index_clicked.row()][0]
line_number_str = self.model.breakpoints[index_clicked.row()][1]
... | def mouseDoubleClickEvent(self, event):
"""Reimplement Qt method"""
index_clicked = self.indexAt(event.pos())
if self.model.breakpoints:
filename = self.model.breakpoints[index_clicked.row()][0]
line_number_str = self.model.breakpoints[index_clicked.row()][1]
... | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/breakpoints/widgets/breakpointsgui.py#L166-L174 | [
"def",
"mouseDoubleClickEvent",
"(",
"self",
",",
"event",
")",
":",
"index_clicked",
"=",
"self",
".",
"indexAt",
"(",
"event",
".",
"pos",
"(",
")",
")",
"if",
"self",
".",
"model",
".",
"breakpoints",
":",
"filename",
"=",
"self",
".",
"model",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPManager.get_languages | Get the list of languages we need to start servers and create
clients for. | spyder/plugins/editor/lsp/manager.py | def get_languages(self):
"""
Get the list of languages we need to start servers and create
clients for.
"""
languages = ['python']
all_options = CONF.options(self.CONF_SECTION)
for option in all_options:
if option in [l.lower() for l in LSP_LANGUAGES]:... | def get_languages(self):
"""
Get the list of languages we need to start servers and create
clients for.
"""
languages = ['python']
all_options = CONF.options(self.CONF_SECTION)
for option in all_options:
if option in [l.lower() for l in LSP_LANGUAGES]:... | [
"Get",
"the",
"list",
"of",
"languages",
"we",
"need",
"to",
"start",
"servers",
"and",
"create",
"clients",
"for",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/manager.py#L68-L78 | [
"def",
"get_languages",
"(",
"self",
")",
":",
"languages",
"=",
"[",
"'python'",
"]",
"all_options",
"=",
"CONF",
".",
"options",
"(",
"self",
".",
"CONF_SECTION",
")",
"for",
"option",
"in",
"all_options",
":",
"if",
"option",
"in",
"[",
"l",
".",
"l... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPManager.get_root_path | Get root path to pass to the LSP servers.
This can be the current project path or the output of
getcwd_or_home (except for Python, see below). | spyder/plugins/editor/lsp/manager.py | def get_root_path(self, language):
"""
Get root path to pass to the LSP servers.
This can be the current project path or the output of
getcwd_or_home (except for Python, see below).
"""
path = None
# Get path of the current project
if self.main and self.... | def get_root_path(self, language):
"""
Get root path to pass to the LSP servers.
This can be the current project path or the output of
getcwd_or_home (except for Python, see below).
"""
path = None
# Get path of the current project
if self.main and self.... | [
"Get",
"root",
"path",
"to",
"pass",
"to",
"the",
"LSP",
"servers",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/manager.py#L87-L115 | [
"def",
"get_root_path",
"(",
"self",
",",
"language",
")",
":",
"path",
"=",
"None",
"# Get path of the current project",
"if",
"self",
".",
"main",
"and",
"self",
".",
"main",
".",
"projects",
":",
"path",
"=",
"self",
".",
"main",
".",
"projects",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPManager.reinitialize_all_clients | Send a new initialize message to each LSP server when the project
path has changed so they can update the respective server root paths. | spyder/plugins/editor/lsp/manager.py | def reinitialize_all_clients(self):
"""
Send a new initialize message to each LSP server when the project
path has changed so they can update the respective server root paths.
"""
for language in self.clients:
language_client = self.clients[language]
if la... | def reinitialize_all_clients(self):
"""
Send a new initialize message to each LSP server when the project
path has changed so they can update the respective server root paths.
"""
for language in self.clients:
language_client = self.clients[language]
if la... | [
"Send",
"a",
"new",
"initialize",
"message",
"to",
"each",
"LSP",
"server",
"when",
"the",
"project",
"path",
"has",
"changed",
"so",
"they",
"can",
"update",
"the",
"respective",
"server",
"root",
"paths",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/manager.py#L118-L129 | [
"def",
"reinitialize_all_clients",
"(",
"self",
")",
":",
"for",
"language",
"in",
"self",
".",
"clients",
":",
"language_client",
"=",
"self",
".",
"clients",
"[",
"language",
"]",
"if",
"language_client",
"[",
"'status'",
"]",
"==",
"self",
".",
"RUNNING",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPManager.start_client | Start an LSP client for a given language. | spyder/plugins/editor/lsp/manager.py | def start_client(self, language):
"""Start an LSP client for a given language."""
started = False
if language in self.clients:
language_client = self.clients[language]
queue = self.register_queue[language]
# Don't start LSP services when testing unless we dem... | def start_client(self, language):
"""Start an LSP client for a given language."""
started = False
if language in self.clients:
language_client = self.clients[language]
queue = self.register_queue[language]
# Don't start LSP services when testing unless we dem... | [
"Start",
"an",
"LSP",
"client",
"for",
"a",
"given",
"language",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/manager.py#L131-L172 | [
"def",
"start_client",
"(",
"self",
",",
"language",
")",
":",
"started",
"=",
"False",
"if",
"language",
"in",
"self",
".",
"clients",
":",
"language_client",
"=",
"self",
".",
"clients",
"[",
"language",
"]",
"queue",
"=",
"self",
".",
"register_queue",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPManager.generate_python_config | Update Python server configuration with the options saved in our
config system. | spyder/plugins/editor/lsp/manager.py | def generate_python_config(self):
"""
Update Python server configuration with the options saved in our
config system.
"""
python_config = PYTHON_CONFIG.copy()
# Server options
cmd = self.get_option('advanced/command_launch')
host = self.get_option('advanc... | def generate_python_config(self):
"""
Update Python server configuration with the options saved in our
config system.
"""
python_config = PYTHON_CONFIG.copy()
# Server options
cmd = self.get_option('advanced/command_launch')
host = self.get_option('advanc... | [
"Update",
"Python",
"server",
"configuration",
"with",
"the",
"options",
"saved",
"in",
"our",
"config",
"system",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/manager.py#L230-L326 | [
"def",
"generate_python_config",
"(",
"self",
")",
":",
"python_config",
"=",
"PYTHON_CONFIG",
".",
"copy",
"(",
")",
"# Server options",
"cmd",
"=",
"self",
".",
"get_option",
"(",
"'advanced/command_launch'",
")",
"host",
"=",
"self",
".",
"get_option",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | HistoryConfigPage.setup_page | Setup config page widgets and options. | spyder/plugins/history/confpage.py | def setup_page(self):
"""Setup config page widgets and options."""
settings_group = QGroupBox(_("Settings"))
hist_spin = self.create_spinbox(
_("History depth: "), _(" entries"),
'max_entries', min_=10, max_=10000, step=10,
... | def setup_page(self):
"""Setup config page widgets and options."""
settings_group = QGroupBox(_("Settings"))
hist_spin = self.create_spinbox(
_("History depth: "), _(" entries"),
'max_entries', min_=10, max_=10000, step=10,
... | [
"Setup",
"config",
"page",
"widgets",
"and",
"options",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/history/confpage.py#L25-L54 | [
"def",
"setup_page",
"(",
"self",
")",
":",
"settings_group",
"=",
"QGroupBox",
"(",
"_",
"(",
"\"Settings\"",
")",
")",
"hist_spin",
"=",
"self",
".",
"create_spinbox",
"(",
"_",
"(",
"\"History depth: \"",
")",
",",
"_",
"(",
"\" entries\"",
")",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | transcode | Transcode a text string | spyder/utils/encoding.py | def transcode(text, input=PREFERRED_ENCODING, output=PREFERRED_ENCODING):
"""Transcode a text string"""
try:
return text.decode("cp437").encode("cp1252")
except UnicodeError:
try:
return text.decode("cp437").encode(output)
except UnicodeError:
return t... | def transcode(text, input=PREFERRED_ENCODING, output=PREFERRED_ENCODING):
"""Transcode a text string"""
try:
return text.decode("cp437").encode("cp1252")
except UnicodeError:
try:
return text.decode("cp437").encode(output)
except UnicodeError:
return t... | [
"Transcode",
"a",
"text",
"string"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L33-L41 | [
"def",
"transcode",
"(",
"text",
",",
"input",
"=",
"PREFERRED_ENCODING",
",",
"output",
"=",
"PREFERRED_ENCODING",
")",
":",
"try",
":",
"return",
"text",
".",
"decode",
"(",
"\"cp437\"",
")",
".",
"encode",
"(",
"\"cp1252\"",
")",
"except",
"UnicodeError",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | to_unicode_from_fs | Return a unicode version of string decoded using the file system encoding. | spyder/utils/encoding.py | def to_unicode_from_fs(string):
"""
Return a unicode version of string decoded using the file system encoding.
"""
if not is_string(string): # string is a QString
string = to_text_string(string.toUtf8(), 'utf-8')
else:
if is_binary_string(string):
try:
... | def to_unicode_from_fs(string):
"""
Return a unicode version of string decoded using the file system encoding.
"""
if not is_string(string): # string is a QString
string = to_text_string(string.toUtf8(), 'utf-8')
else:
if is_binary_string(string):
try:
... | [
"Return",
"a",
"unicode",
"version",
"of",
"string",
"decoded",
"using",
"the",
"file",
"system",
"encoding",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L63-L77 | [
"def",
"to_unicode_from_fs",
"(",
"string",
")",
":",
"if",
"not",
"is_string",
"(",
"string",
")",
":",
"# string is a QString\r",
"string",
"=",
"to_text_string",
"(",
"string",
".",
"toUtf8",
"(",
")",
",",
"'utf-8'",
")",
"else",
":",
"if",
"is_binary_st... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | to_fs_from_unicode | Return a byte string version of unic encoded using the file
system encoding. | spyder/utils/encoding.py | def to_fs_from_unicode(unic):
"""
Return a byte string version of unic encoded using the file
system encoding.
"""
if is_unicode(unic):
try:
string = unic.encode(FS_ENCODING)
except (UnicodeError, TypeError):
pass
else:
return s... | def to_fs_from_unicode(unic):
"""
Return a byte string version of unic encoded using the file
system encoding.
"""
if is_unicode(unic):
try:
string = unic.encode(FS_ENCODING)
except (UnicodeError, TypeError):
pass
else:
return s... | [
"Return",
"a",
"byte",
"string",
"version",
"of",
"unic",
"encoded",
"using",
"the",
"file",
"system",
"encoding",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L79-L91 | [
"def",
"to_fs_from_unicode",
"(",
"unic",
")",
":",
"if",
"is_unicode",
"(",
"unic",
")",
":",
"try",
":",
"string",
"=",
"unic",
".",
"encode",
"(",
"FS_ENCODING",
")",
"except",
"(",
"UnicodeError",
",",
"TypeError",
")",
":",
"pass",
"else",
":",
"r... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_coding | Function to get the coding of a text.
@param text text to inspect (string)
@return coding string | spyder/utils/encoding.py | def get_coding(text, force_chardet=False):
"""
Function to get the coding of a text.
@param text text to inspect (string)
@return coding string
"""
if not force_chardet:
for line in text.splitlines()[:2]:
try:
result = CODING_RE.search(to_text_string(... | def get_coding(text, force_chardet=False):
"""
Function to get the coding of a text.
@param text text to inspect (string)
@return coding string
"""
if not force_chardet:
for line in text.splitlines()[:2]:
try:
result = CODING_RE.search(to_text_string(... | [
"Function",
"to",
"get",
"the",
"coding",
"of",
"a",
"text",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L107-L140 | [
"def",
"get_coding",
"(",
"text",
",",
"force_chardet",
"=",
"False",
")",
":",
"if",
"not",
"force_chardet",
":",
"for",
"line",
"in",
"text",
".",
"splitlines",
"(",
")",
"[",
":",
"2",
"]",
":",
"try",
":",
"result",
"=",
"CODING_RE",
".",
"search... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | decode | Function to decode a text.
@param text text to decode (string)
@return decoded text and encoding | spyder/utils/encoding.py | def decode(text):
"""
Function to decode a text.
@param text text to decode (string)
@return decoded text and encoding
"""
try:
if text.startswith(BOM_UTF8):
# UTF-8 with BOM
return to_text_string(text[len(BOM_UTF8):], 'utf-8'), 'utf-8-bom'
elif ... | def decode(text):
"""
Function to decode a text.
@param text text to decode (string)
@return decoded text and encoding
"""
try:
if text.startswith(BOM_UTF8):
# UTF-8 with BOM
return to_text_string(text[len(BOM_UTF8):], 'utf-8'), 'utf-8-bom'
elif ... | [
"Function",
"to",
"decode",
"a",
"text",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L142-L169 | [
"def",
"decode",
"(",
"text",
")",
":",
"try",
":",
"if",
"text",
".",
"startswith",
"(",
"BOM_UTF8",
")",
":",
"# UTF-8 with BOM\r",
"return",
"to_text_string",
"(",
"text",
"[",
"len",
"(",
"BOM_UTF8",
")",
":",
"]",
",",
"'utf-8'",
")",
",",
"'utf-8... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | to_unicode | Convert a string to unicode | spyder/utils/encoding.py | def to_unicode(string):
"""Convert a string to unicode"""
if not is_unicode(string):
for codec in CODECS:
try:
unic = to_text_string(string, codec)
except UnicodeError:
pass
except TypeError:
break
... | def to_unicode(string):
"""Convert a string to unicode"""
if not is_unicode(string):
for codec in CODECS:
try:
unic = to_text_string(string, codec)
except UnicodeError:
pass
except TypeError:
break
... | [
"Convert",
"a",
"string",
"to",
"unicode"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L213-L225 | [
"def",
"to_unicode",
"(",
"string",
")",
":",
"if",
"not",
"is_unicode",
"(",
"string",
")",
":",
"for",
"codec",
"in",
"CODECS",
":",
"try",
":",
"unic",
"=",
"to_text_string",
"(",
"string",
",",
"codec",
")",
"except",
"UnicodeError",
":",
"pass",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | write | Write 'text' to file ('filename') assuming 'encoding' in an atomic way
Return (eventually new) encoding | spyder/utils/encoding.py | def write(text, filename, encoding='utf-8', mode='wb'):
"""
Write 'text' to file ('filename') assuming 'encoding' in an atomic way
Return (eventually new) encoding
"""
text, encoding = encode(text, encoding)
if 'a' in mode:
with open(filename, mode) as textfile:
textf... | def write(text, filename, encoding='utf-8', mode='wb'):
"""
Write 'text' to file ('filename') assuming 'encoding' in an atomic way
Return (eventually new) encoding
"""
text, encoding = encode(text, encoding)
if 'a' in mode:
with open(filename, mode) as textfile:
textf... | [
"Write",
"text",
"to",
"file",
"(",
"filename",
")",
"assuming",
"encoding",
"in",
"an",
"atomic",
"way",
"Return",
"(",
"eventually",
"new",
")",
"encoding"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L228-L242 | [
"def",
"write",
"(",
"text",
",",
"filename",
",",
"encoding",
"=",
"'utf-8'",
",",
"mode",
"=",
"'wb'",
")",
":",
"text",
",",
"encoding",
"=",
"encode",
"(",
"text",
",",
"encoding",
")",
"if",
"'a'",
"in",
"mode",
":",
"with",
"open",
"(",
"file... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | writelines | Write 'lines' to file ('filename') assuming 'encoding'
Return (eventually new) encoding | spyder/utils/encoding.py | def writelines(lines, filename, encoding='utf-8', mode='wb'):
"""
Write 'lines' to file ('filename') assuming 'encoding'
Return (eventually new) encoding
"""
return write(os.linesep.join(lines), filename, encoding, mode) | def writelines(lines, filename, encoding='utf-8', mode='wb'):
"""
Write 'lines' to file ('filename') assuming 'encoding'
Return (eventually new) encoding
"""
return write(os.linesep.join(lines), filename, encoding, mode) | [
"Write",
"lines",
"to",
"file",
"(",
"filename",
")",
"assuming",
"encoding",
"Return",
"(",
"eventually",
"new",
")",
"encoding"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L245-L250 | [
"def",
"writelines",
"(",
"lines",
",",
"filename",
",",
"encoding",
"=",
"'utf-8'",
",",
"mode",
"=",
"'wb'",
")",
":",
"return",
"write",
"(",
"os",
".",
"linesep",
".",
"join",
"(",
"lines",
")",
",",
"filename",
",",
"encoding",
",",
"mode",
")"
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | read | Read text from file ('filename')
Return text and encoding | spyder/utils/encoding.py | def read(filename, encoding='utf-8'):
"""
Read text from file ('filename')
Return text and encoding
"""
text, encoding = decode( open(filename, 'rb').read() )
return text, encoding | def read(filename, encoding='utf-8'):
"""
Read text from file ('filename')
Return text and encoding
"""
text, encoding = decode( open(filename, 'rb').read() )
return text, encoding | [
"Read",
"text",
"from",
"file",
"(",
"filename",
")",
"Return",
"text",
"and",
"encoding"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L252-L258 | [
"def",
"read",
"(",
"filename",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"text",
",",
"encoding",
"=",
"decode",
"(",
"open",
"(",
"filename",
",",
"'rb'",
")",
".",
"read",
"(",
")",
")",
"return",
"text",
",",
"encoding"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | readlines | Read lines from file ('filename')
Return lines and encoding | spyder/utils/encoding.py | def readlines(filename, encoding='utf-8'):
"""
Read lines from file ('filename')
Return lines and encoding
"""
text, encoding = read(filename, encoding)
return text.split(os.linesep), encoding | def readlines(filename, encoding='utf-8'):
"""
Read lines from file ('filename')
Return lines and encoding
"""
text, encoding = read(filename, encoding)
return text.split(os.linesep), encoding | [
"Read",
"lines",
"from",
"file",
"(",
"filename",
")",
"Return",
"lines",
"and",
"encoding"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/encoding.py#L260-L266 | [
"def",
"readlines",
"(",
"filename",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"text",
",",
"encoding",
"=",
"read",
"(",
"filename",
",",
"encoding",
")",
"return",
"text",
".",
"split",
"(",
"os",
".",
"linesep",
")",
",",
"encoding"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | _get_pygments_extensions | Return all file type extensions supported by Pygments | spyder/config/utils.py | def _get_pygments_extensions():
"""Return all file type extensions supported by Pygments"""
# NOTE: Leave this import here to keep startup process fast!
import pygments.lexers as lexers
extensions = []
for lx in lexers.get_all_lexers():
lexer_exts = lx[2]
if lexer_exts:
... | def _get_pygments_extensions():
"""Return all file type extensions supported by Pygments"""
# NOTE: Leave this import here to keep startup process fast!
import pygments.lexers as lexers
extensions = []
for lx in lexers.get_all_lexers():
lexer_exts = lx[2]
if lexer_exts:
... | [
"Return",
"all",
"file",
"type",
"extensions",
"supported",
"by",
"Pygments"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/utils.py#L82-L102 | [
"def",
"_get_pygments_extensions",
"(",
")",
":",
"# NOTE: Leave this import here to keep startup process fast!",
"import",
"pygments",
".",
"lexers",
"as",
"lexers",
"extensions",
"=",
"[",
"]",
"for",
"lx",
"in",
"lexers",
".",
"get_all_lexers",
"(",
")",
":",
"le... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_filter | Return filter associated to file extension | spyder/config/utils.py | def get_filter(filetypes, ext):
"""Return filter associated to file extension"""
if not ext:
return ALL_FILTER
for title, ftypes in filetypes:
if ext in ftypes:
return _create_filter(title, ftypes)
else:
return '' | def get_filter(filetypes, ext):
"""Return filter associated to file extension"""
if not ext:
return ALL_FILTER
for title, ftypes in filetypes:
if ext in ftypes:
return _create_filter(title, ftypes)
else:
return '' | [
"Return",
"filter",
"associated",
"to",
"file",
"extension"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/utils.py#L108-L116 | [
"def",
"get_filter",
"(",
"filetypes",
",",
"ext",
")",
":",
"if",
"not",
"ext",
":",
"return",
"ALL_FILTER",
"for",
"title",
",",
"ftypes",
"in",
"filetypes",
":",
"if",
"ext",
"in",
"ftypes",
":",
"return",
"_create_filter",
"(",
"title",
",",
"ftypes"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_edit_filetypes | Get all file types supported by the Editor | spyder/config/utils.py | def get_edit_filetypes():
"""Get all file types supported by the Editor"""
# The filter details are not hidden on Windows, so we can't use
# all Pygments extensions on that platform
if os.name == 'nt':
supported_exts = []
else:
try:
supported_exts = _get_pygments_extensio... | def get_edit_filetypes():
"""Get all file types supported by the Editor"""
# The filter details are not hidden on Windows, so we can't use
# all Pygments extensions on that platform
if os.name == 'nt':
supported_exts = []
else:
try:
supported_exts = _get_pygments_extensio... | [
"Get",
"all",
"file",
"types",
"supported",
"by",
"the",
"Editor"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/utils.py#L119-L140 | [
"def",
"get_edit_filetypes",
"(",
")",
":",
"# The filter details are not hidden on Windows, so we can't use",
"# all Pygments extensions on that platform",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"supported_exts",
"=",
"[",
"]",
"else",
":",
"try",
":",
"supported_ex... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_ubuntu | Detect if we are running in an Ubuntu-based distribution | spyder/config/utils.py | def is_ubuntu():
"""Detect if we are running in an Ubuntu-based distribution"""
if sys.platform.startswith('linux') and osp.isfile('/etc/lsb-release'):
release_info = open('/etc/lsb-release').read()
if 'Ubuntu' in release_info:
return True
else:
return False
e... | def is_ubuntu():
"""Detect if we are running in an Ubuntu-based distribution"""
if sys.platform.startswith('linux') and osp.isfile('/etc/lsb-release'):
release_info = open('/etc/lsb-release').read()
if 'Ubuntu' in release_info:
return True
else:
return False
e... | [
"Detect",
"if",
"we",
"are",
"running",
"in",
"an",
"Ubuntu",
"-",
"based",
"distribution"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/utils.py#L164-L173 | [
"def",
"is_ubuntu",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'linux'",
")",
"and",
"osp",
".",
"isfile",
"(",
"'/etc/lsb-release'",
")",
":",
"release_info",
"=",
"open",
"(",
"'/etc/lsb-release'",
")",
".",
"read",
"(",
")",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_gtk_desktop | Detect if we are running in a Gtk-based desktop | spyder/config/utils.py | def is_gtk_desktop():
"""Detect if we are running in a Gtk-based desktop"""
if sys.platform.startswith('linux'):
xdg_desktop = os.environ.get('XDG_CURRENT_DESKTOP', '')
if xdg_desktop:
gtk_desktops = ['Unity', 'GNOME', 'XFCE']
if any([xdg_desktop.startswith(d) for d in gt... | def is_gtk_desktop():
"""Detect if we are running in a Gtk-based desktop"""
if sys.platform.startswith('linux'):
xdg_desktop = os.environ.get('XDG_CURRENT_DESKTOP', '')
if xdg_desktop:
gtk_desktops = ['Unity', 'GNOME', 'XFCE']
if any([xdg_desktop.startswith(d) for d in gt... | [
"Detect",
"if",
"we",
"are",
"running",
"in",
"a",
"Gtk",
"-",
"based",
"desktop"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/utils.py#L176-L189 | [
"def",
"is_gtk_desktop",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'linux'",
")",
":",
"xdg_desktop",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'XDG_CURRENT_DESKTOP'",
",",
"''",
")",
"if",
"xdg_desktop",
":",
"gtk_desktops",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_kde_desktop | Detect if we are running in a KDE desktop | spyder/config/utils.py | def is_kde_desktop():
"""Detect if we are running in a KDE desktop"""
if sys.platform.startswith('linux'):
xdg_desktop = os.environ.get('XDG_CURRENT_DESKTOP', '')
if xdg_desktop:
if 'KDE' in xdg_desktop:
return True
else:
return False
... | def is_kde_desktop():
"""Detect if we are running in a KDE desktop"""
if sys.platform.startswith('linux'):
xdg_desktop = os.environ.get('XDG_CURRENT_DESKTOP', '')
if xdg_desktop:
if 'KDE' in xdg_desktop:
return True
else:
return False
... | [
"Detect",
"if",
"we",
"are",
"running",
"in",
"a",
"KDE",
"desktop"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/utils.py#L192-L204 | [
"def",
"is_kde_desktop",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'linux'",
")",
":",
"xdg_desktop",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'XDG_CURRENT_DESKTOP'",
",",
"''",
")",
"if",
"xdg_desktop",
":",
"if",
"'KDE'"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonProject._get_relative_pythonpath | Return PYTHONPATH list as relative paths | spyder/plugins/projects/projecttypes/python.py | def _get_relative_pythonpath(self):
"""Return PYTHONPATH list as relative paths"""
# Workaround to replace os.path.relpath (new in Python v2.6):
offset = len(self.root_path)+len(os.pathsep)
return [path[offset:] for path in self.pythonpath] | def _get_relative_pythonpath(self):
"""Return PYTHONPATH list as relative paths"""
# Workaround to replace os.path.relpath (new in Python v2.6):
offset = len(self.root_path)+len(os.pathsep)
return [path[offset:] for path in self.pythonpath] | [
"Return",
"PYTHONPATH",
"list",
"as",
"relative",
"paths"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/projecttypes/python.py#L23-L27 | [
"def",
"_get_relative_pythonpath",
"(",
"self",
")",
":",
"# Workaround to replace os.path.relpath (new in Python v2.6):\r",
"offset",
"=",
"len",
"(",
"self",
".",
"root_path",
")",
"+",
"len",
"(",
"os",
".",
"pathsep",
")",
"return",
"[",
"path",
"[",
"offset",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonProject._set_relative_pythonpath | Set PYTHONPATH list relative paths | spyder/plugins/projects/projecttypes/python.py | def _set_relative_pythonpath(self, value):
"""Set PYTHONPATH list relative paths"""
self.pythonpath = [osp.abspath(osp.join(self.root_path, path))
for path in value] | def _set_relative_pythonpath(self, value):
"""Set PYTHONPATH list relative paths"""
self.pythonpath = [osp.abspath(osp.join(self.root_path, path))
for path in value] | [
"Set",
"PYTHONPATH",
"list",
"relative",
"paths"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/projecttypes/python.py#L29-L32 | [
"def",
"_set_relative_pythonpath",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"pythonpath",
"=",
"[",
"osp",
".",
"abspath",
"(",
"osp",
".",
"join",
"(",
"self",
".",
"root_path",
",",
"path",
")",
")",
"for",
"path",
"in",
"value",
"]"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonProject.is_in_pythonpath | Return True if dirname is in project's PYTHONPATH | spyder/plugins/projects/projecttypes/python.py | def is_in_pythonpath(self, dirname):
"""Return True if dirname is in project's PYTHONPATH"""
return fixpath(dirname) in [fixpath(_p) for _p in self.pythonpath] | def is_in_pythonpath(self, dirname):
"""Return True if dirname is in project's PYTHONPATH"""
return fixpath(dirname) in [fixpath(_p) for _p in self.pythonpath] | [
"Return",
"True",
"if",
"dirname",
"is",
"in",
"project",
"s",
"PYTHONPATH"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/projecttypes/python.py#L38-L40 | [
"def",
"is_in_pythonpath",
"(",
"self",
",",
"dirname",
")",
":",
"return",
"fixpath",
"(",
"dirname",
")",
"in",
"[",
"fixpath",
"(",
"_p",
")",
"for",
"_p",
"in",
"self",
".",
"pythonpath",
"]"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonProject.remove_from_pythonpath | Remove path from project's PYTHONPATH
Return True if path was removed, False if it was not found | spyder/plugins/projects/projecttypes/python.py | def remove_from_pythonpath(self, path):
"""Remove path from project's PYTHONPATH
Return True if path was removed, False if it was not found"""
pathlist = self.get_pythonpath()
if path in pathlist:
pathlist.pop(pathlist.index(path))
self.set_pythonpath(pathli... | def remove_from_pythonpath(self, path):
"""Remove path from project's PYTHONPATH
Return True if path was removed, False if it was not found"""
pathlist = self.get_pythonpath()
if path in pathlist:
pathlist.pop(pathlist.index(path))
self.set_pythonpath(pathli... | [
"Remove",
"path",
"from",
"project",
"s",
"PYTHONPATH",
"Return",
"True",
"if",
"path",
"was",
"removed",
"False",
"if",
"it",
"was",
"not",
"found"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/projecttypes/python.py#L51-L60 | [
"def",
"remove_from_pythonpath",
"(",
"self",
",",
"path",
")",
":",
"pathlist",
"=",
"self",
".",
"get_pythonpath",
"(",
")",
"if",
"path",
"in",
"pathlist",
":",
"pathlist",
".",
"pop",
"(",
"pathlist",
".",
"index",
"(",
"path",
")",
")",
"self",
".... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonProject.add_to_pythonpath | Add path to project's PYTHONPATH
Return True if path was added, False if it was already there | spyder/plugins/projects/projecttypes/python.py | def add_to_pythonpath(self, path):
"""Add path to project's PYTHONPATH
Return True if path was added, False if it was already there"""
pathlist = self.get_pythonpath()
if path in pathlist:
return False
else:
pathlist.insert(0, path)
sel... | def add_to_pythonpath(self, path):
"""Add path to project's PYTHONPATH
Return True if path was added, False if it was already there"""
pathlist = self.get_pythonpath()
if path in pathlist:
return False
else:
pathlist.insert(0, path)
sel... | [
"Add",
"path",
"to",
"project",
"s",
"PYTHONPATH",
"Return",
"True",
"if",
"path",
"was",
"added",
"False",
"if",
"it",
"was",
"already",
"there"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/projecttypes/python.py#L62-L71 | [
"def",
"add_to_pythonpath",
"(",
"self",
",",
"path",
")",
":",
"pathlist",
"=",
"self",
".",
"get_pythonpath",
"(",
")",
"if",
"path",
"in",
"pathlist",
":",
"return",
"False",
"else",
":",
"pathlist",
".",
"insert",
"(",
"0",
",",
"path",
")",
"self"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_package_data | Return data files for package *name* with extensions in *extlist* | setup.py | def get_package_data(name, extlist):
"""Return data files for package *name* with extensions in *extlist*"""
flist = []
# Workaround to replace os.path.relpath (not available until Python 2.6):
offset = len(name)+len(os.pathsep)
for dirpath, _dirnames, filenames in os.walk(name):
for fname i... | def get_package_data(name, extlist):
"""Return data files for package *name* with extensions in *extlist*"""
flist = []
# Workaround to replace os.path.relpath (not available until Python 2.6):
offset = len(name)+len(os.pathsep)
for dirpath, _dirnames, filenames in os.walk(name):
for fname i... | [
"Return",
"data",
"files",
"for",
"package",
"*",
"name",
"*",
"with",
"extensions",
"in",
"*",
"extlist",
"*"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/setup.py#L63-L72 | [
"def",
"get_package_data",
"(",
"name",
",",
"extlist",
")",
":",
"flist",
"=",
"[",
"]",
"# Workaround to replace os.path.relpath (not available until Python 2.6):",
"offset",
"=",
"len",
"(",
"name",
")",
"+",
"len",
"(",
"os",
".",
"pathsep",
")",
"for",
"dir... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_subpackages | Return subpackages of package *name* | setup.py | def get_subpackages(name):
"""Return subpackages of package *name*"""
splist = []
for dirpath, _dirnames, _filenames in os.walk(name):
if osp.isfile(osp.join(dirpath, '__init__.py')):
splist.append(".".join(dirpath.split(os.sep)))
return splist | def get_subpackages(name):
"""Return subpackages of package *name*"""
splist = []
for dirpath, _dirnames, _filenames in os.walk(name):
if osp.isfile(osp.join(dirpath, '__init__.py')):
splist.append(".".join(dirpath.split(os.sep)))
return splist | [
"Return",
"subpackages",
"of",
"package",
"*",
"name",
"*"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/setup.py#L75-L81 | [
"def",
"get_subpackages",
"(",
"name",
")",
":",
"splist",
"=",
"[",
"]",
"for",
"dirpath",
",",
"_dirnames",
",",
"_filenames",
"in",
"os",
".",
"walk",
"(",
"name",
")",
":",
"if",
"osp",
".",
"isfile",
"(",
"osp",
".",
"join",
"(",
"dirpath",
",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_python_doc_path | Return Python documentation path
(Windows: return the PythonXX.chm path if available) | spyder/app/mainwindow.py | def get_python_doc_path():
"""
Return Python documentation path
(Windows: return the PythonXX.chm path if available)
"""
if os.name == 'nt':
doc_path = osp.join(sys.prefix, "Doc")
if not osp.isdir(doc_path):
return
python_chm = [path for path in os.listdi... | def get_python_doc_path():
"""
Return Python documentation path
(Windows: return the PythonXX.chm path if available)
"""
if os.name == 'nt':
doc_path = osp.join(sys.prefix, "Doc")
if not osp.isdir(doc_path):
return
python_chm = [path for path in os.listdi... | [
"Return",
"Python",
"documentation",
"path",
"(",
"Windows",
":",
"return",
"the",
"PythonXX",
".",
"chm",
"path",
"if",
"available",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L192-L210 | [
"def",
"get_python_doc_path",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"doc_path",
"=",
"osp",
".",
"join",
"(",
"sys",
".",
"prefix",
",",
"\"Doc\"",
")",
"if",
"not",
"osp",
".",
"isdir",
"(",
"doc_path",
")",
":",
"return",
"py... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | set_opengl_implementation | Set the OpenGL implementation used by Spyder.
See issue 7447 for the details. | spyder/app/mainwindow.py | def set_opengl_implementation(option):
"""
Set the OpenGL implementation used by Spyder.
See issue 7447 for the details.
"""
if option == 'software':
QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)
if QQuickWindow is not None:
QQuickWindow.setSceneGraphBa... | def set_opengl_implementation(option):
"""
Set the OpenGL implementation used by Spyder.
See issue 7447 for the details.
"""
if option == 'software':
QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)
if QQuickWindow is not None:
QQuickWindow.setSceneGraphBa... | [
"Set",
"the",
"OpenGL",
"implementation",
"used",
"by",
"Spyder",
".",
"See",
"issue",
"7447",
"for",
"the",
"details",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L213-L230 | [
"def",
"set_opengl_implementation",
"(",
"option",
")",
":",
"if",
"option",
"==",
"'software'",
":",
"QCoreApplication",
".",
"setAttribute",
"(",
"Qt",
".",
"AA_UseSoftwareOpenGL",
")",
"if",
"QQuickWindow",
"is",
"not",
"None",
":",
"QQuickWindow",
".",
"setS... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | setup_logging | Setup logging with cli options defined by the user. | spyder/app/mainwindow.py | 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):
"""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] -> %(... | [
"Setup",
"logging",
"with",
"cli",
"options",
"defined",
"by",
"the",
"user",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L233-L248 | [
"def",
"setup_logging",
"(",
"cli_options",
")",
":",
"if",
"cli_options",
".",
"debug_info",
"or",
"get_debug_level",
"(",
")",
">",
"0",
":",
"levels",
"=",
"{",
"2",
":",
"logging",
".",
"INFO",
",",
"3",
":",
"logging",
".",
"DEBUG",
"}",
"log_leve... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | qt_message_handler | 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... | spyder/app/mainwindow.py | 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):
"""
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... | [
"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",
... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L251-L266 | [
"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... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | initialize | Initialize Qt, patching sys.exit and eventually setting up ETS | spyder/app/mainwindow.py | 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():
"""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... | [
"Initialize",
"Qt",
"patching",
"sys",
".",
"exit",
"and",
"eventually",
"setting",
"up",
"ETS"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3210-L3253 | [
"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... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | run_spyder | Create and show Spyder's main window
Start QApplication event loop | spyder/app/mainwindow.py | 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):
"""
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:... | [
"Create",
"and",
"show",
"Spyder",
"s",
"main",
"window",
"Start",
"QApplication",
"event",
"loop"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3274-L3318 | [
"def",
"run_spyder",
"(",
"app",
",",
"options",
",",
"args",
")",
":",
"#TODO: insert here\r",
"# Main window\r",
"main",
"=",
"MainWindow",
"(",
"options",
")",
"try",
":",
"main",
".",
"setup",
"(",
")",
"except",
"BaseException",
":",
"if",
"main",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | main | Main function | spyder/app/mainwindow.py | 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():
"""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... | [
"Main",
"function"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L3324-L3453 | [
"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... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.create_toolbar | Create and return toolbar with *title* and *object_name* | spyder/app/mainwindow.py | 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):
"""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)
... | [
"Create",
"and",
"return",
"toolbar",
"with",
"*",
"title",
"*",
"and",
"*",
"object_name",
"*"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L585-L591 | [
"def",
"create_toolbar",
"(",
"self",
",",
"title",
",",
"object_name",
",",
"iconsize",
"=",
"24",
")",
":",
"toolbar",
"=",
"self",
".",
"addToolBar",
"(",
"title",
")",
"toolbar",
".",
"setObjectName",
"(",
"object_name",
")",
"toolbar",
".",
"setIconSi... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.setup | Setup main window | spyder/app/mainwindow.py | 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):
"""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':
... | [
"Setup",
"main",
"window"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L593-L1263 | [
"def",
"setup",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"*** Start of MainWindow setup ***\"",
")",
"logger",
".",
"info",
"(",
"\"Applying theme configuration...\"",
")",
"ui_theme",
"=",
"CONF",
".",
"get",
"(",
"'appearance'",
",",
"'ui_theme'",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.post_visible_setup | Actions to be performed only after the main window's `show` method
was triggered | spyder/app/mainwindow.py | 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):
"""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 ... | [
"Actions",
"to",
"be",
"performed",
"only",
"after",
"the",
"main",
"window",
"s",
"show",
"method",
"was",
"triggered"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1265-L1349 | [
"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",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.set_window_title | Set window title. | spyder/app/mainwindow.py | 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):
"""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:
... | [
"Set",
"window",
"title",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1351-L1374 | [
"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",
"]... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.report_missing_dependencies | Show a QMessageBox with a list of missing hard dependencies | spyder/app/mainwindow.py | 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):
"""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>"
... | [
"Show",
"a",
"QMessageBox",
"with",
"a",
"list",
"of",
"missing",
"hard",
"dependencies"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1376-L1393 | [
"def",
"report_missing_dependencies",
"(",
"self",
")",
":",
"missing_deps",
"=",
"dependencies",
".",
"missing_dependencies",
"(",
")",
"if",
"missing_deps",
":",
"QMessageBox",
".",
"critical",
"(",
"self",
",",
"_",
"(",
"'Error'",
")",
",",
"_",
"(",
"\"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.load_window_settings | Load window layout settings from userconfig-based configuration
with *prefix*, under *section*
default: if True, do not restore inner layout | spyder/app/mainwindow.py | 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'):
"""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... | [
"Load",
"window",
"layout",
"settings",
"from",
"userconfig",
"-",
"based",
"configuration",
"with",
"*",
"prefix",
"*",
"under",
"*",
"section",
"*",
"default",
":",
"if",
"True",
"do",
"not",
"restore",
"inner",
"layout"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1395-L1421 | [
"def",
"load_window_settings",
"(",
"self",
",",
"prefix",
",",
"default",
"=",
"False",
",",
"section",
"=",
"'main'",
")",
":",
"get_func",
"=",
"CONF",
".",
"get_default",
"if",
"default",
"else",
"CONF",
".",
"get",
"window_size",
"=",
"get_func",
"(",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.get_window_settings | Return current window settings
Symetric to the 'set_window_settings' setter | spyder/app/mainwindow.py | 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):
"""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... | [
"Return",
"current",
"window",
"settings",
"Symetric",
"to",
"the",
"set_window_settings",
"setter"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1423-L1437 | [
"def",
"get_window_settings",
"(",
"self",
")",
":",
"window_size",
"=",
"(",
"self",
".",
"window_size",
".",
"width",
"(",
")",
",",
"self",
".",
"window_size",
".",
"height",
"(",
")",
")",
"is_fullscreen",
"=",
"self",
".",
"isFullScreen",
"(",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.set_window_settings | Set window settings
Symetric to the 'get_window_settings' accessor | spyder/app/mainwindow.py | 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):
"""Set window settings
Symetric to the 'get_window_settings' accessor"""
self.setUpdatesEnabled(False)
self.window_size = QSize(window_size[0], wind... | [
"Set",
"window",
"settings",
"Symetric",
"to",
"the",
"get_window_settings",
"accessor"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1439-L1474 | [
"def",
"set_window_settings",
"(",
"self",
",",
"hexstate",
",",
"window_size",
",",
"prefs_dialog_size",
",",
"pos",
",",
"is_maximized",
",",
"is_fullscreen",
")",
":",
"self",
".",
"setUpdatesEnabled",
"(",
"False",
")",
"self",
".",
"window_size",
"=",
"QS... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.save_current_window_settings | Save current window settings with *prefix* in
the userconfig-based configuration, under *section* | spyder/app/mainwindow.py | 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):
"""Save current window settings with *prefix* in
the userconfig-based configuration, under *section*"""
win_size = self.window_size
prefs_size = self.prefs_dialog_s... | [
"Save",
"current",
"window",
"settings",
"with",
"*",
"prefix",
"*",
"in",
"the",
"userconfig",
"-",
"based",
"configuration",
"under",
"*",
"section",
"*"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1476-L1497 | [
"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",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.tabify_plugins | Tabify plugin dockwigdets | spyder/app/mainwindow.py | def tabify_plugins(self, first, second):
"""Tabify plugin dockwigdets"""
self.tabifyDockWidget(first.dockwidget, second.dockwidget) | def tabify_plugins(self, first, second):
"""Tabify plugin dockwigdets"""
self.tabifyDockWidget(first.dockwidget, second.dockwidget) | [
"Tabify",
"plugin",
"dockwigdets"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1499-L1501 | [
"def",
"tabify_plugins",
"(",
"self",
",",
"first",
",",
"second",
")",
":",
"self",
".",
"tabifyDockWidget",
"(",
"first",
".",
"dockwidget",
",",
"second",
".",
"dockwidget",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.setup_layout | Setup window layout | spyder/app/mainwindow.py | 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):
"""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:
... | [
"Setup",
"window",
"layout"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1504-L1551 | [
"def",
"setup_layout",
"(",
"self",
",",
"default",
"=",
"False",
")",
":",
"prefix",
"=",
"'window'",
"+",
"'/'",
"settings",
"=",
"self",
".",
"load_window_settings",
"(",
"prefix",
",",
"default",
")",
"hexstate",
"=",
"settings",
"[",
"0",
"]",
"self... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.setup_default_layouts | Setup default layouts when run for the first time. | spyder/app/mainwindow.py | 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):
"""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... | [
"Setup",
"default",
"layouts",
"when",
"run",
"for",
"the",
"first",
"time",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1553-L1808 | [
"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",
":"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.reset_window_layout | Reset window layout to default | spyder/app/mainwindow.py | 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):
"""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... | [
"Reset",
"window",
"layout",
"to",
"default"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1903-L1911 | [
"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... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.quick_layout_save | Save layout dialog | spyder/app/mainwindow.py | 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):
"""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)
... | [
"Save",
"layout",
"dialog"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1913-L1954 | [
"def",
"quick_layout_save",
"(",
"self",
")",
":",
"get",
"=",
"CONF",
".",
"get",
"set_",
"=",
"CONF",
".",
"set",
"names",
"=",
"get",
"(",
"'quick_layouts'",
",",
"'names'",
")",
"order",
"=",
"get",
"(",
"'quick_layouts'",
",",
"'order'",
")",
"act... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.quick_layout_settings | Layout settings dialog | spyder/app/mainwindow.py | 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):
"""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... | [
"Layout",
"settings",
"dialog"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1956-L1972 | [
"def",
"quick_layout_settings",
"(",
"self",
")",
":",
"get",
"=",
"CONF",
".",
"get",
"set_",
"=",
"CONF",
".",
"set",
"section",
"=",
"'quick_layouts'",
"names",
"=",
"get",
"(",
"section",
",",
"'names'",
")",
"order",
"=",
"get",
"(",
"section",
",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.quick_layout_switch | Switch to quick layout number *index* | spyder/app/mainwindow.py | 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):
"""Switch to quick layout number *index*"""
section = 'quick_layouts'
try:
settings = self.load_window_settings('layout_{}/'.format(index),
section=section)
(hexstate, window_si... | [
"Switch",
"to",
"quick",
"layout",
"number",
"*",
"index",
"*"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L1974-L2014 | [
"def",
"quick_layout_switch",
"(",
"self",
",",
"index",
")",
":",
"section",
"=",
"'quick_layouts'",
"try",
":",
"settings",
"=",
"self",
".",
"load_window_settings",
"(",
"'layout_{}/'",
".",
"format",
"(",
"index",
")",
",",
"section",
"=",
"section",
")"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow._update_show_toolbars_action | Update the text displayed in the menu entry. | spyder/app/mainwindow.py | 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):
"""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... | [
"Update",
"the",
"text",
"displayed",
"in",
"the",
"menu",
"entry",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2017-L2026 | [
"def",
"_update_show_toolbars_action",
"(",
"self",
")",
":",
"if",
"self",
".",
"toolbars_visible",
":",
"text",
"=",
"_",
"(",
"\"Hide toolbars\"",
")",
"tip",
"=",
"_",
"(",
"\"Hide toolbars\"",
")",
"else",
":",
"text",
"=",
"_",
"(",
"\"Show toolbars\""... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.save_visible_toolbars | Saves the name of the visible toolbars in the .ini file. | spyder/app/mainwindow.py | 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):
"""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) | [
"Saves",
"the",
"name",
"of",
"the",
"visible",
"toolbars",
"in",
"the",
".",
"ini",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2028-L2033 | [
"def",
"save_visible_toolbars",
"(",
"self",
")",
":",
"toolbars",
"=",
"[",
"]",
"for",
"toolbar",
"in",
"self",
".",
"visible_toolbars",
":",
"toolbars",
".",
"append",
"(",
"toolbar",
".",
"objectName",
"(",
")",
")",
"CONF",
".",
"set",
"(",
"'main'"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainWindow.get_visible_toolbars | Collects the visible toolbars. | spyder/app/mainwindow.py | 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):
"""Collects the visible toolbars."""
toolbars = []
for toolbar in self.toolbarslist:
if toolbar.toggleViewAction().isChecked():
toolbars.append(toolbar)
self.visible_toolbars = toolbars | [
"Collects",
"the",
"visible",
"toolbars",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2035-L2041 | [
"def",
"get_visible_toolbars",
"(",
"self",
")",
":",
"toolbars",
"=",
"[",
"]",
"for",
"toolbar",
"in",
"self",
".",
"toolbarslist",
":",
"if",
"toolbar",
".",
"toggleViewAction",
"(",
")",
".",
"isChecked",
"(",
")",
":",
"toolbars",
".",
"append",
"("... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.