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 | WorkerManager.create_python_worker | Create a new python worker instance. | spyder/utils/workers.py | def create_python_worker(self, func, *args, **kwargs):
"""Create a new python worker instance."""
worker = PythonWorker(func, args, kwargs)
self._create_worker(worker)
return worker | def create_python_worker(self, func, *args, **kwargs):
"""Create a new python worker instance."""
worker = PythonWorker(func, args, kwargs)
self._create_worker(worker)
return worker | [
"Create",
"a",
"new",
"python",
"worker",
"instance",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L291-L295 | [
"def",
"create_python_worker",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"worker",
"=",
"PythonWorker",
"(",
"func",
",",
"args",
",",
"kwargs",
")",
"self",
".",
"_create_worker",
"(",
"worker",
")",
"return",
"wor... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkerManager.create_process_worker | Create a new process worker instance. | spyder/utils/workers.py | def create_process_worker(self, cmd_list, environ=None):
"""Create a new process worker instance."""
worker = ProcessWorker(cmd_list, environ=environ)
self._create_worker(worker)
return worker | def create_process_worker(self, cmd_list, environ=None):
"""Create a new process worker instance."""
worker = ProcessWorker(cmd_list, environ=environ)
self._create_worker(worker)
return worker | [
"Create",
"a",
"new",
"process",
"worker",
"instance",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L297-L301 | [
"def",
"create_process_worker",
"(",
"self",
",",
"cmd_list",
",",
"environ",
"=",
"None",
")",
":",
"worker",
"=",
"ProcessWorker",
"(",
"cmd_list",
",",
"environ",
"=",
"environ",
")",
"self",
".",
"_create_worker",
"(",
"worker",
")",
"return",
"worker"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkerManager.terminate_all | Terminate all worker processes. | spyder/utils/workers.py | def terminate_all(self):
"""Terminate all worker processes."""
for worker in self._workers:
worker.terminate()
# for thread in self._threads:
# try:
# thread.terminate()
# thread.wait()
# except Exception:
# pas... | def terminate_all(self):
"""Terminate all worker processes."""
for worker in self._workers:
worker.terminate()
# for thread in self._threads:
# try:
# thread.terminate()
# thread.wait()
# except Exception:
# pas... | [
"Terminate",
"all",
"worker",
"processes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L303-L314 | [
"def",
"terminate_all",
"(",
"self",
")",
":",
"for",
"worker",
"in",
"self",
".",
"_workers",
":",
"worker",
".",
"terminate",
"(",
")",
"# for thread in self._threads:",
"# try:",
"# thread.terminate()",
"# thread.wait()",
"# except Exception:",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkerManager._create_worker | Common worker setup. | spyder/utils/workers.py | def _create_worker(self, worker):
"""Common worker setup."""
worker.sig_started.connect(self._start)
self._workers.append(worker) | def _create_worker(self, worker):
"""Common worker setup."""
worker.sig_started.connect(self._start)
self._workers.append(worker) | [
"Common",
"worker",
"setup",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/workers.py#L316-L319 | [
"def",
"_create_worker",
"(",
"self",
",",
"worker",
")",
":",
"worker",
".",
"sig_started",
".",
"connect",
"(",
"self",
".",
"_start",
")",
"self",
".",
"_workers",
".",
"append",
"(",
"worker",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | gather_file_data | Gather data about a given file.
Returns a dict with fields name, mtime and size, containing the relevant
data for the fiel. | spyder/plugins/editor/widgets/recover.py | def gather_file_data(name):
"""
Gather data about a given file.
Returns a dict with fields name, mtime and size, containing the relevant
data for the fiel.
"""
res = {'name': name}
try:
res['mtime'] = osp.getmtime(name)
res['size'] = osp.getsize(name)
except OSError:
... | def gather_file_data(name):
"""
Gather data about a given file.
Returns a dict with fields name, mtime and size, containing the relevant
data for the fiel.
"""
res = {'name': name}
try:
res['mtime'] = osp.getmtime(name)
res['size'] = osp.getsize(name)
except OSError:
... | [
"Gather",
"data",
"about",
"a",
"given",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L26-L39 | [
"def",
"gather_file_data",
"(",
"name",
")",
":",
"res",
"=",
"{",
"'name'",
":",
"name",
"}",
"try",
":",
"res",
"[",
"'mtime'",
"]",
"=",
"osp",
".",
"getmtime",
"(",
"name",
")",
"res",
"[",
"'size'",
"]",
"=",
"osp",
".",
"getsize",
"(",
"nam... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | file_data_to_str | Convert file data to a string for display.
This function takes the file data produced by gather_file_data(). | spyder/plugins/editor/widgets/recover.py | def file_data_to_str(data):
"""
Convert file data to a string for display.
This function takes the file data produced by gather_file_data().
"""
if not data:
return _('<i>File name not recorded</i>')
res = data['name']
try:
mtime_as_str = time.strftime('%Y-%m-%d %H:%M:%S',
... | def file_data_to_str(data):
"""
Convert file data to a string for display.
This function takes the file data produced by gather_file_data().
"""
if not data:
return _('<i>File name not recorded</i>')
res = data['name']
try:
mtime_as_str = time.strftime('%Y-%m-%d %H:%M:%S',
... | [
"Convert",
"file",
"data",
"to",
"a",
"string",
"for",
"display",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L42-L59 | [
"def",
"file_data_to_str",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"_",
"(",
"'<i>File name not recorded</i>'",
")",
"res",
"=",
"data",
"[",
"'name'",
"]",
"try",
":",
"mtime_as_str",
"=",
"time",
".",
"strftime",
"(",
"'%Y-%m-%d %H:%M:%S... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | make_temporary_files | Make temporary files to simulate a recovery use case.
Create a directory under tempdir containing some original files and another
directory with autosave files. Return a tuple with the name of the
directory with the original files, the name of the directory with the
autosave files, and the autosave map... | spyder/plugins/editor/widgets/recover.py | def make_temporary_files(tempdir):
"""
Make temporary files to simulate a recovery use case.
Create a directory under tempdir containing some original files and another
directory with autosave files. Return a tuple with the name of the
directory with the original files, the name of the directory wi... | def make_temporary_files(tempdir):
"""
Make temporary files to simulate a recovery use case.
Create a directory under tempdir containing some original files and another
directory with autosave files. Return a tuple with the name of the
directory with the original files, the name of the directory wi... | [
"Make",
"temporary",
"files",
"to",
"simulate",
"a",
"recovery",
"use",
"case",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L278-L321 | [
"def",
"make_temporary_files",
"(",
"tempdir",
")",
":",
"orig_dir",
"=",
"osp",
".",
"join",
"(",
"tempdir",
",",
"'orig'",
")",
"os",
".",
"mkdir",
"(",
"orig_dir",
")",
"autosave_dir",
"=",
"osp",
".",
"join",
"(",
"tempdir",
",",
"'autosave'",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | RecoveryDialog.gather_data | Gather data about files which may be recovered.
The data is stored in self.data as a list of tuples with the data
pertaining to the original file and the autosave file. Each element of
the tuple is a dict as returned by gather_file_data(). | spyder/plugins/editor/widgets/recover.py | def gather_data(self):
"""
Gather data about files which may be recovered.
The data is stored in self.data as a list of tuples with the data
pertaining to the original file and the autosave file. Each element of
the tuple is a dict as returned by gather_file_data().
"""
... | def gather_data(self):
"""
Gather data about files which may be recovered.
The data is stored in self.data as a list of tuples with the data
pertaining to the original file and the autosave file. Each element of
the tuple is a dict as returned by gather_file_data().
"""
... | [
"Gather",
"data",
"about",
"files",
"which",
"may",
"be",
"recovered",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L93-L123 | [
"def",
"gather_data",
"(",
"self",
")",
":",
"self",
".",
"data",
"=",
"[",
"]",
"try",
":",
"FileNotFoundError",
"except",
"NameError",
":",
"# Python 2",
"FileNotFoundError",
"=",
"OSError",
"# In Python 3, easier to use os.scandir()",
"try",
":",
"for",
"name",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | RecoveryDialog.add_label | Add label with explanation at top of dialog window. | spyder/plugins/editor/widgets/recover.py | def add_label(self):
"""Add label with explanation at top of dialog window."""
txt = _('Autosave files found. What would you like to do?\n\n'
'This dialog will be shown again on next startup if any '
'autosave files are not restored, moved or deleted.')
label = QL... | def add_label(self):
"""Add label with explanation at top of dialog window."""
txt = _('Autosave files found. What would you like to do?\n\n'
'This dialog will be shown again on next startup if any '
'autosave files are not restored, moved or deleted.')
label = QL... | [
"Add",
"label",
"with",
"explanation",
"at",
"top",
"of",
"dialog",
"window",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L125-L132 | [
"def",
"add_label",
"(",
"self",
")",
":",
"txt",
"=",
"_",
"(",
"'Autosave files found. What would you like to do?\\n\\n'",
"'This dialog will be shown again on next startup if any '",
"'autosave files are not restored, moved or deleted.'",
")",
"label",
"=",
"QLabel",
"(",
"txt... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | RecoveryDialog.add_label_to_table | Add a label to specified cell in table. | spyder/plugins/editor/widgets/recover.py | def add_label_to_table(self, row, col, txt):
"""Add a label to specified cell in table."""
label = QLabel(txt)
label.setMargin(5)
label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.table.setCellWidget(row, col, label) | def add_label_to_table(self, row, col, txt):
"""Add a label to specified cell in table."""
label = QLabel(txt)
label.setMargin(5)
label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.table.setCellWidget(row, col, label) | [
"Add",
"a",
"label",
"to",
"specified",
"cell",
"in",
"table",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L134-L139 | [
"def",
"add_label_to_table",
"(",
"self",
",",
"row",
",",
"col",
",",
"txt",
")",
":",
"label",
"=",
"QLabel",
"(",
"txt",
")",
"label",
".",
"setMargin",
"(",
"5",
")",
"label",
".",
"setAlignment",
"(",
"Qt",
".",
"AlignLeft",
"|",
"Qt",
".",
"A... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | RecoveryDialog.add_table | Add table with info about files to be recovered. | spyder/plugins/editor/widgets/recover.py | def add_table(self):
"""Add table with info about files to be recovered."""
table = QTableWidget(len(self.data), 3, self)
self.table = table
labels = [_('Original file'), _('Autosave file'), _('Actions')]
table.setHorizontalHeaderLabels(labels)
table.verticalHeader().hid... | def add_table(self):
"""Add table with info about files to be recovered."""
table = QTableWidget(len(self.data), 3, self)
self.table = table
labels = [_('Original file'), _('Autosave file'), _('Actions')]
table.setHorizontalHeaderLabels(labels)
table.verticalHeader().hid... | [
"Add",
"table",
"with",
"info",
"about",
"files",
"to",
"be",
"recovered",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L141-L201 | [
"def",
"add_table",
"(",
"self",
")",
":",
"table",
"=",
"QTableWidget",
"(",
"len",
"(",
"self",
".",
"data",
")",
",",
"3",
",",
"self",
")",
"self",
".",
"table",
"=",
"table",
"labels",
"=",
"[",
"_",
"(",
"'Original file'",
")",
",",
"_",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | RecoveryDialog.add_cancel_button | Add a cancel button at the bottom of the dialog window. | spyder/plugins/editor/widgets/recover.py | def add_cancel_button(self):
"""Add a cancel button at the bottom of the dialog window."""
button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self)
button_box.rejected.connect(self.reject)
self.layout.addWidget(button_box) | def add_cancel_button(self):
"""Add a cancel button at the bottom of the dialog window."""
button_box = QDialogButtonBox(QDialogButtonBox.Cancel, self)
button_box.rejected.connect(self.reject)
self.layout.addWidget(button_box) | [
"Add",
"a",
"cancel",
"button",
"at",
"the",
"bottom",
"of",
"the",
"dialog",
"window",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/recover.py#L203-L207 | [
"def",
"add_cancel_button",
"(",
"self",
")",
":",
"button_box",
"=",
"QDialogButtonBox",
"(",
"QDialogButtonBox",
".",
"Cancel",
",",
"self",
")",
"button_box",
".",
"rejected",
".",
"connect",
"(",
"self",
".",
"reject",
")",
"self",
".",
"layout",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.register_plugin | Register plugin in Spyder's main window | spyder/plugins/workingdirectory/plugin.py | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.redirect_stdio.connect(self.main.redirect_internalshell_stdio)
self.main.console.shell.refresh.connect(self.refresh_plugin)
iconsize = 24
self.toolbar.setIconSize(QSize(iconsize, iconsize))
... | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.redirect_stdio.connect(self.main.redirect_internalshell_stdio)
self.main.console.shell.refresh.connect(self.refresh_plugin)
iconsize = 24
self.toolbar.setIconSize(QSize(iconsize, iconsize))
... | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L133-L139 | [
"def",
"register_plugin",
"(",
"self",
")",
":",
"self",
".",
"redirect_stdio",
".",
"connect",
"(",
"self",
".",
"main",
".",
"redirect_internalshell_stdio",
")",
"self",
".",
"main",
".",
"console",
".",
"shell",
".",
"refresh",
".",
"connect",
"(",
"sel... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.refresh_plugin | Refresh widget | spyder/plugins/workingdirectory/plugin.py | def refresh_plugin(self):
"""Refresh widget"""
curdir = getcwd_or_home()
self.pathedit.add_text(curdir)
self.save_wdhistory()
self.set_previous_enabled.emit(
self.histindex is not None and self.histindex > 0)
self.set_next_enabled.emit(... | def refresh_plugin(self):
"""Refresh widget"""
curdir = getcwd_or_home()
self.pathedit.add_text(curdir)
self.save_wdhistory()
self.set_previous_enabled.emit(
self.histindex is not None and self.histindex > 0)
self.set_next_enabled.emit(... | [
"Refresh",
"widget"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L141-L149 | [
"def",
"refresh_plugin",
"(",
"self",
")",
":",
"curdir",
"=",
"getcwd_or_home",
"(",
")",
"self",
".",
"pathedit",
".",
"add_text",
"(",
"curdir",
")",
"self",
".",
"save_wdhistory",
"(",
")",
"self",
".",
"set_previous_enabled",
".",
"emit",
"(",
"self",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.load_wdhistory | Load history from a text file in user home directory | spyder/plugins/workingdirectory/plugin.py | def load_wdhistory(self, workdir=None):
"""Load history from a text file in user home directory"""
if osp.isfile(self.LOG_PATH):
wdhistory, _ = encoding.readlines(self.LOG_PATH)
wdhistory = [name for name in wdhistory if os.path.isdir(name)]
else:
if wor... | def load_wdhistory(self, workdir=None):
"""Load history from a text file in user home directory"""
if osp.isfile(self.LOG_PATH):
wdhistory, _ = encoding.readlines(self.LOG_PATH)
wdhistory = [name for name in wdhistory if os.path.isdir(name)]
else:
if wor... | [
"Load",
"history",
"from",
"a",
"text",
"file",
"in",
"user",
"home",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L160-L169 | [
"def",
"load_wdhistory",
"(",
"self",
",",
"workdir",
"=",
"None",
")",
":",
"if",
"osp",
".",
"isfile",
"(",
"self",
".",
"LOG_PATH",
")",
":",
"wdhistory",
",",
"_",
"=",
"encoding",
".",
"readlines",
"(",
"self",
".",
"LOG_PATH",
")",
"wdhistory",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.save_wdhistory | Save history to a text file in user home directory | spyder/plugins/workingdirectory/plugin.py | def save_wdhistory(self):
"""Save history to a text file in user home directory"""
text = [ to_text_string( self.pathedit.itemText(index) ) \
for index in range(self.pathedit.count()) ]
try:
encoding.writelines(text, self.LOG_PATH)
except EnvironmentErr... | def save_wdhistory(self):
"""Save history to a text file in user home directory"""
text = [ to_text_string( self.pathedit.itemText(index) ) \
for index in range(self.pathedit.count()) ]
try:
encoding.writelines(text, self.LOG_PATH)
except EnvironmentErr... | [
"Save",
"history",
"to",
"a",
"text",
"file",
"in",
"user",
"home",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L171-L178 | [
"def",
"save_wdhistory",
"(",
"self",
")",
":",
"text",
"=",
"[",
"to_text_string",
"(",
"self",
".",
"pathedit",
".",
"itemText",
"(",
"index",
")",
")",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"pathedit",
".",
"count",
"(",
")",
")",
"]",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.select_directory | Select directory | spyder/plugins/workingdirectory/plugin.py | def select_directory(self):
"""Select directory"""
self.redirect_stdio.emit(False)
directory = getexistingdirectory(self.main, _("Select directory"),
getcwd_or_home())
if directory:
self.chdir(directory)
self.redirect_st... | def select_directory(self):
"""Select directory"""
self.redirect_stdio.emit(False)
directory = getexistingdirectory(self.main, _("Select directory"),
getcwd_or_home())
if directory:
self.chdir(directory)
self.redirect_st... | [
"Select",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L181-L188 | [
"def",
"select_directory",
"(",
"self",
")",
":",
"self",
".",
"redirect_stdio",
".",
"emit",
"(",
"False",
")",
"directory",
"=",
"getexistingdirectory",
"(",
"self",
".",
"main",
",",
"_",
"(",
"\"Select directory\"",
")",
",",
"getcwd_or_home",
"(",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.parent_directory | Change working directory to parent directory | spyder/plugins/workingdirectory/plugin.py | def parent_directory(self):
"""Change working directory to parent directory"""
self.chdir(os.path.join(getcwd_or_home(), os.path.pardir)) | def parent_directory(self):
"""Change working directory to parent directory"""
self.chdir(os.path.join(getcwd_or_home(), os.path.pardir)) | [
"Change",
"working",
"directory",
"to",
"parent",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L203-L205 | [
"def",
"parent_directory",
"(",
"self",
")",
":",
"self",
".",
"chdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"getcwd_or_home",
"(",
")",
",",
"os",
".",
"path",
".",
"pardir",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | WorkingDirectory.chdir | Set directory as working directory | spyder/plugins/workingdirectory/plugin.py | def chdir(self, directory, browsing_history=False,
refresh_explorer=True, refresh_console=True):
"""Set directory as working directory"""
if directory:
directory = osp.abspath(to_text_string(directory))
# Working directory history management
if browsing_... | def chdir(self, directory, browsing_history=False,
refresh_explorer=True, refresh_console=True):
"""Set directory as working directory"""
if directory:
directory = osp.abspath(to_text_string(directory))
# Working directory history management
if browsing_... | [
"Set",
"directory",
"as",
"working",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/workingdirectory/plugin.py#L211-L240 | [
"def",
"chdir",
"(",
"self",
",",
"directory",
",",
"browsing_history",
"=",
"False",
",",
"refresh_explorer",
"=",
"True",
",",
"refresh_console",
"=",
"True",
")",
":",
"if",
"directory",
":",
"directory",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerManager.toogle_breakpoint | Add/remove breakpoint. | spyder/plugins/editor/utils/debugger.py | def toogle_breakpoint(self, line_number=None, condition=None,
edit_condition=False):
"""Add/remove breakpoint."""
if not self.editor.is_python_like():
return
if line_number is None:
block = self.editor.textCursor().block()
else:
... | def toogle_breakpoint(self, line_number=None, condition=None,
edit_condition=False):
"""Add/remove breakpoint."""
if not self.editor.is_python_like():
return
if line_number is None:
block = self.editor.textCursor().block()
else:
... | [
"Add",
"/",
"remove",
"breakpoint",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L79-L114 | [
"def",
"toogle_breakpoint",
"(",
"self",
",",
"line_number",
"=",
"None",
",",
"condition",
"=",
"None",
",",
"edit_condition",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"editor",
".",
"is_python_like",
"(",
")",
":",
"return",
"if",
"line_number",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerManager.get_breakpoints | Get breakpoints | spyder/plugins/editor/utils/debugger.py | def get_breakpoints(self):
"""Get breakpoints"""
breakpoints = []
block = self.editor.document().firstBlock()
for line_number in range(1, self.editor.document().blockCount()+1):
data = block.userData()
if data and data.breakpoint:
breakpoints.appen... | def get_breakpoints(self):
"""Get breakpoints"""
breakpoints = []
block = self.editor.document().firstBlock()
for line_number in range(1, self.editor.document().blockCount()+1):
data = block.userData()
if data and data.breakpoint:
breakpoints.appen... | [
"Get",
"breakpoints"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L116-L125 | [
"def",
"get_breakpoints",
"(",
"self",
")",
":",
"breakpoints",
"=",
"[",
"]",
"block",
"=",
"self",
".",
"editor",
".",
"document",
"(",
")",
".",
"firstBlock",
"(",
")",
"for",
"line_number",
"in",
"range",
"(",
"1",
",",
"self",
".",
"editor",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerManager.clear_breakpoints | Clear breakpoints | spyder/plugins/editor/utils/debugger.py | def clear_breakpoints(self):
"""Clear breakpoints"""
self.breakpoints = []
for data in self.editor.blockuserdata_list[:]:
data.breakpoint = False
# data.breakpoint_condition = None # not necessary, but logical
if data.is_empty():
# This is not... | def clear_breakpoints(self):
"""Clear breakpoints"""
self.breakpoints = []
for data in self.editor.blockuserdata_list[:]:
data.breakpoint = False
# data.breakpoint_condition = None # not necessary, but logical
if data.is_empty():
# This is not... | [
"Clear",
"breakpoints"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L127-L137 | [
"def",
"clear_breakpoints",
"(",
"self",
")",
":",
"self",
".",
"breakpoints",
"=",
"[",
"]",
"for",
"data",
"in",
"self",
".",
"editor",
".",
"blockuserdata_list",
"[",
":",
"]",
":",
"data",
".",
"breakpoint",
"=",
"False",
"# data.breakpoint_condition = N... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerManager.set_breakpoints | Set breakpoints | spyder/plugins/editor/utils/debugger.py | def set_breakpoints(self, breakpoints):
"""Set breakpoints"""
self.clear_breakpoints()
for line_number, condition in breakpoints:
self.toogle_breakpoint(line_number, condition)
self.breakpoints = self.get_breakpoints() | def set_breakpoints(self, breakpoints):
"""Set breakpoints"""
self.clear_breakpoints()
for line_number, condition in breakpoints:
self.toogle_breakpoint(line_number, condition)
self.breakpoints = self.get_breakpoints() | [
"Set",
"breakpoints"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L139-L144 | [
"def",
"set_breakpoints",
"(",
"self",
",",
"breakpoints",
")",
":",
"self",
".",
"clear_breakpoints",
"(",
")",
"for",
"line_number",
",",
"condition",
"in",
"breakpoints",
":",
"self",
".",
"toogle_breakpoint",
"(",
"line_number",
",",
"condition",
")",
"sel... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggerManager.breakpoints_changed | Breakpoint list has changed | spyder/plugins/editor/utils/debugger.py | def breakpoints_changed(self):
"""Breakpoint list has changed"""
breakpoints = self.get_breakpoints()
if self.breakpoints != breakpoints:
self.breakpoints = breakpoints
self.save_breakpoints() | def breakpoints_changed(self):
"""Breakpoint list has changed"""
breakpoints = self.get_breakpoints()
if self.breakpoints != breakpoints:
self.breakpoints = breakpoints
self.save_breakpoints() | [
"Breakpoint",
"list",
"has",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/debugger.py#L150-L155 | [
"def",
"breakpoints_changed",
"(",
"self",
")",
":",
"breakpoints",
"=",
"self",
".",
"get_breakpoints",
"(",
")",
"if",
"self",
".",
"breakpoints",
"!=",
"breakpoints",
":",
"self",
".",
"breakpoints",
"=",
"breakpoints",
"self",
".",
"save_breakpoints",
"(",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | unmatched_quotes_in_line | Return whether a string has open quotes.
This simply counts whether the number of quote characters of either
type in the string is odd.
Take from the IPython project (in IPython/core/completer.py in v0.13)
Spyder team: Add some changes to deal with escaped quotes
- Copyright (C) 2008-2011 IPython... | spyder/plugins/editor/extensions/closequotes.py | def unmatched_quotes_in_line(text):
"""Return whether a string has open quotes.
This simply counts whether the number of quote characters of either
type in the string is odd.
Take from the IPython project (in IPython/core/completer.py in v0.13)
Spyder team: Add some changes to deal with escaped qu... | def unmatched_quotes_in_line(text):
"""Return whether a string has open quotes.
This simply counts whether the number of quote characters of either
type in the string is odd.
Take from the IPython project (in IPython/core/completer.py in v0.13)
Spyder team: Add some changes to deal with escaped qu... | [
"Return",
"whether",
"a",
"string",
"has",
"open",
"quotes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L14-L38 | [
"def",
"unmatched_quotes_in_line",
"(",
"text",
")",
":",
"# We check \" first, then ', so complex cases with nested quotes will",
"# get the \" to take precedence.",
"text",
"=",
"text",
".",
"replace",
"(",
"\"\\\\'\"",
",",
"\"\"",
")",
"text",
"=",
"text",
".",
"repla... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CloseQuotesExtension.on_state_changed | Connect/disconnect sig_key_pressed signal. | spyder/plugins/editor/extensions/closequotes.py | def on_state_changed(self, state):
"""Connect/disconnect sig_key_pressed signal."""
if state:
self.editor.sig_key_pressed.connect(self._on_key_pressed)
else:
self.editor.sig_key_pressed.disconnect(self._on_key_pressed) | def on_state_changed(self, state):
"""Connect/disconnect sig_key_pressed signal."""
if state:
self.editor.sig_key_pressed.connect(self._on_key_pressed)
else:
self.editor.sig_key_pressed.disconnect(self._on_key_pressed) | [
"Connect",
"/",
"disconnect",
"sig_key_pressed",
"signal",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L44-L49 | [
"def",
"on_state_changed",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
":",
"self",
".",
"editor",
".",
"sig_key_pressed",
".",
"connect",
"(",
"self",
".",
"_on_key_pressed",
")",
"else",
":",
"self",
".",
"editor",
".",
"sig_key_pressed",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CloseQuotesExtension._autoinsert_quotes | Control how to automatically insert quotes in various situations. | spyder/plugins/editor/extensions/closequotes.py | def _autoinsert_quotes(self, key):
"""Control how to automatically insert quotes in various situations."""
char = {Qt.Key_QuoteDbl: '"', Qt.Key_Apostrophe: '\''}[key]
line_text = self.editor.get_text('sol', 'eol')
line_to_cursor = self.editor.get_text('sol', 'cursor')
cursor = s... | def _autoinsert_quotes(self, key):
"""Control how to automatically insert quotes in various situations."""
char = {Qt.Key_QuoteDbl: '"', Qt.Key_Apostrophe: '\''}[key]
line_text = self.editor.get_text('sol', 'eol')
line_to_cursor = self.editor.get_text('sol', 'cursor')
cursor = s... | [
"Control",
"how",
"to",
"automatically",
"insert",
"quotes",
"in",
"various",
"situations",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/closequotes.py#L61-L113 | [
"def",
"_autoinsert_quotes",
"(",
"self",
",",
"key",
")",
":",
"char",
"=",
"{",
"Qt",
".",
"Key_QuoteDbl",
":",
"'\"'",
",",
"Qt",
".",
"Key_Apostrophe",
":",
"'\\''",
"}",
"[",
"key",
"]",
"line_text",
"=",
"self",
".",
"editor",
".",
"get_text",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | populate | Populate the given ``combobox`` with the class or function names.
Parameters
----------
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
data : list of :class:`FoldScopeHelper`
The data to populate with. There should be one list element per
class or function ... | spyder/plugins/editor/panels/classfunctiondropdown.py | def populate(combobox, data):
"""
Populate the given ``combobox`` with the class or function names.
Parameters
----------
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
data : list of :class:`FoldScopeHelper`
The data to populate with. There should be one l... | def populate(combobox, data):
"""
Populate the given ``combobox`` with the class or function names.
Parameters
----------
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
data : list of :class:`FoldScopeHelper`
The data to populate with. There should be one l... | [
"Populate",
"the",
"given",
"combobox",
"with",
"the",
"class",
"or",
"function",
"names",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L32-L77 | [
"def",
"populate",
"(",
"combobox",
",",
"data",
")",
":",
"combobox",
".",
"clear",
"(",
")",
"combobox",
".",
"addItem",
"(",
"\"<None>\"",
",",
"0",
")",
"# First create a list of fully-qualified names.",
"cb_data",
"=",
"[",
"]",
"for",
"item",
"in",
"da... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | _get_fold_levels | Return a list of all the class/function definition ranges.
Parameters
----------
editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor`
Returns
-------
folds : list of :class:`FoldScopeHelper`
A list of all the class or function defintion fold points. | spyder/plugins/editor/panels/classfunctiondropdown.py | def _get_fold_levels(editor):
"""
Return a list of all the class/function definition ranges.
Parameters
----------
editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor`
Returns
-------
folds : list of :class:`FoldScopeHelper`
A list of all the class or function ... | def _get_fold_levels(editor):
"""
Return a list of all the class/function definition ranges.
Parameters
----------
editor : :class:`spyder.plugins.editor.widgets.codeeditor.CodeEditor`
Returns
-------
folds : list of :class:`FoldScopeHelper`
A list of all the class or function ... | [
"Return",
"a",
"list",
"of",
"all",
"the",
"class",
"/",
"function",
"definition",
"ranges",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L80-L120 | [
"def",
"_get_fold_levels",
"(",
"editor",
")",
":",
"block",
"=",
"editor",
".",
"document",
"(",
")",
".",
"firstBlock",
"(",
")",
"oed",
"=",
"editor",
".",
"get_outlineexplorer_data",
"(",
")",
"folds",
"=",
"[",
"]",
"parents",
"=",
"[",
"]",
"prev... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | _adjust_parent_stack | Adjust the parent stack in-place as the trigger level changes.
Parameters
----------
fsh : :class:`FoldScopeHelper`
The :class:`FoldScopeHelper` object to act on.
prev : :class:`FoldScopeHelper`
The previous :class:`FoldScopeHelper` object.
parents : list of :class:`FoldScopeHelper`... | spyder/plugins/editor/panels/classfunctiondropdown.py | def _adjust_parent_stack(fsh, prev, parents):
"""
Adjust the parent stack in-place as the trigger level changes.
Parameters
----------
fsh : :class:`FoldScopeHelper`
The :class:`FoldScopeHelper` object to act on.
prev : :class:`FoldScopeHelper`
The previous :class:`FoldScopeHelp... | def _adjust_parent_stack(fsh, prev, parents):
"""
Adjust the parent stack in-place as the trigger level changes.
Parameters
----------
fsh : :class:`FoldScopeHelper`
The :class:`FoldScopeHelper` object to act on.
prev : :class:`FoldScopeHelper`
The previous :class:`FoldScopeHelp... | [
"Adjust",
"the",
"parent",
"stack",
"in",
"-",
"place",
"as",
"the",
"trigger",
"level",
"changes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L123-L149 | [
"def",
"_adjust_parent_stack",
"(",
"fsh",
",",
"prev",
",",
"parents",
")",
":",
"if",
"prev",
"is",
"None",
":",
"return",
"if",
"fsh",
".",
"fold_scope",
".",
"trigger_level",
"<",
"prev",
".",
"fold_scope",
".",
"trigger_level",
":",
"diff",
"=",
"pr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | _split_classes_and_methods | Split out classes and methods into two separate lists.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
The result of :func:`_get_fold_levels`.
Returns
-------
classes, functions: list of :class:`FoldScopeHelper`
Two separate lists of :class:`FoldScopeHelper` obje... | spyder/plugins/editor/panels/classfunctiondropdown.py | def _split_classes_and_methods(folds):
"""
Split out classes and methods into two separate lists.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
The result of :func:`_get_fold_levels`.
Returns
-------
classes, functions: list of :class:`FoldScopeHelper`
... | def _split_classes_and_methods(folds):
"""
Split out classes and methods into two separate lists.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
The result of :func:`_get_fold_levels`.
Returns
-------
classes, functions: list of :class:`FoldScopeHelper`
... | [
"Split",
"out",
"classes",
"and",
"methods",
"into",
"two",
"separate",
"lists",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L152-L176 | [
"def",
"_split_classes_and_methods",
"(",
"folds",
")",
":",
"classes",
"=",
"[",
"]",
"functions",
"=",
"[",
"]",
"for",
"fold",
"in",
"folds",
":",
"if",
"fold",
".",
"def_type",
"==",
"OED",
".",
"FUNCTION_TOKEN",
":",
"functions",
".",
"append",
"(",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | _get_parents | Get the parents at a given linenum.
If parents is empty, then the linenum belongs to the module.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
linenum : int
The line number to get parents for. Typically this would be the
cursor position.
Returns
-------
... | spyder/plugins/editor/panels/classfunctiondropdown.py | def _get_parents(folds, linenum):
"""
Get the parents at a given linenum.
If parents is empty, then the linenum belongs to the module.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
linenum : int
The line number to get parents for. Typically this would be the
... | def _get_parents(folds, linenum):
"""
Get the parents at a given linenum.
If parents is empty, then the linenum belongs to the module.
Parameters
----------
folds : list of :class:`FoldScopeHelper`
linenum : int
The line number to get parents for. Typically this would be the
... | [
"Get",
"the",
"parents",
"at",
"a",
"given",
"linenum",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L179-L210 | [
"def",
"_get_parents",
"(",
"folds",
",",
"linenum",
")",
":",
"# Note: this might be able to be sped up by finding some kind of",
"# abort-early condition.",
"parents",
"=",
"[",
"]",
"for",
"fold",
"in",
"folds",
":",
"start",
",",
"end",
"=",
"fold",
".",
"range"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | update_selected_cb | Update the combobox with the selected item based on the parents.
Parameters
----------
parents : list of :class:`FoldScopeHelper`
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
Returns
-------
None | spyder/plugins/editor/panels/classfunctiondropdown.py | def update_selected_cb(parents, combobox):
"""
Update the combobox with the selected item based on the parents.
Parameters
----------
parents : list of :class:`FoldScopeHelper`
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
Returns
-------
None
"""... | def update_selected_cb(parents, combobox):
"""
Update the combobox with the selected item based on the parents.
Parameters
----------
parents : list of :class:`FoldScopeHelper`
combobox : :class:`qtpy.QtWidets.QComboBox`
The combobox to populate
Returns
-------
None
"""... | [
"Update",
"the",
"combobox",
"with",
"the",
"selected",
"item",
"based",
"on",
"the",
"parents",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L213-L234 | [
"def",
"update_selected_cb",
"(",
"parents",
",",
"combobox",
")",
":",
"if",
"parents",
"is",
"not",
"None",
"and",
"len",
"(",
"parents",
")",
"==",
"0",
":",
"combobox",
".",
"setCurrentIndex",
"(",
"0",
")",
"else",
":",
"item",
"=",
"parents",
"["... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ClassFunctionDropdown._update_data | Update the internal data values. | spyder/plugins/editor/panels/classfunctiondropdown.py | def _update_data(self):
"""Update the internal data values."""
_old = self.folds
self.folds = _get_fold_levels(self.editor)
# only update our dropdown lists if the folds have changed.
if self.folds != _old:
self.classes, self.funcs = _split_classes_and_methods(self.f... | def _update_data(self):
"""Update the internal data values."""
_old = self.folds
self.folds = _get_fold_levels(self.editor)
# only update our dropdown lists if the folds have changed.
if self.folds != _old:
self.classes, self.funcs = _split_classes_and_methods(self.f... | [
"Update",
"the",
"internal",
"data",
"values",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L378-L386 | [
"def",
"_update_data",
"(",
"self",
")",
":",
"_old",
"=",
"self",
".",
"folds",
"self",
".",
"folds",
"=",
"_get_fold_levels",
"(",
"self",
".",
"editor",
")",
"# only update our dropdown lists if the folds have changed.",
"if",
"self",
".",
"folds",
"!=",
"_ol... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ClassFunctionDropdown.combobox_activated | Move the cursor to the selected definition. | spyder/plugins/editor/panels/classfunctiondropdown.py | def combobox_activated(self):
"""Move the cursor to the selected definition."""
sender = self.sender()
data = sender.itemData(sender.currentIndex())
if isinstance(data, FoldScopeHelper):
self.editor.go_to_line(data.line + 1) | def combobox_activated(self):
"""Move the cursor to the selected definition."""
sender = self.sender()
data = sender.itemData(sender.currentIndex())
if isinstance(data, FoldScopeHelper):
self.editor.go_to_line(data.line + 1) | [
"Move",
"the",
"cursor",
"to",
"the",
"selected",
"definition",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L395-L401 | [
"def",
"combobox_activated",
"(",
"self",
")",
":",
"sender",
"=",
"self",
".",
"sender",
"(",
")",
"data",
"=",
"sender",
".",
"itemData",
"(",
"sender",
".",
"currentIndex",
"(",
")",
")",
"if",
"isinstance",
"(",
"data",
",",
"FoldScopeHelper",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ClassFunctionDropdown.update_selected | Updates the dropdowns to reflect the current class and function. | spyder/plugins/editor/panels/classfunctiondropdown.py | def update_selected(self, linenum):
"""Updates the dropdowns to reflect the current class and function."""
self.parents = _get_parents(self.funcs, linenum)
update_selected_cb(self.parents, self.method_cb)
self.parents = _get_parents(self.classes, linenum)
update_selected_cb(self... | def update_selected(self, linenum):
"""Updates the dropdowns to reflect the current class and function."""
self.parents = _get_parents(self.funcs, linenum)
update_selected_cb(self.parents, self.method_cb)
self.parents = _get_parents(self.classes, linenum)
update_selected_cb(self... | [
"Updates",
"the",
"dropdowns",
"to",
"reflect",
"the",
"current",
"class",
"and",
"function",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/classfunctiondropdown.py#L403-L409 | [
"def",
"update_selected",
"(",
"self",
",",
"linenum",
")",
":",
"self",
".",
"parents",
"=",
"_get_parents",
"(",
"self",
".",
"funcs",
",",
"linenum",
")",
"update_selected_cb",
"(",
"self",
".",
"parents",
",",
"self",
".",
"method_cb",
")",
"self",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.set_palette | Set text editor palette colors:
background color and caret (text cursor) color | spyder/plugins/editor/widgets/base.py | def set_palette(self, background, foreground):
"""
Set text editor palette colors:
background color and caret (text cursor) color
"""
palette = QPalette()
palette.setColor(QPalette.Base, background)
palette.setColor(QPalette.Text, foreground)
self.... | def set_palette(self, background, foreground):
"""
Set text editor palette colors:
background color and caret (text cursor) color
"""
palette = QPalette()
palette.setColor(QPalette.Base, background)
palette.setColor(QPalette.Text, foreground)
self.... | [
"Set",
"text",
"editor",
"palette",
"colors",
":",
"background",
"color",
"and",
"caret",
"(",
"text",
"cursor",
")",
"color"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L336-L352 | [
"def",
"set_palette",
"(",
"self",
",",
"background",
",",
"foreground",
")",
":",
"palette",
"=",
"QPalette",
"(",
")",
"palette",
".",
"setColor",
"(",
"QPalette",
".",
"Base",
",",
"background",
")",
"palette",
".",
"setColor",
"(",
"QPalette",
".",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.set_extra_selections | Set extra selections for a key.
Also assign draw orders to leave current_cell and current_line
in the backgrund (and avoid them to cover other decorations)
NOTE: This will remove previous decorations added to the same key.
Args:
key (str) name of the extra selecti... | spyder/plugins/editor/widgets/base.py | def set_extra_selections(self, key, extra_selections):
"""Set extra selections for a key.
Also assign draw orders to leave current_cell and current_line
in the backgrund (and avoid them to cover other decorations)
NOTE: This will remove previous decorations added to the same key... | def set_extra_selections(self, key, extra_selections):
"""Set extra selections for a key.
Also assign draw orders to leave current_cell and current_line
in the backgrund (and avoid them to cover other decorations)
NOTE: This will remove previous decorations added to the same key... | [
"Set",
"extra",
"selections",
"for",
"a",
"key",
".",
"Also",
"assign",
"draw",
"orders",
"to",
"leave",
"current_cell",
"and",
"current_line",
"in",
"the",
"backgrund",
"(",
"and",
"avoid",
"them",
"to",
"cover",
"other",
"decorations",
")",
"NOTE",
":",
... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L367-L388 | [
"def",
"set_extra_selections",
"(",
"self",
",",
"key",
",",
"extra_selections",
")",
":",
"# use draw orders to highlight current_cell and current_line first\r",
"draw_order",
"=",
"DRAW_ORDERS",
".",
"get",
"(",
"key",
")",
"if",
"draw_order",
"is",
"None",
":",
"dr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.update_extra_selections | Add extra selections to DecorationsManager.
TODO: This method could be remove it and decorations could be
added/removed in set_extra_selections/clear_extra_selections. | spyder/plugins/editor/widgets/base.py | def update_extra_selections(self):
"""Add extra selections to DecorationsManager.
TODO: This method could be remove it and decorations could be
added/removed in set_extra_selections/clear_extra_selections.
"""
extra_selections = []
for key, extra in list(self.ex... | def update_extra_selections(self):
"""Add extra selections to DecorationsManager.
TODO: This method could be remove it and decorations could be
added/removed in set_extra_selections/clear_extra_selections.
"""
extra_selections = []
for key, extra in list(self.ex... | [
"Add",
"extra",
"selections",
"to",
"DecorationsManager",
".",
"TODO",
":",
"This",
"method",
"could",
"be",
"remove",
"it",
"and",
"decorations",
"could",
"be",
"added",
"/",
"removed",
"in",
"set_extra_selections",
"/",
"clear_extra_selections",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L390-L400 | [
"def",
"update_extra_selections",
"(",
"self",
")",
":",
"extra_selections",
"=",
"[",
"]",
"for",
"key",
",",
"extra",
"in",
"list",
"(",
"self",
".",
"extra_selections_dict",
".",
"items",
"(",
")",
")",
":",
"extra_selections",
".",
"extend",
"(",
"extr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.clear_extra_selections | Remove decorations added through set_extra_selections.
Args:
key (str) name of the extra selections group. | spyder/plugins/editor/widgets/base.py | def clear_extra_selections(self, key):
"""Remove decorations added through set_extra_selections.
Args:
key (str) name of the extra selections group.
"""
for decoration in self.extra_selections_dict.get(key, []):
self.decorations.remove(decoration)
... | def clear_extra_selections(self, key):
"""Remove decorations added through set_extra_selections.
Args:
key (str) name of the extra selections group.
"""
for decoration in self.extra_selections_dict.get(key, []):
self.decorations.remove(decoration)
... | [
"Remove",
"decorations",
"added",
"through",
"set_extra_selections",
".",
"Args",
":",
"key",
"(",
"str",
")",
"name",
"of",
"the",
"extra",
"selections",
"group",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L402-L410 | [
"def",
"clear_extra_selections",
"(",
"self",
",",
"key",
")",
":",
"for",
"decoration",
"in",
"self",
".",
"extra_selections_dict",
".",
"get",
"(",
"key",
",",
"[",
"]",
")",
":",
"self",
".",
"decorations",
".",
"remove",
"(",
"decoration",
")",
"self... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.highlight_current_line | Highlight current line | spyder/plugins/editor/widgets/base.py | def highlight_current_line(self):
"""Highlight current line"""
selection = TextDecoration(self.textCursor())
selection.format.setProperty(QTextFormat.FullWidthSelection,
to_qvariant(True))
selection.format.setBackground(self.currentline_color)
... | def highlight_current_line(self):
"""Highlight current line"""
selection = TextDecoration(self.textCursor())
selection.format.setProperty(QTextFormat.FullWidthSelection,
to_qvariant(True))
selection.format.setBackground(self.currentline_color)
... | [
"Highlight",
"current",
"line"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L418-L426 | [
"def",
"highlight_current_line",
"(",
"self",
")",
":",
"selection",
"=",
"TextDecoration",
"(",
"self",
".",
"textCursor",
"(",
")",
")",
"selection",
".",
"format",
".",
"setProperty",
"(",
"QTextFormat",
".",
"FullWidthSelection",
",",
"to_qvariant",
"(",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.highlight_current_cell | Highlight current cell | spyder/plugins/editor/widgets/base.py | def highlight_current_cell(self):
"""Highlight current cell"""
if self.cell_separators is None or \
not self.highlight_current_cell_enabled:
return
cursor, whole_file_selected, whole_screen_selected =\
self.select_current_cell_in_visible_portion()
... | def highlight_current_cell(self):
"""Highlight current cell"""
if self.cell_separators is None or \
not self.highlight_current_cell_enabled:
return
cursor, whole_file_selected, whole_screen_selected =\
self.select_current_cell_in_visible_portion()
... | [
"Highlight",
"current",
"cell"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L433-L455 | [
"def",
"highlight_current_cell",
"(",
"self",
")",
":",
"if",
"self",
".",
"cell_separators",
"is",
"None",
"or",
"not",
"self",
".",
"highlight_current_cell_enabled",
":",
"return",
"cursor",
",",
"whole_file_selected",
",",
"whole_screen_selected",
"=",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.cursor_position_changed | Brace matching | spyder/plugins/editor/widgets/base.py | def cursor_position_changed(self):
"""Brace matching"""
if self.bracepos is not None:
self.__highlight(self.bracepos, cancel=True)
self.bracepos = None
cursor = self.textCursor()
if cursor.position() == 0:
return
cursor.movePosition(QTe... | def cursor_position_changed(self):
"""Brace matching"""
if self.bracepos is not None:
self.__highlight(self.bracepos, cancel=True)
self.bracepos = None
cursor = self.textCursor()
if cursor.position() == 0:
return
cursor.movePosition(QTe... | [
"Brace",
"matching"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L520-L543 | [
"def",
"cursor_position_changed",
"(",
"self",
")",
":",
"if",
"self",
".",
"bracepos",
"is",
"not",
"None",
":",
"self",
".",
"__highlight",
"(",
"self",
".",
"bracepos",
",",
"cancel",
"=",
"True",
")",
"self",
".",
"bracepos",
"=",
"None",
"cursor",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.set_wrap_mode | Set wrap mode
Valid *mode* values: None, 'word', 'character' | spyder/plugins/editor/widgets/base.py | def set_wrap_mode(self, mode=None):
"""
Set wrap mode
Valid *mode* values: None, 'word', 'character'
"""
if mode == 'word':
wrap_mode = QTextOption.WrapAtWordBoundaryOrAnywhere
elif mode == 'character':
wrap_mode = QTextOption.WrapAnywhere
... | def set_wrap_mode(self, mode=None):
"""
Set wrap mode
Valid *mode* values: None, 'word', 'character'
"""
if mode == 'word':
wrap_mode = QTextOption.WrapAtWordBoundaryOrAnywhere
elif mode == 'character':
wrap_mode = QTextOption.WrapAnywhere
... | [
"Set",
"wrap",
"mode",
"Valid",
"*",
"mode",
"*",
"values",
":",
"None",
"word",
"character"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L551-L562 | [
"def",
"set_wrap_mode",
"(",
"self",
",",
"mode",
"=",
"None",
")",
":",
"if",
"mode",
"==",
"'word'",
":",
"wrap_mode",
"=",
"QTextOption",
".",
"WrapAtWordBoundaryOrAnywhere",
"elif",
"mode",
"==",
"'character'",
":",
"wrap_mode",
"=",
"QTextOption",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.toPlainText | Reimplement Qt method
Fix PyQt4 bug on Windows and Python 3 | spyder/plugins/editor/widgets/base.py | def toPlainText(self):
"""
Reimplement Qt method
Fix PyQt4 bug on Windows and Python 3
"""
# Fix what appears to be a PyQt4 bug when getting file
# contents under Windows and PY3. This bug leads to
# corruptions when saving files with certain combinations
... | def toPlainText(self):
"""
Reimplement Qt method
Fix PyQt4 bug on Windows and Python 3
"""
# Fix what appears to be a PyQt4 bug when getting file
# contents under Windows and PY3. This bug leads to
# corruptions when saving files with certain combinations
... | [
"Reimplement",
"Qt",
"method",
"Fix",
"PyQt4",
"bug",
"on",
"Windows",
"and",
"Python",
"3"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L575-L590 | [
"def",
"toPlainText",
"(",
"self",
")",
":",
"# Fix what appears to be a PyQt4 bug when getting file\r",
"# contents under Windows and PY3. This bug leads to\r",
"# corruptions when saving files with certain combinations\r",
"# of unicode chars on them (like the one attached on\r",
"# Issue 1546... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.get_selection_as_executable_code | Return selected text as a processed text,
to be executable in a Python/IPython interpreter | spyder/plugins/editor/widgets/base.py | def get_selection_as_executable_code(self):
"""Return selected text as a processed text,
to be executable in a Python/IPython interpreter"""
ls = self.get_line_separator()
_indent = lambda line: len(line)-len(line.lstrip())
line_from, line_to = self.get_selection_bounds(... | def get_selection_as_executable_code(self):
"""Return selected text as a processed text,
to be executable in a Python/IPython interpreter"""
ls = self.get_line_separator()
_indent = lambda line: len(line)-len(line.lstrip())
line_from, line_to = self.get_selection_bounds(... | [
"Return",
"selected",
"text",
"as",
"a",
"processed",
"text",
"to",
"be",
"executable",
"in",
"a",
"Python",
"/",
"IPython",
"interpreter"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L604-L658 | [
"def",
"get_selection_as_executable_code",
"(",
"self",
")",
":",
"ls",
"=",
"self",
".",
"get_line_separator",
"(",
")",
"_indent",
"=",
"lambda",
"line",
":",
"len",
"(",
"line",
")",
"-",
"len",
"(",
"line",
".",
"lstrip",
"(",
")",
")",
"line_from",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.is_cell_separator | Return True if cursor (or text block) is on a block separator | spyder/plugins/editor/widgets/base.py | def is_cell_separator(self, cursor=None, block=None):
"""Return True if cursor (or text block) is on a block separator"""
assert cursor is not None or block is not None
if cursor is not None:
cursor0 = QTextCursor(cursor)
cursor0.select(QTextCursor.BlockUnderCursor)
... | def is_cell_separator(self, cursor=None, block=None):
"""Return True if cursor (or text block) is on a block separator"""
assert cursor is not None or block is not None
if cursor is not None:
cursor0 = QTextCursor(cursor)
cursor0.select(QTextCursor.BlockUnderCursor)
... | [
"Return",
"True",
"if",
"cursor",
"(",
"or",
"text",
"block",
")",
"is",
"on",
"a",
"block",
"separator"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L686-L698 | [
"def",
"is_cell_separator",
"(",
"self",
",",
"cursor",
"=",
"None",
",",
"block",
"=",
"None",
")",
":",
"assert",
"cursor",
"is",
"not",
"None",
"or",
"block",
"is",
"not",
"None",
"if",
"cursor",
"is",
"not",
"None",
":",
"cursor0",
"=",
"QTextCurso... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.select_current_cell | Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected | spyder/plugins/editor/widgets/base.py | def select_current_cell(self):
"""Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.StartOfBlock)
... | def select_current_cell(self):
"""Select cell under cursor
cell = group of lines separated by CELL_SEPARATORS
returns the textCursor and a boolean indicating if the
entire file is selected"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.StartOfBlock)
... | [
"Select",
"cell",
"under",
"cursor",
"cell",
"=",
"group",
"of",
"lines",
"separated",
"by",
"CELL_SEPARATORS",
"returns",
"the",
"textCursor",
"and",
"a",
"boolean",
"indicating",
"if",
"the",
"entire",
"file",
"is",
"selected"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L700-L743 | [
"def",
"select_current_cell",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"StartOfBlock",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"# M... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.select_current_cell_in_visible_portion | Select cell under cursor in the visible portion of the file
cell = group of lines separated by CELL_SEPARATORS
returns
-the textCursor
-a boolean indicating if the entire file is selected
-a boolean indicating if the entire visible portion of the file is selected | spyder/plugins/editor/widgets/base.py | def select_current_cell_in_visible_portion(self):
"""Select cell under cursor in the visible portion of the file
cell = group of lines separated by CELL_SEPARATORS
returns
-the textCursor
-a boolean indicating if the entire file is selected
-a boolean indicating ... | def select_current_cell_in_visible_portion(self):
"""Select cell under cursor in the visible portion of the file
cell = group of lines separated by CELL_SEPARATORS
returns
-the textCursor
-a boolean indicating if the entire file is selected
-a boolean indicating ... | [
"Select",
"cell",
"under",
"cursor",
"in",
"the",
"visible",
"portion",
"of",
"the",
"file",
"cell",
"=",
"group",
"of",
"lines",
"separated",
"by",
"CELL_SEPARATORS",
"returns",
"-",
"the",
"textCursor",
"-",
"a",
"boolean",
"indicating",
"if",
"the",
"enti... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L745-L806 | [
"def",
"select_current_cell_in_visible_portion",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"StartOfBlock",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.go_to_next_cell | Go to the next cell of lines | spyder/plugins/editor/widgets/base.py | def go_to_next_cell(self):
"""Go to the next cell of lines"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.NextBlock)
cur_pos = prev_pos = cursor.position()
while not self.is_cell_separator(cursor):
# Moving to the next code cell
curso... | def go_to_next_cell(self):
"""Go to the next cell of lines"""
cursor = self.textCursor()
cursor.movePosition(QTextCursor.NextBlock)
cur_pos = prev_pos = cursor.position()
while not self.is_cell_separator(cursor):
# Moving to the next code cell
curso... | [
"Go",
"to",
"the",
"next",
"cell",
"of",
"lines"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L808-L820 | [
"def",
"go_to_next_cell",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"NextBlock",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"while",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.go_to_previous_cell | Go to the previous cell of lines | spyder/plugins/editor/widgets/base.py | def go_to_previous_cell(self):
"""Go to the previous cell of lines"""
cursor = self.textCursor()
cur_pos = prev_pos = cursor.position()
if self.is_cell_separator(cursor):
# Move to the previous cell
cursor.movePosition(QTextCursor.PreviousBlock)
... | def go_to_previous_cell(self):
"""Go to the previous cell of lines"""
cursor = self.textCursor()
cur_pos = prev_pos = cursor.position()
if self.is_cell_separator(cursor):
# Move to the previous cell
cursor.movePosition(QTextCursor.PreviousBlock)
... | [
"Go",
"to",
"the",
"previous",
"cell",
"of",
"lines"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L822-L840 | [
"def",
"go_to_previous_cell",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cur_pos",
"=",
"prev_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"if",
"self",
".",
"is_cell_separator",
"(",
"cursor",
")",
":",
"# Move to the p... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.__restore_selection | Restore cursor selection from position bounds | spyder/plugins/editor/widgets/base.py | def __restore_selection(self, start_pos, end_pos):
"""Restore cursor selection from position bounds"""
cursor = self.textCursor()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
self.setTextCursor(cursor) | def __restore_selection(self, start_pos, end_pos):
"""Restore cursor selection from position bounds"""
cursor = self.textCursor()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
self.setTextCursor(cursor) | [
"Restore",
"cursor",
"selection",
"from",
"position",
"bounds"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L851-L856 | [
"def",
"__restore_selection",
"(",
"self",
",",
"start_pos",
",",
"end_pos",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"setPosition",
"(",
"start_pos",
")",
"cursor",
".",
"setPosition",
"(",
"end_pos",
",",
"QTextCursor",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.__duplicate_line_or_selection | Duplicate current line or selected text | spyder/plugins/editor/widgets/base.py | def __duplicate_line_or_selection(self, after_current_line=True):
"""Duplicate current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
if to_text_string(cursor.selectedText()):
cursor.setPo... | def __duplicate_line_or_selection(self, after_current_line=True):
"""Duplicate current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
if to_text_string(cursor.selectedText()):
cursor.setPo... | [
"Duplicate",
"current",
"line",
"or",
"selected",
"text"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L858-L896 | [
"def",
"__duplicate_line_or_selection",
"(",
"self",
",",
"after_current_line",
"=",
"True",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"beginEditBlock",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"self",
".",
"__save_selecti... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.__move_line_or_selection | Move current line or selected text | spyder/plugins/editor/widgets/base.py | def __move_line_or_selection(self, after_current_line=True):
"""Move current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
last_line = False
# ------ Select text
# Get selection ... | def __move_line_or_selection(self, after_current_line=True):
"""Move current line or selected text"""
cursor = self.textCursor()
cursor.beginEditBlock()
start_pos, end_pos = self.__save_selection()
last_line = False
# ------ Select text
# Get selection ... | [
"Move",
"current",
"line",
"or",
"selected",
"text"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L912-L989 | [
"def",
"__move_line_or_selection",
"(",
"self",
",",
"after_current_line",
"=",
"True",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"beginEditBlock",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"self",
".",
"__save_selection",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.go_to_new_line | Go to the end of the current line and create a new line | spyder/plugins/editor/widgets/base.py | def go_to_new_line(self):
"""Go to the end of the current line and create a new line"""
self.stdkey_end(False, False)
self.insert_text(self.get_line_separator()) | def go_to_new_line(self):
"""Go to the end of the current line and create a new line"""
self.stdkey_end(False, False)
self.insert_text(self.get_line_separator()) | [
"Go",
"to",
"the",
"end",
"of",
"the",
"current",
"line",
"and",
"create",
"a",
"new",
"line"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L999-L1002 | [
"def",
"go_to_new_line",
"(",
"self",
")",
":",
"self",
".",
"stdkey_end",
"(",
"False",
",",
"False",
")",
"self",
".",
"insert_text",
"(",
"self",
".",
"get_line_separator",
"(",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.extend_selection_to_complete_lines | Extend current selection to complete lines | spyder/plugins/editor/widgets/base.py | def extend_selection_to_complete_lines(self):
"""Extend current selection to complete lines"""
cursor = self.textCursor()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
... | def extend_selection_to_complete_lines(self):
"""Extend current selection to complete lines"""
cursor = self.textCursor()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
... | [
"Extend",
"current",
"selection",
"to",
"complete",
"lines"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1004-L1015 | [
"def",
"extend_selection_to_complete_lines",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"cursor",
".",
"selectionStart",
"(",
")",
",",
"cursor",
".",
"selectionEnd",
"(",
")",
"cursor",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.delete_line | Delete current line | spyder/plugins/editor/widgets/base.py | def delete_line(self):
"""Delete current line"""
cursor = self.textCursor()
if self.has_selected_text():
self.extend_selection_to_complete_lines()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
... | def delete_line(self):
"""Delete current line"""
cursor = self.textCursor()
if self.has_selected_text():
self.extend_selection_to_complete_lines()
start_pos, end_pos = cursor.selectionStart(), cursor.selectionEnd()
cursor.setPosition(start_pos)
... | [
"Delete",
"current",
"line"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1017-L1036 | [
"def",
"delete_line",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"if",
"self",
".",
"has_selected_text",
"(",
")",
":",
"self",
".",
"extend_selection_to_complete_lines",
"(",
")",
"start_pos",
",",
"end_pos",
"=",
"cursor",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.truncate_selection | Unselect read-only parts in shell, like prompt | spyder/plugins/editor/widgets/base.py | def truncate_selection(self, position_from):
"""Unselect read-only parts in shell, like prompt"""
position_from = self.get_position(position_from)
cursor = self.textCursor()
start, end = cursor.selectionStart(), cursor.selectionEnd()
if start < end:
start = max(... | def truncate_selection(self, position_from):
"""Unselect read-only parts in shell, like prompt"""
position_from = self.get_position(position_from)
cursor = self.textCursor()
start, end = cursor.selectionStart(), cursor.selectionEnd()
if start < end:
start = max(... | [
"Unselect",
"read",
"-",
"only",
"parts",
"in",
"shell",
"like",
"prompt"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1044-L1053 | [
"def",
"truncate_selection",
"(",
"self",
",",
"position_from",
")",
":",
"position_from",
"=",
"self",
".",
"get_position",
"(",
"position_from",
")",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"start",
",",
"end",
"=",
"cursor",
".",
"selectionSta... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.restrict_cursor_position | In shell, avoid editing text except between prompt and EOF | spyder/plugins/editor/widgets/base.py | def restrict_cursor_position(self, position_from, position_to):
"""In shell, avoid editing text except between prompt and EOF"""
position_from = self.get_position(position_from)
position_to = self.get_position(position_to)
cursor = self.textCursor()
cursor_position = cursor.... | def restrict_cursor_position(self, position_from, position_to):
"""In shell, avoid editing text except between prompt and EOF"""
position_from = self.get_position(position_from)
position_to = self.get_position(position_to)
cursor = self.textCursor()
cursor_position = cursor.... | [
"In",
"shell",
"avoid",
"editing",
"text",
"except",
"between",
"prompt",
"and",
"EOF"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1055-L1062 | [
"def",
"restrict_cursor_position",
"(",
"self",
",",
"position_from",
",",
"position_to",
")",
":",
"position_from",
"=",
"self",
".",
"get_position",
"(",
"position_from",
")",
"position_to",
"=",
"self",
".",
"get_position",
"(",
"position_to",
")",
"cursor",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.hide_tooltip_if_necessary | Hide calltip when necessary | spyder/plugins/editor/widgets/base.py | def hide_tooltip_if_necessary(self, key):
"""Hide calltip when necessary"""
try:
calltip_char = self.get_character(self.calltip_position)
before = self.is_cursor_before(self.calltip_position,
char_offset=1)
other = key ... | def hide_tooltip_if_necessary(self, key):
"""Hide calltip when necessary"""
try:
calltip_char = self.get_character(self.calltip_position)
before = self.is_cursor_before(self.calltip_position,
char_offset=1)
other = key ... | [
"Hide",
"calltip",
"when",
"necessary"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1065-L1075 | [
"def",
"hide_tooltip_if_necessary",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"calltip_char",
"=",
"self",
".",
"get_character",
"(",
"self",
".",
"calltip_position",
")",
"before",
"=",
"self",
".",
"is_cursor_before",
"(",
"self",
".",
"calltip_position... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.stdkey_home | Smart HOME feature: cursor is first moved at
indentation position, then at the start of the line | spyder/plugins/editor/widgets/base.py | def stdkey_home(self, shift, ctrl, prompt_pos=None):
"""Smart HOME feature: cursor is first moved at
indentation position, then at the start of the line"""
move_mode = self.__get_move_mode(shift)
if ctrl:
self.moveCursor(QTextCursor.Start, move_mode)
else:
... | def stdkey_home(self, shift, ctrl, prompt_pos=None):
"""Smart HOME feature: cursor is first moved at
indentation position, then at the start of the line"""
move_mode = self.__get_move_mode(shift)
if ctrl:
self.moveCursor(QTextCursor.Start, move_mode)
else:
... | [
"Smart",
"HOME",
"feature",
":",
"cursor",
"is",
"first",
"moved",
"at",
"indentation",
"position",
"then",
"at",
"the",
"start",
"of",
"the",
"line"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1130-L1148 | [
"def",
"stdkey_home",
"(",
"self",
",",
"shift",
",",
"ctrl",
",",
"prompt_pos",
"=",
"None",
")",
":",
"move_mode",
"=",
"self",
".",
"__get_move_mode",
"(",
"shift",
")",
"if",
"ctrl",
":",
"self",
".",
"moveCursor",
"(",
"QTextCursor",
".",
"Start",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.mousePressEvent | Reimplement Qt method | spyder/plugins/editor/widgets/base.py | def mousePressEvent(self, event):
"""Reimplement Qt method"""
if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
self.calltip_widget.hide()
self.setFocus()
event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
... | def mousePressEvent(self, event):
"""Reimplement Qt method"""
if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
self.calltip_widget.hide()
self.setFocus()
event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
... | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1168-L1190 | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'linux'",
")",
"and",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"MidButton",
":",
"self",
".",
"calltip_widget",
".",
"hide",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.focusInEvent | Reimplemented to handle focus | spyder/plugins/editor/widgets/base.py | def focusInEvent(self, event):
"""Reimplemented to handle focus"""
self.focus_changed.emit()
self.focus_in.emit()
self.highlight_current_cell()
QPlainTextEdit.focusInEvent(self, event) | def focusInEvent(self, event):
"""Reimplemented to handle focus"""
self.focus_changed.emit()
self.focus_in.emit()
self.highlight_current_cell()
QPlainTextEdit.focusInEvent(self, event) | [
"Reimplemented",
"to",
"handle",
"focus"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1192-L1197 | [
"def",
"focusInEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"focus_changed",
".",
"emit",
"(",
")",
"self",
".",
"focus_in",
".",
"emit",
"(",
")",
"self",
".",
"highlight_current_cell",
"(",
")",
"QPlainTextEdit",
".",
"focusInEvent",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.focusOutEvent | Reimplemented to handle focus | spyder/plugins/editor/widgets/base.py | def focusOutEvent(self, event):
"""Reimplemented to handle focus"""
self.focus_changed.emit()
QPlainTextEdit.focusOutEvent(self, event) | def focusOutEvent(self, event):
"""Reimplemented to handle focus"""
self.focus_changed.emit()
QPlainTextEdit.focusOutEvent(self, event) | [
"Reimplemented",
"to",
"handle",
"focus"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1199-L1202 | [
"def",
"focusOutEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"focus_changed",
".",
"emit",
"(",
")",
"QPlainTextEdit",
".",
"focusOutEvent",
"(",
"self",
",",
"event",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditBaseWidget.wheelEvent | Reimplemented to emit zoom in/out signals when Ctrl is pressed | spyder/plugins/editor/widgets/base.py | def wheelEvent(self, event):
"""Reimplemented to emit zoom in/out signals when Ctrl is pressed"""
# This feature is disabled on MacOS, see Issue 1510
if sys.platform != 'darwin':
if event.modifiers() & Qt.ControlModifier:
if hasattr(event, 'angleDelta'):
... | def wheelEvent(self, event):
"""Reimplemented to emit zoom in/out signals when Ctrl is pressed"""
# This feature is disabled on MacOS, see Issue 1510
if sys.platform != 'darwin':
if event.modifiers() & Qt.ControlModifier:
if hasattr(event, 'angleDelta'):
... | [
"Reimplemented",
"to",
"emit",
"zoom",
"in",
"/",
"out",
"signals",
"when",
"Ctrl",
"is",
"pressed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/base.py#L1204-L1221 | [
"def",
"wheelEvent",
"(",
"self",
",",
"event",
")",
":",
"# This feature is disabled on MacOS, see Issue 1510\r",
"if",
"sys",
".",
"platform",
"!=",
"'darwin'",
":",
"if",
"event",
".",
"modifiers",
"(",
")",
"&",
"Qt",
".",
"ControlModifier",
":",
"if",
"ha... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_options | Convert options into commands
return commands, message | spyder/app/cli_options.py | def get_options(argv=None):
"""
Convert options into commands
return commands, message
"""
parser = argparse.ArgumentParser(usage="spyder [options] files")
parser.add_argument('--new-instance', action='store_true', default=False,
help="Run a new instance of Spyder, even if ... | def get_options(argv=None):
"""
Convert options into commands
return commands, message
"""
parser = argparse.ArgumentParser(usage="spyder [options] files")
parser.add_argument('--new-instance', action='store_true', default=False,
help="Run a new instance of Spyder, even if ... | [
"Convert",
"options",
"into",
"commands",
"return",
"commands",
"message"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/cli_options.py#L9-L70 | [
"def",
"get_options",
"(",
"argv",
"=",
"None",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"usage",
"=",
"\"spyder [options] files\"",
")",
"parser",
".",
"add_argument",
"(",
"'--new-instance'",
",",
"action",
"=",
"'store_true'",
",",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BaseProject.set_recent_files | Set a list of files opened by the project. | spyder/plugins/projects/api.py | def set_recent_files(self, recent_files):
"""Set a list of files opened by the project."""
for recent_file in recent_files[:]:
if not os.path.isfile(recent_file):
recent_files.remove(recent_file)
try:
self.CONF[WORKSPACE].set('main', 'recent_files',
... | def set_recent_files(self, recent_files):
"""Set a list of files opened by the project."""
for recent_file in recent_files[:]:
if not os.path.isfile(recent_file):
recent_files.remove(recent_file)
try:
self.CONF[WORKSPACE].set('main', 'recent_files',
... | [
"Set",
"a",
"list",
"of",
"files",
"opened",
"by",
"the",
"project",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L68-L77 | [
"def",
"set_recent_files",
"(",
"self",
",",
"recent_files",
")",
":",
"for",
"recent_file",
"in",
"recent_files",
"[",
":",
"]",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"recent_file",
")",
":",
"recent_files",
".",
"remove",
"(",
"recen... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BaseProject.get_recent_files | Return a list of files opened by the project. | spyder/plugins/projects/api.py | def get_recent_files(self):
"""Return a list of files opened by the project."""
try:
recent_files = self.CONF[WORKSPACE].get('main', 'recent_files',
default=[])
except EnvironmentError:
return []
for rec... | def get_recent_files(self):
"""Return a list of files opened by the project."""
try:
recent_files = self.CONF[WORKSPACE].get('main', 'recent_files',
default=[])
except EnvironmentError:
return []
for rec... | [
"Return",
"a",
"list",
"of",
"files",
"opened",
"by",
"the",
"project",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L79-L90 | [
"def",
"get_recent_files",
"(",
"self",
")",
":",
"try",
":",
"recent_files",
"=",
"self",
".",
"CONF",
"[",
"WORKSPACE",
"]",
".",
"get",
"(",
"'main'",
",",
"'recent_files'",
",",
"default",
"=",
"[",
"]",
")",
"except",
"EnvironmentError",
":",
"retur... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BaseProject.set_root_path | Set project root path. | spyder/plugins/projects/api.py | def set_root_path(self, root_path):
"""Set project root path."""
if self.name is None:
self.name = osp.basename(root_path)
self.root_path = to_text_string(root_path)
config_path = self.__get_project_config_path()
if osp.exists(config_path):
self.loa... | def set_root_path(self, root_path):
"""Set project root path."""
if self.name is None:
self.name = osp.basename(root_path)
self.root_path = to_text_string(root_path)
config_path = self.__get_project_config_path()
if osp.exists(config_path):
self.loa... | [
"Set",
"project",
"root",
"path",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L115-L126 | [
"def",
"set_root_path",
"(",
"self",
",",
"root_path",
")",
":",
"if",
"self",
".",
"name",
"is",
"None",
":",
"self",
".",
"name",
"=",
"osp",
".",
"basename",
"(",
"root_path",
")",
"self",
".",
"root_path",
"=",
"to_text_string",
"(",
"root_path",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | BaseProject.rename | Rename project and rename its root path accordingly. | spyder/plugins/projects/api.py | def rename(self, new_name):
"""Rename project and rename its root path accordingly."""
old_name = self.name
self.name = new_name
pypath = self.relative_pythonpath # ??
self.root_path = self.root_path[:-len(old_name)]+new_name
self.relative_pythonpath = pypath # ??... | def rename(self, new_name):
"""Rename project and rename its root path accordingly."""
old_name = self.name
self.name = new_name
pypath = self.relative_pythonpath # ??
self.root_path = self.root_path[:-len(old_name)]+new_name
self.relative_pythonpath = pypath # ??... | [
"Rename",
"project",
"and",
"rename",
"its",
"root",
"path",
"accordingly",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/api.py#L128-L135 | [
"def",
"rename",
"(",
"self",
",",
"new_name",
")",
":",
"old_name",
"=",
"self",
".",
"name",
"self",
".",
"name",
"=",
"new_name",
"pypath",
"=",
"self",
".",
"relative_pythonpath",
"# ??\r",
"self",
".",
"root_path",
"=",
"self",
".",
"root_path",
"["... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PydocBrowser.initialize | Start pydoc server | spyder/plugins/onlinehelp/widgets.py | def initialize(self):
"""Start pydoc server"""
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
QApplication.processEvents()
self.start_server() | def initialize(self):
"""Start pydoc server"""
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
QApplication.processEvents()
self.start_server() | [
"Start",
"pydoc",
"server"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L80-L84 | [
"def",
"initialize",
"(",
"self",
")",
":",
"QApplication",
".",
"setOverrideCursor",
"(",
"QCursor",
"(",
"Qt",
".",
"WaitCursor",
")",
")",
"QApplication",
".",
"processEvents",
"(",
")",
"self",
".",
"start_server",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PydocBrowser.start_server | Start pydoc server | spyder/plugins/onlinehelp/widgets.py | def start_server(self):
"""Start pydoc server"""
if self.server is None:
self.port = select_port(default_port=self.DEFAULT_PORT)
self.set_home_url('http://localhost:%d/' % self.port)
elif self.server.isRunning():
self.server.server_started.disconnect(sel... | def start_server(self):
"""Start pydoc server"""
if self.server is None:
self.port = select_port(default_port=self.DEFAULT_PORT)
self.set_home_url('http://localhost:%d/' % self.port)
elif self.server.isRunning():
self.server.server_started.disconnect(sel... | [
"Start",
"pydoc",
"server"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L104-L114 | [
"def",
"start_server",
"(",
"self",
")",
":",
"if",
"self",
".",
"server",
"is",
"None",
":",
"self",
".",
"port",
"=",
"select_port",
"(",
"default_port",
"=",
"self",
".",
"DEFAULT_PORT",
")",
"self",
".",
"set_home_url",
"(",
"'http://localhost:%d/'",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PydocBrowser.text_to_url | Convert text address into QUrl object | spyder/plugins/onlinehelp/widgets.py | def text_to_url(self, text):
"""Convert text address into QUrl object"""
if text.startswith('/'):
text = text[1:]
return QUrl(self.home_url.toString()+text+'.html') | def text_to_url(self, text):
"""Convert text address into QUrl object"""
if text.startswith('/'):
text = text[1:]
return QUrl(self.home_url.toString()+text+'.html') | [
"Convert",
"text",
"address",
"into",
"QUrl",
"object"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/widgets.py#L126-L130 | [
"def",
"text_to_url",
"(",
"self",
",",
"text",
")",
":",
"if",
"text",
".",
"startswith",
"(",
"'/'",
")",
":",
"text",
"=",
"text",
"[",
"1",
":",
"]",
"return",
"QUrl",
"(",
"self",
".",
"home_url",
".",
"toString",
"(",
")",
"+",
"text",
"+",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForPlugin.do_autosave | Instruct current editorstack to autosave files where necessary. | spyder/plugins/editor/utils/autosave.py | def do_autosave(self):
"""Instruct current editorstack to autosave files where necessary."""
logger.debug('Autosave triggered')
stack = self.editor.get_current_editorstack()
stack.autosave.autosave_all()
self.start_autosave_timer() | def do_autosave(self):
"""Instruct current editorstack to autosave files where necessary."""
logger.debug('Autosave triggered')
stack = self.editor.get_current_editorstack()
stack.autosave.autosave_all()
self.start_autosave_timer() | [
"Instruct",
"current",
"editorstack",
"to",
"autosave",
"files",
"where",
"necessary",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L99-L104 | [
"def",
"do_autosave",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"'Autosave triggered'",
")",
"stack",
"=",
"self",
".",
"editor",
".",
"get_current_editorstack",
"(",
")",
"stack",
".",
"autosave",
".",
"autosave_all",
"(",
")",
"self",
".",
"sta... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForPlugin.try_recover_from_autosave | Offer to recover files from autosave. | spyder/plugins/editor/utils/autosave.py | def try_recover_from_autosave(self):
"""Offer to recover files from autosave."""
autosave_dir = get_conf_path('autosave')
autosave_mapping = CONF.get('editor', 'autosave_mapping', {})
dialog = RecoveryDialog(autosave_dir, autosave_mapping,
parent=self.edit... | def try_recover_from_autosave(self):
"""Offer to recover files from autosave."""
autosave_dir = get_conf_path('autosave')
autosave_mapping = CONF.get('editor', 'autosave_mapping', {})
dialog = RecoveryDialog(autosave_dir, autosave_mapping,
parent=self.edit... | [
"Offer",
"to",
"recover",
"files",
"from",
"autosave",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L106-L113 | [
"def",
"try_recover_from_autosave",
"(",
"self",
")",
":",
"autosave_dir",
"=",
"get_conf_path",
"(",
"'autosave'",
")",
"autosave_mapping",
"=",
"CONF",
".",
"get",
"(",
"'editor'",
",",
"'autosave_mapping'",
",",
"{",
"}",
")",
"dialog",
"=",
"RecoveryDialog",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForStack.create_unique_autosave_filename | Create unique autosave file name for specified file name.
Args:
filename (str): original file name
autosave_dir (str): directory in which autosave files are stored | spyder/plugins/editor/utils/autosave.py | def create_unique_autosave_filename(self, filename, autosave_dir):
"""
Create unique autosave file name for specified file name.
Args:
filename (str): original file name
autosave_dir (str): directory in which autosave files are stored
"""
basename = osp.b... | def create_unique_autosave_filename(self, filename, autosave_dir):
"""
Create unique autosave file name for specified file name.
Args:
filename (str): original file name
autosave_dir (str): directory in which autosave files are stored
"""
basename = osp.b... | [
"Create",
"unique",
"autosave",
"file",
"name",
"for",
"specified",
"file",
"name",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L135-L152 | [
"def",
"create_unique_autosave_filename",
"(",
"self",
",",
"filename",
",",
"autosave_dir",
")",
":",
"basename",
"=",
"osp",
".",
"basename",
"(",
"filename",
")",
"autosave_filename",
"=",
"osp",
".",
"join",
"(",
"autosave_dir",
",",
"basename",
")",
"if",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForStack.remove_autosave_file | Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag. | spyder/plugins/editor/utils/autosave.py | def remove_autosave_file(self, fileinfo):
"""
Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag.
"""
filename = fileinfo.filename
if filename not in self.name_mapping:
... | def remove_autosave_file(self, fileinfo):
"""
Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag.
"""
filename = fileinfo.filename
if filename not in self.name_mapping:
... | [
"Remove",
"autosave",
"file",
"for",
"specified",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L154-L175 | [
"def",
"remove_autosave_file",
"(",
"self",
",",
"fileinfo",
")",
":",
"filename",
"=",
"fileinfo",
".",
"filename",
"if",
"filename",
"not",
"in",
"self",
".",
"name_mapping",
":",
"return",
"autosave_filename",
"=",
"self",
".",
"name_mapping",
"[",
"filenam... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForStack.get_autosave_filename | Get name of autosave file for specified file name.
This function uses the dict in `self.name_mapping`. If `filename` is
in the mapping, then return the corresponding autosave file name.
Otherwise, construct a unique file name and update the mapping.
Args:
filename (str): or... | spyder/plugins/editor/utils/autosave.py | def get_autosave_filename(self, filename):
"""
Get name of autosave file for specified file name.
This function uses the dict in `self.name_mapping`. If `filename` is
in the mapping, then return the corresponding autosave file name.
Otherwise, construct a unique file name and up... | def get_autosave_filename(self, filename):
"""
Get name of autosave file for specified file name.
This function uses the dict in `self.name_mapping`. If `filename` is
in the mapping, then return the corresponding autosave file name.
Otherwise, construct a unique file name and up... | [
"Get",
"name",
"of",
"autosave",
"file",
"for",
"specified",
"file",
"name",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L177-L205 | [
"def",
"get_autosave_filename",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"autosave_filename",
"=",
"self",
".",
"name_mapping",
"[",
"filename",
"]",
"except",
"KeyError",
":",
"autosave_dir",
"=",
"get_conf_path",
"(",
"'autosave'",
")",
"if",
"not... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForStack.autosave | Autosave a file.
Do nothing if the `changed_since_autosave` flag is not set or the file
is newly created (and thus not named by the user). Otherwise, save a
copy of the file with the name given by `self.get_autosave_filename()`
and clear the `changed_since_autosave` flag. Errors raised ... | spyder/plugins/editor/utils/autosave.py | def autosave(self, index):
"""
Autosave a file.
Do nothing if the `changed_since_autosave` flag is not set or the file
is newly created (and thus not named by the user). Otherwise, save a
copy of the file with the name given by `self.get_autosave_filename()`
and clear th... | def autosave(self, index):
"""
Autosave a file.
Do nothing if the `changed_since_autosave` flag is not set or the file
is newly created (and thus not named by the user). Otherwise, save a
copy of the file with the name given by `self.get_autosave_filename()`
and clear th... | [
"Autosave",
"a",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L207-L233 | [
"def",
"autosave",
"(",
"self",
",",
"index",
")",
":",
"finfo",
"=",
"self",
".",
"stack",
".",
"data",
"[",
"index",
"]",
"document",
"=",
"finfo",
".",
"editor",
".",
"document",
"(",
")",
"if",
"not",
"document",
".",
"changed_since_autosave",
"or"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AutosaveForStack.autosave_all | Autosave all opened files. | spyder/plugins/editor/utils/autosave.py | def autosave_all(self):
"""Autosave all opened files."""
for index in range(self.stack.get_stack_count()):
self.autosave(index) | def autosave_all(self):
"""Autosave all opened files."""
for index in range(self.stack.get_stack_count()):
self.autosave(index) | [
"Autosave",
"all",
"opened",
"files",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L235-L238 | [
"def",
"autosave_all",
"(",
"self",
")",
":",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"stack",
".",
"get_stack_count",
"(",
")",
")",
":",
"self",
".",
"autosave",
"(",
"index",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | tmpconfig | Fixtures that returns a temporary CONF element. | spyder/utils/fixtures.py | def tmpconfig(request):
"""
Fixtures that returns a temporary CONF element.
"""
SUBFOLDER = tempfile.mkdtemp()
CONF = UserConfig('spyder-test',
defaults=DEFAULTS,
version=CONF_VERSION,
subfolder=SUBFOLDER,
raw_mo... | def tmpconfig(request):
"""
Fixtures that returns a temporary CONF element.
"""
SUBFOLDER = tempfile.mkdtemp()
CONF = UserConfig('spyder-test',
defaults=DEFAULTS,
version=CONF_VERSION,
subfolder=SUBFOLDER,
raw_mo... | [
"Fixtures",
"that",
"returns",
"a",
"temporary",
"CONF",
"element",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/fixtures.py#L27-L46 | [
"def",
"tmpconfig",
"(",
"request",
")",
":",
"SUBFOLDER",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"CONF",
"=",
"UserConfig",
"(",
"'spyder-test'",
",",
"defaults",
"=",
"DEFAULTS",
",",
"version",
"=",
"CONF_VERSION",
",",
"subfolder",
"=",
"SUBFOLDER",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | log_last_error | Log last error in filename *fname* -- *context*: string (optional) | spyder/utils/debug.py | def log_last_error(fname, context=None):
"""Log last error in filename *fname* -- *context*: string (optional)"""
fd = open(fname, 'a')
log_time(fd)
if context:
print("Context", file=fd)
print("-------", file=fd)
print("", file=fd)
if PY2:
print(u' '.... | def log_last_error(fname, context=None):
"""Log last error in filename *fname* -- *context*: string (optional)"""
fd = open(fname, 'a')
log_time(fd)
if context:
print("Context", file=fd)
print("-------", file=fd)
print("", file=fd)
if PY2:
print(u' '.... | [
"Log",
"last",
"error",
"in",
"filename",
"*",
"fname",
"*",
"--",
"*",
"context",
"*",
":",
"string",
"(",
"optional",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/debug.py#L30-L48 | [
"def",
"log_last_error",
"(",
"fname",
",",
"context",
"=",
"None",
")",
":",
"fd",
"=",
"open",
"(",
"fname",
",",
"'a'",
")",
"log_time",
"(",
"fd",
")",
"if",
"context",
":",
"print",
"(",
"\"Context\"",
",",
"file",
"=",
"fd",
")",
"print",
"("... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | log_methods_calls | Hack `some_class` to log all method calls into `fname` file.
If `prefix` format is not set, each log entry is prefixed with:
--[ asked / called / defined ] --
asked - name of `some_class`
called - name of class for which a method is called
defined - name of class where method i... | spyder/utils/debug.py | def log_methods_calls(fname, some_class, prefix=None):
"""
Hack `some_class` to log all method calls into `fname` file.
If `prefix` format is not set, each log entry is prefixed with:
--[ asked / called / defined ] --
asked - name of `some_class`
called - name of class for whi... | def log_methods_calls(fname, some_class, prefix=None):
"""
Hack `some_class` to log all method calls into `fname` file.
If `prefix` format is not set, each log entry is prefixed with:
--[ asked / called / defined ] --
asked - name of `some_class`
called - name of class for whi... | [
"Hack",
"some_class",
"to",
"log",
"all",
"method",
"calls",
"into",
"fname",
"file",
".",
"If",
"prefix",
"format",
"is",
"not",
"set",
"each",
"log",
"entry",
"is",
"prefixed",
"with",
":",
"--",
"[",
"asked",
"/",
"called",
"/",
"defined",
"]",
"--"... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/debug.py#L95-L146 | [
"def",
"log_methods_calls",
"(",
"fname",
",",
"some_class",
",",
"prefix",
"=",
"None",
")",
":",
"# test if file is writable\r",
"open",
"(",
"fname",
",",
"'a'",
")",
".",
"close",
"(",
")",
"FILENAME",
"=",
"fname",
"CLASS",
"=",
"some_class",
"PREFIX",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.offset | This property holds the vertical offset of the scroll flag area
relative to the top of the text editor. | spyder/plugins/editor/panels/scrollflag.py | def offset(self):
"""This property holds the vertical offset of the scroll flag area
relative to the top of the text editor."""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in which t... | def offset(self):
"""This property holds the vertical offset of the scroll flag area
relative to the top of the text editor."""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in which t... | [
"This",
"property",
"holds",
"the",
"vertical",
"offset",
"of",
"the",
"scroll",
"flag",
"area",
"relative",
"to",
"the",
"top",
"of",
"the",
"text",
"editor",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L49-L61 | [
"def",
"offset",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",
"QStyleOptionSlider",
"(",
")",
"vsb",
".",
"initStyleOption",
"(",
"opt",
")",
"#... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.paintEvent | Override Qt method.
Painting the scroll flag area | spyder/plugins/editor/panels/scrollflag.py | def paintEvent(self, event):
"""
Override Qt method.
Painting the scroll flag area
"""
make_flag = self.make_flag_qrect
# Fill the whole painting area
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
# Paint wa... | def paintEvent(self, event):
"""
Override Qt method.
Painting the scroll flag area
"""
make_flag = self.make_flag_qrect
# Fill the whole painting area
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
# Paint wa... | [
"Override",
"Qt",
"method",
".",
"Painting",
"the",
"scroll",
"flag",
"area"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L67-L138 | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"make_flag",
"=",
"self",
".",
"make_flag_qrect",
"# Fill the whole painting area",
"painter",
"=",
"QPainter",
"(",
"self",
")",
"painter",
".",
"fillRect",
"(",
"event",
".",
"rect",
"(",
")",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.mousePressEvent | Override Qt method | spyder/plugins/editor/panels/scrollflag.py | def mousePressEvent(self, event):
"""Override Qt method"""
if self.slider and event.button() == Qt.LeftButton:
vsb = self.editor.verticalScrollBar()
value = self.position_to_value(event.pos().y())
vsb.setValue(value-vsb.pageStep()/2) | def mousePressEvent(self, event):
"""Override Qt method"""
if self.slider and event.button() == Qt.LeftButton:
vsb = self.editor.verticalScrollBar()
value = self.position_to_value(event.pos().y())
vsb.setValue(value-vsb.pageStep()/2) | [
"Override",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L152-L157 | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"slider",
"and",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"LeftButton",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"value",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.keyReleaseEvent | Override Qt method. | spyder/plugins/editor/panels/scrollflag.py | def keyReleaseEvent(self, event):
"""Override Qt method."""
if event.key() == Qt.Key_Alt:
self._alt_key_is_down = False
self.update() | def keyReleaseEvent(self, event):
"""Override Qt method."""
if event.key() == Qt.Key_Alt:
self._alt_key_is_down = False
self.update() | [
"Override",
"Qt",
"method",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L159-L163 | [
"def",
"keyReleaseEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Alt",
":",
"self",
".",
"_alt_key_is_down",
"=",
"False",
"self",
".",
"update",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.keyPressEvent | Override Qt method | spyder/plugins/editor/panels/scrollflag.py | def keyPressEvent(self, event):
"""Override Qt method"""
if event.key() == Qt.Key_Alt:
self._alt_key_is_down = True
self.update() | def keyPressEvent(self, event):
"""Override Qt method"""
if event.key() == Qt.Key_Alt:
self._alt_key_is_down = True
self.update() | [
"Override",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L165-L169 | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Alt",
":",
"self",
".",
"_alt_key_is_down",
"=",
"True",
"self",
".",
"update",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.get_scrollbar_position_height | Return the pixel span height of the scrollbar area in which
the slider handle may move | spyder/plugins/editor/panels/scrollflag.py | def get_scrollbar_position_height(self):
"""Return the pixel span height of the scrollbar area in which
the slider handle may move"""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in w... | def get_scrollbar_position_height(self):
"""Return the pixel span height of the scrollbar area in which
the slider handle may move"""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in w... | [
"Return",
"the",
"pixel",
"span",
"height",
"of",
"the",
"scrollbar",
"area",
"in",
"which",
"the",
"slider",
"handle",
"may",
"move"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L171-L183 | [
"def",
"get_scrollbar_position_height",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",
"QStyleOptionSlider",
"(",
")",
"vsb",
".",
"initStyleOption",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.get_scrollbar_value_height | Return the value span height of the scrollbar | spyder/plugins/editor/panels/scrollflag.py | def get_scrollbar_value_height(self):
"""Return the value span height of the scrollbar"""
vsb = self.editor.verticalScrollBar()
return vsb.maximum()-vsb.minimum()+vsb.pageStep() | def get_scrollbar_value_height(self):
"""Return the value span height of the scrollbar"""
vsb = self.editor.verticalScrollBar()
return vsb.maximum()-vsb.minimum()+vsb.pageStep() | [
"Return",
"the",
"value",
"span",
"height",
"of",
"the",
"scrollbar"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L185-L188 | [
"def",
"get_scrollbar_value_height",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"return",
"vsb",
".",
"maximum",
"(",
")",
"-",
"vsb",
".",
"minimum",
"(",
")",
"+",
"vsb",
".",
"pageStep",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.value_to_position | Convert value to position in pixels | spyder/plugins/editor/panels/scrollflag.py | def value_to_position(self, y):
"""Convert value to position in pixels"""
vsb = self.editor.verticalScrollBar()
return (y-vsb.minimum())*self.get_scale_factor()+self.offset | def value_to_position(self, y):
"""Convert value to position in pixels"""
vsb = self.editor.verticalScrollBar()
return (y-vsb.minimum())*self.get_scale_factor()+self.offset | [
"Convert",
"value",
"to",
"position",
"in",
"pixels"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L196-L199 | [
"def",
"value_to_position",
"(",
"self",
",",
"y",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"return",
"(",
"y",
"-",
"vsb",
".",
"minimum",
"(",
")",
")",
"*",
"self",
".",
"get_scale_factor",
"(",
")",
"+",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.position_to_value | Convert position in pixels to value | spyder/plugins/editor/panels/scrollflag.py | def position_to_value(self, y):
"""Convert position in pixels to value"""
vsb = self.editor.verticalScrollBar()
return vsb.minimum()+max([0, (y-self.offset)/self.get_scale_factor()]) | def position_to_value(self, y):
"""Convert position in pixels to value"""
vsb = self.editor.verticalScrollBar()
return vsb.minimum()+max([0, (y-self.offset)/self.get_scale_factor()]) | [
"Convert",
"position",
"in",
"pixels",
"to",
"value"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L201-L204 | [
"def",
"position_to_value",
"(",
"self",
",",
"y",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"return",
"vsb",
".",
"minimum",
"(",
")",
"+",
"max",
"(",
"[",
"0",
",",
"(",
"y",
"-",
"self",
".",
"offset",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.make_flag_qrect | Make flag QRect | spyder/plugins/editor/panels/scrollflag.py | def make_flag_qrect(self, value):
"""Make flag QRect"""
if self.slider:
position = self.value_to_position(value+0.5)
# The 0.5 offset is used to align the flags with the center of
# their corresponding text edit block before scaling.
return QRect(self.FLA... | def make_flag_qrect(self, value):
"""Make flag QRect"""
if self.slider:
position = self.value_to_position(value+0.5)
# The 0.5 offset is used to align the flags with the center of
# their corresponding text edit block before scaling.
return QRect(self.FLA... | [
"Make",
"flag",
"QRect"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L206-L226 | [
"def",
"make_flag_qrect",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"slider",
":",
"position",
"=",
"self",
".",
"value_to_position",
"(",
"value",
"+",
"0.5",
")",
"# The 0.5 offset is used to align the flags with the center of",
"# their corresponding ... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.make_slider_range | Make slider range QRect | spyder/plugins/editor/panels/scrollflag.py | def make_slider_range(self, cursor_pos):
"""Make slider range QRect"""
# The slider range indicator position follows the mouse vertical
# position while its height corresponds to the part of the file that
# is currently visible on screen.
vsb = self.editor.verticalScrollBar()
... | def make_slider_range(self, cursor_pos):
"""Make slider range QRect"""
# The slider range indicator position follows the mouse vertical
# position while its height corresponds to the part of the file that
# is currently visible on screen.
vsb = self.editor.verticalScrollBar()
... | [
"Make",
"slider",
"range",
"QRect"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L228-L247 | [
"def",
"make_slider_range",
"(",
"self",
",",
"cursor_pos",
")",
":",
"# The slider range indicator position follows the mouse vertical",
"# position while its height corresponds to the part of the file that",
"# is currently visible on screen.",
"vsb",
"=",
"self",
".",
"editor",
".... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ScrollFlagArea.set_painter | Set scroll flag area painter pen and brush colors | spyder/plugins/editor/panels/scrollflag.py | def set_painter(self, painter, light_color):
"""Set scroll flag area painter pen and brush colors"""
painter.setPen(QColor(light_color).darker(120))
painter.setBrush(QBrush(QColor(light_color))) | def set_painter(self, painter, light_color):
"""Set scroll flag area painter pen and brush colors"""
painter.setPen(QColor(light_color).darker(120))
painter.setBrush(QBrush(QColor(light_color))) | [
"Set",
"scroll",
"flag",
"area",
"painter",
"pen",
"and",
"brush",
"colors"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L253-L256 | [
"def",
"set_painter",
"(",
"self",
",",
"painter",
",",
"light_color",
")",
":",
"painter",
".",
"setPen",
"(",
"QColor",
"(",
"light_color",
")",
".",
"darker",
"(",
"120",
")",
")",
"painter",
".",
"setBrush",
"(",
"QBrush",
"(",
"QColor",
"(",
"ligh... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Profiler.on_first_registration | Action to be performed on first plugin registration | spyder/plugins/profiler/plugin.py | def on_first_registration(self):
"""Action to be performed on first plugin registration"""
self.main.tabify_plugins(self.main.help, self)
self.dockwidget.hide() | def on_first_registration(self):
"""Action to be performed on first plugin registration"""
self.main.tabify_plugins(self.main.help, self)
self.dockwidget.hide() | [
"Action",
"to",
"be",
"performed",
"on",
"first",
"plugin",
"registration"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/plugin.py#L75-L78 | [
"def",
"on_first_registration",
"(",
"self",
")",
":",
"self",
".",
"main",
".",
"tabify_plugins",
"(",
"self",
".",
"main",
".",
"help",
",",
"self",
")",
"self",
".",
"dockwidget",
".",
"hide",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Profiler.register_plugin | Register plugin in Spyder's main window | spyder/plugins/profiler/plugin.py | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.profiler.datatree.sig_edit_goto.connect(self.main.editor.load)
self.profiler.redirect_stdio.connect(
self.main.redirect_internalshell_stdio)
self.main.add_dockwidget(self)
profiler_act = cr... | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.profiler.datatree.sig_edit_goto.connect(self.main.editor.load)
self.profiler.redirect_stdio.connect(
self.main.redirect_internalshell_stdio)
self.main.add_dockwidget(self)
profiler_act = cr... | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/plugin.py#L80-L95 | [
"def",
"register_plugin",
"(",
"self",
")",
":",
"self",
".",
"profiler",
".",
"datatree",
".",
"sig_edit_goto",
".",
"connect",
"(",
"self",
".",
"main",
".",
"editor",
".",
"load",
")",
"self",
".",
"profiler",
".",
"redirect_stdio",
".",
"connect",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Profiler.run_profiler | Run profiler | spyder/plugins/profiler/plugin.py | def run_profiler(self):
"""Run profiler"""
if self.main.editor.save():
self.switch_to_plugin()
self.analyze(self.main.editor.get_current_filename()) | def run_profiler(self):
"""Run profiler"""
if self.main.editor.save():
self.switch_to_plugin()
self.analyze(self.main.editor.get_current_filename()) | [
"Run",
"profiler"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/plugin.py#L112-L116 | [
"def",
"run_profiler",
"(",
"self",
")",
":",
"if",
"self",
".",
"main",
".",
"editor",
".",
"save",
"(",
")",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"self",
".",
"analyze",
"(",
"self",
".",
"main",
".",
"editor",
".",
"get_current_filename",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Profiler.analyze | Reimplement analyze method | spyder/plugins/profiler/plugin.py | def analyze(self, filename):
"""Reimplement analyze method"""
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.setFocus()
self.dockwidget.raise_()
pythonpath = self.main.get_spyder_pythonpath()
runconf = get... | def analyze(self, filename):
"""Reimplement analyze method"""
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.setFocus()
self.dockwidget.raise_()
pythonpath = self.main.get_spyder_pythonpath()
runconf = get... | [
"Reimplement",
"analyze",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/plugin.py#L118-L133 | [
"def",
"analyze",
"(",
"self",
",",
"filename",
")",
":",
"if",
"self",
".",
"dockwidget",
"and",
"not",
"self",
".",
"ismaximized",
":",
"self",
".",
"dockwidget",
".",
"setVisible",
"(",
"True",
")",
"self",
".",
"dockwidget",
".",
"setFocus",
"(",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | windows_memory_usage | Return physical memory usage (float)
Works on Windows platforms only | spyder/utils/system.py | def windows_memory_usage():
"""Return physical memory usage (float)
Works on Windows platforms only"""
from ctypes import windll, Structure, c_uint64, sizeof, byref
from ctypes.wintypes import DWORD
class MemoryStatus(Structure):
_fields_ = [('dwLength', DWORD),
('... | def windows_memory_usage():
"""Return physical memory usage (float)
Works on Windows platforms only"""
from ctypes import windll, Structure, c_uint64, sizeof, byref
from ctypes.wintypes import DWORD
class MemoryStatus(Structure):
_fields_ = [('dwLength', DWORD),
('... | [
"Return",
"physical",
"memory",
"usage",
"(",
"float",
")",
"Works",
"on",
"Windows",
"platforms",
"only"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/system.py#L22-L43 | [
"def",
"windows_memory_usage",
"(",
")",
":",
"from",
"ctypes",
"import",
"windll",
",",
"Structure",
",",
"c_uint64",
",",
"sizeof",
",",
"byref",
"from",
"ctypes",
".",
"wintypes",
"import",
"DWORD",
"class",
"MemoryStatus",
"(",
"Structure",
")",
":",
"_f... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.