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 | ArrayModel.setData | Cell content change | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def setData(self, index, value, role=Qt.EditRole):
"""Cell content change"""
if not index.isValid() or self.readonly:
return False
i = index.row()
j = index.column()
value = from_qvariant(value, str)
dtype = self._data.dtype.name
if dtype == "b... | def setData(self, index, value, role=Qt.EditRole):
"""Cell content change"""
if not index.isValid() or self.readonly:
return False
i = index.row()
j = index.column()
value = from_qvariant(value, str)
dtype = self._data.dtype.name
if dtype == "b... | [
"Cell",
"content",
"change"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L289-L333 | [
"def",
"setData",
"(",
"self",
",",
"index",
",",
"value",
",",
"role",
"=",
"Qt",
".",
"EditRole",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
"or",
"self",
".",
"readonly",
":",
"return",
"False",
"i",
"=",
"index",
".",
"row",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayModel.headerData | Set header data | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def headerData(self, section, orientation, role=Qt.DisplayRole):
"""Set header data"""
if role != Qt.DisplayRole:
return to_qvariant()
labels = self.xlabels if orientation == Qt.Horizontal else self.ylabels
if labels is None:
return to_qvariant(int(section))... | def headerData(self, section, orientation, role=Qt.DisplayRole):
"""Set header data"""
if role != Qt.DisplayRole:
return to_qvariant()
labels = self.xlabels if orientation == Qt.Horizontal else self.ylabels
if labels is None:
return to_qvariant(int(section))... | [
"Set",
"header",
"data"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L342-L350 | [
"def",
"headerData",
"(",
"self",
",",
"section",
",",
"orientation",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"role",
"!=",
"Qt",
".",
"DisplayRole",
":",
"return",
"to_qvariant",
"(",
")",
"labels",
"=",
"self",
".",
"xlabels",
"if... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayDelegate.createEditor | Create editor widget | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def createEditor(self, parent, option, index):
"""Create editor widget"""
model = index.model()
value = model.get_value(index)
if model._data.dtype.name == "bool":
value = not value
model.setData(index, to_qvariant(value))
return
elif v... | def createEditor(self, parent, option, index):
"""Create editor widget"""
model = index.model()
value = model.get_value(index)
if model._data.dtype.name == "bool":
value = not value
model.setData(index, to_qvariant(value))
return
elif v... | [
"Create",
"editor",
"widget"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L363-L380 | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"option",
",",
"index",
")",
":",
"model",
"=",
"index",
".",
"model",
"(",
")",
"value",
"=",
"model",
".",
"get_value",
"(",
"index",
")",
"if",
"model",
".",
"_data",
".",
"dtype",
".",
"na... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayDelegate.commitAndCloseEditor | Commit and close editor | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def commitAndCloseEditor(self):
"""Commit and close editor"""
editor = self.sender()
# Avoid a segfault with PyQt5. Variable value won't be changed
# but at least Spyder won't crash. It seems generated by a bug in sip.
try:
self.commitData.emit(editor)
... | def commitAndCloseEditor(self):
"""Commit and close editor"""
editor = self.sender()
# Avoid a segfault with PyQt5. Variable value won't be changed
# but at least Spyder won't crash. It seems generated by a bug in sip.
try:
self.commitData.emit(editor)
... | [
"Commit",
"and",
"close",
"editor"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L382-L391 | [
"def",
"commitAndCloseEditor",
"(",
"self",
")",
":",
"editor",
"=",
"self",
".",
"sender",
"(",
")",
"# Avoid a segfault with PyQt5. Variable value won't be changed\r",
"# but at least Spyder won't crash. It seems generated by a bug in sip.\r",
"try",
":",
"self",
".",
"commit... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayDelegate.setEditorData | Set editor widget's data | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def setEditorData(self, editor, index):
"""Set editor widget's data"""
text = from_qvariant(index.model().data(index, Qt.DisplayRole), str)
editor.setText(text) | def setEditorData(self, editor, index):
"""Set editor widget's data"""
text = from_qvariant(index.model().data(index, Qt.DisplayRole), str)
editor.setText(text) | [
"Set",
"editor",
"widget",
"s",
"data"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L393-L396 | [
"def",
"setEditorData",
"(",
"self",
",",
"editor",
",",
"index",
")",
":",
"text",
"=",
"from_qvariant",
"(",
"index",
".",
"model",
"(",
")",
".",
"data",
"(",
"index",
",",
"Qt",
".",
"DisplayRole",
")",
",",
"str",
")",
"editor",
".",
"setText",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayView.resize_to_contents | Resize cells to contents | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def resize_to_contents(self):
"""Resize cells to contents"""
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
self.resizeColumnsToContents()
self.model().fetch_more(columns=True)
self.resizeColumnsToContents()
QApplication.restoreOverrideCursor() | def resize_to_contents(self):
"""Resize cells to contents"""
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
self.resizeColumnsToContents()
self.model().fetch_more(columns=True)
self.resizeColumnsToContents()
QApplication.restoreOverrideCursor() | [
"Resize",
"cells",
"to",
"contents"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L464-L470 | [
"def",
"resize_to_contents",
"(",
"self",
")",
":",
"QApplication",
".",
"setOverrideCursor",
"(",
"QCursor",
"(",
"Qt",
".",
"WaitCursor",
")",
")",
"self",
".",
"resizeColumnsToContents",
"(",
")",
"self",
".",
"model",
"(",
")",
".",
"fetch_more",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayView.setup_menu | Setup context menu | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def setup_menu(self):
"""Setup context menu"""
self.copy_action = create_action(self, _('Copy'),
shortcut=keybinding('Copy'),
icon=ima.icon('editcopy'),
triggered=self.copy,
... | def setup_menu(self):
"""Setup context menu"""
self.copy_action = create_action(self, _('Copy'),
shortcut=keybinding('Copy'),
icon=ima.icon('editcopy'),
triggered=self.copy,
... | [
"Setup",
"context",
"menu"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L472-L481 | [
"def",
"setup_menu",
"(",
"self",
")",
":",
"self",
".",
"copy_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"'Copy'",
")",
",",
"shortcut",
"=",
"keybinding",
"(",
"'Copy'",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'editcopy'",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayView.contextMenuEvent | Reimplement Qt method | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.menu.popup(event.globalPos())
event.accept() | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.menu.popup(event.globalPos())
event.accept() | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L483-L486 | [
"def",
"contextMenuEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"menu",
".",
"popup",
"(",
"event",
".",
"globalPos",
"(",
")",
")",
"event",
".",
"accept",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayView.keyPressEvent | Reimplement Qt method | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def keyPressEvent(self, event):
"""Reimplement Qt method"""
if event == QKeySequence.Copy:
self.copy()
else:
QTableView.keyPressEvent(self, event) | def keyPressEvent(self, event):
"""Reimplement Qt method"""
if event == QKeySequence.Copy:
self.copy()
else:
QTableView.keyPressEvent(self, event) | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L488-L493 | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
"==",
"QKeySequence",
".",
"Copy",
":",
"self",
".",
"copy",
"(",
")",
"else",
":",
"QTableView",
".",
"keyPressEvent",
"(",
"self",
",",
"event",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayView._sel_to_text | Copy an array portion to a unicode string | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def _sel_to_text(self, cell_range):
"""Copy an array portion to a unicode string"""
if not cell_range:
return
row_min, row_max, col_min, col_max = get_idx_rect(cell_range)
if col_min == 0 and col_max == (self.model().cols_loaded-1):
# we've selected a whole ... | def _sel_to_text(self, cell_range):
"""Copy an array portion to a unicode string"""
if not cell_range:
return
row_min, row_max, col_min, col_max = get_idx_rect(cell_range)
if col_min == 0 and col_max == (self.model().cols_loaded-1):
# we've selected a whole ... | [
"Copy",
"an",
"array",
"portion",
"to",
"a",
"unicode",
"string"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L495-L523 | [
"def",
"_sel_to_text",
"(",
"self",
",",
"cell_range",
")",
":",
"if",
"not",
"cell_range",
":",
"return",
"row_min",
",",
"row_max",
",",
"col_min",
",",
"col_max",
"=",
"get_idx_rect",
"(",
"cell_range",
")",
"if",
"col_min",
"==",
"0",
"and",
"col_max",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayView.copy | Copy text to clipboard | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def copy(self):
"""Copy text to clipboard"""
cliptxt = self._sel_to_text( self.selectedIndexes() )
clipboard = QApplication.clipboard()
clipboard.setText(cliptxt) | def copy(self):
"""Copy text to clipboard"""
cliptxt = self._sel_to_text( self.selectedIndexes() )
clipboard = QApplication.clipboard()
clipboard.setText(cliptxt) | [
"Copy",
"text",
"to",
"clipboard"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L526-L530 | [
"def",
"copy",
"(",
"self",
")",
":",
"cliptxt",
"=",
"self",
".",
"_sel_to_text",
"(",
"self",
".",
"selectedIndexes",
"(",
")",
")",
"clipboard",
"=",
"QApplication",
".",
"clipboard",
"(",
")",
"clipboard",
".",
"setText",
"(",
"cliptxt",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditorWidget.accept_changes | Accept changes | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def accept_changes(self):
"""Accept changes"""
for (i, j), value in list(self.model.changes.items()):
self.data[i, j] = value
if self.old_data_shape is not None:
self.data.shape = self.old_data_shape | def accept_changes(self):
"""Accept changes"""
for (i, j), value in list(self.model.changes.items()):
self.data[i, j] = value
if self.old_data_shape is not None:
self.data.shape = self.old_data_shape | [
"Accept",
"changes"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L573-L578 | [
"def",
"accept_changes",
"(",
"self",
")",
":",
"for",
"(",
"i",
",",
"j",
")",
",",
"value",
"in",
"list",
"(",
"self",
".",
"model",
".",
"changes",
".",
"items",
"(",
")",
")",
":",
"self",
".",
"data",
"[",
"i",
",",
"j",
"]",
"=",
"value... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditorWidget.change_format | Change display format | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def change_format(self):
"""Change display format"""
format, valid = QInputDialog.getText(self, _( 'Format'),
_( "Float formatting"),
QLineEdit.Normal, self.model.get_format())
if valid:
format = str(format)
... | def change_format(self):
"""Change display format"""
format, valid = QInputDialog.getText(self, _( 'Format'),
_( "Float formatting"),
QLineEdit.Normal, self.model.get_format())
if valid:
format = str(format)
... | [
"Change",
"display",
"format"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L585-L598 | [
"def",
"change_format",
"(",
"self",
")",
":",
"format",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'Format'",
")",
",",
"_",
"(",
"\"Float formatting\"",
")",
",",
"QLineEdit",
".",
"Normal",
",",
"self",
".",
"mod... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditor.setup_and_check | Setup ArrayEditor:
return False if data is not supported, True otherwise | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def setup_and_check(self, data, title='', readonly=False,
xlabels=None, ylabels=None):
"""
Setup ArrayEditor:
return False if data is not supported, True otherwise
"""
self.data = data
readonly = readonly or not self.data.flags.writeable
... | def setup_and_check(self, data, title='', readonly=False,
xlabels=None, ylabels=None):
"""
Setup ArrayEditor:
return False if data is not supported, True otherwise
"""
self.data = data
readonly = readonly or not self.data.flags.writeable
... | [
"Setup",
"ArrayEditor",
":",
"return",
"False",
"if",
"data",
"is",
"not",
"supported",
"True",
"otherwise"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L622-L761 | [
"def",
"setup_and_check",
"(",
"self",
",",
"data",
",",
"title",
"=",
"''",
",",
"readonly",
"=",
"False",
",",
"xlabels",
"=",
"None",
",",
"ylabels",
"=",
"None",
")",
":",
"self",
".",
"data",
"=",
"data",
"readonly",
"=",
"readonly",
"or",
"not"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditor.change_active_widget | This is implemented for handling negative values in index for
3d arrays, to give the same behavior as slicing | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def change_active_widget(self, index):
"""
This is implemented for handling negative values in index for
3d arrays, to give the same behavior as slicing
"""
string_index = [':']*3
string_index[self.last_dim] = '<font color=red>%i</font>'
self.slicing_label.... | def change_active_widget(self, index):
"""
This is implemented for handling negative values in index for
3d arrays, to give the same behavior as slicing
"""
string_index = [':']*3
string_index[self.last_dim] = '<font color=red>%i</font>'
self.slicing_label.... | [
"This",
"is",
"implemented",
"for",
"handling",
"negative",
"values",
"in",
"index",
"for",
"3d",
"arrays",
"to",
"give",
"the",
"same",
"behavior",
"as",
"slicing"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L775-L801 | [
"def",
"change_active_widget",
"(",
"self",
",",
"index",
")",
":",
"string_index",
"=",
"[",
"':'",
"]",
"*",
"3",
"string_index",
"[",
"self",
".",
"last_dim",
"]",
"=",
"'<font color=red>%i</font>'",
"self",
".",
"slicing_label",
".",
"setText",
"(",
"(",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditor.current_dim_changed | This change the active axis the array editor is plotting over
in 3D | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def current_dim_changed(self, index):
"""
This change the active axis the array editor is plotting over
in 3D
"""
self.last_dim = index
string_size = ['%i']*3
string_size[index] = '<font color=red>%i</font>'
self.shape_label.setText(('Shape: (' + '... | def current_dim_changed(self, index):
"""
This change the active axis the array editor is plotting over
in 3D
"""
self.last_dim = index
string_size = ['%i']*3
string_size[index] = '<font color=red>%i</font>'
self.shape_label.setText(('Shape: (' + '... | [
"This",
"change",
"the",
"active",
"axis",
"the",
"array",
"editor",
"is",
"plotting",
"over",
"in",
"3D"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L803-L820 | [
"def",
"current_dim_changed",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"last_dim",
"=",
"index",
"string_size",
"=",
"[",
"'%i'",
"]",
"*",
"3",
"string_size",
"[",
"index",
"]",
"=",
"'<font color=red>%i</font>'",
"self",
".",
"shape_label",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditor.accept | Reimplement Qt method | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def accept(self):
"""Reimplement Qt method"""
for index in range(self.stack.count()):
self.stack.widget(index).accept_changes()
QDialog.accept(self) | def accept(self):
"""Reimplement Qt method"""
for index in range(self.stack.count()):
self.stack.widget(index).accept_changes()
QDialog.accept(self) | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L823-L827 | [
"def",
"accept",
"(",
"self",
")",
":",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"stack",
".",
"count",
"(",
")",
")",
":",
"self",
".",
"stack",
".",
"widget",
"(",
"index",
")",
".",
"accept_changes",
"(",
")",
"QDialog",
".",
"accept",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditor.error | An error occured, closing the dialog box | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def error(self, message):
"""An error occured, closing the dialog box"""
QMessageBox.critical(self, _("Array editor"), message)
self.setAttribute(Qt.WA_DeleteOnClose)
self.reject() | def error(self, message):
"""An error occured, closing the dialog box"""
QMessageBox.critical(self, _("Array editor"), message)
self.setAttribute(Qt.WA_DeleteOnClose)
self.reject() | [
"An",
"error",
"occured",
"closing",
"the",
"dialog",
"box"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L835-L839 | [
"def",
"error",
"(",
"self",
",",
"message",
")",
":",
"QMessageBox",
".",
"critical",
"(",
"self",
",",
"_",
"(",
"\"Array editor\"",
")",
",",
"message",
")",
"self",
".",
"setAttribute",
"(",
"Qt",
".",
"WA_DeleteOnClose",
")",
"self",
".",
"reject",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ArrayEditor.reject | Reimplement Qt method | spyder/plugins/variableexplorer/widgets/arrayeditor.py | def reject(self):
"""Reimplement Qt method"""
if self.arraywidget is not None:
for index in range(self.stack.count()):
self.stack.widget(index).reject_changes()
QDialog.reject(self) | def reject(self):
"""Reimplement Qt method"""
if self.arraywidget is not None:
for index in range(self.stack.count()):
self.stack.widget(index).reject_changes()
QDialog.reject(self) | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L842-L847 | [
"def",
"reject",
"(",
"self",
")",
":",
"if",
"self",
".",
"arraywidget",
"is",
"not",
"None",
":",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"stack",
".",
"count",
"(",
")",
")",
":",
"self",
".",
"stack",
".",
"widget",
"(",
"index",
")"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | find_lexer_for_filename | Get a Pygments Lexer given a filename. | spyder/utils/introspection/utils.py | def find_lexer_for_filename(filename):
"""Get a Pygments Lexer given a filename.
"""
filename = filename or ''
root, ext = os.path.splitext(filename)
if ext in custom_extension_lexer_mapping:
lexer = get_lexer_by_name(custom_extension_lexer_mapping[ext])
else:
try:
le... | def find_lexer_for_filename(filename):
"""Get a Pygments Lexer given a filename.
"""
filename = filename or ''
root, ext = os.path.splitext(filename)
if ext in custom_extension_lexer_mapping:
lexer = get_lexer_by_name(custom_extension_lexer_mapping[ext])
else:
try:
le... | [
"Get",
"a",
"Pygments",
"Lexer",
"given",
"a",
"filename",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L169-L181 | [
"def",
"find_lexer_for_filename",
"(",
"filename",
")",
":",
"filename",
"=",
"filename",
"or",
"''",
"root",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"ext",
"in",
"custom_extension_lexer_mapping",
":",
"lexer",
"=",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_keywords | Get the keywords for a given lexer. | spyder/utils/introspection/utils.py | def get_keywords(lexer):
"""Get the keywords for a given lexer.
"""
if not hasattr(lexer, 'tokens'):
return []
if 'keywords' in lexer.tokens:
try:
return lexer.tokens['keywords'][0][0].words
except:
pass
keywords = []
for vals in lexer.tokens.value... | def get_keywords(lexer):
"""Get the keywords for a given lexer.
"""
if not hasattr(lexer, 'tokens'):
return []
if 'keywords' in lexer.tokens:
try:
return lexer.tokens['keywords'][0][0].words
except:
pass
keywords = []
for vals in lexer.tokens.value... | [
"Get",
"the",
"keywords",
"for",
"a",
"given",
"lexer",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L184-L211 | [
"def",
"get_keywords",
"(",
"lexer",
")",
":",
"if",
"not",
"hasattr",
"(",
"lexer",
",",
"'tokens'",
")",
":",
"return",
"[",
"]",
"if",
"'keywords'",
"in",
"lexer",
".",
"tokens",
":",
"try",
":",
"return",
"lexer",
".",
"tokens",
"[",
"'keywords'",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_words | Extract all words from a source code file to be used in code completion.
Extract the list of words that contains the file in the editor,
to carry out the inline completion similar to VSCode. | spyder/utils/introspection/utils.py | def get_words(file_path=None, content=None, extension=None):
"""
Extract all words from a source code file to be used in code completion.
Extract the list of words that contains the file in the editor,
to carry out the inline completion similar to VSCode.
"""
if (file_path is None and (content ... | def get_words(file_path=None, content=None, extension=None):
"""
Extract all words from a source code file to be used in code completion.
Extract the list of words that contains the file in the editor,
to carry out the inline completion similar to VSCode.
"""
if (file_path is None and (content ... | [
"Extract",
"all",
"words",
"from",
"a",
"source",
"code",
"file",
"to",
"be",
"used",
"in",
"code",
"completion",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L213-L238 | [
"def",
"get_words",
"(",
"file_path",
"=",
"None",
",",
"content",
"=",
"None",
",",
"extension",
"=",
"None",
")",
":",
"if",
"(",
"file_path",
"is",
"None",
"and",
"(",
"content",
"is",
"None",
"or",
"extension",
"is",
"None",
")",
"or",
"file_path",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_parent_until | Given a file path, determine the full module path.
e.g. '/usr/lib/python2.7/dist-packages/numpy/core/__init__.pyc' yields
'numpy.core' | spyder/utils/introspection/utils.py | def get_parent_until(path):
"""
Given a file path, determine the full module path.
e.g. '/usr/lib/python2.7/dist-packages/numpy/core/__init__.pyc' yields
'numpy.core'
"""
dirname = osp.dirname(path)
try:
mod = osp.basename(path)
mod = osp.splitext(mod)[0]
imp.find_mo... | def get_parent_until(path):
"""
Given a file path, determine the full module path.
e.g. '/usr/lib/python2.7/dist-packages/numpy/core/__init__.pyc' yields
'numpy.core'
"""
dirname = osp.dirname(path)
try:
mod = osp.basename(path)
mod = osp.splitext(mod)[0]
imp.find_mo... | [
"Given",
"a",
"file",
"path",
"determine",
"the",
"full",
"module",
"path",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L241-L263 | [
"def",
"get_parent_until",
"(",
"path",
")",
":",
"dirname",
"=",
"osp",
".",
"dirname",
"(",
"path",
")",
"try",
":",
"mod",
"=",
"osp",
".",
"basename",
"(",
"path",
")",
"mod",
"=",
"osp",
".",
"splitext",
"(",
"mod",
")",
"[",
"0",
"]",
"imp"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CodeInfo._get_docstring | Find the docstring we are currently in. | spyder/utils/introspection/utils.py | def _get_docstring(self):
"""Find the docstring we are currently in."""
left = self.position
while left:
if self.source_code[left: left + 3] in ['"""', "'''"]:
left += 3
break
left -= 1
right = self.position
while right < le... | def _get_docstring(self):
"""Find the docstring we are currently in."""
left = self.position
while left:
if self.source_code[left: left + 3] in ['"""', "'''"]:
left += 3
break
left -= 1
right = self.position
while right < le... | [
"Find",
"the",
"docstring",
"we",
"are",
"currently",
"in",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L128-L144 | [
"def",
"_get_docstring",
"(",
"self",
")",
":",
"left",
"=",
"self",
".",
"position",
"while",
"left",
":",
"if",
"self",
".",
"source_code",
"[",
"left",
":",
"left",
"+",
"3",
"]",
"in",
"[",
"'\"\"\"'",
",",
"\"'''\"",
"]",
":",
"left",
"+=",
"3... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | KernelConnectionDialog.load_connection_settings | Load the user's previously-saved kernel connection settings. | spyder/plugins/ipythonconsole/widgets/kernelconnect.py | def load_connection_settings(self):
"""Load the user's previously-saved kernel connection settings."""
existing_kernel = CONF.get("existing-kernel", "settings", {})
connection_file_path = existing_kernel.get("json_file_path", "")
is_remote = existing_kernel.get("is_remote", False)
... | def load_connection_settings(self):
"""Load the user's previously-saved kernel connection settings."""
existing_kernel = CONF.get("existing-kernel", "settings", {})
connection_file_path = existing_kernel.get("json_file_path", "")
is_remote = existing_kernel.get("is_remote", False)
... | [
"Load",
"the",
"user",
"s",
"previously",
"-",
"saved",
"kernel",
"connection",
"settings",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/kernelconnect.py#L164-L200 | [
"def",
"load_connection_settings",
"(",
"self",
")",
":",
"existing_kernel",
"=",
"CONF",
".",
"get",
"(",
"\"existing-kernel\"",
",",
"\"settings\"",
",",
"{",
"}",
")",
"connection_file_path",
"=",
"existing_kernel",
".",
"get",
"(",
"\"json_file_path\"",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | KernelConnectionDialog.save_connection_settings | Save user's kernel connection settings. | spyder/plugins/ipythonconsole/widgets/kernelconnect.py | def save_connection_settings(self):
"""Save user's kernel connection settings."""
if not self.save_layout.isChecked():
return
is_ssh_key = bool(self.kf_radio.isChecked())
connection_settings = {
"json_file_path": self.cf.text(),
"is_remote": self.rm_... | def save_connection_settings(self):
"""Save user's kernel connection settings."""
if not self.save_layout.isChecked():
return
is_ssh_key = bool(self.kf_radio.isChecked())
connection_settings = {
"json_file_path": self.cf.text(),
"is_remote": self.rm_... | [
"Save",
"user",
"s",
"kernel",
"connection",
"settings",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/kernelconnect.py#L202-L231 | [
"def",
"save_connection_settings",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"save_layout",
".",
"isChecked",
"(",
")",
":",
"return",
"is_ssh_key",
"=",
"bool",
"(",
"self",
".",
"kf_radio",
".",
"isChecked",
"(",
")",
")",
"connection_settings",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_color | Return color depending on value type | spyder/plugins/variableexplorer/widgets/importwizard.py | def get_color(value, alpha):
"""Return color depending on value type"""
color = QColor()
for typ in COLORS:
if isinstance(value, typ):
color = QColor(COLORS[typ])
color.setAlphaF(alpha)
return color | def get_color(value, alpha):
"""Return color depending on value type"""
color = QColor()
for typ in COLORS:
if isinstance(value, typ):
color = QColor(COLORS[typ])
color.setAlphaF(alpha)
return color | [
"Return",
"color",
"depending",
"on",
"value",
"type"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L96-L103 | [
"def",
"get_color",
"(",
"value",
",",
"alpha",
")",
":",
"color",
"=",
"QColor",
"(",
")",
"for",
"typ",
"in",
"COLORS",
":",
"if",
"isinstance",
"(",
"value",
",",
"typ",
")",
":",
"color",
"=",
"QColor",
"(",
"COLORS",
"[",
"typ",
"]",
")",
"c... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ContentsWidget.get_col_sep | Return the column separator | spyder/plugins/variableexplorer/widgets/importwizard.py | def get_col_sep(self):
"""Return the column separator"""
if self.tab_btn.isChecked():
return u"\t"
elif self.ws_btn.isChecked():
return None
return to_text_string(self.line_edt.text()) | def get_col_sep(self):
"""Return the column separator"""
if self.tab_btn.isChecked():
return u"\t"
elif self.ws_btn.isChecked():
return None
return to_text_string(self.line_edt.text()) | [
"Return",
"the",
"column",
"separator"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L236-L242 | [
"def",
"get_col_sep",
"(",
"self",
")",
":",
"if",
"self",
".",
"tab_btn",
".",
"isChecked",
"(",
")",
":",
"return",
"u\"\\t\"",
"elif",
"self",
".",
"ws_btn",
".",
"isChecked",
"(",
")",
":",
"return",
"None",
"return",
"to_text_string",
"(",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ContentsWidget.get_row_sep | Return the row separator | spyder/plugins/variableexplorer/widgets/importwizard.py | def get_row_sep(self):
"""Return the row separator"""
if self.eol_btn.isChecked():
return u"\n"
return to_text_string(self.line_edt_row.text()) | def get_row_sep(self):
"""Return the row separator"""
if self.eol_btn.isChecked():
return u"\n"
return to_text_string(self.line_edt_row.text()) | [
"Return",
"the",
"row",
"separator"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L244-L248 | [
"def",
"get_row_sep",
"(",
"self",
")",
":",
"if",
"self",
".",
"eol_btn",
".",
"isChecked",
"(",
")",
":",
"return",
"u\"\\n\"",
"return",
"to_text_string",
"(",
"self",
".",
"line_edt_row",
".",
"text",
"(",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ContentsWidget.set_as_data | Set if data type conversion | spyder/plugins/variableexplorer/widgets/importwizard.py | def set_as_data(self, as_data):
"""Set if data type conversion"""
self._as_data = as_data
self.asDataChanged.emit(as_data) | def set_as_data(self, as_data):
"""Set if data type conversion"""
self._as_data = as_data
self.asDataChanged.emit(as_data) | [
"Set",
"if",
"data",
"type",
"conversion"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L259-L262 | [
"def",
"set_as_data",
"(",
"self",
",",
"as_data",
")",
":",
"self",
".",
"_as_data",
"=",
"as_data",
"self",
".",
"asDataChanged",
".",
"emit",
"(",
"as_data",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTableModel._display_data | Return a data element | spyder/plugins/variableexplorer/widgets/importwizard.py | def _display_data(self, index):
"""Return a data element"""
return to_qvariant(self._data[index.row()][index.column()]) | def _display_data(self, index):
"""Return a data element"""
return to_qvariant(self._data[index.row()][index.column()]) | [
"Return",
"a",
"data",
"element"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L284-L286 | [
"def",
"_display_data",
"(",
"self",
",",
"index",
")",
":",
"return",
"to_qvariant",
"(",
"self",
".",
"_data",
"[",
"index",
".",
"row",
"(",
")",
"]",
"[",
"index",
".",
"column",
"(",
")",
"]",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTableModel.data | Return a model data element | spyder/plugins/variableexplorer/widgets/importwizard.py | def data(self, index, role=Qt.DisplayRole):
"""Return a model data element"""
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole:
return self._display_data(index)
elif role == Qt.BackgroundColorRole:
return to_qvariant(get_co... | def data(self, index, role=Qt.DisplayRole):
"""Return a model data element"""
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole:
return self._display_data(index)
elif role == Qt.BackgroundColorRole:
return to_qvariant(get_co... | [
"Return",
"a",
"model",
"data",
"element"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L288-L298 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"to_qvariant",
"(",
")",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
":",
"return",
"se... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTableModel.parse_data_type | Parse a type to an other type | spyder/plugins/variableexplorer/widgets/importwizard.py | def parse_data_type(self, index, **kwargs):
"""Parse a type to an other type"""
if not index.isValid():
return False
try:
if kwargs['atype'] == "date":
self._data[index.row()][index.column()] = \
datestr_to_datetime(self._data[in... | def parse_data_type(self, index, **kwargs):
"""Parse a type to an other type"""
if not index.isValid():
return False
try:
if kwargs['atype'] == "date":
self._data[index.row()][index.column()] = \
datestr_to_datetime(self._data[in... | [
"Parse",
"a",
"type",
"to",
"an",
"other",
"type"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L308-L334 | [
"def",
"parse_data_type",
"(",
"self",
",",
"index",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"False",
"try",
":",
"if",
"kwargs",
"[",
"'atype'",
"]",
"==",
"\"date\"",
":",
"self",
".",
"_d... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTable._shape_text | Decode the shape of the given text | spyder/plugins/variableexplorer/widgets/importwizard.py | def _shape_text(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Decode the shape of the given text"""
assert colsep != rowsep
out = []
text_rows = text.split(rowsep)[skiprows:]
for row in text_rows:
str... | def _shape_text(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Decode the shape of the given text"""
assert colsep != rowsep
out = []
text_rows = text.split(rowsep)[skiprows:]
for row in text_rows:
str... | [
"Decode",
"the",
"shape",
"of",
"the",
"given",
"text"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L376-L399 | [
"def",
"_shape_text",
"(",
"self",
",",
"text",
",",
"colsep",
"=",
"u\"\\t\"",
",",
"rowsep",
"=",
"u\"\\n\"",
",",
"transpose",
"=",
"False",
",",
"skiprows",
"=",
"0",
",",
"comments",
"=",
"'#'",
")",
":",
"assert",
"colsep",
"!=",
"rowsep",
"out",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTable.process_data | Put data into table model | spyder/plugins/variableexplorer/widgets/importwizard.py | def process_data(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Put data into table model"""
data = self._shape_text(text, colsep, rowsep, transpose, skiprows,
comments)
self._model = PreviewTableMo... | def process_data(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Put data into table model"""
data = self._shape_text(text, colsep, rowsep, transpose, skiprows,
comments)
self._model = PreviewTableMo... | [
"Put",
"data",
"into",
"table",
"model"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L407-L413 | [
"def",
"process_data",
"(",
"self",
",",
"text",
",",
"colsep",
"=",
"u\"\\t\"",
",",
"rowsep",
"=",
"u\"\\n\"",
",",
"transpose",
"=",
"False",
",",
"skiprows",
"=",
"0",
",",
"comments",
"=",
"'#'",
")",
":",
"data",
"=",
"self",
".",
"_shape_text",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTable.parse_to_type | Parse to a given type | spyder/plugins/variableexplorer/widgets/importwizard.py | def parse_to_type(self,**kwargs):
"""Parse to a given type"""
indexes = self.selectedIndexes()
if not indexes: return
for index in indexes:
self.model().parse_data_type(index, **kwargs) | def parse_to_type(self,**kwargs):
"""Parse to a given type"""
indexes = self.selectedIndexes()
if not indexes: return
for index in indexes:
self.model().parse_data_type(index, **kwargs) | [
"Parse",
"to",
"a",
"given",
"type"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L416-L421 | [
"def",
"parse_to_type",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"indexes",
"=",
"self",
".",
"selectedIndexes",
"(",
")",
"if",
"not",
"indexes",
":",
"return",
"for",
"index",
"in",
"indexes",
":",
"self",
".",
"model",
"(",
")",
".",
"parse... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewTable.contextMenuEvent | Reimplement Qt method | spyder/plugins/variableexplorer/widgets/importwizard.py | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.opt_menu.popup(event.globalPos())
event.accept() | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.opt_menu.popup(event.globalPos())
event.accept() | [
"Reimplement",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L423-L426 | [
"def",
"contextMenuEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"opt_menu",
".",
"popup",
"(",
"event",
".",
"globalPos",
"(",
")",
")",
"event",
".",
"accept",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PreviewWidget.open_data | Open clipboard text as table | spyder/plugins/variableexplorer/widgets/importwizard.py | def open_data(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Open clipboard text as table"""
if pd:
self.pd_text = text
self.pd_info = dict(sep=colsep, lineterminator=rowsep,
skiprows=skiprows, commen... | def open_data(self, text, colsep=u"\t", rowsep=u"\n",
transpose=False, skiprows=0, comments='#'):
"""Open clipboard text as table"""
if pd:
self.pd_text = text
self.pd_info = dict(sep=colsep, lineterminator=rowsep,
skiprows=skiprows, commen... | [
"Open",
"clipboard",
"text",
"as",
"table"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L467-L478 | [
"def",
"open_data",
"(",
"self",
",",
"text",
",",
"colsep",
"=",
"u\"\\t\"",
",",
"rowsep",
"=",
"u\"\\n\"",
",",
"transpose",
"=",
"False",
",",
"skiprows",
"=",
"0",
",",
"comments",
"=",
"'#'",
")",
":",
"if",
"pd",
":",
"self",
".",
"pd_text",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ImportWizard._focus_tab | Change tab focus | spyder/plugins/variableexplorer/widgets/importwizard.py | def _focus_tab(self, tab_idx):
"""Change tab focus"""
for i in range(self.tab_widget.count()):
self.tab_widget.setTabEnabled(i, False)
self.tab_widget.setTabEnabled(tab_idx, True)
self.tab_widget.setCurrentIndex(tab_idx) | def _focus_tab(self, tab_idx):
"""Change tab focus"""
for i in range(self.tab_widget.count()):
self.tab_widget.setTabEnabled(i, False)
self.tab_widget.setTabEnabled(tab_idx, True)
self.tab_widget.setCurrentIndex(tab_idx) | [
"Change",
"tab",
"focus"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L558-L563 | [
"def",
"_focus_tab",
"(",
"self",
",",
"tab_idx",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tab_widget",
".",
"count",
"(",
")",
")",
":",
"self",
".",
"tab_widget",
".",
"setTabEnabled",
"(",
"i",
",",
"False",
")",
"self",
".",
"tab... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ImportWizard._set_step | Proceed to a given step | spyder/plugins/variableexplorer/widgets/importwizard.py | def _set_step(self, step):
"""Proceed to a given step"""
new_tab = self.tab_widget.currentIndex() + step
assert new_tab < self.tab_widget.count() and new_tab >= 0
if new_tab == self.tab_widget.count()-1:
try:
self.table_widget.open_data(self._get_plain_t... | def _set_step(self, step):
"""Proceed to a given step"""
new_tab = self.tab_widget.currentIndex() + step
assert new_tab < self.tab_widget.count() and new_tab >= 0
if new_tab == self.tab_widget.count()-1:
try:
self.table_widget.open_data(self._get_plain_t... | [
"Proceed",
"to",
"a",
"given",
"step"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L565-L591 | [
"def",
"_set_step",
"(",
"self",
",",
"step",
")",
":",
"new_tab",
"=",
"self",
".",
"tab_widget",
".",
"currentIndex",
"(",
")",
"+",
"step",
"assert",
"new_tab",
"<",
"self",
".",
"tab_widget",
".",
"count",
"(",
")",
"and",
"new_tab",
">=",
"0",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ImportWizard._simplify_shape | Reduce the alist dimension if needed | spyder/plugins/variableexplorer/widgets/importwizard.py | def _simplify_shape(self, alist, rec=0):
"""Reduce the alist dimension if needed"""
if rec != 0:
if len(alist) == 1:
return alist[-1]
return alist
if len(alist) == 1:
return self._simplify_shape(alist[-1], 1)
return [self._simpl... | def _simplify_shape(self, alist, rec=0):
"""Reduce the alist dimension if needed"""
if rec != 0:
if len(alist) == 1:
return alist[-1]
return alist
if len(alist) == 1:
return self._simplify_shape(alist[-1], 1)
return [self._simpl... | [
"Reduce",
"the",
"alist",
"dimension",
"if",
"needed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L599-L607 | [
"def",
"_simplify_shape",
"(",
"self",
",",
"alist",
",",
"rec",
"=",
"0",
")",
":",
"if",
"rec",
"!=",
"0",
":",
"if",
"len",
"(",
"alist",
")",
"==",
"1",
":",
"return",
"alist",
"[",
"-",
"1",
"]",
"return",
"alist",
"if",
"len",
"(",
"alist... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ImportWizard._get_table_data | Return clipboard processed as data | spyder/plugins/variableexplorer/widgets/importwizard.py | def _get_table_data(self):
"""Return clipboard processed as data"""
data = self._simplify_shape(
self.table_widget.get_data())
if self.table_widget.array_btn.isChecked():
return array(data)
elif pd and self.table_widget.df_btn.isChecked():
i... | def _get_table_data(self):
"""Return clipboard processed as data"""
data = self._simplify_shape(
self.table_widget.get_data())
if self.table_widget.array_btn.isChecked():
return array(data)
elif pd and self.table_widget.df_btn.isChecked():
i... | [
"Return",
"clipboard",
"processed",
"as",
"data"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L609-L619 | [
"def",
"_get_table_data",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_simplify_shape",
"(",
"self",
".",
"table_widget",
".",
"get_data",
"(",
")",
")",
"if",
"self",
".",
"table_widget",
".",
"array_btn",
".",
"isChecked",
"(",
")",
":",
"return"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ImportWizard.process | Process the data from clipboard | spyder/plugins/variableexplorer/widgets/importwizard.py | def process(self):
"""Process the data from clipboard"""
var_name = self.name_edt.text()
try:
self.var_name = str(var_name)
except UnicodeEncodeError:
self.var_name = to_text_string(var_name)
if self.text_widget.get_as_data():
self.clip... | def process(self):
"""Process the data from clipboard"""
var_name = self.name_edt.text()
try:
self.var_name = str(var_name)
except UnicodeEncodeError:
self.var_name = to_text_string(var_name)
if self.text_widget.get_as_data():
self.clip... | [
"Process",
"the",
"data",
"from",
"clipboard"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L626-L640 | [
"def",
"process",
"(",
"self",
")",
":",
"var_name",
"=",
"self",
".",
"name_edt",
".",
"text",
"(",
")",
"try",
":",
"self",
".",
"var_name",
"=",
"str",
"(",
"var_name",
")",
"except",
"UnicodeEncodeError",
":",
"self",
".",
"var_name",
"=",
"to_text... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggingWidget.set_spyder_breakpoints | Set Spyder breakpoints into a debugging session | spyder/plugins/ipythonconsole/widgets/debugging.py | def set_spyder_breakpoints(self, force=False):
"""Set Spyder breakpoints into a debugging session"""
if self._reading or force:
breakpoints_dict = CONF.get('run', 'breakpoints', {})
# We need to enclose pickled values in a list to be able to
# send them to the kernel... | def set_spyder_breakpoints(self, force=False):
"""Set Spyder breakpoints into a debugging session"""
if self._reading or force:
breakpoints_dict = CONF.get('run', 'breakpoints', {})
# We need to enclose pickled values in a list to be able to
# send them to the kernel... | [
"Set",
"Spyder",
"breakpoints",
"into",
"a",
"debugging",
"session"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L36-L48 | [
"def",
"set_spyder_breakpoints",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"self",
".",
"_reading",
"or",
"force",
":",
"breakpoints_dict",
"=",
"CONF",
".",
"get",
"(",
"'run'",
",",
"'breakpoints'",
",",
"{",
"}",
")",
"# We need to enclos... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggingWidget.dbg_exec_magic | Run an IPython magic while debugging. | spyder/plugins/ipythonconsole/widgets/debugging.py | def dbg_exec_magic(self, magic, args=''):
"""Run an IPython magic while debugging."""
code = "!get_ipython().kernel.shell.run_line_magic('{}', '{}')".format(
magic, args)
self.kernel_client.input(code) | def dbg_exec_magic(self, magic, args=''):
"""Run an IPython magic while debugging."""
code = "!get_ipython().kernel.shell.run_line_magic('{}', '{}')".format(
magic, args)
self.kernel_client.input(code) | [
"Run",
"an",
"IPython",
"magic",
"while",
"debugging",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L50-L54 | [
"def",
"dbg_exec_magic",
"(",
"self",
",",
"magic",
",",
"args",
"=",
"''",
")",
":",
"code",
"=",
"\"!get_ipython().kernel.shell.run_line_magic('{}', '{}')\"",
".",
"format",
"(",
"magic",
",",
"args",
")",
"self",
".",
"kernel_client",
".",
"input",
"(",
"co... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggingWidget.refresh_from_pdb | Refresh Variable Explorer and Editor from a Pdb session,
after running any pdb command.
See publish_pdb_state and notify_spyder in spyder_kernels | spyder/plugins/ipythonconsole/widgets/debugging.py | def refresh_from_pdb(self, pdb_state):
"""
Refresh Variable Explorer and Editor from a Pdb session,
after running any pdb command.
See publish_pdb_state and notify_spyder in spyder_kernels
"""
if 'step' in pdb_state and 'fname' in pdb_state['step']:
fname = p... | def refresh_from_pdb(self, pdb_state):
"""
Refresh Variable Explorer and Editor from a Pdb session,
after running any pdb command.
See publish_pdb_state and notify_spyder in spyder_kernels
"""
if 'step' in pdb_state and 'fname' in pdb_state['step']:
fname = p... | [
"Refresh",
"Variable",
"Explorer",
"and",
"Editor",
"from",
"a",
"Pdb",
"session",
"after",
"running",
"any",
"pdb",
"command",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L56-L74 | [
"def",
"refresh_from_pdb",
"(",
"self",
",",
"pdb_state",
")",
":",
"if",
"'step'",
"in",
"pdb_state",
"and",
"'fname'",
"in",
"pdb_state",
"[",
"'step'",
"]",
":",
"fname",
"=",
"pdb_state",
"[",
"'step'",
"]",
"[",
"'fname'",
"]",
"lineno",
"=",
"pdb_s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggingWidget._handle_input_request | Save history and add a %plot magic. | spyder/plugins/ipythonconsole/widgets/debugging.py | def _handle_input_request(self, msg):
"""Save history and add a %plot magic."""
if self._hidden:
raise RuntimeError('Request for raw input during hidden execution.')
# Make sure that all output from the SUB channel has been processed
# before entering readline mode.
... | def _handle_input_request(self, msg):
"""Save history and add a %plot magic."""
if self._hidden:
raise RuntimeError('Request for raw input during hidden execution.')
# Make sure that all output from the SUB channel has been processed
# before entering readline mode.
... | [
"Save",
"history",
"and",
"add",
"a",
"%plot",
"magic",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L77-L106 | [
"def",
"_handle_input_request",
"(",
"self",
",",
"msg",
")",
":",
"if",
"self",
".",
"_hidden",
":",
"raise",
"RuntimeError",
"(",
"'Request for raw input during hidden execution.'",
")",
"# Make sure that all output from the SUB channel has been processed",
"# before entering... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DebuggingWidget._event_filter_console_keypress | Handle Key_Up/Key_Down while debugging. | spyder/plugins/ipythonconsole/widgets/debugging.py | def _event_filter_console_keypress(self, event):
"""Handle Key_Up/Key_Down while debugging."""
key = event.key()
if self._reading:
self._control.current_prompt_pos = self._prompt_pos
if key == Qt.Key_Up:
self._control.browse_history(backward=True)
... | def _event_filter_console_keypress(self, event):
"""Handle Key_Up/Key_Down while debugging."""
key = event.key()
if self._reading:
self._control.current_prompt_pos = self._prompt_pos
if key == Qt.Key_Up:
self._control.browse_history(backward=True)
... | [
"Handle",
"Key_Up",
"/",
"Key_Down",
"while",
"debugging",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L108-L127 | [
"def",
"_event_filter_console_keypress",
"(",
"self",
",",
"event",
")",
":",
"key",
"=",
"event",
".",
"key",
"(",
")",
"if",
"self",
".",
"_reading",
":",
"self",
".",
"_control",
".",
"current_prompt_pos",
"=",
"self",
".",
"_prompt_pos",
"if",
"key",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | global_max | Returns the global maximum and minimum. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def global_max(col_vals, index):
"""Returns the global maximum and minimum."""
col_vals_without_None = [x for x in col_vals if x is not None]
max_col, min_col = zip(*col_vals_without_None)
return max(max_col), min(min_col) | def global_max(col_vals, index):
"""Returns the global maximum and minimum."""
col_vals_without_None = [x for x in col_vals if x is not None]
max_col, min_col = zip(*col_vals_without_None)
return max(max_col), min(min_col) | [
"Returns",
"the",
"global",
"maximum",
"and",
"minimum",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L105-L109 | [
"def",
"global_max",
"(",
"col_vals",
",",
"index",
")",
":",
"col_vals_without_None",
"=",
"[",
"x",
"for",
"x",
"in",
"col_vals",
"if",
"x",
"is",
"not",
"None",
"]",
"max_col",
",",
"min_col",
"=",
"zip",
"(",
"*",
"col_vals_without_None",
")",
"retur... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel._axis | Return the corresponding labels taking into account the axis.
The axis could be horizontal (0) or vertical (1). | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _axis(self, axis):
"""
Return the corresponding labels taking into account the axis.
The axis could be horizontal (0) or vertical (1).
"""
return self.df.columns if axis == 0 else self.df.index | def _axis(self, axis):
"""
Return the corresponding labels taking into account the axis.
The axis could be horizontal (0) or vertical (1).
"""
return self.df.columns if axis == 0 else self.df.index | [
"Return",
"the",
"corresponding",
"labels",
"taking",
"into",
"account",
"the",
"axis",
".",
"The",
"axis",
"could",
"be",
"horizontal",
"(",
"0",
")",
"or",
"vertical",
"(",
"1",
")",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L162-L168 | [
"def",
"_axis",
"(",
"self",
",",
"axis",
")",
":",
"return",
"self",
".",
"df",
".",
"columns",
"if",
"axis",
"==",
"0",
"else",
"self",
".",
"df",
".",
"index"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel._axis_levels | Return the number of levels in the labels taking into account the axis.
Get the number of levels for the columns (0) or rows (1). | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _axis_levels(self, axis):
"""
Return the number of levels in the labels taking into account the axis.
Get the number of levels for the columns (0) or rows (1).
"""
ax = self._axis(axis)
return 1 if not hasattr(ax, 'levels') else len(ax.levels) | def _axis_levels(self, axis):
"""
Return the number of levels in the labels taking into account the axis.
Get the number of levels for the columns (0) or rows (1).
"""
ax = self._axis(axis)
return 1 if not hasattr(ax, 'levels') else len(ax.levels) | [
"Return",
"the",
"number",
"of",
"levels",
"in",
"the",
"labels",
"taking",
"into",
"account",
"the",
"axis",
".",
"Get",
"the",
"number",
"of",
"levels",
"for",
"the",
"columns",
"(",
"0",
")",
"or",
"rows",
"(",
"1",
")",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L170-L177 | [
"def",
"_axis_levels",
"(",
"self",
",",
"axis",
")",
":",
"ax",
"=",
"self",
".",
"_axis",
"(",
"axis",
")",
"return",
"1",
"if",
"not",
"hasattr",
"(",
"ax",
",",
"'levels'",
")",
"else",
"len",
"(",
"ax",
".",
"levels",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.header | Return the values of the labels for the header of columns or rows.
The value corresponds to the header of column or row x in the
given level. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def header(self, axis, x, level=0):
"""
Return the values of the labels for the header of columns or rows.
The value corresponds to the header of column or row x in the
given level.
"""
ax = self._axis(axis)
return ax.values[x] if not hasattr(ax, 'levels'... | def header(self, axis, x, level=0):
"""
Return the values of the labels for the header of columns or rows.
The value corresponds to the header of column or row x in the
given level.
"""
ax = self._axis(axis)
return ax.values[x] if not hasattr(ax, 'levels'... | [
"Return",
"the",
"values",
"of",
"the",
"labels",
"for",
"the",
"header",
"of",
"columns",
"or",
"rows",
".",
"The",
"value",
"corresponds",
"to",
"the",
"header",
"of",
"column",
"or",
"row",
"x",
"in",
"the",
"given",
"level",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L194-L203 | [
"def",
"header",
"(",
"self",
",",
"axis",
",",
"x",
",",
"level",
"=",
"0",
")",
":",
"ax",
"=",
"self",
".",
"_axis",
"(",
"axis",
")",
"return",
"ax",
".",
"values",
"[",
"x",
"]",
"if",
"not",
"hasattr",
"(",
"ax",
",",
"'levels'",
")",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.max_min_col_update | Determines the maximum and minimum number in each column.
The result is a list whose k-th entry is [vmax, vmin], where vmax and
vmin denote the maximum and minimum of the k-th column (ignoring NaN).
This list is stored in self.max_min_col.
If the k-th column has a non-numerical ... | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def max_min_col_update(self):
"""
Determines the maximum and minimum number in each column.
The result is a list whose k-th entry is [vmax, vmin], where vmax and
vmin denote the maximum and minimum of the k-th column (ignoring NaN).
This list is stored in self.max_min_col... | def max_min_col_update(self):
"""
Determines the maximum and minimum number in each column.
The result is a list whose k-th entry is [vmax, vmin], where vmax and
vmin denote the maximum and minimum of the k-th column (ignoring NaN).
This list is stored in self.max_min_col... | [
"Determines",
"the",
"maximum",
"and",
"minimum",
"number",
"in",
"each",
"column",
".",
"The",
"result",
"is",
"a",
"list",
"whose",
"k",
"-",
"th",
"entry",
"is",
"[",
"vmax",
"vmin",
"]",
"where",
"vmax",
"and",
"vmin",
"denote",
"the",
"maximum",
"... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L213-L243 | [
"def",
"max_min_col_update",
"(",
"self",
")",
":",
"if",
"self",
".",
"df",
".",
"shape",
"[",
"0",
"]",
"==",
"0",
":",
"# If no rows to compute max/min then return\r",
"return",
"self",
".",
"max_min_col",
"=",
"[",
"]",
"for",
"dummy",
",",
"col",
"in"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.colum_avg | Toggle backgroundcolor | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def colum_avg(self, state):
"""Toggle backgroundcolor"""
self.colum_avg_enabled = state > 0
if self.colum_avg_enabled:
self.return_max = lambda col_vals, index: col_vals[index]
else:
self.return_max = global_max
self.reset() | def colum_avg(self, state):
"""Toggle backgroundcolor"""
self.colum_avg_enabled = state > 0
if self.colum_avg_enabled:
self.return_max = lambda col_vals, index: col_vals[index]
else:
self.return_max = global_max
self.reset() | [
"Toggle",
"backgroundcolor"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L260-L267 | [
"def",
"colum_avg",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"colum_avg_enabled",
"=",
"state",
">",
"0",
"if",
"self",
".",
"colum_avg_enabled",
":",
"self",
".",
"return_max",
"=",
"lambda",
"col_vals",
",",
"index",
":",
"col_vals",
"[",
"ind... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.get_bgcolor | Background color depending on value. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def get_bgcolor(self, index):
"""Background color depending on value."""
column = index.column()
if not self.bgcolor_enabled:
return
value = self.get_value(index.row(), column)
if self.max_min_col[column] is None or isna(value):
color = QColor(BACKG... | def get_bgcolor(self, index):
"""Background color depending on value."""
column = index.column()
if not self.bgcolor_enabled:
return
value = self.get_value(index.row(), column)
if self.max_min_col[column] is None or isna(value):
color = QColor(BACKG... | [
"Background",
"color",
"depending",
"on",
"value",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L269-L295 | [
"def",
"get_bgcolor",
"(",
"self",
",",
"index",
")",
":",
"column",
"=",
"index",
".",
"column",
"(",
")",
"if",
"not",
"self",
".",
"bgcolor_enabled",
":",
"return",
"value",
"=",
"self",
".",
"get_value",
"(",
"index",
".",
"row",
"(",
")",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.get_value | Return the value of the DataFrame. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def get_value(self, row, column):
"""Return the value of the DataFrame."""
# To increase the performance iat is used but that requires error
# handling, so fallback uses iloc
try:
value = self.df.iat[row, column]
except OutOfBoundsDatetime:
value = ... | def get_value(self, row, column):
"""Return the value of the DataFrame."""
# To increase the performance iat is used but that requires error
# handling, so fallback uses iloc
try:
value = self.df.iat[row, column]
except OutOfBoundsDatetime:
value = ... | [
"Return",
"the",
"value",
"of",
"the",
"DataFrame",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L297-L307 | [
"def",
"get_value",
"(",
"self",
",",
"row",
",",
"column",
")",
":",
"# To increase the performance iat is used but that requires error\r",
"# handling, so fallback uses iloc\r",
"try",
":",
"value",
"=",
"self",
".",
"df",
".",
"iat",
"[",
"row",
",",
"column",
"]... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.data | Cell content | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def data(self, index, role=Qt.DisplayRole):
"""Cell content"""
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole or role == Qt.EditRole:
column = index.column()
row = index.row()
value = self.get_value(row, column)
... | def data(self, index, role=Qt.DisplayRole):
"""Cell content"""
if not index.isValid():
return to_qvariant()
if role == Qt.DisplayRole or role == Qt.EditRole:
column = index.column()
row = index.row()
value = self.get_value(row, column)
... | [
"Cell",
"content"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L313-L348 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"to_qvariant",
"(",
")",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
"or",
"role",
"=="... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.sort | Overriding sort method | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def sort(self, column, order=Qt.AscendingOrder):
"""Overriding sort method"""
if self.complex_intran is not None:
if self.complex_intran.any(axis=0).iloc[column]:
QMessageBox.critical(self.dialog, "Error",
"TypeError error: no orderin... | def sort(self, column, order=Qt.AscendingOrder):
"""Overriding sort method"""
if self.complex_intran is not None:
if self.complex_intran.any(axis=0).iloc[column]:
QMessageBox.critical(self.dialog, "Error",
"TypeError error: no orderin... | [
"Overriding",
"sort",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L350-L389 | [
"def",
"sort",
"(",
"self",
",",
"column",
",",
"order",
"=",
"Qt",
".",
"AscendingOrder",
")",
":",
"if",
"self",
".",
"complex_intran",
"is",
"not",
"None",
":",
"if",
"self",
".",
"complex_intran",
".",
"any",
"(",
"axis",
"=",
"0",
")",
".",
"i... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.flags | Set flags | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def flags(self, index):
"""Set flags"""
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
Qt.ItemIsEditable) | def flags(self, index):
"""Set flags"""
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
Qt.ItemIsEditable) | [
"Set",
"flags"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L391-L394 | [
"def",
"flags",
"(",
"self",
",",
"index",
")",
":",
"return",
"Qt",
".",
"ItemFlags",
"(",
"QAbstractTableModel",
".",
"flags",
"(",
"self",
",",
"index",
")",
"|",
"Qt",
".",
"ItemIsEditable",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.setData | Cell content change | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def setData(self, index, value, role=Qt.EditRole, change_type=None):
"""Cell content change"""
column = index.column()
row = index.row()
if index in self.display_error_idxs:
return False
if change_type is not None:
try:
value = se... | def setData(self, index, value, role=Qt.EditRole, change_type=None):
"""Cell content change"""
column = index.column()
row = index.row()
if index in self.display_error_idxs:
return False
if change_type is not None:
try:
value = se... | [
"Cell",
"content",
"change"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L396-L433 | [
"def",
"setData",
"(",
"self",
",",
"index",
",",
"value",
",",
"role",
"=",
"Qt",
".",
"EditRole",
",",
"change_type",
"=",
"None",
")",
":",
"column",
"=",
"index",
".",
"column",
"(",
")",
"row",
"=",
"index",
".",
"row",
"(",
")",
"if",
"inde... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameModel.columnCount | DataFrame column number | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def columnCount(self, index=QModelIndex()):
"""DataFrame column number"""
# Avoid a "Qt exception in virtual methods" generated in our
# tests on Windows/Python 3.7
# See PR 8910
try:
# This is done to implement series
if len(self.df.shape) == 1:
... | def columnCount(self, index=QModelIndex()):
"""DataFrame column number"""
# Avoid a "Qt exception in virtual methods" generated in our
# tests on Windows/Python 3.7
# See PR 8910
try:
# This is done to implement series
if len(self.df.shape) == 1:
... | [
"DataFrame",
"column",
"number"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L469-L483 | [
"def",
"columnCount",
"(",
"self",
",",
"index",
"=",
"QModelIndex",
"(",
")",
")",
":",
"# Avoid a \"Qt exception in virtual methods\" generated in our\r",
"# tests on Windows/Python 3.7\r",
"# See PR 8910\r",
"try",
":",
"# This is done to implement series\r",
"if",
"len",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameView.load_more_data | Load more rows and columns to display. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def load_more_data(self, value, rows=False, columns=False):
"""Load more rows and columns to display."""
try:
if rows and value == self.verticalScrollBar().maximum():
self.model().fetch_more(rows=rows)
self.sig_fetch_more_rows.emit()
if colum... | def load_more_data(self, value, rows=False, columns=False):
"""Load more rows and columns to display."""
try:
if rows and value == self.verticalScrollBar().maximum():
self.model().fetch_more(rows=rows)
self.sig_fetch_more_rows.emit()
if colum... | [
"Load",
"more",
"rows",
"and",
"columns",
"to",
"display",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L524-L537 | [
"def",
"load_more_data",
"(",
"self",
",",
"value",
",",
"rows",
"=",
"False",
",",
"columns",
"=",
"False",
")",
":",
"try",
":",
"if",
"rows",
"and",
"value",
"==",
"self",
".",
"verticalScrollBar",
"(",
")",
".",
"maximum",
"(",
")",
":",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameView.sortByColumn | Implement a column sort. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def sortByColumn(self, index):
"""Implement a column sort."""
if self.sort_old == [None]:
self.header_class.setSortIndicatorShown(True)
sort_order = self.header_class.sortIndicatorOrder()
self.sig_sort_by_column.emit()
if not self.model().sort(index, sort_order)... | def sortByColumn(self, index):
"""Implement a column sort."""
if self.sort_old == [None]:
self.header_class.setSortIndicatorShown(True)
sort_order = self.header_class.sortIndicatorOrder()
self.sig_sort_by_column.emit()
if not self.model().sort(index, sort_order)... | [
"Implement",
"a",
"column",
"sort",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L539-L552 | [
"def",
"sortByColumn",
"(",
"self",
",",
"index",
")",
":",
"if",
"self",
".",
"sort_old",
"==",
"[",
"None",
"]",
":",
"self",
".",
"header_class",
".",
"setSortIndicatorShown",
"(",
"True",
")",
"sort_order",
"=",
"self",
".",
"header_class",
".",
"sor... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameView.setup_menu | Setup context menu. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def setup_menu(self):
"""Setup context menu."""
copy_action = create_action(self, _('Copy'),
shortcut=keybinding('Copy'),
icon=ima.icon('editcopy'),
triggered=self.copy,
... | def setup_menu(self):
"""Setup context menu."""
copy_action = create_action(self, _('Copy'),
shortcut=keybinding('Copy'),
icon=ima.icon('editcopy'),
triggered=self.copy,
... | [
"Setup",
"context",
"menu",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L559-L577 | [
"def",
"setup_menu",
"(",
"self",
")",
":",
"copy_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"'Copy'",
")",
",",
"shortcut",
"=",
"keybinding",
"(",
"'Copy'",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'editcopy'",
")",
",",
"tr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameView.change_type | A function that changes types of cells. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def change_type(self, func):
"""A function that changes types of cells."""
model = self.model()
index_list = self.selectedIndexes()
[model.setData(i, '', change_type=func) for i in index_list] | def change_type(self, func):
"""A function that changes types of cells."""
model = self.model()
index_list = self.selectedIndexes()
[model.setData(i, '', change_type=func) for i in index_list] | [
"A",
"function",
"that",
"changes",
"types",
"of",
"cells",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L579-L583 | [
"def",
"change_type",
"(",
"self",
",",
"func",
")",
":",
"model",
"=",
"self",
".",
"model",
"(",
")",
"index_list",
"=",
"self",
".",
"selectedIndexes",
"(",
")",
"[",
"model",
".",
"setData",
"(",
"i",
",",
"''",
",",
"change_type",
"=",
"func",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameView.copy | Copy text to clipboard | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def copy(self):
"""Copy text to clipboard"""
if not self.selectedIndexes():
return
(row_min, row_max,
col_min, col_max) = get_idx_rect(self.selectedIndexes())
index = header = False
df = self.model().df
obj = df.iloc[slice(row_min, row_max + 1... | def copy(self):
"""Copy text to clipboard"""
if not self.selectedIndexes():
return
(row_min, row_max,
col_min, col_max) = get_idx_rect(self.selectedIndexes())
index = header = False
df = self.model().df
obj = df.iloc[slice(row_min, row_max + 1... | [
"Copy",
"text",
"to",
"clipboard"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L586-L604 | [
"def",
"copy",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"selectedIndexes",
"(",
")",
":",
"return",
"(",
"row_min",
",",
"row_max",
",",
"col_min",
",",
"col_max",
")",
"=",
"get_idx_rect",
"(",
"self",
".",
"selectedIndexes",
"(",
")",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameHeaderModel.rowCount | Get number of rows in the header. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def rowCount(self, index=None):
"""Get number of rows in the header."""
if self.axis == 0:
return max(1, self._shape[0])
else:
if self.total_rows <= self.rows_loaded:
return self.total_rows
else:
return self.rows_loaded | def rowCount(self, index=None):
"""Get number of rows in the header."""
if self.axis == 0:
return max(1, self._shape[0])
else:
if self.total_rows <= self.rows_loaded:
return self.total_rows
else:
return self.rows_loaded | [
"Get",
"number",
"of",
"rows",
"in",
"the",
"header",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L645-L653 | [
"def",
"rowCount",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"self",
".",
"axis",
"==",
"0",
":",
"return",
"max",
"(",
"1",
",",
"self",
".",
"_shape",
"[",
"0",
"]",
")",
"else",
":",
"if",
"self",
".",
"total_rows",
"<=",
"self... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameHeaderModel.columnCount | DataFrame column number | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def columnCount(self, index=QModelIndex()):
"""DataFrame column number"""
if self.axis == 0:
if self.total_cols <= self.cols_loaded:
return self.total_cols
else:
return self.cols_loaded
else:
return max(1, self._shape[1]... | def columnCount(self, index=QModelIndex()):
"""DataFrame column number"""
if self.axis == 0:
if self.total_cols <= self.cols_loaded:
return self.total_cols
else:
return self.cols_loaded
else:
return max(1, self._shape[1]... | [
"DataFrame",
"column",
"number"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L655-L663 | [
"def",
"columnCount",
"(",
"self",
",",
"index",
"=",
"QModelIndex",
"(",
")",
")",
":",
"if",
"self",
".",
"axis",
"==",
"0",
":",
"if",
"self",
".",
"total_cols",
"<=",
"self",
".",
"cols_loaded",
":",
"return",
"self",
".",
"total_cols",
"else",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameHeaderModel.fetch_more | Get more columns or rows (based on axis). | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def fetch_more(self, rows=False, columns=False):
"""Get more columns or rows (based on axis)."""
if self.axis == 1 and self.total_rows > self.rows_loaded:
reminder = self.total_rows - self.rows_loaded
items_to_fetch = min(reminder, ROWS_TO_LOAD)
self.beginInsert... | def fetch_more(self, rows=False, columns=False):
"""Get more columns or rows (based on axis)."""
if self.axis == 1 and self.total_rows > self.rows_loaded:
reminder = self.total_rows - self.rows_loaded
items_to_fetch = min(reminder, ROWS_TO_LOAD)
self.beginInsert... | [
"Get",
"more",
"columns",
"or",
"rows",
"(",
"based",
"on",
"axis",
")",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L665-L680 | [
"def",
"fetch_more",
"(",
"self",
",",
"rows",
"=",
"False",
",",
"columns",
"=",
"False",
")",
":",
"if",
"self",
".",
"axis",
"==",
"1",
"and",
"self",
".",
"total_rows",
">",
"self",
".",
"rows_loaded",
":",
"reminder",
"=",
"self",
".",
"total_ro... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameHeaderModel.sort | Overriding sort method. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def sort(self, column, order=Qt.AscendingOrder):
"""Overriding sort method."""
ascending = order == Qt.AscendingOrder
self.model.sort(self.COLUMN_INDEX, order=ascending)
return True | def sort(self, column, order=Qt.AscendingOrder):
"""Overriding sort method."""
ascending = order == Qt.AscendingOrder
self.model.sort(self.COLUMN_INDEX, order=ascending)
return True | [
"Overriding",
"sort",
"method",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L682-L686 | [
"def",
"sort",
"(",
"self",
",",
"column",
",",
"order",
"=",
"Qt",
".",
"AscendingOrder",
")",
":",
"ascending",
"=",
"order",
"==",
"Qt",
".",
"AscendingOrder",
"self",
".",
"model",
".",
"sort",
"(",
"self",
".",
"COLUMN_INDEX",
",",
"order",
"=",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameHeaderModel.headerData | Get the information to put in the header. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def headerData(self, section, orientation, role):
"""Get the information to put in the header."""
if role == Qt.TextAlignmentRole:
if orientation == Qt.Horizontal:
return Qt.AlignCenter | Qt.AlignBottom
else:
return Qt.AlignRight | Qt.AlignVC... | def headerData(self, section, orientation, role):
"""Get the information to put in the header."""
if role == Qt.TextAlignmentRole:
if orientation == Qt.Horizontal:
return Qt.AlignCenter | Qt.AlignBottom
else:
return Qt.AlignRight | Qt.AlignVC... | [
"Get",
"the",
"information",
"to",
"put",
"in",
"the",
"header",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L688-L712 | [
"def",
"headerData",
"(",
"self",
",",
"section",
",",
"orientation",
",",
"role",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"TextAlignmentRole",
":",
"if",
"orientation",
"==",
"Qt",
".",
"Horizontal",
":",
"return",
"Qt",
".",
"AlignCenter",
"|",
"Qt",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameHeaderModel.data | Get the data for the header.
This is used when a header has levels. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def data(self, index, role):
"""
Get the data for the header.
This is used when a header has levels.
"""
if not index.isValid() or \
index.row() >= self._shape[0] or \
index.column() >= self._shape[1]:
return None
row, col = ((... | def data(self, index, role):
"""
Get the data for the header.
This is used when a header has levels.
"""
if not index.isValid() or \
index.row() >= self._shape[0] or \
index.column() >= self._shape[1]:
return None
row, col = ((... | [
"Get",
"the",
"data",
"for",
"the",
"header",
".",
"This",
"is",
"used",
"when",
"a",
"header",
"has",
"levels",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L714-L740 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
"or",
"index",
".",
"row",
"(",
")",
">=",
"self",
".",
"_shape",
"[",
"0",
"]",
"or",
"index",
".",
"column",
"(",
")",
">=",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameLevelModel.headerData | Get the text to put in the header of the levels of the indexes.
By default it returns 'Index i', where i is the section in the index | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def headerData(self, section, orientation, role):
"""
Get the text to put in the header of the levels of the indexes.
By default it returns 'Index i', where i is the section in the index
"""
if role == Qt.TextAlignmentRole:
if orientation == Qt.Horizontal:
... | def headerData(self, section, orientation, role):
"""
Get the text to put in the header of the levels of the indexes.
By default it returns 'Index i', where i is the section in the index
"""
if role == Qt.TextAlignmentRole:
if orientation == Qt.Horizontal:
... | [
"Get",
"the",
"text",
"to",
"put",
"in",
"the",
"header",
"of",
"the",
"levels",
"of",
"the",
"indexes",
".",
"By",
"default",
"it",
"returns",
"Index",
"i",
"where",
"i",
"is",
"the",
"section",
"in",
"the",
"index"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L776-L797 | [
"def",
"headerData",
"(",
"self",
",",
"section",
",",
"orientation",
",",
"role",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"TextAlignmentRole",
":",
"if",
"orientation",
"==",
"Qt",
".",
"Horizontal",
":",
"return",
"Qt",
".",
"AlignCenter",
"|",
"Qt",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameLevelModel.data | Get the information of the levels. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def data(self, index, role):
"""Get the information of the levels."""
if not index.isValid():
return None
if role == Qt.FontRole:
return self._font
label = ''
if index.column() == self.model.header_shape[1] - 1:
label = str(self.model.n... | def data(self, index, role):
"""Get the information of the levels."""
if not index.isValid():
return None
if role == Qt.FontRole:
return self._font
label = ''
if index.column() == self.model.header_shape[1] - 1:
label = str(self.model.n... | [
"Get",
"the",
"information",
"of",
"the",
"levels",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L799-L818 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"None",
"if",
"role",
"==",
"Qt",
".",
"FontRole",
":",
"return",
"self",
".",
"_font",
"label",
"=",
"''",
"if",
"ind... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.setup_and_check | Setup DataFrameEditor:
return False if data is not supported, True otherwise.
Supported types for data are DataFrame, Series and Index. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def setup_and_check(self, data, title=''):
"""
Setup DataFrameEditor:
return False if data is not supported, True otherwise.
Supported types for data are DataFrame, Series and Index.
"""
self._selection_rec = False
self._model = None
self.layout ... | def setup_and_check(self, data, title=''):
"""
Setup DataFrameEditor:
return False if data is not supported, True otherwise.
Supported types for data are DataFrame, Series and Index.
"""
self._selection_rec = False
self._model = None
self.layout ... | [
"Setup",
"DataFrameEditor",
":",
"return",
"False",
"if",
"data",
"is",
"not",
"supported",
"True",
"otherwise",
".",
"Supported",
"types",
"for",
"data",
"are",
"DataFrame",
"Series",
"and",
"Index",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L846-L947 | [
"def",
"setup_and_check",
"(",
"self",
",",
"data",
",",
"title",
"=",
"''",
")",
":",
"self",
".",
"_selection_rec",
"=",
"False",
"self",
".",
"_model",
"=",
"None",
"self",
".",
"layout",
"=",
"QGridLayout",
"(",
")",
"self",
".",
"layout",
".",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.save_and_close_enable | Handle the data change event to enable the save and close button. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def save_and_close_enable(self, top_left, bottom_right):
"""Handle the data change event to enable the save and close button."""
self.btn_save_and_close.setEnabled(True)
self.btn_save_and_close.setAutoDefault(True)
self.btn_save_and_close.setDefault(True) | def save_and_close_enable(self, top_left, bottom_right):
"""Handle the data change event to enable the save and close button."""
self.btn_save_and_close.setEnabled(True)
self.btn_save_and_close.setAutoDefault(True)
self.btn_save_and_close.setDefault(True) | [
"Handle",
"the",
"data",
"change",
"event",
"to",
"enable",
"the",
"save",
"and",
"close",
"button",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L950-L954 | [
"def",
"save_and_close_enable",
"(",
"self",
",",
"top_left",
",",
"bottom_right",
")",
":",
"self",
".",
"btn_save_and_close",
".",
"setEnabled",
"(",
"True",
")",
"self",
".",
"btn_save_and_close",
".",
"setAutoDefault",
"(",
"True",
")",
"self",
".",
"btn_s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.create_table_level | Create the QTableView that will hold the level model. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def create_table_level(self):
"""Create the QTableView that will hold the level model."""
self.table_level = QTableView()
self.table_level.setEditTriggers(QTableWidget.NoEditTriggers)
self.table_level.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.table_level.setVe... | def create_table_level(self):
"""Create the QTableView that will hold the level model."""
self.table_level = QTableView()
self.table_level.setEditTriggers(QTableWidget.NoEditTriggers)
self.table_level.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.table_level.setVe... | [
"Create",
"the",
"QTableView",
"that",
"will",
"hold",
"the",
"level",
"model",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L956-L971 | [
"def",
"create_table_level",
"(",
"self",
")",
":",
"self",
".",
"table_level",
"=",
"QTableView",
"(",
")",
"self",
".",
"table_level",
".",
"setEditTriggers",
"(",
"QTableWidget",
".",
"NoEditTriggers",
")",
"self",
".",
"table_level",
".",
"setHorizontalScrol... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.create_table_header | Create the QTableView that will hold the header model. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def create_table_header(self):
"""Create the QTableView that will hold the header model."""
self.table_header = QTableView()
self.table_header.verticalHeader().hide()
self.table_header.setEditTriggers(QTableWidget.NoEditTriggers)
self.table_header.setHorizontalScrollBarPolic... | def create_table_header(self):
"""Create the QTableView that will hold the header model."""
self.table_header = QTableView()
self.table_header.verticalHeader().hide()
self.table_header.setEditTriggers(QTableWidget.NoEditTriggers)
self.table_header.setHorizontalScrollBarPolic... | [
"Create",
"the",
"QTableView",
"that",
"will",
"hold",
"the",
"header",
"model",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L973-L986 | [
"def",
"create_table_header",
"(",
"self",
")",
":",
"self",
".",
"table_header",
"=",
"QTableView",
"(",
")",
"self",
".",
"table_header",
".",
"verticalHeader",
"(",
")",
".",
"hide",
"(",
")",
"self",
".",
"table_header",
".",
"setEditTriggers",
"(",
"Q... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.create_table_index | Create the QTableView that will hold the index model. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def create_table_index(self):
"""Create the QTableView that will hold the index model."""
self.table_index = QTableView()
self.table_index.horizontalHeader().hide()
self.table_index.setEditTriggers(QTableWidget.NoEditTriggers)
self.table_index.setHorizontalScrollBarPolicy(Qt... | def create_table_index(self):
"""Create the QTableView that will hold the index model."""
self.table_index = QTableView()
self.table_index.horizontalHeader().hide()
self.table_index.setEditTriggers(QTableWidget.NoEditTriggers)
self.table_index.setHorizontalScrollBarPolicy(Qt... | [
"Create",
"the",
"QTableView",
"that",
"will",
"hold",
"the",
"index",
"model",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L988-L1002 | [
"def",
"create_table_index",
"(",
"self",
")",
":",
"self",
".",
"table_index",
"=",
"QTableView",
"(",
")",
"self",
".",
"table_index",
".",
"horizontalHeader",
"(",
")",
".",
"hide",
"(",
")",
"self",
".",
"table_index",
".",
"setEditTriggers",
"(",
"QTa... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.create_data_table | Create the QTableView that will hold the data model. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def create_data_table(self):
"""Create the QTableView that will hold the data model."""
self.dataTable = DataFrameView(self, self.dataModel,
self.table_header.horizontalHeader(),
self.hscroll, self.vscroll)
self.d... | def create_data_table(self):
"""Create the QTableView that will hold the data model."""
self.dataTable = DataFrameView(self, self.dataModel,
self.table_header.horizontalHeader(),
self.hscroll, self.vscroll)
self.d... | [
"Create",
"the",
"QTableView",
"that",
"will",
"hold",
"the",
"data",
"model",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1004-L1021 | [
"def",
"create_data_table",
"(",
"self",
")",
":",
"self",
".",
"dataTable",
"=",
"DataFrameView",
"(",
"self",
",",
"self",
".",
"dataModel",
",",
"self",
".",
"table_header",
".",
"horizontalHeader",
"(",
")",
",",
"self",
".",
"hscroll",
",",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.sortByIndex | Implement a Index sort. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def sortByIndex(self, index):
"""Implement a Index sort."""
self.table_level.horizontalHeader().setSortIndicatorShown(True)
sort_order = self.table_level.horizontalHeader().sortIndicatorOrder()
self.table_index.model().sort(index, sort_order)
self._sort_update() | def sortByIndex(self, index):
"""Implement a Index sort."""
self.table_level.horizontalHeader().setSortIndicatorShown(True)
sort_order = self.table_level.horizontalHeader().sortIndicatorOrder()
self.table_index.model().sort(index, sort_order)
self._sort_update() | [
"Implement",
"a",
"Index",
"sort",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1023-L1028 | [
"def",
"sortByIndex",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"table_level",
".",
"horizontalHeader",
"(",
")",
".",
"setSortIndicatorShown",
"(",
"True",
")",
"sort_order",
"=",
"self",
".",
"table_level",
".",
"horizontalHeader",
"(",
")",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._column_resized | Update the column width. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _column_resized(self, col, old_width, new_width):
"""Update the column width."""
self.dataTable.setColumnWidth(col, new_width)
self._update_layout() | def _column_resized(self, col, old_width, new_width):
"""Update the column width."""
self.dataTable.setColumnWidth(col, new_width)
self._update_layout() | [
"Update",
"the",
"column",
"width",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1034-L1037 | [
"def",
"_column_resized",
"(",
"self",
",",
"col",
",",
"old_width",
",",
"new_width",
")",
":",
"self",
".",
"dataTable",
".",
"setColumnWidth",
"(",
"col",
",",
"new_width",
")",
"self",
".",
"_update_layout",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._row_resized | Update the row height. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _row_resized(self, row, old_height, new_height):
"""Update the row height."""
self.dataTable.setRowHeight(row, new_height)
self._update_layout() | def _row_resized(self, row, old_height, new_height):
"""Update the row height."""
self.dataTable.setRowHeight(row, new_height)
self._update_layout() | [
"Update",
"the",
"row",
"height",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1039-L1042 | [
"def",
"_row_resized",
"(",
"self",
",",
"row",
",",
"old_height",
",",
"new_height",
")",
":",
"self",
".",
"dataTable",
".",
"setRowHeight",
"(",
"row",
",",
"new_height",
")",
"self",
".",
"_update_layout",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._index_resized | Resize the corresponding column of the index section selected. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _index_resized(self, col, old_width, new_width):
"""Resize the corresponding column of the index section selected."""
self.table_index.setColumnWidth(col, new_width)
self._update_layout() | def _index_resized(self, col, old_width, new_width):
"""Resize the corresponding column of the index section selected."""
self.table_index.setColumnWidth(col, new_width)
self._update_layout() | [
"Resize",
"the",
"corresponding",
"column",
"of",
"the",
"index",
"section",
"selected",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1044-L1047 | [
"def",
"_index_resized",
"(",
"self",
",",
"col",
",",
"old_width",
",",
"new_width",
")",
":",
"self",
".",
"table_index",
".",
"setColumnWidth",
"(",
"col",
",",
"new_width",
")",
"self",
".",
"_update_layout",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._header_resized | Resize the corresponding row of the header section selected. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _header_resized(self, row, old_height, new_height):
"""Resize the corresponding row of the header section selected."""
self.table_header.setRowHeight(row, new_height)
self._update_layout() | def _header_resized(self, row, old_height, new_height):
"""Resize the corresponding row of the header section selected."""
self.table_header.setRowHeight(row, new_height)
self._update_layout() | [
"Resize",
"the",
"corresponding",
"row",
"of",
"the",
"header",
"section",
"selected",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1049-L1052 | [
"def",
"_header_resized",
"(",
"self",
",",
"row",
",",
"old_height",
",",
"new_height",
")",
":",
"self",
".",
"table_header",
".",
"setRowHeight",
"(",
"row",
",",
"new_height",
")",
"self",
".",
"_update_layout",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._reset_model | Set the model in the given table. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _reset_model(self, table, model):
"""Set the model in the given table."""
old_sel_model = table.selectionModel()
table.setModel(model)
if old_sel_model:
del old_sel_model | def _reset_model(self, table, model):
"""Set the model in the given table."""
old_sel_model = table.selectionModel()
table.setModel(model)
if old_sel_model:
del old_sel_model | [
"Set",
"the",
"model",
"in",
"the",
"given",
"table",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1087-L1092 | [
"def",
"_reset_model",
"(",
"self",
",",
"table",
",",
"model",
")",
":",
"old_sel_model",
"=",
"table",
".",
"selectionModel",
"(",
")",
"table",
".",
"setModel",
"(",
"model",
")",
"if",
"old_sel_model",
":",
"del",
"old_sel_model"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.setModel | Set the model for the data, header/index and level views. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def setModel(self, model, relayout=True):
"""Set the model for the data, header/index and level views."""
self._model = model
sel_model = self.dataTable.selectionModel()
sel_model.currentColumnChanged.connect(
self._resizeCurrentColumnToContents)
# Asociat... | def setModel(self, model, relayout=True):
"""Set the model for the data, header/index and level views."""
self._model = model
sel_model = self.dataTable.selectionModel()
sel_model.currentColumnChanged.connect(
self._resizeCurrentColumnToContents)
# Asociat... | [
"Set",
"the",
"model",
"for",
"the",
"data",
"header",
"/",
"index",
"and",
"level",
"views",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1098-L1121 | [
"def",
"setModel",
"(",
"self",
",",
"model",
",",
"relayout",
"=",
"True",
")",
":",
"self",
".",
"_model",
"=",
"model",
"sel_model",
"=",
"self",
".",
"dataTable",
".",
"selectionModel",
"(",
")",
"sel_model",
".",
"currentColumnChanged",
".",
"connect"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.setCurrentIndex | Set current selection. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def setCurrentIndex(self, y, x):
"""Set current selection."""
self.dataTable.selectionModel().setCurrentIndex(
self.dataTable.model().index(y, x),
QItemSelectionModel.ClearAndSelect) | def setCurrentIndex(self, y, x):
"""Set current selection."""
self.dataTable.selectionModel().setCurrentIndex(
self.dataTable.model().index(y, x),
QItemSelectionModel.ClearAndSelect) | [
"Set",
"current",
"selection",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1123-L1127 | [
"def",
"setCurrentIndex",
"(",
"self",
",",
"y",
",",
"x",
")",
":",
"self",
".",
"dataTable",
".",
"selectionModel",
"(",
")",
".",
"setCurrentIndex",
"(",
"self",
".",
"dataTable",
".",
"model",
"(",
")",
".",
"index",
"(",
"y",
",",
"x",
")",
",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._resizeColumnToContents | Resize a column by its contents. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _resizeColumnToContents(self, header, data, col, limit_ms):
"""Resize a column by its contents."""
hdr_width = self._sizeHintForColumn(header, col, limit_ms)
data_width = self._sizeHintForColumn(data, col, limit_ms)
if data_width > hdr_width:
width = min(self.max_wid... | def _resizeColumnToContents(self, header, data, col, limit_ms):
"""Resize a column by its contents."""
hdr_width = self._sizeHintForColumn(header, col, limit_ms)
data_width = self._sizeHintForColumn(data, col, limit_ms)
if data_width > hdr_width:
width = min(self.max_wid... | [
"Resize",
"a",
"column",
"by",
"its",
"contents",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1146-L1157 | [
"def",
"_resizeColumnToContents",
"(",
"self",
",",
"header",
",",
"data",
",",
"col",
",",
"limit_ms",
")",
":",
"hdr_width",
"=",
"self",
".",
"_sizeHintForColumn",
"(",
"header",
",",
"col",
",",
"limit_ms",
")",
"data_width",
"=",
"self",
".",
"_sizeHi... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._resizeColumnsToContents | Resize all the colummns to its contents. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _resizeColumnsToContents(self, header, data, limit_ms):
"""Resize all the colummns to its contents."""
max_col = data.model().columnCount()
if limit_ms is None:
max_col_ms = None
else:
max_col_ms = limit_ms / max(1, max_col)
for col in range(max... | def _resizeColumnsToContents(self, header, data, limit_ms):
"""Resize all the colummns to its contents."""
max_col = data.model().columnCount()
if limit_ms is None:
max_col_ms = None
else:
max_col_ms = limit_ms / max(1, max_col)
for col in range(max... | [
"Resize",
"all",
"the",
"colummns",
"to",
"its",
"contents",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1159-L1167 | [
"def",
"_resizeColumnsToContents",
"(",
"self",
",",
"header",
",",
"data",
",",
"limit_ms",
")",
":",
"max_col",
"=",
"data",
".",
"model",
"(",
")",
".",
"columnCount",
"(",
")",
"if",
"limit_ms",
"is",
"None",
":",
"max_col_ms",
"=",
"None",
"else",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.eventFilter | Override eventFilter to catch resize event. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def eventFilter(self, obj, event):
"""Override eventFilter to catch resize event."""
if obj == self.dataTable and event.type() == QEvent.Resize:
self._resizeVisibleColumnsToContents()
return False | def eventFilter(self, obj, event):
"""Override eventFilter to catch resize event."""
if obj == self.dataTable and event.type() == QEvent.Resize:
self._resizeVisibleColumnsToContents()
return False | [
"Override",
"eventFilter",
"to",
"catch",
"resize",
"event",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1169-L1173 | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"if",
"obj",
"==",
"self",
".",
"dataTable",
"and",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"Resize",
":",
"self",
".",
"_resizeVisibleColumnsToContents",
"(",
")",
"re... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._resizeCurrentColumnToContents | Resize the current column to its contents. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _resizeCurrentColumnToContents(self, new_index, old_index):
"""Resize the current column to its contents."""
if new_index.column() not in self._autosized_cols:
# Ensure the requested column is fully into view after resizing
self._resizeVisibleColumnsToContents()
... | def _resizeCurrentColumnToContents(self, new_index, old_index):
"""Resize the current column to its contents."""
if new_index.column() not in self._autosized_cols:
# Ensure the requested column is fully into view after resizing
self._resizeVisibleColumnsToContents()
... | [
"Resize",
"the",
"current",
"column",
"to",
"its",
"contents",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1202-L1207 | [
"def",
"_resizeCurrentColumnToContents",
"(",
"self",
",",
"new_index",
",",
"old_index",
")",
":",
"if",
"new_index",
".",
"column",
"(",
")",
"not",
"in",
"self",
".",
"_autosized_cols",
":",
"# Ensure the requested column is fully into view after resizing\r",
"self",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.resizeColumnsToContents | Resize the columns to its contents. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def resizeColumnsToContents(self):
"""Resize the columns to its contents."""
self._autosized_cols = set()
self._resizeColumnsToContents(self.table_level,
self.table_index, self._max_autosize_ms)
self._update_layout() | def resizeColumnsToContents(self):
"""Resize the columns to its contents."""
self._autosized_cols = set()
self._resizeColumnsToContents(self.table_level,
self.table_index, self._max_autosize_ms)
self._update_layout() | [
"Resize",
"the",
"columns",
"to",
"its",
"contents",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1209-L1214 | [
"def",
"resizeColumnsToContents",
"(",
"self",
")",
":",
"self",
".",
"_autosized_cols",
"=",
"set",
"(",
")",
"self",
".",
"_resizeColumnsToContents",
"(",
"self",
".",
"table_level",
",",
"self",
".",
"table_index",
",",
"self",
".",
"_max_autosize_ms",
")",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.change_bgcolor_enable | This is implementet so column min/max is only active when bgcolor is | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def change_bgcolor_enable(self, state):
"""
This is implementet so column min/max is only active when bgcolor is
"""
self.dataModel.bgcolor(state)
self.bgcolor_global.setEnabled(not self.is_series and state > 0) | def change_bgcolor_enable(self, state):
"""
This is implementet so column min/max is only active when bgcolor is
"""
self.dataModel.bgcolor(state)
self.bgcolor_global.setEnabled(not self.is_series and state > 0) | [
"This",
"is",
"implementet",
"so",
"column",
"min",
"/",
"max",
"is",
"only",
"active",
"when",
"bgcolor",
"is"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1216-L1221 | [
"def",
"change_bgcolor_enable",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"dataModel",
".",
"bgcolor",
"(",
"state",
")",
"self",
".",
"bgcolor_global",
".",
"setEnabled",
"(",
"not",
"self",
".",
"is_series",
"and",
"state",
">",
"0",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.change_format | Ask user for display format for floats and use it.
This function also checks whether the format is valid and emits
`sig_option_changed`. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def change_format(self):
"""
Ask user for display format for floats and use it.
This function also checks whether the format is valid and emits
`sig_option_changed`.
"""
format, valid = QInputDialog.getText(self, _('Format'),
... | def change_format(self):
"""
Ask user for display format for floats and use it.
This function also checks whether the format is valid and emits
`sig_option_changed`.
"""
format, valid = QInputDialog.getText(self, _('Format'),
... | [
"Ask",
"user",
"for",
"display",
"format",
"for",
"floats",
"and",
"use",
"it",
".",
"This",
"function",
"also",
"checks",
"whether",
"the",
"format",
"is",
"valid",
"and",
"emits",
"sig_option_changed",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1223-L1247 | [
"def",
"change_format",
"(",
"self",
")",
":",
"format",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'Format'",
")",
",",
"_",
"(",
"\"Float formatting\"",
")",
",",
"QLineEdit",
".",
"Normal",
",",
"self",
".",
"dat... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor.get_value | Return modified Dataframe -- this is *not* a copy | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def get_value(self):
"""Return modified Dataframe -- this is *not* a copy"""
# It is import to avoid accessing Qt C++ object as it has probably
# already been destroyed, due to the Qt.WA_DeleteOnClose attribute
df = self.dataModel.get_data()
if self.is_series:
r... | def get_value(self):
"""Return modified Dataframe -- this is *not* a copy"""
# It is import to avoid accessing Qt C++ object as it has probably
# already been destroyed, due to the Qt.WA_DeleteOnClose attribute
df = self.dataModel.get_data()
if self.is_series:
r... | [
"Return",
"modified",
"Dataframe",
"--",
"this",
"is",
"*",
"not",
"*",
"a",
"copy"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1249-L1257 | [
"def",
"get_value",
"(",
"self",
")",
":",
"# It is import to avoid accessing Qt C++ object as it has probably\r",
"# already been destroyed, due to the Qt.WA_DeleteOnClose attribute\r",
"df",
"=",
"self",
".",
"dataModel",
".",
"get_data",
"(",
")",
"if",
"self",
".",
"is_se... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | DataFrameEditor._update_header_size | Update the column width of the header. | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | def _update_header_size(self):
"""Update the column width of the header."""
column_count = self.table_header.model().columnCount()
for index in range(0, column_count):
if index < column_count:
column_width = self.dataTable.columnWidth(index)
self... | def _update_header_size(self):
"""Update the column width of the header."""
column_count = self.table_header.model().columnCount()
for index in range(0, column_count):
if index < column_count:
column_width = self.dataTable.columnWidth(index)
self... | [
"Update",
"the",
"column",
"width",
"of",
"the",
"header",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L1259-L1267 | [
"def",
"_update_header_size",
"(",
"self",
")",
":",
"column_count",
"=",
"self",
".",
"table_header",
".",
"model",
"(",
")",
".",
"columnCount",
"(",
")",
"for",
"index",
"in",
"range",
"(",
"0",
",",
"column_count",
")",
":",
"if",
"index",
"<",
"co... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamespaceBrowser.setup | Setup the namespace browser with provided settings.
Args:
dataframe_format (string): default floating-point format for
DataFrame editor | spyder/plugins/variableexplorer/widgets/namespacebrowser.py | def setup(self, check_all=None, exclude_private=None,
exclude_uppercase=None, exclude_capitalized=None,
exclude_unsupported=None, excluded_names=None,
minmax=None, dataframe_format=None):
"""
Setup the namespace browser with provided settings.
Ar... | def setup(self, check_all=None, exclude_private=None,
exclude_uppercase=None, exclude_capitalized=None,
exclude_unsupported=None, excluded_names=None,
minmax=None, dataframe_format=None):
"""
Setup the namespace browser with provided settings.
Ar... | [
"Setup",
"the",
"namespace",
"browser",
"with",
"provided",
"settings",
".",
"Args",
":",
"dataframe_format",
"(",
"string",
")",
":",
"default",
"floating",
"-",
"point",
"format",
"for",
"DataFrame",
"editor"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/namespacebrowser.py#L82-L142 | [
"def",
"setup",
"(",
"self",
",",
"check_all",
"=",
"None",
",",
"exclude_private",
"=",
"None",
",",
"exclude_uppercase",
"=",
"None",
",",
"exclude_capitalized",
"=",
"None",
",",
"exclude_unsupported",
"=",
"None",
",",
"excluded_names",
"=",
"None",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamespaceBrowser.setup_toolbar | Setup toolbar | spyder/plugins/variableexplorer/widgets/namespacebrowser.py | def setup_toolbar(self):
"""Setup toolbar"""
load_button = create_toolbutton(self, text=_('Import data'),
icon=ima.icon('fileimport'),
triggered=lambda: self.import_data())
self.save_button = create_toolbutton(s... | def setup_toolbar(self):
"""Setup toolbar"""
load_button = create_toolbutton(self, text=_('Import data'),
icon=ima.icon('fileimport'),
triggered=lambda: self.import_data())
self.save_button = create_toolbutton(s... | [
"Setup",
"toolbar"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/namespacebrowser.py#L153-L171 | [
"def",
"setup_toolbar",
"(",
"self",
")",
":",
"load_button",
"=",
"create_toolbutton",
"(",
"self",
",",
"text",
"=",
"_",
"(",
"'Import data'",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'fileimport'",
")",
",",
"triggered",
"=",
"lambda",
":",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamespaceBrowser.setup_option_actions | Setup the actions to show in the cog menu. | spyder/plugins/variableexplorer/widgets/namespacebrowser.py | def setup_option_actions(self, exclude_private, exclude_uppercase,
exclude_capitalized, exclude_unsupported):
"""Setup the actions to show in the cog menu."""
self.setup_in_progress = True
self.exclude_private_action = create_action(self,
_("Ex... | def setup_option_actions(self, exclude_private, exclude_uppercase,
exclude_capitalized, exclude_unsupported):
"""Setup the actions to show in the cog menu."""
self.setup_in_progress = True
self.exclude_private_action = create_action(self,
_("Ex... | [
"Setup",
"the",
"actions",
"to",
"show",
"in",
"the",
"cog",
"menu",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/namespacebrowser.py#L173-L215 | [
"def",
"setup_option_actions",
"(",
"self",
",",
"exclude_private",
",",
"exclude_uppercase",
",",
"exclude_capitalized",
",",
"exclude_unsupported",
")",
":",
"self",
".",
"setup_in_progress",
"=",
"True",
"self",
".",
"exclude_private_action",
"=",
"create_action",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.