repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | item_at_line | def item_at_line(root_item, line):
"""
Find and return the item of the outline explorer under which is located
the specified 'line' of the editor.
"""
previous_item = root_item
item = root_item
for item in get_item_children(root_item):
if item.line > line:
return... | python | def item_at_line(root_item, line):
"""
Find and return the item of the outline explorer under which is located
the specified 'line' of the editor.
"""
previous_item = root_item
item = root_item
for item in get_item_children(root_item):
if item.line > line:
return... | [
"def",
"item_at_line",
"(",
"root_item",
",",
"line",
")",
":",
"previous_item",
"=",
"root_item",
"item",
"=",
"root_item",
"for",
"item",
"in",
"get_item_children",
"(",
"root_item",
")",
":",
"if",
"item",
".",
"line",
">",
"line",
":",
"return",
"previ... | Find and return the item of the outline explorer under which is located
the specified 'line' of the editor. | [
"Find",
"and",
"return",
"the",
"item",
"of",
"the",
"outline",
"explorer",
"under",
"which",
"is",
"located",
"the",
"specified",
"line",
"of",
"the",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L131-L143 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.get_actions_from_items | def get_actions_from_items(self, items):
"""Reimplemented OneColumnTree method"""
fromcursor_act = create_action(self, text=_('Go to cursor position'),
icon=ima.icon('fromcursor'),
triggered=self.go_to_cursor_position)
... | python | def get_actions_from_items(self, items):
"""Reimplemented OneColumnTree method"""
fromcursor_act = create_action(self, text=_('Go to cursor position'),
icon=ima.icon('fromcursor'),
triggered=self.go_to_cursor_position)
... | [
"def",
"get_actions_from_items",
"(",
"self",
",",
"items",
")",
":",
"fromcursor_act",
"=",
"create_action",
"(",
"self",
",",
"text",
"=",
"_",
"(",
"'Go to cursor position'",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'fromcursor'",
")",
",",
"tri... | Reimplemented OneColumnTree method | [
"Reimplemented",
"OneColumnTree",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L183-L207 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.__hide_or_show_root_items | def __hide_or_show_root_items(self, item):
"""
show_all_files option is disabled: hide all root items except *item*
show_all_files option is enabled: do nothing
"""
for _it in self.get_top_level_items():
_it.setHidden(_it is not item and not self.show_all_files) | python | def __hide_or_show_root_items(self, item):
"""
show_all_files option is disabled: hide all root items except *item*
show_all_files option is enabled: do nothing
"""
for _it in self.get_top_level_items():
_it.setHidden(_it is not item and not self.show_all_files) | [
"def",
"__hide_or_show_root_items",
"(",
"self",
",",
"item",
")",
":",
"for",
"_it",
"in",
"self",
".",
"get_top_level_items",
"(",
")",
":",
"_it",
".",
"setHidden",
"(",
"_it",
"is",
"not",
"item",
"and",
"not",
"self",
".",
"show_all_files",
")"
] | show_all_files option is disabled: hide all root items except *item*
show_all_files option is enabled: do nothing | [
"show_all_files",
"option",
"is",
"disabled",
":",
"hide",
"all",
"root",
"items",
"except",
"*",
"item",
"*",
"show_all_files",
"option",
"is",
"enabled",
":",
"do",
"nothing"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L216-L222 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.set_current_editor | def set_current_editor(self, editor, update):
"""Bind editor instance"""
editor_id = editor.get_id()
if editor_id in list(self.editor_ids.values()):
item = self.editor_items[editor_id]
if not self.freeze:
self.scrollToItem(item)
self... | python | def set_current_editor(self, editor, update):
"""Bind editor instance"""
editor_id = editor.get_id()
if editor_id in list(self.editor_ids.values()):
item = self.editor_items[editor_id]
if not self.freeze:
self.scrollToItem(item)
self... | [
"def",
"set_current_editor",
"(",
"self",
",",
"editor",
",",
"update",
")",
":",
"editor_id",
"=",
"editor",
".",
"get_id",
"(",
")",
"if",
"editor_id",
"in",
"list",
"(",
"self",
".",
"editor_ids",
".",
"values",
"(",
")",
")",
":",
"item",
"=",
"s... | Bind editor instance | [
"Bind",
"editor",
"instance"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L267-L294 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.file_renamed | def file_renamed(self, editor, new_filename):
"""File was renamed, updating outline explorer tree"""
if editor is None:
# This is needed when we can't find an editor to attach
# the outline explorer to.
# Fix issue 8813
return
editor_id = ed... | python | def file_renamed(self, editor, new_filename):
"""File was renamed, updating outline explorer tree"""
if editor is None:
# This is needed when we can't find an editor to attach
# the outline explorer to.
# Fix issue 8813
return
editor_id = ed... | [
"def",
"file_renamed",
"(",
"self",
",",
"editor",
",",
"new_filename",
")",
":",
"if",
"editor",
"is",
"None",
":",
"# This is needed when we can't find an editor to attach\r",
"# the outline explorer to.\r",
"# Fix issue 8813\r",
"return",
"editor_id",
"=",
"editor",
".... | File was renamed, updating outline explorer tree | [
"File",
"was",
"renamed",
"updating",
"outline",
"explorer",
"tree"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L296-L307 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.set_editor_ids_order | def set_editor_ids_order(self, ordered_editor_ids):
"""
Order the root file items in the Outline Explorer following the
provided list of editor ids.
"""
if self.ordered_editor_ids != ordered_editor_ids:
self.ordered_editor_ids = ordered_editor_ids
i... | python | def set_editor_ids_order(self, ordered_editor_ids):
"""
Order the root file items in the Outline Explorer following the
provided list of editor ids.
"""
if self.ordered_editor_ids != ordered_editor_ids:
self.ordered_editor_ids = ordered_editor_ids
i... | [
"def",
"set_editor_ids_order",
"(",
"self",
",",
"ordered_editor_ids",
")",
":",
"if",
"self",
".",
"ordered_editor_ids",
"!=",
"ordered_editor_ids",
":",
"self",
".",
"ordered_editor_ids",
"=",
"ordered_editor_ids",
"if",
"self",
".",
"sort_files_alphabetically",
"is... | Order the root file items in the Outline Explorer following the
provided list of editor ids. | [
"Order",
"the",
"root",
"file",
"items",
"in",
"the",
"Outline",
"Explorer",
"following",
"the",
"provided",
"list",
"of",
"editor",
"ids",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L333-L341 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.__sort_toplevel_items | def __sort_toplevel_items(self):
"""
Sort the root file items in alphabetical order if
'sort_files_alphabetically' is True, else order the items as
specified in the 'self.ordered_editor_ids' list.
"""
if self.show_all_files is False:
return
c... | python | def __sort_toplevel_items(self):
"""
Sort the root file items in alphabetical order if
'sort_files_alphabetically' is True, else order the items as
specified in the 'self.ordered_editor_ids' list.
"""
if self.show_all_files is False:
return
c... | [
"def",
"__sort_toplevel_items",
"(",
"self",
")",
":",
"if",
"self",
".",
"show_all_files",
"is",
"False",
":",
"return",
"current_ordered_items",
"=",
"[",
"self",
".",
"topLevelItem",
"(",
"index",
")",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"t... | Sort the root file items in alphabetical order if
'sort_files_alphabetically' is True, else order the items as
specified in the 'self.ordered_editor_ids' list. | [
"Sort",
"the",
"root",
"file",
"items",
"in",
"alphabetical",
"order",
"if",
"sort_files_alphabetically",
"is",
"True",
"else",
"order",
"the",
"items",
"as",
"specified",
"in",
"the",
"self",
".",
"ordered_editor_ids",
"list",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L343-L374 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.populate_branch | def populate_branch(self, editor, root_item, tree_cache=None):
"""
Generates an outline of the editor's content and stores the result
in a cache.
"""
if tree_cache is None:
tree_cache = {}
# Removing cached items for which line is > total line... | python | def populate_branch(self, editor, root_item, tree_cache=None):
"""
Generates an outline of the editor's content and stores the result
in a cache.
"""
if tree_cache is None:
tree_cache = {}
# Removing cached items for which line is > total line... | [
"def",
"populate_branch",
"(",
"self",
",",
"editor",
",",
"root_item",
",",
"tree_cache",
"=",
"None",
")",
":",
"if",
"tree_cache",
"is",
"None",
":",
"tree_cache",
"=",
"{",
"}",
"# Removing cached items for which line is > total line nb\r",
"for",
"_l",
"in",
... | Generates an outline of the editor's content and stores the result
in a cache. | [
"Generates",
"an",
"outline",
"of",
"the",
"editor",
"s",
"content",
"and",
"stores",
"the",
"result",
"in",
"a",
"cache",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L376-L528 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.root_item_selected | def root_item_selected(self, item):
"""Root item has been selected: expanding it and collapsing others"""
if self.show_all_files:
return
for root_item in self.get_top_level_items():
if root_item is item:
self.expandItem(root_item)
else:
... | python | def root_item_selected(self, item):
"""Root item has been selected: expanding it and collapsing others"""
if self.show_all_files:
return
for root_item in self.get_top_level_items():
if root_item is item:
self.expandItem(root_item)
else:
... | [
"def",
"root_item_selected",
"(",
"self",
",",
"item",
")",
":",
"if",
"self",
".",
"show_all_files",
":",
"return",
"for",
"root_item",
"in",
"self",
".",
"get_top_level_items",
"(",
")",
":",
"if",
"root_item",
"is",
"item",
":",
"self",
".",
"expandItem... | Root item has been selected: expanding it and collapsing others | [
"Root",
"item",
"has",
"been",
"selected",
":",
"expanding",
"it",
"and",
"collapsing",
"others"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L530-L538 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.restore | def restore(self):
"""Reimplemented OneColumnTree method"""
if self.current_editor is not None:
self.collapseAll()
editor_id = self.editor_ids[self.current_editor]
self.root_item_selected(self.editor_items[editor_id]) | python | def restore(self):
"""Reimplemented OneColumnTree method"""
if self.current_editor is not None:
self.collapseAll()
editor_id = self.editor_ids[self.current_editor]
self.root_item_selected(self.editor_items[editor_id]) | [
"def",
"restore",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_editor",
"is",
"not",
"None",
":",
"self",
".",
"collapseAll",
"(",
")",
"editor_id",
"=",
"self",
".",
"editor_ids",
"[",
"self",
".",
"current_editor",
"]",
"self",
".",
"root_item_se... | Reimplemented OneColumnTree method | [
"Reimplemented",
"OneColumnTree",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L540-L545 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.get_root_item | def get_root_item(self, item):
"""Return the root item of the specified item."""
root_item = item
while isinstance(root_item.parent(), QTreeWidgetItem):
root_item = root_item.parent()
return root_item | python | def get_root_item(self, item):
"""Return the root item of the specified item."""
root_item = item
while isinstance(root_item.parent(), QTreeWidgetItem):
root_item = root_item.parent()
return root_item | [
"def",
"get_root_item",
"(",
"self",
",",
"item",
")",
":",
"root_item",
"=",
"item",
"while",
"isinstance",
"(",
"root_item",
".",
"parent",
"(",
")",
",",
"QTreeWidgetItem",
")",
":",
"root_item",
"=",
"root_item",
".",
"parent",
"(",
")",
"return",
"r... | Return the root item of the specified item. | [
"Return",
"the",
"root",
"item",
"of",
"the",
"specified",
"item",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L547-L552 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.get_visible_items | def get_visible_items(self):
"""Return a list of all visible items in the treewidget."""
items = []
iterator = QTreeWidgetItemIterator(self)
while iterator.value():
item = iterator.value()
if not item.isHidden():
if item.parent():
... | python | def get_visible_items(self):
"""Return a list of all visible items in the treewidget."""
items = []
iterator = QTreeWidgetItemIterator(self)
while iterator.value():
item = iterator.value()
if not item.isHidden():
if item.parent():
... | [
"def",
"get_visible_items",
"(",
"self",
")",
":",
"items",
"=",
"[",
"]",
"iterator",
"=",
"QTreeWidgetItemIterator",
"(",
"self",
")",
"while",
"iterator",
".",
"value",
"(",
")",
":",
"item",
"=",
"iterator",
".",
"value",
"(",
")",
"if",
"not",
"it... | Return a list of all visible items in the treewidget. | [
"Return",
"a",
"list",
"of",
"all",
"visible",
"items",
"in",
"the",
"treewidget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L554-L567 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.activated | def activated(self, item):
"""Double-click event"""
editor_item = self.editor_items.get(
self.editor_ids.get(self.current_editor))
line = 0
if item == editor_item:
line = 1
elif isinstance(item, TreeItem):
line = item.line
se... | python | def activated(self, item):
"""Double-click event"""
editor_item = self.editor_items.get(
self.editor_ids.get(self.current_editor))
line = 0
if item == editor_item:
line = 1
elif isinstance(item, TreeItem):
line = item.line
se... | [
"def",
"activated",
"(",
"self",
",",
"item",
")",
":",
"editor_item",
"=",
"self",
".",
"editor_items",
".",
"get",
"(",
"self",
".",
"editor_ids",
".",
"get",
"(",
"self",
".",
"current_editor",
")",
")",
"line",
"=",
"0",
"if",
"item",
"==",
"edit... | Double-click event | [
"Double",
"-",
"click",
"event"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L569-L594 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerTreeWidget.clicked | def clicked(self, item):
"""Click event"""
if isinstance(item, FileRootItem):
self.root_item_selected(item)
self.activated(item) | python | def clicked(self, item):
"""Click event"""
if isinstance(item, FileRootItem):
self.root_item_selected(item)
self.activated(item) | [
"def",
"clicked",
"(",
"self",
",",
"item",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"FileRootItem",
")",
":",
"self",
".",
"root_item_selected",
"(",
"item",
")",
"self",
".",
"activated",
"(",
"item",
")"
] | Click event | [
"Click",
"event"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L596-L600 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerWidget.setup_buttons | def setup_buttons(self):
"""Setup the buttons of the outline explorer widget toolbar."""
self.fromcursor_btn = create_toolbutton(
self, icon=ima.icon('fromcursor'), tip=_('Go to cursor position'),
triggered=self.treewidget.go_to_cursor_position)
buttons = [self.fro... | python | def setup_buttons(self):
"""Setup the buttons of the outline explorer widget toolbar."""
self.fromcursor_btn = create_toolbutton(
self, icon=ima.icon('fromcursor'), tip=_('Go to cursor position'),
triggered=self.treewidget.go_to_cursor_position)
buttons = [self.fro... | [
"def",
"setup_buttons",
"(",
"self",
")",
":",
"self",
".",
"fromcursor_btn",
"=",
"create_toolbutton",
"(",
"self",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'fromcursor'",
")",
",",
"tip",
"=",
"_",
"(",
"'Go to cursor position'",
")",
",",
"triggered"... | Setup the buttons of the outline explorer widget toolbar. | [
"Setup",
"the",
"buttons",
"of",
"the",
"outline",
"explorer",
"widget",
"toolbar",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L650-L664 | train |
spyder-ide/spyder | spyder/plugins/outlineexplorer/widgets.py | OutlineExplorerWidget.get_options | def get_options(self):
"""
Return outline explorer options
"""
return dict(
show_fullpath=self.treewidget.show_fullpath,
show_all_files=self.treewidget.show_all_files,
group_cells=self.treewidget.group_cells,
show_comments=self.tree... | python | def get_options(self):
"""
Return outline explorer options
"""
return dict(
show_fullpath=self.treewidget.show_fullpath,
show_all_files=self.treewidget.show_all_files,
group_cells=self.treewidget.group_cells,
show_comments=self.tree... | [
"def",
"get_options",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"show_fullpath",
"=",
"self",
".",
"treewidget",
".",
"show_fullpath",
",",
"show_all_files",
"=",
"self",
".",
"treewidget",
".",
"show_all_files",
",",
"group_cells",
"=",
"self",
".",
"tr... | Return outline explorer options | [
"Return",
"outline",
"explorer",
"options"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/outlineexplorer/widgets.py#L675-L689 | train |
spyder-ide/spyder | spyder/api/editorextension.py | EditorExtension.on_uninstall | def on_uninstall(self):
"""Uninstalls the editor extension from the editor."""
self._on_close = True
self.enabled = False
self._editor = None | python | def on_uninstall(self):
"""Uninstalls the editor extension from the editor."""
self._on_close = True
self.enabled = False
self._editor = None | [
"def",
"on_uninstall",
"(",
"self",
")",
":",
"self",
".",
"_on_close",
"=",
"True",
"self",
".",
"enabled",
"=",
"False",
"self",
".",
"_editor",
"=",
"None"
] | Uninstalls the editor extension from the editor. | [
"Uninstalls",
"the",
"editor",
"extension",
"from",
"the",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/editorextension.py#L112-L116 | train |
spyder-ide/spyder | spyder/__init__.py | add_to_distribution | def add_to_distribution(dist):
"""Add package to py2exe/cx_Freeze distribution object
Extension to guidata.disthelpers"""
try:
dist.add_qt_bindings()
except AttributeError:
raise ImportError("This script requires guidata 1.5+")
for _modname in ('spyder', 'spyderplugins'):
dis... | python | def add_to_distribution(dist):
"""Add package to py2exe/cx_Freeze distribution object
Extension to guidata.disthelpers"""
try:
dist.add_qt_bindings()
except AttributeError:
raise ImportError("This script requires guidata 1.5+")
for _modname in ('spyder', 'spyderplugins'):
dis... | [
"def",
"add_to_distribution",
"(",
"dist",
")",
":",
"try",
":",
"dist",
".",
"add_qt_bindings",
"(",
")",
"except",
"AttributeError",
":",
"raise",
"ImportError",
"(",
"\"This script requires guidata 1.5+\"",
")",
"for",
"_modname",
"in",
"(",
"'spyder'",
",",
... | Add package to py2exe/cx_Freeze distribution object
Extension to guidata.disthelpers | [
"Add",
"package",
"to",
"py2exe",
"/",
"cx_Freeze",
"distribution",
"object",
"Extension",
"to",
"guidata",
".",
"disthelpers"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/__init__.py#L52-L64 | train |
spyder-ide/spyder | spyder/__init__.py | get_versions | def get_versions(reporev=True):
"""Get version information for components used by Spyder"""
import sys
import platform
import qtpy
import qtpy.QtCore
revision = None
if reporev:
from spyder.utils import vcs
revision, branch = vcs.get_git_revision(os.path.dirname(__dir__))
... | python | def get_versions(reporev=True):
"""Get version information for components used by Spyder"""
import sys
import platform
import qtpy
import qtpy.QtCore
revision = None
if reporev:
from spyder.utils import vcs
revision, branch = vcs.get_git_revision(os.path.dirname(__dir__))
... | [
"def",
"get_versions",
"(",
"reporev",
"=",
"True",
")",
":",
"import",
"sys",
"import",
"platform",
"import",
"qtpy",
"import",
"qtpy",
".",
"QtCore",
"revision",
"=",
"None",
"if",
"reporev",
":",
"from",
"spyder",
".",
"utils",
"import",
"vcs",
"revisio... | Get version information for components used by Spyder | [
"Get",
"version",
"information",
"for",
"components",
"used",
"by",
"Spyder"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/__init__.py#L67-L95 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | is_number | def is_number(dtype):
"""Return True is datatype dtype is a number kind"""
return is_float(dtype) or ('int' in dtype.name) or ('long' in dtype.name) \
or ('short' in dtype.name) | python | def is_number(dtype):
"""Return True is datatype dtype is a number kind"""
return is_float(dtype) or ('int' in dtype.name) or ('long' in dtype.name) \
or ('short' in dtype.name) | [
"def",
"is_number",
"(",
"dtype",
")",
":",
"return",
"is_float",
"(",
"dtype",
")",
"or",
"(",
"'int'",
"in",
"dtype",
".",
"name",
")",
"or",
"(",
"'long'",
"in",
"dtype",
".",
"name",
")",
"or",
"(",
"'short'",
"in",
"dtype",
".",
"name",
")"
] | Return True is datatype dtype is a number kind | [
"Return",
"True",
"is",
"datatype",
"dtype",
"is",
"a",
"number",
"kind"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L101-L104 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | get_idx_rect | def get_idx_rect(index_list):
"""Extract the boundaries from a list of indexes"""
rows, cols = list(zip(*[(i.row(), i.column()) for i in index_list]))
return ( min(rows), max(rows), min(cols), max(cols) ) | python | def get_idx_rect(index_list):
"""Extract the boundaries from a list of indexes"""
rows, cols = list(zip(*[(i.row(), i.column()) for i in index_list]))
return ( min(rows), max(rows), min(cols), max(cols) ) | [
"def",
"get_idx_rect",
"(",
"index_list",
")",
":",
"rows",
",",
"cols",
"=",
"list",
"(",
"zip",
"(",
"*",
"[",
"(",
"i",
".",
"row",
"(",
")",
",",
"i",
".",
"column",
"(",
")",
")",
"for",
"i",
"in",
"index_list",
"]",
")",
")",
"return",
... | Extract the boundaries from a list of indexes | [
"Extract",
"the",
"boundaries",
"from",
"a",
"list",
"of",
"indexes"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L107-L110 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayModel.columnCount | def columnCount(self, qindex=QModelIndex()):
"""Array column number"""
if self.total_cols <= self.cols_loaded:
return self.total_cols
else:
return self.cols_loaded | python | def columnCount(self, qindex=QModelIndex()):
"""Array column number"""
if self.total_cols <= self.cols_loaded:
return self.total_cols
else:
return self.cols_loaded | [
"def",
"columnCount",
"(",
"self",
",",
"qindex",
"=",
"QModelIndex",
"(",
")",
")",
":",
"if",
"self",
".",
"total_cols",
"<=",
"self",
".",
"cols_loaded",
":",
"return",
"self",
".",
"total_cols",
"else",
":",
"return",
"self",
".",
"cols_loaded"
] | Array column number | [
"Array",
"column",
"number"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L197-L202 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayModel.rowCount | def rowCount(self, qindex=QModelIndex()):
"""Array row number"""
if self.total_rows <= self.rows_loaded:
return self.total_rows
else:
return self.rows_loaded | python | def rowCount(self, qindex=QModelIndex()):
"""Array row number"""
if self.total_rows <= self.rows_loaded:
return self.total_rows
else:
return self.rows_loaded | [
"def",
"rowCount",
"(",
"self",
",",
"qindex",
"=",
"QModelIndex",
"(",
")",
")",
":",
"if",
"self",
".",
"total_rows",
"<=",
"self",
".",
"rows_loaded",
":",
"return",
"self",
".",
"total_rows",
"else",
":",
"return",
"self",
".",
"rows_loaded"
] | Array row number | [
"Array",
"row",
"number"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L204-L209 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayModel.data | def data(self, index, role=Qt.DisplayRole):
"""Cell content"""
if not index.isValid():
return to_qvariant()
value = self.get_value(index)
if is_binary_string(value):
try:
value = to_text_string(value, 'utf8')
except:
... | python | def data(self, index, role=Qt.DisplayRole):
"""Cell content"""
if not index.isValid():
return to_qvariant()
value = self.get_value(index)
if is_binary_string(value):
try:
value = to_text_string(value, 'utf8')
except:
... | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"to_qvariant",
"(",
")",
"value",
"=",
"self",
".",
"get_value",
"(",
"index",
")",
"if",... | Cell content | [
"Cell",
"content"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L253-L287 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayModel.setData | 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... | python | 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",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
"or",
"self",
".",
"readonly",
":",
"return",
"False",
"i",
"=",
"index",
".",
"row",
"(... | Cell content change | [
"Cell",
"content",
"change"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L289-L333 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayModel.headerData | 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))... | python | 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",
")",
":",
"if",
"role",
"!=",
"Qt",
".",
"DisplayRole",
":",
"return",
"to_qvariant",
"(",
")",
"labels",
"=",
"self",
".",
"xlabels",
"if... | Set header data | [
"Set",
"header",
"data"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L342-L350 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayDelegate.createEditor | 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... | python | 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",
")",
":",
"model",
"=",
"index",
".",
"model",
"(",
")",
"value",
"=",
"model",
".",
"get_value",
"(",
"index",
")",
"if",
"model",
".",
"_data",
".",
"dtype",
".",
"na... | Create editor widget | [
"Create",
"editor",
"widget"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L363-L380 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayDelegate.commitAndCloseEditor | 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)
... | python | 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",
")",
":",
"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... | Commit and close editor | [
"Commit",
"and",
"close",
"editor"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L382-L391 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayDelegate.setEditorData | def setEditorData(self, editor, index):
"""Set editor widget's data"""
text = from_qvariant(index.model().data(index, Qt.DisplayRole), str)
editor.setText(text) | python | 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",
")",
":",
"text",
"=",
"from_qvariant",
"(",
"index",
".",
"model",
"(",
")",
".",
"data",
"(",
"index",
",",
"Qt",
".",
"DisplayRole",
")",
",",
"str",
")",
"editor",
".",
"setText",
... | Set editor widget's data | [
"Set",
"editor",
"widget",
"s",
"data"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L393-L396 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayView.resize_to_contents | 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() | python | 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",
")",
":",
"QApplication",
".",
"setOverrideCursor",
"(",
"QCursor",
"(",
"Qt",
".",
"WaitCursor",
")",
")",
"self",
".",
"resizeColumnsToContents",
"(",
")",
"self",
".",
"model",
"(",
")",
".",
"fetch_more",
"(",
... | Resize cells to contents | [
"Resize",
"cells",
"to",
"contents"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L464-L470 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayView.setup_menu | def setup_menu(self):
"""Setup context menu"""
self.copy_action = create_action(self, _('Copy'),
shortcut=keybinding('Copy'),
icon=ima.icon('editcopy'),
triggered=self.copy,
... | python | 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",
")",
":",
"self",
".",
"copy_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"'Copy'",
")",
",",
"shortcut",
"=",
"keybinding",
"(",
"'Copy'",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'editcopy'",
... | Setup context menu | [
"Setup",
"context",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L472-L481 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayView.contextMenuEvent | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.menu.popup(event.globalPos())
event.accept() | python | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.menu.popup(event.globalPos())
event.accept() | [
"def",
"contextMenuEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"menu",
".",
"popup",
"(",
"event",
".",
"globalPos",
"(",
")",
")",
"event",
".",
"accept",
"(",
")"
] | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L483-L486 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayView.keyPressEvent | def keyPressEvent(self, event):
"""Reimplement Qt method"""
if event == QKeySequence.Copy:
self.copy()
else:
QTableView.keyPressEvent(self, event) | python | def keyPressEvent(self, event):
"""Reimplement Qt method"""
if event == QKeySequence.Copy:
self.copy()
else:
QTableView.keyPressEvent(self, event) | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
"==",
"QKeySequence",
".",
"Copy",
":",
"self",
".",
"copy",
"(",
")",
"else",
":",
"QTableView",
".",
"keyPressEvent",
"(",
"self",
",",
"event",
")"
] | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L488-L493 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayView._sel_to_text | 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 ... | python | 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",
")",
":",
"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",... | Copy an array portion to a unicode string | [
"Copy",
"an",
"array",
"portion",
"to",
"a",
"unicode",
"string"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L495-L523 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayView.copy | def copy(self):
"""Copy text to clipboard"""
cliptxt = self._sel_to_text( self.selectedIndexes() )
clipboard = QApplication.clipboard()
clipboard.setText(cliptxt) | python | def copy(self):
"""Copy text to clipboard"""
cliptxt = self._sel_to_text( self.selectedIndexes() )
clipboard = QApplication.clipboard()
clipboard.setText(cliptxt) | [
"def",
"copy",
"(",
"self",
")",
":",
"cliptxt",
"=",
"self",
".",
"_sel_to_text",
"(",
"self",
".",
"selectedIndexes",
"(",
")",
")",
"clipboard",
"=",
"QApplication",
".",
"clipboard",
"(",
")",
"clipboard",
".",
"setText",
"(",
"cliptxt",
")"
] | Copy text to clipboard | [
"Copy",
"text",
"to",
"clipboard"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L526-L530 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditorWidget.accept_changes | 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 | python | 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",
")",
":",
"for",
"(",
"i",
",",
"j",
")",
",",
"value",
"in",
"list",
"(",
"self",
".",
"model",
".",
"changes",
".",
"items",
"(",
")",
")",
":",
"self",
".",
"data",
"[",
"i",
",",
"j",
"]",
"=",
"value... | Accept changes | [
"Accept",
"changes"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L573-L578 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditorWidget.change_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)
... | python | 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",
")",
":",
"format",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'Format'",
")",
",",
"_",
"(",
"\"Float formatting\"",
")",
",",
"QLineEdit",
".",
"Normal",
",",
"self",
".",
"mod... | Change display format | [
"Change",
"display",
"format"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L585-L598 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditor.setup_and_check | 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
... | python | 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",
")",
":",
"self",
".",
"data",
"=",
"data",
"readonly",
"=",
"readonly",
"or",
"not"... | Setup ArrayEditor:
return False if data is not supported, True otherwise | [
"Setup",
"ArrayEditor",
":",
"return",
"False",
"if",
"data",
"is",
"not",
"supported",
"True",
"otherwise"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L622-L761 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditor.change_active_widget | 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.... | python | 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",
")",
":",
"string_index",
"=",
"[",
"':'",
"]",
"*",
"3",
"string_index",
"[",
"self",
".",
"last_dim",
"]",
"=",
"'<font color=red>%i</font>'",
"self",
".",
"slicing_label",
".",
"setText",
"(",
"(",... | This is implemented for handling negative values in index for
3d arrays, to give the same behavior as slicing | [
"This",
"is",
"implemented",
"for",
"handling",
"negative",
"values",
"in",
"index",
"for",
"3d",
"arrays",
"to",
"give",
"the",
"same",
"behavior",
"as",
"slicing"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L775-L801 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditor.current_dim_changed | 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: (' + '... | python | 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",
")",
":",
"self",
".",
"last_dim",
"=",
"index",
"string_size",
"=",
"[",
"'%i'",
"]",
"*",
"3",
"string_size",
"[",
"index",
"]",
"=",
"'<font color=red>%i</font>'",
"self",
".",
"shape_label",
".",
... | This change the active axis the array editor is plotting over
in 3D | [
"This",
"change",
"the",
"active",
"axis",
"the",
"array",
"editor",
"is",
"plotting",
"over",
"in",
"3D"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L803-L820 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditor.accept | def accept(self):
"""Reimplement Qt method"""
for index in range(self.stack.count()):
self.stack.widget(index).accept_changes()
QDialog.accept(self) | python | 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",
")",
":",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"stack",
".",
"count",
"(",
")",
")",
":",
"self",
".",
"stack",
".",
"widget",
"(",
"index",
")",
".",
"accept_changes",
"(",
")",
"QDialog",
".",
"accept",
... | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L823-L827 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditor.error | def error(self, message):
"""An error occured, closing the dialog box"""
QMessageBox.critical(self, _("Array editor"), message)
self.setAttribute(Qt.WA_DeleteOnClose)
self.reject() | python | 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",
")",
":",
"QMessageBox",
".",
"critical",
"(",
"self",
",",
"_",
"(",
"\"Array editor\"",
")",
",",
"message",
")",
"self",
".",
"setAttribute",
"(",
"Qt",
".",
"WA_DeleteOnClose",
")",
"self",
".",
"reject",
... | An error occured, closing the dialog box | [
"An",
"error",
"occured",
"closing",
"the",
"dialog",
"box"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L835-L839 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/arrayeditor.py | ArrayEditor.reject | 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) | python | 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",
")",
":",
"if",
"self",
".",
"arraywidget",
"is",
"not",
"None",
":",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"stack",
".",
"count",
"(",
")",
")",
":",
"self",
".",
"stack",
".",
"widget",
"(",
"index",
")"... | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/arrayeditor.py#L842-L847 | train |
spyder-ide/spyder | spyder/utils/introspection/utils.py | find_lexer_for_filename | 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... | python | 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",
")",
":",
"filename",
"=",
"filename",
"or",
"''",
"root",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"ext",
"in",
"custom_extension_lexer_mapping",
":",
"lexer",
"=",
... | Get a Pygments Lexer given a filename. | [
"Get",
"a",
"Pygments",
"Lexer",
"given",
"a",
"filename",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L169-L181 | train |
spyder-ide/spyder | spyder/utils/introspection/utils.py | get_keywords | 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... | python | 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",
")",
":",
"if",
"not",
"hasattr",
"(",
"lexer",
",",
"'tokens'",
")",
":",
"return",
"[",
"]",
"if",
"'keywords'",
"in",
"lexer",
".",
"tokens",
":",
"try",
":",
"return",
"lexer",
".",
"tokens",
"[",
"'keywords'",
... | Get the keywords for a given lexer. | [
"Get",
"the",
"keywords",
"for",
"a",
"given",
"lexer",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L184-L211 | train |
spyder-ide/spyder | spyder/utils/introspection/utils.py | get_words | 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 ... | python | 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",
")",
":",
"if",
"(",
"file_path",
"is",
"None",
"and",
"(",
"content",
"is",
"None",
"or",
"extension",
"is",
"None",
")",
"or",
"file_path",... | 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. | [
"Extract",
"all",
"words",
"from",
"a",
"source",
"code",
"file",
"to",
"be",
"used",
"in",
"code",
"completion",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L213-L238 | train |
spyder-ide/spyder | spyder/utils/introspection/utils.py | get_parent_until | 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... | python | 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",
")",
":",
"dirname",
"=",
"osp",
".",
"dirname",
"(",
"path",
")",
"try",
":",
"mod",
"=",
"osp",
".",
"basename",
"(",
"path",
")",
"mod",
"=",
"osp",
".",
"splitext",
"(",
"mod",
")",
"[",
"0",
"]",
"imp"... | Given a file path, determine the full module path.
e.g. '/usr/lib/python2.7/dist-packages/numpy/core/__init__.pyc' yields
'numpy.core' | [
"Given",
"a",
"file",
"path",
"determine",
"the",
"full",
"module",
"path",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L241-L263 | train |
spyder-ide/spyder | spyder/utils/introspection/utils.py | CodeInfo._get_docstring | 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... | python | 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",
")",
":",
"left",
"=",
"self",
".",
"position",
"while",
"left",
":",
"if",
"self",
".",
"source_code",
"[",
"left",
":",
"left",
"+",
"3",
"]",
"in",
"[",
"'\"\"\"'",
",",
"\"'''\"",
"]",
":",
"left",
"+=",
"3... | Find the docstring we are currently in. | [
"Find",
"the",
"docstring",
"we",
"are",
"currently",
"in",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/utils.py#L128-L144 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/kernelconnect.py | KernelConnectionDialog.load_connection_settings | 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)
... | python | 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",
")",
":",
"existing_kernel",
"=",
"CONF",
".",
"get",
"(",
"\"existing-kernel\"",
",",
"\"settings\"",
",",
"{",
"}",
")",
"connection_file_path",
"=",
"existing_kernel",
".",
"get",
"(",
"\"json_file_path\"",
",",
... | Load the user's previously-saved kernel connection settings. | [
"Load",
"the",
"user",
"s",
"previously",
"-",
"saved",
"kernel",
"connection",
"settings",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/kernelconnect.py#L164-L200 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/kernelconnect.py | KernelConnectionDialog.save_connection_settings | 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_... | python | 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",
")",
":",
"if",
"not",
"self",
".",
"save_layout",
".",
"isChecked",
"(",
")",
":",
"return",
"is_ssh_key",
"=",
"bool",
"(",
"self",
".",
"kf_radio",
".",
"isChecked",
"(",
")",
")",
"connection_settings",
"... | Save user's kernel connection settings. | [
"Save",
"user",
"s",
"kernel",
"connection",
"settings",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/kernelconnect.py#L202-L231 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | get_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 | python | 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",
")",
":",
"color",
"=",
"QColor",
"(",
")",
"for",
"typ",
"in",
"COLORS",
":",
"if",
"isinstance",
"(",
"value",
",",
"typ",
")",
":",
"color",
"=",
"QColor",
"(",
"COLORS",
"[",
"typ",
"]",
")",
"c... | Return color depending on value type | [
"Return",
"color",
"depending",
"on",
"value",
"type"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L96-L103 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ContentsWidget.get_col_sep | 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()) | python | 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",
")",
":",
"if",
"self",
".",
"tab_btn",
".",
"isChecked",
"(",
")",
":",
"return",
"u\"\\t\"",
"elif",
"self",
".",
"ws_btn",
".",
"isChecked",
"(",
")",
":",
"return",
"None",
"return",
"to_text_string",
"(",
"self",
... | Return the column separator | [
"Return",
"the",
"column",
"separator"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L236-L242 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ContentsWidget.get_row_sep | 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()) | python | 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",
")",
":",
"if",
"self",
".",
"eol_btn",
".",
"isChecked",
"(",
")",
":",
"return",
"u\"\\n\"",
"return",
"to_text_string",
"(",
"self",
".",
"line_edt_row",
".",
"text",
"(",
")",
")"
] | Return the row separator | [
"Return",
"the",
"row",
"separator"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L244-L248 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ContentsWidget.set_as_data | def set_as_data(self, as_data):
"""Set if data type conversion"""
self._as_data = as_data
self.asDataChanged.emit(as_data) | python | 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",
")",
":",
"self",
".",
"_as_data",
"=",
"as_data",
"self",
".",
"asDataChanged",
".",
"emit",
"(",
"as_data",
")"
] | Set if data type conversion | [
"Set",
"if",
"data",
"type",
"conversion"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L259-L262 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTableModel._display_data | def _display_data(self, index):
"""Return a data element"""
return to_qvariant(self._data[index.row()][index.column()]) | python | def _display_data(self, index):
"""Return a data element"""
return to_qvariant(self._data[index.row()][index.column()]) | [
"def",
"_display_data",
"(",
"self",
",",
"index",
")",
":",
"return",
"to_qvariant",
"(",
"self",
".",
"_data",
"[",
"index",
".",
"row",
"(",
")",
"]",
"[",
"index",
".",
"column",
"(",
")",
"]",
")"
] | Return a data element | [
"Return",
"a",
"data",
"element"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L284-L286 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTableModel.data | 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... | python | 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",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"to_qvariant",
"(",
")",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
":",
"return",
"se... | Return a model data element | [
"Return",
"a",
"model",
"data",
"element"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L288-L298 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTableModel.parse_data_type | 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... | python | 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",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"False",
"try",
":",
"if",
"kwargs",
"[",
"'atype'",
"]",
"==",
"\"date\"",
":",
"self",
".",
"_d... | Parse a type to an other type | [
"Parse",
"a",
"type",
"to",
"an",
"other",
"type"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L308-L334 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTable._shape_text | 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... | python | 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",
"=",
"'#'",
")",
":",
"assert",
"colsep",
"!=",
"rowsep",
"out",... | Decode the shape of the given text | [
"Decode",
"the",
"shape",
"of",
"the",
"given",
"text"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L376-L399 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTable.process_data | 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... | python | 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",
"=",
"'#'",
")",
":",
"data",
"=",
"self",
".",
"_shape_text",
... | Put data into table model | [
"Put",
"data",
"into",
"table",
"model"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L407-L413 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTable.parse_to_type | 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) | python | 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",
")",
":",
"indexes",
"=",
"self",
".",
"selectedIndexes",
"(",
")",
"if",
"not",
"indexes",
":",
"return",
"for",
"index",
"in",
"indexes",
":",
"self",
".",
"model",
"(",
")",
".",
"parse... | Parse to a given type | [
"Parse",
"to",
"a",
"given",
"type"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L416-L421 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewTable.contextMenuEvent | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.opt_menu.popup(event.globalPos())
event.accept() | python | def contextMenuEvent(self, event):
"""Reimplement Qt method"""
self.opt_menu.popup(event.globalPos())
event.accept() | [
"def",
"contextMenuEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"opt_menu",
".",
"popup",
"(",
"event",
".",
"globalPos",
"(",
")",
")",
"event",
".",
"accept",
"(",
")"
] | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L423-L426 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | PreviewWidget.open_data | 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... | python | 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",
"=",
"'#'",
")",
":",
"if",
"pd",
":",
"self",
".",
"pd_text",
... | Open clipboard text as table | [
"Open",
"clipboard",
"text",
"as",
"table"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L467-L478 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ImportWizard._focus_tab | 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) | python | 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",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"tab_widget",
".",
"count",
"(",
")",
")",
":",
"self",
".",
"tab_widget",
".",
"setTabEnabled",
"(",
"i",
",",
"False",
")",
"self",
".",
"tab... | Change tab focus | [
"Change",
"tab",
"focus"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L558-L563 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ImportWizard._set_step | 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... | python | 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",
")",
":",
"new_tab",
"=",
"self",
".",
"tab_widget",
".",
"currentIndex",
"(",
")",
"+",
"step",
"assert",
"new_tab",
"<",
"self",
".",
"tab_widget",
".",
"count",
"(",
")",
"and",
"new_tab",
">=",
"0",
"... | Proceed to a given step | [
"Proceed",
"to",
"a",
"given",
"step"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L565-L591 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ImportWizard._simplify_shape | 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... | python | 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",
")",
":",
"if",
"rec",
"!=",
"0",
":",
"if",
"len",
"(",
"alist",
")",
"==",
"1",
":",
"return",
"alist",
"[",
"-",
"1",
"]",
"return",
"alist",
"if",
"len",
"(",
"alist... | Reduce the alist dimension if needed | [
"Reduce",
"the",
"alist",
"dimension",
"if",
"needed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L599-L607 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ImportWizard._get_table_data | 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... | python | 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",
")",
":",
"data",
"=",
"self",
".",
"_simplify_shape",
"(",
"self",
".",
"table_widget",
".",
"get_data",
"(",
")",
")",
"if",
"self",
".",
"table_widget",
".",
"array_btn",
".",
"isChecked",
"(",
")",
":",
"return"... | Return clipboard processed as data | [
"Return",
"clipboard",
"processed",
"as",
"data"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L609-L619 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/importwizard.py | ImportWizard.process | 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... | python | 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",
")",
":",
"var_name",
"=",
"self",
".",
"name_edt",
".",
"text",
"(",
")",
"try",
":",
"self",
".",
"var_name",
"=",
"str",
"(",
"var_name",
")",
"except",
"UnicodeEncodeError",
":",
"self",
".",
"var_name",
"=",
"to_text... | Process the data from clipboard | [
"Process",
"the",
"data",
"from",
"clipboard"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/importwizard.py#L626-L640 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/debugging.py | DebuggingWidget.set_spyder_breakpoints | 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... | python | 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",
")",
":",
"if",
"self",
".",
"_reading",
"or",
"force",
":",
"breakpoints_dict",
"=",
"CONF",
".",
"get",
"(",
"'run'",
",",
"'breakpoints'",
",",
"{",
"}",
")",
"# We need to enclos... | Set Spyder breakpoints into a debugging session | [
"Set",
"Spyder",
"breakpoints",
"into",
"a",
"debugging",
"session"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L36-L48 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/debugging.py | DebuggingWidget.dbg_exec_magic | 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) | python | 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",
"=",
"''",
")",
":",
"code",
"=",
"\"!get_ipython().kernel.shell.run_line_magic('{}', '{}')\"",
".",
"format",
"(",
"magic",
",",
"args",
")",
"self",
".",
"kernel_client",
".",
"input",
"(",
"co... | Run an IPython magic while debugging. | [
"Run",
"an",
"IPython",
"magic",
"while",
"debugging",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L50-L54 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/debugging.py | DebuggingWidget.refresh_from_pdb | 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... | python | 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",
")",
":",
"if",
"'step'",
"in",
"pdb_state",
"and",
"'fname'",
"in",
"pdb_state",
"[",
"'step'",
"]",
":",
"fname",
"=",
"pdb_state",
"[",
"'step'",
"]",
"[",
"'fname'",
"]",
"lineno",
"=",
"pdb_s... | Refresh Variable Explorer and Editor from a Pdb session,
after running any pdb command.
See publish_pdb_state and notify_spyder in spyder_kernels | [
"Refresh",
"Variable",
"Explorer",
"and",
"Editor",
"from",
"a",
"Pdb",
"session",
"after",
"running",
"any",
"pdb",
"command",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L56-L74 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/debugging.py | DebuggingWidget._handle_input_request | 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.
... | python | 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",
")",
":",
"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... | Save history and add a %plot magic. | [
"Save",
"history",
"and",
"add",
"a",
"%plot",
"magic",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L77-L106 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/debugging.py | DebuggingWidget._event_filter_console_keypress | 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)
... | python | 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",
")",
":",
"key",
"=",
"event",
".",
"key",
"(",
")",
"if",
"self",
".",
"_reading",
":",
"self",
".",
"_control",
".",
"current_prompt_pos",
"=",
"self",
".",
"_prompt_pos",
"if",
"key",
... | Handle Key_Up/Key_Down while debugging. | [
"Handle",
"Key_Up",
"/",
"Key_Down",
"while",
"debugging",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/debugging.py#L108-L127 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | global_max | 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) | python | 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",
")",
":",
"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... | Returns the global maximum and minimum. | [
"Returns",
"the",
"global",
"maximum",
"and",
"minimum",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L105-L109 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel._axis | 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 | python | 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",
"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). | [
"Return",
"the",
"corresponding",
"labels",
"taking",
"into",
"account",
"the",
"axis",
".",
"The",
"axis",
"could",
"be",
"horizontal",
"(",
"0",
")",
"or",
"vertical",
"(",
"1",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L162-L168 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel._axis_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) | python | 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",
")",
":",
"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). | [
"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",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L170-L177 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.header | 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'... | python | 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",
")",
":",
"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. | [
"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",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L194-L203 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.max_min_col_update | 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... | python | 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",
")",
":",
"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"... | 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 ... | [
"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",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L213-L243 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.colum_avg | 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() | python | 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",
")",
":",
"self",
".",
"colum_avg_enabled",
"=",
"state",
">",
"0",
"if",
"self",
".",
"colum_avg_enabled",
":",
"self",
".",
"return_max",
"=",
"lambda",
"col_vals",
",",
"index",
":",
"col_vals",
"[",
"ind... | Toggle backgroundcolor | [
"Toggle",
"backgroundcolor"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L260-L267 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.get_bgcolor | 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... | python | 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",
")",
":",
"column",
"=",
"index",
".",
"column",
"(",
")",
"if",
"not",
"self",
".",
"bgcolor_enabled",
":",
"return",
"value",
"=",
"self",
".",
"get_value",
"(",
"index",
".",
"row",
"(",
")",
",",
... | Background color depending on value. | [
"Background",
"color",
"depending",
"on",
"value",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L269-L295 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.get_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 = ... | python | 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",
")",
":",
"# 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",
"]... | Return the value of the DataFrame. | [
"Return",
"the",
"value",
"of",
"the",
"DataFrame",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L297-L307 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.data | 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)
... | python | 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",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"to_qvariant",
"(",
")",
"if",
"role",
"==",
"Qt",
".",
"DisplayRole",
"or",
"role",
"=="... | Cell content | [
"Cell",
"content"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L313-L348 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.sort | 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... | python | 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",
")",
":",
"if",
"self",
".",
"complex_intran",
"is",
"not",
"None",
":",
"if",
"self",
".",
"complex_intran",
".",
"any",
"(",
"axis",
"=",
"0",
")",
".",
"i... | Overriding sort method | [
"Overriding",
"sort",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L350-L389 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.flags | def flags(self, index):
"""Set flags"""
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
Qt.ItemIsEditable) | python | def flags(self, index):
"""Set flags"""
return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
Qt.ItemIsEditable) | [
"def",
"flags",
"(",
"self",
",",
"index",
")",
":",
"return",
"Qt",
".",
"ItemFlags",
"(",
"QAbstractTableModel",
".",
"flags",
"(",
"self",
",",
"index",
")",
"|",
"Qt",
".",
"ItemIsEditable",
")"
] | Set flags | [
"Set",
"flags"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L391-L394 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.setData | 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... | python | 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",
")",
":",
"column",
"=",
"index",
".",
"column",
"(",
")",
"row",
"=",
"index",
".",
"row",
"(",
")",
"if",
"inde... | Cell content change | [
"Cell",
"content",
"change"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L396-L433 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameModel.columnCount | 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:
... | python | 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",
"(",
")",
")",
":",
"# 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",
... | DataFrame column number | [
"DataFrame",
"column",
"number"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L469-L483 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameView.load_more_data | 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... | python | 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",
")",
":",
"try",
":",
"if",
"rows",
"and",
"value",
"==",
"self",
".",
"verticalScrollBar",
"(",
")",
".",
"maximum",
"(",
")",
":",
"self",
... | Load more rows and columns to display. | [
"Load",
"more",
"rows",
"and",
"columns",
"to",
"display",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L524-L537 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameView.sortByColumn | 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)... | python | 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",
")",
":",
"if",
"self",
".",
"sort_old",
"==",
"[",
"None",
"]",
":",
"self",
".",
"header_class",
".",
"setSortIndicatorShown",
"(",
"True",
")",
"sort_order",
"=",
"self",
".",
"header_class",
".",
"sor... | Implement a column sort. | [
"Implement",
"a",
"column",
"sort",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L539-L552 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameView.setup_menu | def setup_menu(self):
"""Setup context menu."""
copy_action = create_action(self, _('Copy'),
shortcut=keybinding('Copy'),
icon=ima.icon('editcopy'),
triggered=self.copy,
... | python | 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",
")",
":",
"copy_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"'Copy'",
")",
",",
"shortcut",
"=",
"keybinding",
"(",
"'Copy'",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'editcopy'",
")",
",",
"tr... | Setup context menu. | [
"Setup",
"context",
"menu",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L559-L577 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameView.change_type | 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] | python | 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",
")",
":",
"model",
"=",
"self",
".",
"model",
"(",
")",
"index_list",
"=",
"self",
".",
"selectedIndexes",
"(",
")",
"[",
"model",
".",
"setData",
"(",
"i",
",",
"''",
",",
"change_type",
"=",
"func",
... | A function that changes types of cells. | [
"A",
"function",
"that",
"changes",
"types",
"of",
"cells",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L579-L583 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameView.copy | 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... | python | 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",
")",
":",
"if",
"not",
"self",
".",
"selectedIndexes",
"(",
")",
":",
"return",
"(",
"row_min",
",",
"row_max",
",",
"col_min",
",",
"col_max",
")",
"=",
"get_idx_rect",
"(",
"self",
".",
"selectedIndexes",
"(",
")",
")",
... | Copy text to clipboard | [
"Copy",
"text",
"to",
"clipboard"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L586-L604 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameHeaderModel.rowCount | 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 | python | 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",
")",
":",
"if",
"self",
".",
"axis",
"==",
"0",
":",
"return",
"max",
"(",
"1",
",",
"self",
".",
"_shape",
"[",
"0",
"]",
")",
"else",
":",
"if",
"self",
".",
"total_rows",
"<=",
"self... | Get number of rows in the header. | [
"Get",
"number",
"of",
"rows",
"in",
"the",
"header",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L645-L653 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameHeaderModel.columnCount | 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]... | python | 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",
"(",
")",
")",
":",
"if",
"self",
".",
"axis",
"==",
"0",
":",
"if",
"self",
".",
"total_cols",
"<=",
"self",
".",
"cols_loaded",
":",
"return",
"self",
".",
"total_cols",
"else",
"... | DataFrame column number | [
"DataFrame",
"column",
"number"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L655-L663 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameHeaderModel.fetch_more | 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... | python | 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",
")",
":",
"if",
"self",
".",
"axis",
"==",
"1",
"and",
"self",
".",
"total_rows",
">",
"self",
".",
"rows_loaded",
":",
"reminder",
"=",
"self",
".",
"total_ro... | Get more columns or rows (based on axis). | [
"Get",
"more",
"columns",
"or",
"rows",
"(",
"based",
"on",
"axis",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L665-L680 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameHeaderModel.sort | def sort(self, column, order=Qt.AscendingOrder):
"""Overriding sort method."""
ascending = order == Qt.AscendingOrder
self.model.sort(self.COLUMN_INDEX, order=ascending)
return True | python | 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",
")",
":",
"ascending",
"=",
"order",
"==",
"Qt",
".",
"AscendingOrder",
"self",
".",
"model",
".",
"sort",
"(",
"self",
".",
"COLUMN_INDEX",
",",
"order",
"=",
... | Overriding sort method. | [
"Overriding",
"sort",
"method",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L682-L686 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameHeaderModel.headerData | 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... | python | 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",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"TextAlignmentRole",
":",
"if",
"orientation",
"==",
"Qt",
".",
"Horizontal",
":",
"return",
"Qt",
".",
"AlignCenter",
"|",
"Qt",
... | Get the information to put in the header. | [
"Get",
"the",
"information",
"to",
"put",
"in",
"the",
"header",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L688-L712 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameHeaderModel.data | 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 = ((... | python | 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",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
"or",
"index",
".",
"row",
"(",
")",
">=",
"self",
".",
"_shape",
"[",
"0",
"]",
"or",
"index",
".",
"column",
"(",
")",
">=",
"s... | Get the data for the header.
This is used when a header has levels. | [
"Get",
"the",
"data",
"for",
"the",
"header",
".",
"This",
"is",
"used",
"when",
"a",
"header",
"has",
"levels",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L714-L740 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameLevelModel.headerData | 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:
... | python | 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",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"TextAlignmentRole",
":",
"if",
"orientation",
"==",
"Qt",
".",
"Horizontal",
":",
"return",
"Qt",
".",
"AlignCenter",
"|",
"Qt",
... | 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 | [
"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"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L776-L797 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameLevelModel.data | 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... | python | 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",
")",
":",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
":",
"return",
"None",
"if",
"role",
"==",
"Qt",
".",
"FontRole",
":",
"return",
"self",
".",
"_font",
"label",
"=",
"''",
"if",
"ind... | Get the information of the levels. | [
"Get",
"the",
"information",
"of",
"the",
"levels",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L799-L818 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameEditor.setup_and_check | 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 ... | python | 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",
"=",
"''",
")",
":",
"self",
".",
"_selection_rec",
"=",
"False",
"self",
".",
"_model",
"=",
"None",
"self",
".",
"layout",
"=",
"QGridLayout",
"(",
")",
"self",
".",
"layout",
".",
"... | Setup DataFrameEditor:
return False if data is not supported, True otherwise.
Supported types for data are DataFrame, Series and Index. | [
"Setup",
"DataFrameEditor",
":",
"return",
"False",
"if",
"data",
"is",
"not",
"supported",
"True",
"otherwise",
".",
"Supported",
"types",
"for",
"data",
"are",
"DataFrame",
"Series",
"and",
"Index",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L846-L947 | train |
spyder-ide/spyder | spyder/plugins/variableexplorer/widgets/dataframeeditor.py | DataFrameEditor.save_and_close_enable | 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) | python | 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",
")",
":",
"self",
".",
"btn_save_and_close",
".",
"setEnabled",
"(",
"True",
")",
"self",
".",
"btn_save_and_close",
".",
"setAutoDefault",
"(",
"True",
")",
"self",
".",
"btn_s... | Handle the data change event to enable the save and close button. | [
"Handle",
"the",
"data",
"change",
"event",
"to",
"enable",
"the",
"save",
"and",
"close",
"button",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/dataframeeditor.py#L950-L954 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.