partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Editor.new | Create a new file - Untitled
fname=None --> fname will be 'untitledXX.py' but do not create file
fname=<basestring> --> create file | spyder/plugins/editor/plugin.py | def new(self, fname=None, editorstack=None, text=None):
"""
Create a new file - Untitled
fname=None --> fname will be 'untitledXX.py' but do not create file
fname=<basestring> --> create file
"""
# If no text is provided, create default content
empty = Fa... | def new(self, fname=None, editorstack=None, text=None):
"""
Create a new file - Untitled
fname=None --> fname will be 'untitledXX.py' but do not create file
fname=<basestring> --> create file
"""
# If no text is provided, create default content
empty = Fa... | [
"Create",
"a",
"new",
"file",
"-",
"Untitled",
"fname",
"=",
"None",
"--",
">",
"fname",
"will",
"be",
"untitledXX",
".",
"py",
"but",
"do",
"not",
"create",
"file",
"fname",
"=",
"<basestring",
">",
"--",
">",
"create",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1565-L1646 | [
"def",
"new",
"(",
"self",
",",
"fname",
"=",
"None",
",",
"editorstack",
"=",
"None",
",",
"text",
"=",
"None",
")",
":",
"# If no text is provided, create default content\r",
"empty",
"=",
"False",
"try",
":",
"if",
"text",
"is",
"None",
":",
"default_cont... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.update_recent_file_menu | Update recent file menu | spyder/plugins/editor/plugin.py | def update_recent_file_menu(self):
"""Update recent file menu"""
recent_files = []
for fname in self.recent_files:
if self.is_file_opened(fname) is None and osp.isfile(fname):
recent_files.append(fname)
self.recent_file_menu.clear()
if recent_fi... | def update_recent_file_menu(self):
"""Update recent file menu"""
recent_files = []
for fname in self.recent_files:
if self.is_file_opened(fname) is None and osp.isfile(fname):
recent_files.append(fname)
self.recent_file_menu.clear()
if recent_fi... | [
"Update",
"recent",
"file",
"menu"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1652-L1668 | [
"def",
"update_recent_file_menu",
"(",
"self",
")",
":",
"recent_files",
"=",
"[",
"]",
"for",
"fname",
"in",
"self",
".",
"recent_files",
":",
"if",
"self",
".",
"is_file_opened",
"(",
"fname",
")",
"is",
"None",
"and",
"osp",
".",
"isfile",
"(",
"fname... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.load | Load a text file
editorwindow: load in this editorwindow (useful when clicking on
outline explorer with multiple editor windows)
processevents: determines if processEvents() should be called at the
end of this method (set to False to prevent keyboard events from
creeping thr... | spyder/plugins/editor/plugin.py | def load(self, filenames=None, goto=None, word='',
editorwindow=None, processevents=True, start_column=None,
set_focus=True, add_where='end'):
"""
Load a text file
editorwindow: load in this editorwindow (useful when clicking on
outline explorer with multi... | def load(self, filenames=None, goto=None, word='',
editorwindow=None, processevents=True, start_column=None,
set_focus=True, add_where='end'):
"""
Load a text file
editorwindow: load in this editorwindow (useful when clicking on
outline explorer with multi... | [
"Load",
"a",
"text",
"file",
"editorwindow",
":",
"load",
"in",
"this",
"editorwindow",
"(",
"useful",
"when",
"clicking",
"on",
"outline",
"explorer",
"with",
"multiple",
"editor",
"windows",
")",
"processevents",
":",
"determines",
"if",
"processEvents",
"()",... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1689-L1828 | [
"def",
"load",
"(",
"self",
",",
"filenames",
"=",
"None",
",",
"goto",
"=",
"None",
",",
"word",
"=",
"''",
",",
"editorwindow",
"=",
"None",
",",
"processevents",
"=",
"True",
",",
"start_column",
"=",
"None",
",",
"set_focus",
"=",
"True",
",",
"a... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.print_file | Print current file | spyder/plugins/editor/plugin.py | def print_file(self):
"""Print current file"""
editor = self.get_current_editor()
filename = self.get_current_filename()
printer = Printer(mode=QPrinter.HighResolution,
header_font=self.get_plugin_font('printer_header'))
printDialog = QPrintDialog(... | def print_file(self):
"""Print current file"""
editor = self.get_current_editor()
filename = self.get_current_filename()
printer = Printer(mode=QPrinter.HighResolution,
header_font=self.get_plugin_font('printer_header'))
printDialog = QPrintDialog(... | [
"Print",
"current",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1831-L1847 | [
"def",
"print_file",
"(",
"self",
")",
":",
"editor",
"=",
"self",
".",
"get_current_editor",
"(",
")",
"filename",
"=",
"self",
".",
"get_current_filename",
"(",
")",
"printer",
"=",
"Printer",
"(",
"mode",
"=",
"QPrinter",
".",
"HighResolution",
",",
"he... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.print_preview | Print preview for current file | spyder/plugins/editor/plugin.py | def print_preview(self):
"""Print preview for current file"""
from qtpy.QtPrintSupport import QPrintPreviewDialog
editor = self.get_current_editor()
printer = Printer(mode=QPrinter.HighResolution,
header_font=self.get_plugin_font('printer_header'))
... | def print_preview(self):
"""Print preview for current file"""
from qtpy.QtPrintSupport import QPrintPreviewDialog
editor = self.get_current_editor()
printer = Printer(mode=QPrinter.HighResolution,
header_font=self.get_plugin_font('printer_header'))
... | [
"Print",
"preview",
"for",
"current",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1850-L1862 | [
"def",
"print_preview",
"(",
"self",
")",
":",
"from",
"qtpy",
".",
"QtPrintSupport",
"import",
"QPrintPreviewDialog",
"editor",
"=",
"self",
".",
"get_current_editor",
"(",
")",
"printer",
"=",
"Printer",
"(",
"mode",
"=",
"QPrinter",
".",
"HighResolution",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.save | Save file | spyder/plugins/editor/plugin.py | def save(self, index=None, force=False):
"""Save file"""
editorstack = self.get_current_editorstack()
return editorstack.save(index=index, force=force) | def save(self, index=None, force=False):
"""Save file"""
editorstack = self.get_current_editorstack()
return editorstack.save(index=index, force=force) | [
"Save",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1875-L1878 | [
"def",
"save",
"(",
"self",
",",
"index",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"return",
"editorstack",
".",
"save",
"(",
"index",
"=",
"index",
",",
"force",
"=",
"for... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.save_as | Save *as* the currently edited file | spyder/plugins/editor/plugin.py | def save_as(self):
"""Save *as* the currently edited file"""
editorstack = self.get_current_editorstack()
if editorstack.save_as():
fname = editorstack.get_current_filename()
self.__add_recent_file(fname) | def save_as(self):
"""Save *as* the currently edited file"""
editorstack = self.get_current_editorstack()
if editorstack.save_as():
fname = editorstack.get_current_filename()
self.__add_recent_file(fname) | [
"Save",
"*",
"as",
"*",
"the",
"currently",
"edited",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1881-L1886 | [
"def",
"save_as",
"(",
"self",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"if",
"editorstack",
".",
"save_as",
"(",
")",
":",
"fname",
"=",
"editorstack",
".",
"get_current_filename",
"(",
")",
"self",
".",
"__add_recent_... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.find | Find slot | spyder/plugins/editor/plugin.py | def find(self):
"""Find slot"""
editorstack = self.get_current_editorstack()
editorstack.find_widget.show()
editorstack.find_widget.search_text.setFocus() | def find(self):
"""Find slot"""
editorstack = self.get_current_editorstack()
editorstack.find_widget.show()
editorstack.find_widget.search_text.setFocus() | [
"Find",
"slot"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1906-L1910 | [
"def",
"find",
"(",
"self",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"editorstack",
".",
"find_widget",
".",
"show",
"(",
")",
"editorstack",
".",
"find_widget",
".",
"search_text",
".",
"setFocus",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.open_last_closed | Reopens the last closed tab. | spyder/plugins/editor/plugin.py | def open_last_closed(self):
""" Reopens the last closed tab."""
editorstack = self.get_current_editorstack()
last_closed_files = editorstack.get_last_closed_files()
if (len(last_closed_files) > 0):
file_to_open = last_closed_files[0]
last_closed_files.remove... | def open_last_closed(self):
""" Reopens the last closed tab."""
editorstack = self.get_current_editorstack()
last_closed_files = editorstack.get_last_closed_files()
if (len(last_closed_files) > 0):
file_to_open = last_closed_files[0]
last_closed_files.remove... | [
"Reopens",
"the",
"last",
"closed",
"tab",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1930-L1938 | [
"def",
"open_last_closed",
"(",
"self",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"last_closed_files",
"=",
"editorstack",
".",
"get_last_closed_files",
"(",
")",
"if",
"(",
"len",
"(",
"last_closed_files",
")",
">",
"0",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.close_file_from_name | Close file from its name | spyder/plugins/editor/plugin.py | def close_file_from_name(self, filename):
"""Close file from its name"""
filename = osp.abspath(to_text_string(filename))
index = self.editorstacks[0].has_filename(filename)
if index is not None:
self.editorstacks[0].close_file(index) | def close_file_from_name(self, filename):
"""Close file from its name"""
filename = osp.abspath(to_text_string(filename))
index = self.editorstacks[0].has_filename(filename)
if index is not None:
self.editorstacks[0].close_file(index) | [
"Close",
"file",
"from",
"its",
"name"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1941-L1946 | [
"def",
"close_file_from_name",
"(",
"self",
",",
"filename",
")",
":",
"filename",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",
"(",
"filename",
")",
")",
"index",
"=",
"self",
".",
"editorstacks",
"[",
"0",
"]",
".",
"has_filename",
"(",
"filename",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.removed_tree | Directory was removed in project explorer widget | spyder/plugins/editor/plugin.py | def removed_tree(self, dirname):
"""Directory was removed in project explorer widget"""
dirname = osp.abspath(to_text_string(dirname))
for fname in self.get_filenames():
if osp.abspath(fname).startswith(dirname):
self.close_file_from_name(fname) | def removed_tree(self, dirname):
"""Directory was removed in project explorer widget"""
dirname = osp.abspath(to_text_string(dirname))
for fname in self.get_filenames():
if osp.abspath(fname).startswith(dirname):
self.close_file_from_name(fname) | [
"Directory",
"was",
"removed",
"in",
"project",
"explorer",
"widget"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1952-L1957 | [
"def",
"removed_tree",
"(",
"self",
",",
"dirname",
")",
":",
"dirname",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",
"(",
"dirname",
")",
")",
"for",
"fname",
"in",
"self",
".",
"get_filenames",
"(",
")",
":",
"if",
"osp",
".",
"abspath",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.renamed | File was renamed in file explorer widget or in project explorer | spyder/plugins/editor/plugin.py | def renamed(self, source, dest):
"""File was renamed in file explorer widget or in project explorer"""
filename = osp.abspath(to_text_string(source))
index = self.editorstacks[0].has_filename(filename)
if index is not None:
for editorstack in self.editorstacks:
... | def renamed(self, source, dest):
"""File was renamed in file explorer widget or in project explorer"""
filename = osp.abspath(to_text_string(source))
index = self.editorstacks[0].has_filename(filename)
if index is not None:
for editorstack in self.editorstacks:
... | [
"File",
"was",
"renamed",
"in",
"file",
"explorer",
"widget",
"or",
"in",
"project",
"explorer"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1959-L1966 | [
"def",
"renamed",
"(",
"self",
",",
"source",
",",
"dest",
")",
":",
"filename",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",
"(",
"source",
")",
")",
"index",
"=",
"self",
".",
"editorstacks",
"[",
"0",
"]",
".",
"has_filename",
"(",
"filename",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.renamed_tree | Directory was renamed in file explorer or in project explorer. | spyder/plugins/editor/plugin.py | def renamed_tree(self, source, dest):
"""Directory was renamed in file explorer or in project explorer."""
dirname = osp.abspath(to_text_string(source))
tofile = to_text_string(dest)
for fname in self.get_filenames():
if osp.abspath(fname).startswith(dirname):
... | def renamed_tree(self, source, dest):
"""Directory was renamed in file explorer or in project explorer."""
dirname = osp.abspath(to_text_string(source))
tofile = to_text_string(dest)
for fname in self.get_filenames():
if osp.abspath(fname).startswith(dirname):
... | [
"Directory",
"was",
"renamed",
"in",
"file",
"explorer",
"or",
"in",
"project",
"explorer",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L1968-L1975 | [
"def",
"renamed_tree",
"(",
"self",
",",
"source",
",",
"dest",
")",
":",
"dirname",
"=",
"osp",
".",
"abspath",
"(",
"to_text_string",
"(",
"source",
")",
")",
"tofile",
"=",
"to_text_string",
"(",
"dest",
")",
"for",
"fname",
"in",
"self",
".",
"get_... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.run_winpdb | Run winpdb to debug current file | spyder/plugins/editor/plugin.py | def run_winpdb(self):
"""Run winpdb to debug current file"""
if self.save():
fname = self.get_current_filename()
runconf = get_run_configuration(fname)
if runconf is None:
args = []
wdir = None
else:
... | def run_winpdb(self):
"""Run winpdb to debug current file"""
if self.save():
fname = self.get_current_filename()
runconf = get_run_configuration(fname)
if runconf is None:
args = []
wdir = None
else:
... | [
"Run",
"winpdb",
"to",
"debug",
"current",
"file"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2051-L2066 | [
"def",
"run_winpdb",
"(",
"self",
")",
":",
"if",
"self",
".",
"save",
"(",
")",
":",
"fname",
"=",
"self",
".",
"get_current_filename",
"(",
")",
"runconf",
"=",
"get_run_configuration",
"(",
"fname",
")",
"if",
"runconf",
"is",
"None",
":",
"args",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.cursor_moved | Cursor was just moved: 'go to | spyder/plugins/editor/plugin.py | def cursor_moved(self, filename0, position0, filename1, position1):
"""Cursor was just moved: 'go to'"""
if position0 is not None:
self.add_cursor_position_to_history(filename0, position0)
self.add_cursor_position_to_history(filename1, position1) | def cursor_moved(self, filename0, position0, filename1, position1):
"""Cursor was just moved: 'go to'"""
if position0 is not None:
self.add_cursor_position_to_history(filename0, position0)
self.add_cursor_position_to_history(filename1, position1) | [
"Cursor",
"was",
"just",
"moved",
":",
"go",
"to"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2119-L2123 | [
"def",
"cursor_moved",
"(",
"self",
",",
"filename0",
",",
"position0",
",",
"filename1",
",",
"position1",
")",
":",
"if",
"position0",
"is",
"not",
"None",
":",
"self",
".",
"add_cursor_position_to_history",
"(",
"filename0",
",",
"position0",
")",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.go_to_line | Open 'go to line' dialog | spyder/plugins/editor/plugin.py | def go_to_line(self, line=None):
"""Open 'go to line' dialog"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
editorstack.go_to_line(line) | def go_to_line(self, line=None):
"""Open 'go to line' dialog"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
editorstack.go_to_line(line) | [
"Open",
"go",
"to",
"line",
"dialog"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2182-L2186 | [
"def",
"go_to_line",
"(",
"self",
",",
"line",
"=",
"None",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"if",
"editorstack",
"is",
"not",
"None",
":",
"editorstack",
".",
"go_to_line",
"(",
"line",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.set_or_clear_breakpoint | Set/Clear breakpoint | spyder/plugins/editor/plugin.py | def set_or_clear_breakpoint(self):
"""Set/Clear breakpoint"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
self.switch_to_plugin()
editorstack.set_or_clear_breakpoint() | def set_or_clear_breakpoint(self):
"""Set/Clear breakpoint"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
self.switch_to_plugin()
editorstack.set_or_clear_breakpoint() | [
"Set",
"/",
"Clear",
"breakpoint"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2189-L2194 | [
"def",
"set_or_clear_breakpoint",
"(",
"self",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"if",
"editorstack",
"is",
"not",
"None",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"editorstack",
".",
"set_or_clear_breakpoint",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.set_or_edit_conditional_breakpoint | Set/Edit conditional breakpoint | spyder/plugins/editor/plugin.py | def set_or_edit_conditional_breakpoint(self):
"""Set/Edit conditional breakpoint"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
self.switch_to_plugin()
editorstack.set_or_edit_conditional_breakpoint() | def set_or_edit_conditional_breakpoint(self):
"""Set/Edit conditional breakpoint"""
editorstack = self.get_current_editorstack()
if editorstack is not None:
self.switch_to_plugin()
editorstack.set_or_edit_conditional_breakpoint() | [
"Set",
"/",
"Edit",
"conditional",
"breakpoint"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2197-L2202 | [
"def",
"set_or_edit_conditional_breakpoint",
"(",
"self",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"if",
"editorstack",
"is",
"not",
"None",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"editorstack",
".",
"set_or_edit_con... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.clear_all_breakpoints | Clear breakpoints in all files | spyder/plugins/editor/plugin.py | def clear_all_breakpoints(self):
"""Clear breakpoints in all files"""
self.switch_to_plugin()
clear_all_breakpoints()
self.breakpoints_saved.emit()
editorstack = self.get_current_editorstack()
if editorstack is not None:
for data in editorstack.data:
... | def clear_all_breakpoints(self):
"""Clear breakpoints in all files"""
self.switch_to_plugin()
clear_all_breakpoints()
self.breakpoints_saved.emit()
editorstack = self.get_current_editorstack()
if editorstack is not None:
for data in editorstack.data:
... | [
"Clear",
"breakpoints",
"in",
"all",
"files"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2205-L2214 | [
"def",
"clear_all_breakpoints",
"(",
"self",
")",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"clear_all_breakpoints",
"(",
")",
"self",
".",
"breakpoints_saved",
".",
"emit",
"(",
")",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.clear_breakpoint | Remove a single breakpoint | spyder/plugins/editor/plugin.py | def clear_breakpoint(self, filename, lineno):
"""Remove a single breakpoint"""
clear_breakpoint(filename, lineno)
self.breakpoints_saved.emit()
editorstack = self.get_current_editorstack()
if editorstack is not None:
index = self.is_file_opened(filename)
... | def clear_breakpoint(self, filename, lineno):
"""Remove a single breakpoint"""
clear_breakpoint(filename, lineno)
self.breakpoints_saved.emit()
editorstack = self.get_current_editorstack()
if editorstack is not None:
index = self.is_file_opened(filename)
... | [
"Remove",
"a",
"single",
"breakpoint"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2216-L2225 | [
"def",
"clear_breakpoint",
"(",
"self",
",",
"filename",
",",
"lineno",
")",
":",
"clear_breakpoint",
"(",
"filename",
",",
"lineno",
")",
"self",
".",
"breakpoints_saved",
".",
"emit",
"(",
")",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.debug_command | Debug actions | spyder/plugins/editor/plugin.py | def debug_command(self, command):
"""Debug actions"""
self.switch_to_plugin()
self.main.ipyconsole.write_to_stdin(command)
focus_widget = self.main.ipyconsole.get_focus_widget()
if focus_widget:
focus_widget.setFocus() | def debug_command(self, command):
"""Debug actions"""
self.switch_to_plugin()
self.main.ipyconsole.write_to_stdin(command)
focus_widget = self.main.ipyconsole.get_focus_widget()
if focus_widget:
focus_widget.setFocus() | [
"Debug",
"actions"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2227-L2233 | [
"def",
"debug_command",
"(",
"self",
",",
"command",
")",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"self",
".",
"main",
".",
"ipyconsole",
".",
"write_to_stdin",
"(",
"command",
")",
"focus_widget",
"=",
"self",
".",
"main",
".",
"ipyconsole",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.run_file | Run script inside current interpreter or in a new one | spyder/plugins/editor/plugin.py | def run_file(self, debug=False):
"""Run script inside current interpreter or in a new one"""
editorstack = self.get_current_editorstack()
if editorstack.save():
editor = self.get_current_editor()
fname = osp.abspath(self.get_current_filename())
# Get f... | def run_file(self, debug=False):
"""Run script inside current interpreter or in a new one"""
editorstack = self.get_current_editorstack()
if editorstack.save():
editor = self.get_current_editor()
fname = osp.abspath(self.get_current_filename())
# Get f... | [
"Run",
"script",
"inside",
"current",
"interpreter",
"or",
"in",
"a",
"new",
"one"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2251-L2317 | [
"def",
"run_file",
"(",
"self",
",",
"debug",
"=",
"False",
")",
":",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"if",
"editorstack",
".",
"save",
"(",
")",
":",
"editor",
"=",
"self",
".",
"get_current_editor",
"(",
")",
"fnam... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.debug_file | Debug current script | spyder/plugins/editor/plugin.py | def debug_file(self):
"""Debug current script"""
self.switch_to_plugin()
current_editor = self.get_current_editor()
if current_editor is not None:
current_editor.sig_debug_start.emit()
self.run_file(debug=True) | def debug_file(self):
"""Debug current script"""
self.switch_to_plugin()
current_editor = self.get_current_editor()
if current_editor is not None:
current_editor.sig_debug_start.emit()
self.run_file(debug=True) | [
"Debug",
"current",
"script"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2323-L2329 | [
"def",
"debug_file",
"(",
"self",
")",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"current_editor",
"=",
"self",
".",
"get_current_editor",
"(",
")",
"if",
"current_editor",
"is",
"not",
"None",
":",
"current_editor",
".",
"sig_debug_start",
".",
"emit",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.re_run_file | Re-run last script | spyder/plugins/editor/plugin.py | def re_run_file(self):
"""Re-run last script"""
if self.get_option('save_all_before_run'):
self.save_all()
if self.__last_ec_exec is None:
return
(fname, wdir, args, interact, debug,
python, python_args, current, systerm,
post_mortem, cle... | def re_run_file(self):
"""Re-run last script"""
if self.get_option('save_all_before_run'):
self.save_all()
if self.__last_ec_exec is None:
return
(fname, wdir, args, interact, debug,
python, python_args, current, systerm,
post_mortem, cle... | [
"Re",
"-",
"run",
"last",
"script"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2332-L2348 | [
"def",
"re_run_file",
"(",
"self",
")",
":",
"if",
"self",
".",
"get_option",
"(",
"'save_all_before_run'",
")",
":",
"self",
".",
"save_all",
"(",
")",
"if",
"self",
".",
"__last_ec_exec",
"is",
"None",
":",
"return",
"(",
"fname",
",",
"wdir",
",",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.save_bookmark | Save current line and position as bookmark. | spyder/plugins/editor/plugin.py | def save_bookmark(self, slot_num):
"""Save current line and position as bookmark."""
bookmarks = CONF.get('editor', 'bookmarks')
editorstack = self.get_current_editorstack()
if slot_num in bookmarks:
filename, line_num, column = bookmarks[slot_num]
if osp.is... | def save_bookmark(self, slot_num):
"""Save current line and position as bookmark."""
bookmarks = CONF.get('editor', 'bookmarks')
editorstack = self.get_current_editorstack()
if slot_num in bookmarks:
filename, line_num, column = bookmarks[slot_num]
if osp.is... | [
"Save",
"current",
"line",
"and",
"position",
"as",
"bookmark",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2376-L2390 | [
"def",
"save_bookmark",
"(",
"self",
",",
"slot_num",
")",
":",
"bookmarks",
"=",
"CONF",
".",
"get",
"(",
"'editor'",
",",
"'bookmarks'",
")",
"editorstack",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
"if",
"slot_num",
"in",
"bookmarks",
":",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.load_bookmark | Set cursor to bookmarked file and position. | spyder/plugins/editor/plugin.py | def load_bookmark(self, slot_num):
"""Set cursor to bookmarked file and position."""
bookmarks = CONF.get('editor', 'bookmarks')
if slot_num in bookmarks:
filename, line_num, column = bookmarks[slot_num]
else:
return
if not osp.isfile(filename):
... | def load_bookmark(self, slot_num):
"""Set cursor to bookmarked file and position."""
bookmarks = CONF.get('editor', 'bookmarks')
if slot_num in bookmarks:
filename, line_num, column = bookmarks[slot_num]
else:
return
if not osp.isfile(filename):
... | [
"Set",
"cursor",
"to",
"bookmarked",
"file",
"and",
"position",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2393-L2412 | [
"def",
"load_bookmark",
"(",
"self",
",",
"slot_num",
")",
":",
"bookmarks",
"=",
"CONF",
".",
"get",
"(",
"'editor'",
",",
"'bookmarks'",
")",
"if",
"slot_num",
"in",
"bookmarks",
":",
"filename",
",",
"line_num",
",",
"column",
"=",
"bookmarks",
"[",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.zoom | Zoom in/out/reset | spyder/plugins/editor/plugin.py | def zoom(self, factor):
"""Zoom in/out/reset"""
editor = self.get_current_editorstack().get_current_editor()
if factor == 0:
font = self.get_plugin_font()
editor.set_font(font)
else:
font = editor.font()
size = font.pointSize() + fa... | def zoom(self, factor):
"""Zoom in/out/reset"""
editor = self.get_current_editorstack().get_current_editor()
if factor == 0:
font = self.get_plugin_font()
editor.set_font(font)
else:
font = editor.font()
size = font.pointSize() + fa... | [
"Zoom",
"in",
"/",
"out",
"/",
"reset"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2415-L2427 | [
"def",
"zoom",
"(",
"self",
",",
"factor",
")",
":",
"editor",
"=",
"self",
".",
"get_current_editorstack",
"(",
")",
".",
"get_current_editor",
"(",
")",
"if",
"factor",
"==",
"0",
":",
"font",
"=",
"self",
".",
"get_plugin_font",
"(",
")",
"editor",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.apply_plugin_settings | Apply configuration file's plugin settings | spyder/plugins/editor/plugin.py | def apply_plugin_settings(self, options):
"""Apply configuration file's plugin settings"""
if self.editorstacks is not None:
# --- syntax highlight and text rendering settings
color_scheme_n = 'color_scheme_name'
color_scheme_o = self.get_color_scheme()
... | def apply_plugin_settings(self, options):
"""Apply configuration file's plugin settings"""
if self.editorstacks is not None:
# --- syntax highlight and text rendering settings
color_scheme_n = 'color_scheme_name'
color_scheme_o = self.get_color_scheme()
... | [
"Apply",
"configuration",
"file",
"s",
"plugin",
"settings"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2430-L2574 | [
"def",
"apply_plugin_settings",
"(",
"self",
",",
"options",
")",
":",
"if",
"self",
".",
"editorstacks",
"is",
"not",
"None",
":",
"# --- syntax highlight and text rendering settings\r",
"color_scheme_n",
"=",
"'color_scheme_name'",
"color_scheme_o",
"=",
"self",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.get_open_filenames | Get the list of open files in the current stack | spyder/plugins/editor/plugin.py | def get_open_filenames(self):
"""Get the list of open files in the current stack"""
editorstack = self.editorstacks[0]
filenames = []
filenames += [finfo.filename for finfo in editorstack.data]
return filenames | def get_open_filenames(self):
"""Get the list of open files in the current stack"""
editorstack = self.editorstacks[0]
filenames = []
filenames += [finfo.filename for finfo in editorstack.data]
return filenames | [
"Get",
"the",
"list",
"of",
"open",
"files",
"in",
"the",
"current",
"stack"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2577-L2582 | [
"def",
"get_open_filenames",
"(",
"self",
")",
":",
"editorstack",
"=",
"self",
".",
"editorstacks",
"[",
"0",
"]",
"filenames",
"=",
"[",
"]",
"filenames",
"+=",
"[",
"finfo",
".",
"filename",
"for",
"finfo",
"in",
"editorstack",
".",
"data",
"]",
"retu... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.set_open_filenames | Set the recent opened files on editor based on active project.
If no project is active, then editor filenames are saved, otherwise
the opened filenames are stored in the project config info. | spyder/plugins/editor/plugin.py | def set_open_filenames(self):
"""
Set the recent opened files on editor based on active project.
If no project is active, then editor filenames are saved, otherwise
the opened filenames are stored in the project config info.
"""
if self.projects is not None:
... | def set_open_filenames(self):
"""
Set the recent opened files on editor based on active project.
If no project is active, then editor filenames are saved, otherwise
the opened filenames are stored in the project config info.
"""
if self.projects is not None:
... | [
"Set",
"the",
"recent",
"opened",
"files",
"on",
"editor",
"based",
"on",
"active",
"project",
".",
"If",
"no",
"project",
"is",
"active",
"then",
"editor",
"filenames",
"are",
"saved",
"otherwise",
"the",
"opened",
"filenames",
"are",
"stored",
"in",
"the",... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2584-L2594 | [
"def",
"set_open_filenames",
"(",
"self",
")",
":",
"if",
"self",
".",
"projects",
"is",
"not",
"None",
":",
"if",
"not",
"self",
".",
"projects",
".",
"get_active_project",
"(",
")",
":",
"filenames",
"=",
"self",
".",
"get_open_filenames",
"(",
")",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Editor.setup_open_files | Open the list of saved files per project.
Also open any files that the user selected in the recovery dialog. | spyder/plugins/editor/plugin.py | def setup_open_files(self):
"""
Open the list of saved files per project.
Also open any files that the user selected in the recovery dialog.
"""
self.set_create_new_file_if_empty(False)
active_project_path = None
if self.projects is not None:
... | def setup_open_files(self):
"""
Open the list of saved files per project.
Also open any files that the user selected in the recovery dialog.
"""
self.set_create_new_file_if_empty(False)
active_project_path = None
if self.projects is not None:
... | [
"Open",
"the",
"list",
"of",
"saved",
"files",
"per",
"project",
".",
"Also",
"open",
"any",
"files",
"that",
"the",
"user",
"selected",
"in",
"the",
"recovery",
"dialog",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L2596-L2666 | [
"def",
"setup_open_files",
"(",
"self",
")",
":",
"self",
".",
"set_create_new_file_if_empty",
"(",
"False",
")",
"active_project_path",
"=",
"None",
"if",
"self",
".",
"projects",
"is",
"not",
"None",
":",
"active_project_path",
"=",
"self",
".",
"projects",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | guess_filename | Guess filename | spyder/plugins/console/utils/interpreter.py | def guess_filename(filename):
"""Guess filename"""
if osp.isfile(filename):
return filename
if not filename.endswith('.py'):
filename += '.py'
for path in [getcwd_or_home()] + sys.path:
fname = osp.join(path, filename)
if osp.isfile(fname):
return fna... | def guess_filename(filename):
"""Guess filename"""
if osp.isfile(filename):
return filename
if not filename.endswith('.py'):
filename += '.py'
for path in [getcwd_or_home()] + sys.path:
fname = osp.join(path, filename)
if osp.isfile(fname):
return fna... | [
"Guess",
"filename"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L32-L46 | [
"def",
"guess_filename",
"(",
"filename",
")",
":",
"if",
"osp",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"filename",
"if",
"not",
"filename",
".",
"endswith",
"(",
"'.py'",
")",
":",
"filename",
"+=",
"'.py'",
"for",
"path",
"in",
"[",
"get... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.redirect_stds | Redirects stds | spyder/plugins/console/utils/interpreter.py | def redirect_stds(self):
"""Redirects stds"""
if not self.debug:
sys.stdout = self.stdout_write
sys.stderr = self.stderr_write
sys.stdin = self.stdin_read | def redirect_stds(self):
"""Redirects stds"""
if not self.debug:
sys.stdout = self.stdout_write
sys.stderr = self.stderr_write
sys.stdin = self.stdin_read | [
"Redirects",
"stds"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L98-L103 | [
"def",
"redirect_stds",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"debug",
":",
"sys",
".",
"stdout",
"=",
"self",
".",
"stdout_write",
"sys",
".",
"stderr",
"=",
"self",
".",
"stderr_write",
"sys",
".",
"stdin",
"=",
"self",
".",
"stdin_read"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.restore_stds | Restore stds | spyder/plugins/console/utils/interpreter.py | def restore_stds(self):
"""Restore stds"""
if not self.debug:
sys.stdout = self.initial_stdout
sys.stderr = self.initial_stderr
sys.stdin = self.initial_stdin | def restore_stds(self):
"""Restore stds"""
if not self.debug:
sys.stdout = self.initial_stdout
sys.stderr = self.initial_stderr
sys.stdin = self.initial_stdin | [
"Restore",
"stds"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L105-L110 | [
"def",
"restore_stds",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"debug",
":",
"sys",
".",
"stdout",
"=",
"self",
".",
"initial_stdout",
"sys",
".",
"stderr",
"=",
"self",
".",
"initial_stderr",
"sys",
".",
"stdin",
"=",
"self",
".",
"initial_st... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.raw_input_replacement | For raw_input builtin function emulation | spyder/plugins/console/utils/interpreter.py | def raw_input_replacement(self, prompt=''):
"""For raw_input builtin function emulation"""
self.widget_proxy.wait_input(prompt)
self.input_condition.acquire()
while not self.widget_proxy.data_available():
self.input_condition.wait()
inp = self.widget_proxy.input... | def raw_input_replacement(self, prompt=''):
"""For raw_input builtin function emulation"""
self.widget_proxy.wait_input(prompt)
self.input_condition.acquire()
while not self.widget_proxy.data_available():
self.input_condition.wait()
inp = self.widget_proxy.input... | [
"For",
"raw_input",
"builtin",
"function",
"emulation"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L112-L120 | [
"def",
"raw_input_replacement",
"(",
"self",
",",
"prompt",
"=",
"''",
")",
":",
"self",
".",
"widget_proxy",
".",
"wait_input",
"(",
"prompt",
")",
"self",
".",
"input_condition",
".",
"acquire",
"(",
")",
"while",
"not",
"self",
".",
"widget_proxy",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.help_replacement | For help builtin function emulation | spyder/plugins/console/utils/interpreter.py | def help_replacement(self, text=None, interactive=False):
"""For help builtin function emulation"""
if text is not None and not interactive:
return pydoc.help(text)
elif text is None:
pyver = "%d.%d" % (sys.version_info[0], sys.version_info[1])
self.writ... | def help_replacement(self, text=None, interactive=False):
"""For help builtin function emulation"""
if text is not None and not interactive:
return pydoc.help(text)
elif text is None:
pyver = "%d.%d" % (sys.version_info[0], sys.version_info[1])
self.writ... | [
"For",
"help",
"builtin",
"function",
"emulation"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L122-L160 | [
"def",
"help_replacement",
"(",
"self",
",",
"text",
"=",
"None",
",",
"interactive",
"=",
"False",
")",
":",
"if",
"text",
"is",
"not",
"None",
"and",
"not",
"interactive",
":",
"return",
"pydoc",
".",
"help",
"(",
"text",
")",
"elif",
"text",
"is",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.run_command | Run command in interpreter | spyder/plugins/console/utils/interpreter.py | def run_command(self, cmd, new_prompt=True):
"""Run command in interpreter"""
if cmd == 'exit()':
self.exit_flag = True
self.write('\n')
return
# -- Special commands type I
# (transformed into commands executed in the interpreter)
# ... | def run_command(self, cmd, new_prompt=True):
"""Run command in interpreter"""
if cmd == 'exit()':
self.exit_flag = True
self.write('\n')
return
# -- Special commands type I
# (transformed into commands executed in the interpreter)
# ... | [
"Run",
"command",
"in",
"interpreter"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L162-L233 | [
"def",
"run_command",
"(",
"self",
",",
"cmd",
",",
"new_prompt",
"=",
"True",
")",
":",
"if",
"cmd",
"==",
"'exit()'",
":",
"self",
".",
"exit_flag",
"=",
"True",
"self",
".",
"write",
"(",
"'\\n'",
")",
"return",
"# -- Special commands type I\r",
"# (... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.get_thread_id | Return thread id | spyder/plugins/console/utils/interpreter.py | def get_thread_id(self):
"""Return thread id"""
if self._id is None:
for thread_id, obj in list(threading._active.items()):
if obj is self:
self._id = thread_id
return self._id | def get_thread_id(self):
"""Return thread id"""
if self._id is None:
for thread_id, obj in list(threading._active.items()):
if obj is self:
self._id = thread_id
return self._id | [
"Return",
"thread",
"id"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L247-L253 | [
"def",
"get_thread_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_id",
"is",
"None",
":",
"for",
"thread_id",
",",
"obj",
"in",
"list",
"(",
"threading",
".",
"_active",
".",
"items",
"(",
")",
")",
":",
"if",
"obj",
"is",
"self",
":",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.execfile | Exec filename | spyder/plugins/console/utils/interpreter.py | def execfile(self, filename):
"""Exec filename"""
source = open(filename, 'r').read()
try:
try:
name = filename.encode('ascii')
except UnicodeEncodeError:
name = '<executed_script>'
code = compile(source, name, "exec")
... | def execfile(self, filename):
"""Exec filename"""
source = open(filename, 'r').read()
try:
try:
name = filename.encode('ascii')
except UnicodeEncodeError:
name = '<executed_script>'
code = compile(source, name, "exec")
... | [
"Exec",
"filename"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L268-L280 | [
"def",
"execfile",
"(",
"self",
",",
"filename",
")",
":",
"source",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
".",
"read",
"(",
")",
"try",
":",
"try",
":",
"name",
"=",
"filename",
".",
"encode",
"(",
"'ascii'",
")",
"except",
"UnicodeEncodeEr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.runfile | Run filename
args: command line arguments (string) | spyder/plugins/console/utils/interpreter.py | def runfile(self, filename, args=None):
"""
Run filename
args: command line arguments (string)
"""
if args is not None and not is_text_string(args):
raise TypeError("expected a character buffer object")
self.namespace['__file__'] = filename
sys... | def runfile(self, filename, args=None):
"""
Run filename
args: command line arguments (string)
"""
if args is not None and not is_text_string(args):
raise TypeError("expected a character buffer object")
self.namespace['__file__'] = filename
sys... | [
"Run",
"filename",
"args",
":",
"command",
"line",
"arguments",
"(",
"string",
")"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L282-L296 | [
"def",
"runfile",
"(",
"self",
",",
"filename",
",",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"not",
"None",
"and",
"not",
"is_text_string",
"(",
"args",
")",
":",
"raise",
"TypeError",
"(",
"\"expected a character buffer object\"",
")",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.eval | Evaluate text and return (obj, valid)
where *obj* is the object represented by *text*
and *valid* is True if object evaluation did not raise any exception | spyder/plugins/console/utils/interpreter.py | def eval(self, text):
"""
Evaluate text and return (obj, valid)
where *obj* is the object represented by *text*
and *valid* is True if object evaluation did not raise any exception
"""
assert is_text_string(text)
try:
return eval(text, self.loc... | def eval(self, text):
"""
Evaluate text and return (obj, valid)
where *obj* is the object represented by *text*
and *valid* is True if object evaluation did not raise any exception
"""
assert is_text_string(text)
try:
return eval(text, self.loc... | [
"Evaluate",
"text",
"and",
"return",
"(",
"obj",
"valid",
")",
"where",
"*",
"obj",
"*",
"is",
"the",
"object",
"represented",
"by",
"*",
"text",
"*",
"and",
"*",
"valid",
"*",
"is",
"True",
"if",
"object",
"evaluation",
"did",
"not",
"raise",
"any",
... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L298-L308 | [
"def",
"eval",
"(",
"self",
",",
"text",
")",
":",
"assert",
"is_text_string",
"(",
"text",
")",
"try",
":",
"return",
"eval",
"(",
"text",
",",
"self",
".",
"locals",
")",
",",
"True",
"except",
":",
"return",
"None",
",",
"False"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Interpreter.is_defined | Return True if object is defined | spyder/plugins/console/utils/interpreter.py | def is_defined(self, objtxt, force_import=False):
"""Return True if object is defined"""
return isdefined(objtxt, force_import=force_import,
namespace=self.locals) | def is_defined(self, objtxt, force_import=False):
"""Return True if object is defined"""
return isdefined(objtxt, force_import=force_import,
namespace=self.locals) | [
"Return",
"True",
"if",
"object",
"is",
"defined"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/utils/interpreter.py#L310-L313 | [
"def",
"is_defined",
"(",
"self",
",",
"objtxt",
",",
"force_import",
"=",
"False",
")",
":",
"return",
"isdefined",
"(",
"objtxt",
",",
"force_import",
"=",
"force_import",
",",
"namespace",
"=",
"self",
".",
"locals",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | TextEditor.text_changed | Text has changed | spyder/plugins/variableexplorer/widgets/texteditor.py | def text_changed(self):
"""Text has changed"""
# Save text as bytes, if it was initially bytes
if self.is_binary:
self.text = to_binary_string(self.edit.toPlainText(), 'utf8')
else:
self.text = to_text_string(self.edit.toPlainText())
if self.btn_sav... | def text_changed(self):
"""Text has changed"""
# Save text as bytes, if it was initially bytes
if self.is_binary:
self.text = to_binary_string(self.edit.toPlainText(), 'utf8')
else:
self.text = to_text_string(self.edit.toPlainText())
if self.btn_sav... | [
"Text",
"has",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/texteditor.py#L98-L108 | [
"def",
"text_changed",
"(",
"self",
")",
":",
"# Save text as bytes, if it was initially bytes\r",
"if",
"self",
".",
"is_binary",
":",
"self",
".",
"text",
"=",
"to_binary_string",
"(",
"self",
".",
"edit",
".",
"toPlainText",
"(",
")",
",",
"'utf8'",
")",
"e... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | logger_init | Initialize the logger for this thread.
Sets the log level to ERROR (0), WARNING (1), INFO (2), or DEBUG (3),
depending on the argument `level`. | spyder/plugins/editor/lsp/transport/main.py | def logger_init(level):
"""
Initialize the logger for this thread.
Sets the log level to ERROR (0), WARNING (1), INFO (2), or DEBUG (3),
depending on the argument `level`.
"""
levellist = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
handler = logging.StreamHandler()
fmt... | def logger_init(level):
"""
Initialize the logger for this thread.
Sets the log level to ERROR (0), WARNING (1), INFO (2), or DEBUG (3),
depending on the argument `level`.
"""
levellist = [logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]
handler = logging.StreamHandler()
fmt... | [
"Initialize",
"the",
"logger",
"for",
"this",
"thread",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/transport/main.py#L62-L76 | [
"def",
"logger_init",
"(",
"level",
")",
":",
"levellist",
"=",
"[",
"logging",
".",
"ERROR",
",",
"logging",
".",
"WARNING",
",",
"logging",
".",
"INFO",
",",
"logging",
".",
"DEBUG",
"]",
"handler",
"=",
"logging",
".",
"StreamHandler",
"(",
")",
"fm... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SignalManager.restore | Restore signal handlers to their original settings. | spyder/plugins/editor/lsp/transport/main.py | def restore(self):
"""Restore signal handlers to their original settings."""
signal.signal(signal.SIGINT, self.original_sigint)
signal.signal(signal.SIGTERM, self.original_sigterm)
if os.name == 'nt':
signal.signal(signal.SIGBREAK, self.original_sigbreak) | def restore(self):
"""Restore signal handlers to their original settings."""
signal.signal(signal.SIGINT, self.original_sigint)
signal.signal(signal.SIGTERM, self.original_sigterm)
if os.name == 'nt':
signal.signal(signal.SIGBREAK, self.original_sigbreak) | [
"Restore",
"signal",
"handlers",
"to",
"their",
"original",
"settings",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/transport/main.py#L102-L107 | [
"def",
"restore",
"(",
"self",
")",
":",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"self",
".",
"original_sigint",
")",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGTERM",
",",
"self",
".",
"original_sigterm",
")",
"if",
"os",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | show_warning | Show warning using Tkinter if available | spyder/requirements.py | def show_warning(message):
"""Show warning using Tkinter if available"""
try:
# If Tkinter is installed (highly probable), showing an error pop-up
import Tkinter, tkMessageBox
root = Tkinter.Tk()
root.withdraw()
tkMessageBox.showerror("Spyder", message)
except... | def show_warning(message):
"""Show warning using Tkinter if available"""
try:
# If Tkinter is installed (highly probable), showing an error pop-up
import Tkinter, tkMessageBox
root = Tkinter.Tk()
root.withdraw()
tkMessageBox.showerror("Spyder", message)
except... | [
"Show",
"warning",
"using",
"Tkinter",
"if",
"available"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/requirements.py#L14-L24 | [
"def",
"show_warning",
"(",
"message",
")",
":",
"try",
":",
"# If Tkinter is installed (highly probable), showing an error pop-up\r",
"import",
"Tkinter",
",",
"tkMessageBox",
"root",
"=",
"Tkinter",
".",
"Tk",
"(",
")",
"root",
".",
"withdraw",
"(",
")",
"tkMessag... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | check_path | Check sys.path: is Spyder properly installed? | spyder/requirements.py | def check_path():
"""Check sys.path: is Spyder properly installed?"""
dirname = osp.abspath(osp.join(osp.dirname(__file__), osp.pardir))
if dirname not in sys.path:
show_warning("Spyder must be installed properly "
"(e.g. from source: 'python setup.py install'),\n"
... | def check_path():
"""Check sys.path: is Spyder properly installed?"""
dirname = osp.abspath(osp.join(osp.dirname(__file__), osp.pardir))
if dirname not in sys.path:
show_warning("Spyder must be installed properly "
"(e.g. from source: 'python setup.py install'),\n"
... | [
"Check",
"sys",
".",
"path",
":",
"is",
"Spyder",
"properly",
"installed?"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/requirements.py#L27-L34 | [
"def",
"check_path",
"(",
")",
":",
"dirname",
"=",
"osp",
".",
"abspath",
"(",
"osp",
".",
"join",
"(",
"osp",
".",
"dirname",
"(",
"__file__",
")",
",",
"osp",
".",
"pardir",
")",
")",
"if",
"dirname",
"not",
"in",
"sys",
".",
"path",
":",
"sho... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | check_qt | Check Qt binding requirements | spyder/requirements.py | def check_qt():
"""Check Qt binding requirements"""
qt_infos = dict(pyqt5=("PyQt5", "5.6"))
try:
import qtpy
package_name, required_ver = qt_infos[qtpy.API]
actual_ver = qtpy.PYQT_VERSION
if LooseVersion(actual_ver) < LooseVersion(required_ver):
show_warni... | def check_qt():
"""Check Qt binding requirements"""
qt_infos = dict(pyqt5=("PyQt5", "5.6"))
try:
import qtpy
package_name, required_ver = qt_infos[qtpy.API]
actual_ver = qtpy.PYQT_VERSION
if LooseVersion(actual_ver) < LooseVersion(required_ver):
show_warni... | [
"Check",
"Qt",
"binding",
"requirements"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/requirements.py#L37-L54 | [
"def",
"check_qt",
"(",
")",
":",
"qt_infos",
"=",
"dict",
"(",
"pyqt5",
"=",
"(",
"\"PyQt5\"",
",",
"\"5.6\"",
")",
")",
"try",
":",
"import",
"qtpy",
"package_name",
",",
"required_ver",
"=",
"qt_infos",
"[",
"qtpy",
".",
"API",
"]",
"actual_ver",
"=... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | check_spyder_kernels | Check spyder-kernel requirement. | spyder/requirements.py | def check_spyder_kernels():
"""Check spyder-kernel requirement."""
try:
import spyder_kernels
required_ver = '1.0.0'
actual_ver = spyder_kernels.__version__
if LooseVersion(actual_ver) < LooseVersion(required_ver):
show_warning("Please check Spyder installation... | def check_spyder_kernels():
"""Check spyder-kernel requirement."""
try:
import spyder_kernels
required_ver = '1.0.0'
actual_ver = spyder_kernels.__version__
if LooseVersion(actual_ver) < LooseVersion(required_ver):
show_warning("Please check Spyder installation... | [
"Check",
"spyder",
"-",
"kernel",
"requirement",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/requirements.py#L57-L70 | [
"def",
"check_spyder_kernels",
"(",
")",
":",
"try",
":",
"import",
"spyder_kernels",
"required_ver",
"=",
"'1.0.0'",
"actual_ver",
"=",
"spyder_kernels",
".",
"__version__",
"if",
"LooseVersion",
"(",
"actual_ver",
")",
"<",
"LooseVersion",
"(",
"required_ver",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Breakpoints.register_plugin | Register plugin in Spyder's main window | spyder/plugins/breakpoints/plugin.py | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.breakpoints.edit_goto.connect(self.main.editor.load)
#self.redirect_stdio.connect(self.main.redirect_internalshell_stdio)
self.breakpoints.clear_all_breakpoints.connect(
... | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.breakpoints.edit_goto.connect(self.main.editor.load)
#self.redirect_stdio.connect(self.main.redirect_internalshell_stdio)
self.breakpoints.clear_all_breakpoints.connect(
... | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/breakpoints/plugin.py#L77-L96 | [
"def",
"register_plugin",
"(",
"self",
")",
":",
"self",
".",
"breakpoints",
".",
"edit_goto",
".",
"connect",
"(",
"self",
".",
"main",
".",
"editor",
".",
"load",
")",
"#self.redirect_stdio.connect(self.main.redirect_internalshell_stdio)\r",
"self",
".",
"breakpoi... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | isLocked | Determine if the lock of the given name is held or not.
@type name: C{str}
@param name: The filesystem path to the lock to test
@rtype: C{bool}
@return: True if the lock is held, False otherwise. | spyder/utils/external/lockfile.py | def isLocked(name):
"""Determine if the lock of the given name is held or not.
@type name: C{str}
@param name: The filesystem path to the lock to test
@rtype: C{bool}
@return: True if the lock is held, False otherwise.
"""
l = FilesystemLock(name)
result = None
try:
... | def isLocked(name):
"""Determine if the lock of the given name is held or not.
@type name: C{str}
@param name: The filesystem path to the lock to test
@rtype: C{bool}
@return: True if the lock is held, False otherwise.
"""
l = FilesystemLock(name)
result = None
try:
... | [
"Determine",
"if",
"the",
"lock",
"of",
"the",
"given",
"name",
"is",
"held",
"or",
"not",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/lockfile.py#L248-L264 | [
"def",
"isLocked",
"(",
"name",
")",
":",
"l",
"=",
"FilesystemLock",
"(",
"name",
")",
"result",
"=",
"None",
"try",
":",
"result",
"=",
"l",
".",
"lock",
"(",
")",
"finally",
":",
"if",
"result",
":",
"l",
".",
"unlock",
"(",
")",
"return",
"no... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilesystemLock.lock | Acquire this lock.
@rtype: C{bool}
@return: True if the lock is acquired, false otherwise.
@raise: Any exception os.symlink() may raise, other than
EEXIST. | spyder/utils/external/lockfile.py | def lock(self):
"""
Acquire this lock.
@rtype: C{bool}
@return: True if the lock is acquired, false otherwise.
@raise: Any exception os.symlink() may raise, other than
EEXIST.
"""
clean = True
while True:
try:
... | def lock(self):
"""
Acquire this lock.
@rtype: C{bool}
@return: True if the lock is acquired, false otherwise.
@raise: Any exception os.symlink() may raise, other than
EEXIST.
"""
clean = True
while True:
try:
... | [
"Acquire",
"this",
"lock",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/lockfile.py#L152-L230 | [
"def",
"lock",
"(",
"self",
")",
":",
"clean",
"=",
"True",
"while",
"True",
":",
"try",
":",
"symlink",
"(",
"str",
"(",
"os",
".",
"getpid",
"(",
")",
")",
",",
"self",
".",
"name",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"_windows",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FilesystemLock.unlock | Release this lock.
This deletes the directory with the given name.
@raise: Any exception os.readlink() may raise, or
ValueError if the lock is not owned by this process. | spyder/utils/external/lockfile.py | def unlock(self):
"""
Release this lock.
This deletes the directory with the given name.
@raise: Any exception os.readlink() may raise, or
ValueError if the lock is not owned by this process.
"""
pid = readlink(self.name)
if int(pid) != os.getp... | def unlock(self):
"""
Release this lock.
This deletes the directory with the given name.
@raise: Any exception os.readlink() may raise, or
ValueError if the lock is not owned by this process.
"""
pid = readlink(self.name)
if int(pid) != os.getp... | [
"Release",
"this",
"lock",
".",
"This",
"deletes",
"the",
"directory",
"with",
"the",
"given",
"name",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/lockfile.py#L232-L245 | [
"def",
"unlock",
"(",
"self",
")",
":",
"pid",
"=",
"readlink",
"(",
"self",
".",
"name",
")",
"if",
"int",
"(",
"pid",
")",
"!=",
"os",
".",
"getpid",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Lock %r not owned by this process\"",
"%",
"(",
"self"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SphinxThread.render | Start thread to render a given documentation | spyder/plugins/help/utils/sphinxthread.py | def render(self, doc, context=None, math_option=False, img_path='',
css_path=CSS_PATH):
"""Start thread to render a given documentation"""
# If the thread is already running wait for it to finish before
# starting it again.
if self.wait():
self.doc = doc
... | def render(self, doc, context=None, math_option=False, img_path='',
css_path=CSS_PATH):
"""Start thread to render a given documentation"""
# If the thread is already running wait for it to finish before
# starting it again.
if self.wait():
self.doc = doc
... | [
"Start",
"thread",
"to",
"render",
"a",
"given",
"documentation"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxthread.py#L48-L60 | [
"def",
"render",
"(",
"self",
",",
"doc",
",",
"context",
"=",
"None",
",",
"math_option",
"=",
"False",
",",
"img_path",
"=",
"''",
",",
"css_path",
"=",
"CSS_PATH",
")",
":",
"# If the thread is already running wait for it to finish before",
"# starting it again."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServersModel.sortByName | Qt Override. | spyder/preferences/languageserver.py | def sortByName(self):
"""Qt Override."""
self.servers = sorted(self.servers, key=lambda x: x.language)
self.reset() | def sortByName(self):
"""Qt Override."""
self.servers = sorted(self.servers, key=lambda x: x.language)
self.reset() | [
"Qt",
"Override",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L413-L416 | [
"def",
"sortByName",
"(",
"self",
")",
":",
"self",
".",
"servers",
"=",
"sorted",
"(",
"self",
".",
"servers",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
".",
"language",
")",
"self",
".",
"reset",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServersModel.data | Qt Override. | spyder/preferences/languageserver.py | def data(self, index, role=Qt.DisplayRole):
"""Qt Override."""
row = index.row()
if not index.isValid() or not (0 <= row < len(self.servers)):
return to_qvariant()
server = self.servers[row]
column = index.column()
if role == Qt.DisplayRole:
if c... | def data(self, index, role=Qt.DisplayRole):
"""Qt Override."""
row = index.row()
if not index.isValid() or not (0 <= row < len(self.servers)):
return to_qvariant()
server = self.servers[row]
column = index.column()
if role == Qt.DisplayRole:
if c... | [
"Qt",
"Override",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L424-L447 | [
"def",
"data",
"(",
"self",
",",
"index",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"row",
"=",
"index",
".",
"row",
"(",
")",
"if",
"not",
"index",
".",
"isValid",
"(",
")",
"or",
"not",
"(",
"0",
"<=",
"row",
"<",
"len",
"(",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServersModel.headerData | Qt Override. | spyder/preferences/languageserver.py | def headerData(self, section, orientation, role=Qt.DisplayRole):
"""Qt Override."""
if role == Qt.TextAlignmentRole:
if orientation == Qt.Horizontal:
return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter))
return to_qvariant(int(Qt.AlignRight | Qt.AlignVCenter)... | def headerData(self, section, orientation, role=Qt.DisplayRole):
"""Qt Override."""
if role == Qt.TextAlignmentRole:
if orientation == Qt.Horizontal:
return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter))
return to_qvariant(int(Qt.AlignRight | Qt.AlignVCenter)... | [
"Qt",
"Override",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L449-L464 | [
"def",
"headerData",
"(",
"self",
",",
"section",
",",
"orientation",
",",
"role",
"=",
"Qt",
".",
"DisplayRole",
")",
":",
"if",
"role",
"==",
"Qt",
".",
"TextAlignmentRole",
":",
"if",
"orientation",
"==",
"Qt",
".",
"Horizontal",
":",
"return",
"to_qv... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServerTable.focusInEvent | Qt Override. | spyder/preferences/languageserver.py | def focusInEvent(self, e):
"""Qt Override."""
super(LSPServerTable, self).focusInEvent(e)
self.selectRow(self.currentIndex().row()) | def focusInEvent(self, e):
"""Qt Override."""
super(LSPServerTable, self).focusInEvent(e)
self.selectRow(self.currentIndex().row()) | [
"Qt",
"Override",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L507-L510 | [
"def",
"focusInEvent",
"(",
"self",
",",
"e",
")",
":",
"super",
"(",
"LSPServerTable",
",",
"self",
")",
".",
"focusInEvent",
"(",
"e",
")",
"self",
".",
"selectRow",
"(",
"self",
".",
"currentIndex",
"(",
")",
".",
"row",
"(",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServerTable.selection | Update selected row. | spyder/preferences/languageserver.py | def selection(self, index):
"""Update selected row."""
self.update()
self.isActiveWindow()
self._parent.delete_btn.setEnabled(True) | def selection(self, index):
"""Update selected row."""
self.update()
self.isActiveWindow()
self._parent.delete_btn.setEnabled(True) | [
"Update",
"selected",
"row",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L512-L516 | [
"def",
"selection",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"update",
"(",
")",
"self",
".",
"isActiveWindow",
"(",
")",
"self",
".",
"_parent",
".",
"delete_btn",
".",
"setEnabled",
"(",
"True",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServerTable.adjust_cells | Adjust column size based on contents. | spyder/preferences/languageserver.py | def adjust_cells(self):
"""Adjust column size based on contents."""
self.resizeColumnsToContents()
fm = self.horizontalHeader().fontMetrics()
names = [fm.width(s.cmd) for s in self.source_model.servers]
if names:
self.setColumnWidth(CMD, max(names))
self.horiz... | def adjust_cells(self):
"""Adjust column size based on contents."""
self.resizeColumnsToContents()
fm = self.horizontalHeader().fontMetrics()
names = [fm.width(s.cmd) for s in self.source_model.servers]
if names:
self.setColumnWidth(CMD, max(names))
self.horiz... | [
"Adjust",
"column",
"size",
"based",
"on",
"contents",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L518-L525 | [
"def",
"adjust_cells",
"(",
"self",
")",
":",
"self",
".",
"resizeColumnsToContents",
"(",
")",
"fm",
"=",
"self",
".",
"horizontalHeader",
"(",
")",
".",
"fontMetrics",
"(",
")",
"names",
"=",
"[",
"fm",
".",
"width",
"(",
"s",
".",
"cmd",
")",
"for... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServerTable.next_row | Move to next row from currently selected row. | spyder/preferences/languageserver.py | def next_row(self):
"""Move to next row from currently selected row."""
row = self.currentIndex().row()
rows = self.source_model.rowCount()
if row + 1 == rows:
row = -1
self.selectRow(row + 1) | def next_row(self):
"""Move to next row from currently selected row."""
row = self.currentIndex().row()
rows = self.source_model.rowCount()
if row + 1 == rows:
row = -1
self.selectRow(row + 1) | [
"Move",
"to",
"next",
"row",
"from",
"currently",
"selected",
"row",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L573-L579 | [
"def",
"next_row",
"(",
"self",
")",
":",
"row",
"=",
"self",
".",
"currentIndex",
"(",
")",
".",
"row",
"(",
")",
"rows",
"=",
"self",
".",
"source_model",
".",
"rowCount",
"(",
")",
"if",
"row",
"+",
"1",
"==",
"rows",
":",
"row",
"=",
"-",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServerTable.previous_row | Move to previous row from currently selected row. | spyder/preferences/languageserver.py | def previous_row(self):
"""Move to previous row from currently selected row."""
row = self.currentIndex().row()
rows = self.source_model.rowCount()
if row == 0:
row = rows
self.selectRow(row - 1) | def previous_row(self):
"""Move to previous row from currently selected row."""
row = self.currentIndex().row()
rows = self.source_model.rowCount()
if row == 0:
row = rows
self.selectRow(row - 1) | [
"Move",
"to",
"previous",
"row",
"from",
"currently",
"selected",
"row",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L581-L587 | [
"def",
"previous_row",
"(",
"self",
")",
":",
"row",
"=",
"self",
".",
"currentIndex",
"(",
")",
".",
"row",
"(",
")",
"rows",
"=",
"self",
".",
"source_model",
".",
"rowCount",
"(",
")",
"if",
"row",
"==",
"0",
":",
"row",
"=",
"rows",
"self",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPServerTable.keyPressEvent | Qt Override. | spyder/preferences/languageserver.py | def keyPressEvent(self, event):
"""Qt Override."""
key = event.key()
if key in [Qt.Key_Enter, Qt.Key_Return]:
self.show_editor()
elif key in [Qt.Key_Backtab]:
self.parent().reset_btn.setFocus()
elif key in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Left, Qt.Key_Right... | def keyPressEvent(self, event):
"""Qt Override."""
key = event.key()
if key in [Qt.Key_Enter, Qt.Key_Return]:
self.show_editor()
elif key in [Qt.Key_Backtab]:
self.parent().reset_btn.setFocus()
elif key in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Left, Qt.Key_Right... | [
"Qt",
"Override",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L589-L601 | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"key",
"=",
"event",
".",
"key",
"(",
")",
"if",
"key",
"in",
"[",
"Qt",
".",
"Key_Enter",
",",
"Qt",
".",
"Key_Return",
"]",
":",
"self",
".",
"show_editor",
"(",
")",
"elif",
"key",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | LSPManagerConfigPage.setup_docstring_style_convention | Handle convention changes. | spyder/preferences/languageserver.py | def setup_docstring_style_convention(self, text):
"""Handle convention changes."""
if text == 'Custom':
self.docstring_style_select.label.setText(
_("Show the following errors:"))
self.docstring_style_ignore.label.setText(
_("Ignore the following e... | def setup_docstring_style_convention(self, text):
"""Handle convention changes."""
if text == 'Custom':
self.docstring_style_select.label.setText(
_("Show the following errors:"))
self.docstring_style_ignore.label.setText(
_("Ignore the following e... | [
"Handle",
"convention",
"changes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L955-L968 | [
"def",
"setup_docstring_style_convention",
"(",
"self",
",",
"text",
")",
":",
"if",
"text",
"==",
"'Custom'",
":",
"self",
".",
"docstring_style_select",
".",
"label",
".",
"setText",
"(",
"_",
"(",
"\"Show the following errors:\"",
")",
")",
"self",
".",
"do... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.add_external_path | Adds an external path to the combobox if it exists on the file system.
If the path is already listed in the combobox, it is removed from its
current position and added back at the end. If the maximum number of
paths is reached, the oldest external path is removed from the list. | spyder/plugins/findinfiles/widgets.py | def add_external_path(self, path):
"""
Adds an external path to the combobox if it exists on the file system.
If the path is already listed in the combobox, it is removed from its
current position and added back at the end. If the maximum number of
paths is reached, the olde... | def add_external_path(self, path):
"""
Adds an external path to the combobox if it exists on the file system.
If the path is already listed in the combobox, it is removed from its
current position and added back at the end. If the maximum number of
paths is reached, the olde... | [
"Adds",
"an",
"external",
"path",
"to",
"the",
"combobox",
"if",
"it",
"exists",
"on",
"the",
"file",
"system",
".",
"If",
"the",
"path",
"is",
"already",
"listed",
"in",
"the",
"combobox",
"it",
"is",
"removed",
"from",
"its",
"current",
"position",
"an... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L273-L286 | [
"def",
"add_external_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"osp",
".",
"exists",
"(",
"path",
")",
":",
"return",
"self",
".",
"removeItem",
"(",
"self",
".",
"findText",
"(",
"path",
")",
")",
"self",
".",
"addItem",
"(",
"path",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.get_external_paths | Returns a list of the external paths listed in the combobox. | spyder/plugins/findinfiles/widgets.py | def get_external_paths(self):
"""Returns a list of the external paths listed in the combobox."""
return [to_text_string(self.itemText(i))
for i in range(EXTERNAL_PATHS, self.count())] | def get_external_paths(self):
"""Returns a list of the external paths listed in the combobox."""
return [to_text_string(self.itemText(i))
for i in range(EXTERNAL_PATHS, self.count())] | [
"Returns",
"a",
"list",
"of",
"the",
"external",
"paths",
"listed",
"in",
"the",
"combobox",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L288-L291 | [
"def",
"get_external_paths",
"(",
"self",
")",
":",
"return",
"[",
"to_text_string",
"(",
"self",
".",
"itemText",
"(",
"i",
")",
")",
"for",
"i",
"in",
"range",
"(",
"EXTERNAL_PATHS",
",",
"self",
".",
"count",
"(",
")",
")",
"]"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.get_current_searchpath | Returns the path corresponding to the currently selected item
in the combobox. | spyder/plugins/findinfiles/widgets.py | def get_current_searchpath(self):
"""
Returns the path corresponding to the currently selected item
in the combobox.
"""
idx = self.currentIndex()
if idx == CWD:
return self.path
elif idx == PROJECT:
return self.project_path
... | def get_current_searchpath(self):
"""
Returns the path corresponding to the currently selected item
in the combobox.
"""
idx = self.currentIndex()
if idx == CWD:
return self.path
elif idx == PROJECT:
return self.project_path
... | [
"Returns",
"the",
"path",
"corresponding",
"to",
"the",
"currently",
"selected",
"item",
"in",
"the",
"combobox",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L298-L311 | [
"def",
"get_current_searchpath",
"(",
"self",
")",
":",
"idx",
"=",
"self",
".",
"currentIndex",
"(",
")",
"if",
"idx",
"==",
"CWD",
":",
"return",
"self",
".",
"path",
"elif",
"idx",
"==",
"PROJECT",
":",
"return",
"self",
".",
"project_path",
"elif",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.path_selection_changed | Handles when the current index of the combobox changes. | spyder/plugins/findinfiles/widgets.py | def path_selection_changed(self):
"""Handles when the current index of the combobox changes."""
idx = self.currentIndex()
if idx == SELECT_OTHER:
external_path = self.select_directory()
if len(external_path) > 0:
self.add_external_path(external_path)... | def path_selection_changed(self):
"""Handles when the current index of the combobox changes."""
idx = self.currentIndex()
if idx == SELECT_OTHER:
external_path = self.select_directory()
if len(external_path) > 0:
self.add_external_path(external_path)... | [
"Handles",
"when",
"the",
"current",
"index",
"of",
"the",
"combobox",
"changes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L321-L340 | [
"def",
"path_selection_changed",
"(",
"self",
")",
":",
"idx",
"=",
"self",
".",
"currentIndex",
"(",
")",
"if",
"idx",
"==",
"SELECT_OTHER",
":",
"external_path",
"=",
"self",
".",
"select_directory",
"(",
")",
"if",
"len",
"(",
"external_path",
")",
">",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.select_directory | Select directory | spyder/plugins/findinfiles/widgets.py | def select_directory(self):
"""Select directory"""
self.__redirect_stdio_emit(False)
directory = getexistingdirectory(
self, _("Select directory"), self.path)
if directory:
directory = to_unicode_from_fs(osp.abspath(directory))
self.__redirect_s... | def select_directory(self):
"""Select directory"""
self.__redirect_stdio_emit(False)
directory = getexistingdirectory(
self, _("Select directory"), self.path)
if directory:
directory = to_unicode_from_fs(osp.abspath(directory))
self.__redirect_s... | [
"Select",
"directory"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L343-L351 | [
"def",
"select_directory",
"(",
"self",
")",
":",
"self",
".",
"__redirect_stdio_emit",
"(",
"False",
")",
"directory",
"=",
"getexistingdirectory",
"(",
"self",
",",
"_",
"(",
"\"Select directory\"",
")",
",",
"self",
".",
"path",
")",
"if",
"directory",
":... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.set_project_path | Sets the project path and disables the project search in the combobox
if the value of path is None. | spyder/plugins/findinfiles/widgets.py | def set_project_path(self, path):
"""
Sets the project path and disables the project search in the combobox
if the value of path is None.
"""
if path is None:
self.project_path = None
self.model().item(PROJECT, 0).setEnabled(False)
if s... | def set_project_path(self, path):
"""
Sets the project path and disables the project search in the combobox
if the value of path is None.
"""
if path is None:
self.project_path = None
self.model().item(PROJECT, 0).setEnabled(False)
if s... | [
"Sets",
"the",
"project",
"path",
"and",
"disables",
"the",
"project",
"search",
"in",
"the",
"combobox",
"if",
"the",
"value",
"of",
"path",
"is",
"None",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L353-L366 | [
"def",
"set_project_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
"is",
"None",
":",
"self",
".",
"project_path",
"=",
"None",
"self",
".",
"model",
"(",
")",
".",
"item",
"(",
"PROJECT",
",",
"0",
")",
".",
"setEnabled",
"(",
"False",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.eventFilter | Used to handle key events on the QListView of the combobox. | spyder/plugins/findinfiles/widgets.py | def eventFilter(self, widget, event):
"""Used to handle key events on the QListView of the combobox."""
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Delete:
index = self.view().currentIndex().row()
if index >= EXTERNAL_PATHS:
# Remove item and... | def eventFilter(self, widget, event):
"""Used to handle key events on the QListView of the combobox."""
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Delete:
index = self.view().currentIndex().row()
if index >= EXTERNAL_PATHS:
# Remove item and... | [
"Used",
"to",
"handle",
"key",
"events",
"on",
"the",
"QListView",
"of",
"the",
"combobox",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L368-L382 | [
"def",
"eventFilter",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"KeyPress",
"and",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Delete",
":",
"index",
"=",
"self",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | SearchInComboBox.__redirect_stdio_emit | Searches through the parent tree to see if it is possible to emit the
redirect_stdio signal.
This logic allows to test the SearchInComboBox select_directory method
outside of the FindInFiles plugin. | spyder/plugins/findinfiles/widgets.py | def __redirect_stdio_emit(self, value):
"""
Searches through the parent tree to see if it is possible to emit the
redirect_stdio signal.
This logic allows to test the SearchInComboBox select_directory method
outside of the FindInFiles plugin.
"""
parent = s... | def __redirect_stdio_emit(self, value):
"""
Searches through the parent tree to see if it is possible to emit the
redirect_stdio signal.
This logic allows to test the SearchInComboBox select_directory method
outside of the FindInFiles plugin.
"""
parent = s... | [
"Searches",
"through",
"the",
"parent",
"tree",
"to",
"see",
"if",
"it",
"is",
"possible",
"to",
"emit",
"the",
"redirect_stdio",
"signal",
".",
"This",
"logic",
"allows",
"to",
"test",
"the",
"SearchInComboBox",
"select_directory",
"method",
"outside",
"of",
... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L384-L398 | [
"def",
"__redirect_stdio_emit",
"(",
"self",
",",
"value",
")",
":",
"parent",
"=",
"self",
".",
"parent",
"(",
")",
"while",
"parent",
"is",
"not",
"None",
":",
"try",
":",
"parent",
".",
"redirect_stdio",
".",
"emit",
"(",
"value",
")",
"except",
"At... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FindOptions.get_options | Get options | spyder/plugins/findinfiles/widgets.py | def get_options(self, to_save=False):
"""Get options"""
text_re = self.edit_regexp.isChecked()
exclude_re = self.exclude_regexp.isChecked()
case_sensitive = self.case_button.isChecked()
# Return current options for them to be saved when closing
# Spyder.
... | def get_options(self, to_save=False):
"""Get options"""
text_re = self.edit_regexp.isChecked()
exclude_re = self.exclude_regexp.isChecked()
case_sensitive = self.case_button.isChecked()
# Return current options for them to be saved when closing
# Spyder.
... | [
"Get",
"options"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L532-L610 | [
"def",
"get_options",
"(",
"self",
",",
"to_save",
"=",
"False",
")",
":",
"text_re",
"=",
"self",
".",
"edit_regexp",
".",
"isChecked",
"(",
")",
"exclude_re",
"=",
"self",
".",
"exclude_regexp",
".",
"isChecked",
"(",
")",
"case_sensitive",
"=",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FindOptions.keyPressEvent | Reimplemented to handle key events | spyder/plugins/findinfiles/widgets.py | def keyPressEvent(self, event):
"""Reimplemented to handle key events"""
ctrl = event.modifiers() & Qt.ControlModifier
shift = event.modifiers() & Qt.ShiftModifier
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
self.find.emit()
elif event.key() == Qt.Key_F and... | def keyPressEvent(self, event):
"""Reimplemented to handle key events"""
ctrl = event.modifiers() & Qt.ControlModifier
shift = event.modifiers() & Qt.ShiftModifier
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
self.find.emit()
elif event.key() == Qt.Key_F and... | [
"Reimplemented",
"to",
"handle",
"key",
"events"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L636-L646 | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"ctrl",
"=",
"event",
".",
"modifiers",
"(",
")",
"&",
"Qt",
".",
"ControlModifier",
"shift",
"=",
"event",
".",
"modifiers",
"(",
")",
"&",
"Qt",
".",
"ShiftModifier",
"if",
"event",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ResultsBrowser.activated | Double-click event | spyder/plugins/findinfiles/widgets.py | def activated(self, item):
"""Double-click event"""
itemdata = self.data.get(id(self.currentItem()))
if itemdata is not None:
filename, lineno, colno = itemdata
self.sig_edit_goto.emit(filename, lineno, self.search_text) | def activated(self, item):
"""Double-click event"""
itemdata = self.data.get(id(self.currentItem()))
if itemdata is not None:
filename, lineno, colno = itemdata
self.sig_edit_goto.emit(filename, lineno, self.search_text) | [
"Double",
"-",
"click",
"event"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L771-L776 | [
"def",
"activated",
"(",
"self",
",",
"item",
")",
":",
"itemdata",
"=",
"self",
".",
"data",
".",
"get",
"(",
"id",
"(",
"self",
".",
"currentItem",
"(",
")",
")",
")",
"if",
"itemdata",
"is",
"not",
"None",
":",
"filename",
",",
"lineno",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ResultsBrowser.set_sorting | Enable result sorting after search is complete. | spyder/plugins/findinfiles/widgets.py | def set_sorting(self, flag):
"""Enable result sorting after search is complete."""
self.sorting['status'] = flag
self.header().setSectionsClickable(flag == ON) | def set_sorting(self, flag):
"""Enable result sorting after search is complete."""
self.sorting['status'] = flag
self.header().setSectionsClickable(flag == ON) | [
"Enable",
"result",
"sorting",
"after",
"search",
"is",
"complete",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L778-L781 | [
"def",
"set_sorting",
"(",
"self",
",",
"flag",
")",
":",
"self",
".",
"sorting",
"[",
"'status'",
"]",
"=",
"flag",
"self",
".",
"header",
"(",
")",
".",
"setSectionsClickable",
"(",
"flag",
"==",
"ON",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ResultsBrowser.append_result | Real-time update of search results | spyder/plugins/findinfiles/widgets.py | def append_result(self, results, num_matches):
"""Real-time update of search results"""
filename, lineno, colno, match_end, line = results
if filename not in self.files:
file_item = FileMatchItem(self, filename, self.sorting,
self.text_col... | def append_result(self, results, num_matches):
"""Real-time update of search results"""
filename, lineno, colno, match_end, line = results
if filename not in self.files:
file_item = FileMatchItem(self, filename, self.sorting,
self.text_col... | [
"Real",
"-",
"time",
"update",
"of",
"search",
"results"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L876-L904 | [
"def",
"append_result",
"(",
"self",
",",
"results",
",",
"num_matches",
")",
":",
"filename",
",",
"lineno",
",",
"colno",
",",
"match_end",
",",
"line",
"=",
"results",
"if",
"filename",
"not",
"in",
"self",
".",
"files",
":",
"file_item",
"=",
"FileMa... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FileProgressBar.showEvent | Override show event to start waiting spinner. | spyder/plugins/findinfiles/widgets.py | def showEvent(self, event):
"""Override show event to start waiting spinner."""
QWidget.showEvent(self, event)
self.spinner.start() | def showEvent(self, event):
"""Override show event to start waiting spinner."""
QWidget.showEvent(self, event)
self.spinner.start() | [
"Override",
"show",
"event",
"to",
"start",
"waiting",
"spinner",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L934-L937 | [
"def",
"showEvent",
"(",
"self",
",",
"event",
")",
":",
"QWidget",
".",
"showEvent",
"(",
"self",
",",
"event",
")",
"self",
".",
"spinner",
".",
"start",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FileProgressBar.hideEvent | Override hide event to stop waiting spinner. | spyder/plugins/findinfiles/widgets.py | def hideEvent(self, event):
"""Override hide event to stop waiting spinner."""
QWidget.hideEvent(self, event)
self.spinner.stop() | def hideEvent(self, event):
"""Override hide event to stop waiting spinner."""
QWidget.hideEvent(self, event)
self.spinner.stop() | [
"Override",
"hide",
"event",
"to",
"stop",
"waiting",
"spinner",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L939-L942 | [
"def",
"hideEvent",
"(",
"self",
",",
"event",
")",
":",
"QWidget",
".",
"hideEvent",
"(",
"self",
",",
"event",
")",
"self",
".",
"spinner",
".",
"stop",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FindInFilesWidget.find | Call the find function | spyder/plugins/findinfiles/widgets.py | def find(self):
"""Call the find function"""
options = self.find_options.get_options()
if options is None:
return
self.stop_and_reset_thread(ignore_results=True)
self.search_thread = SearchThread(self)
self.search_thread.sig_finished.connect(self.search... | def find(self):
"""Call the find function"""
options = self.find_options.get_options()
if options is None:
return
self.stop_and_reset_thread(ignore_results=True)
self.search_thread = SearchThread(self)
self.search_thread.sig_finished.connect(self.search... | [
"Call",
"the",
"find",
"function"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L1000-L1027 | [
"def",
"find",
"(",
"self",
")",
":",
"options",
"=",
"self",
".",
"find_options",
".",
"get_options",
"(",
")",
"if",
"options",
"is",
"None",
":",
"return",
"self",
".",
"stop_and_reset_thread",
"(",
"ignore_results",
"=",
"True",
")",
"self",
".",
"se... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FindInFilesWidget.stop_and_reset_thread | Stop current search thread and clean-up | spyder/plugins/findinfiles/widgets.py | def stop_and_reset_thread(self, ignore_results=False):
"""Stop current search thread and clean-up"""
if self.search_thread is not None:
if self.search_thread.isRunning():
if ignore_results:
self.search_thread.sig_finished.disconnect(
... | def stop_and_reset_thread(self, ignore_results=False):
"""Stop current search thread and clean-up"""
if self.search_thread is not None:
if self.search_thread.isRunning():
if ignore_results:
self.search_thread.sig_finished.disconnect(
... | [
"Stop",
"current",
"search",
"thread",
"and",
"clean",
"-",
"up"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L1029-L1039 | [
"def",
"stop_and_reset_thread",
"(",
"self",
",",
"ignore_results",
"=",
"False",
")",
":",
"if",
"self",
".",
"search_thread",
"is",
"not",
"None",
":",
"if",
"self",
".",
"search_thread",
".",
"isRunning",
"(",
")",
":",
"if",
"ignore_results",
":",
"sel... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FindInFilesWidget.search_complete | Current search thread has finished | spyder/plugins/findinfiles/widgets.py | def search_complete(self, completed):
"""Current search thread has finished"""
self.result_browser.set_sorting(ON)
self.find_options.ok_button.setEnabled(True)
self.find_options.stop_button.setEnabled(False)
self.status_bar.hide()
self.result_browser.expandAll()
... | def search_complete(self, completed):
"""Current search thread has finished"""
self.result_browser.set_sorting(ON)
self.find_options.ok_button.setEnabled(True)
self.find_options.stop_button.setEnabled(False)
self.status_bar.hide()
self.result_browser.expandAll()
... | [
"Current",
"search",
"thread",
"has",
"finished"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L1045-L1059 | [
"def",
"search_complete",
"(",
"self",
",",
"completed",
")",
":",
"self",
".",
"result_browser",
".",
"set_sorting",
"(",
"ON",
")",
"self",
".",
"find_options",
".",
"ok_button",
".",
"setEnabled",
"(",
"True",
")",
"self",
".",
"find_options",
".",
"sto... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | GithubBackend._get_credentials_from_settings | Get the stored credentials if any. | spyder/widgets/github/backend.py | def _get_credentials_from_settings(self):
"""Get the stored credentials if any."""
remember_me = CONF.get('main', 'report_error/remember_me')
remember_token = CONF.get('main', 'report_error/remember_token')
username = CONF.get('main', 'report_error/username', '')
if not remember_... | def _get_credentials_from_settings(self):
"""Get the stored credentials if any."""
remember_me = CONF.get('main', 'report_error/remember_me')
remember_token = CONF.get('main', 'report_error/remember_token')
username = CONF.get('main', 'report_error/username', '')
if not remember_... | [
"Get",
"the",
"stored",
"credentials",
"if",
"any",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L177-L185 | [
"def",
"_get_credentials_from_settings",
"(",
"self",
")",
":",
"remember_me",
"=",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'report_error/remember_me'",
")",
"remember_token",
"=",
"CONF",
".",
"get",
"(",
"'main'",
",",
"'report_error/remember_token'",
")",
"use... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | GithubBackend._store_credentials | Store credentials for future use. | spyder/widgets/github/backend.py | def _store_credentials(self, username, password, remember=False):
"""Store credentials for future use."""
if username and password and remember:
CONF.set('main', 'report_error/username', username)
try:
keyring.set_password('github', username, password)
... | def _store_credentials(self, username, password, remember=False):
"""Store credentials for future use."""
if username and password and remember:
CONF.set('main', 'report_error/username', username)
try:
keyring.set_password('github', username, password)
... | [
"Store",
"credentials",
"for",
"future",
"use",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L187-L203 | [
"def",
"_store_credentials",
"(",
"self",
",",
"username",
",",
"password",
",",
"remember",
"=",
"False",
")",
":",
"if",
"username",
"and",
"password",
"and",
"remember",
":",
"CONF",
".",
"set",
"(",
"'main'",
",",
"'report_error/username'",
",",
"usernam... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | GithubBackend._store_token | Store token for future use. | spyder/widgets/github/backend.py | def _store_token(self, token, remember=False):
"""Store token for future use."""
if token and remember:
try:
keyring.set_password('github', 'token', token)
except Exception:
if self._show_msgbox:
QMessageBox.warning(self.parent_... | def _store_token(self, token, remember=False):
"""Store token for future use."""
if token and remember:
try:
keyring.set_password('github', 'token', token)
except Exception:
if self._show_msgbox:
QMessageBox.warning(self.parent_... | [
"Store",
"token",
"for",
"future",
"use",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L205-L220 | [
"def",
"_store_token",
"(",
"self",
",",
"token",
",",
"remember",
"=",
"False",
")",
":",
"if",
"token",
"and",
"remember",
":",
"try",
":",
"keyring",
".",
"set_password",
"(",
"'github'",
",",
"'token'",
",",
"token",
")",
"except",
"Exception",
":",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | GithubBackend.get_user_credentials | Get user credentials with the login dialog. | spyder/widgets/github/backend.py | def get_user_credentials(self):
"""Get user credentials with the login dialog."""
password = None
token = None
(username, remember_me,
remember_token) = self._get_credentials_from_settings()
valid_py_os = not (PY2 and sys.platform.startswith('linux'))
if username... | def get_user_credentials(self):
"""Get user credentials with the login dialog."""
password = None
token = None
(username, remember_me,
remember_token) = self._get_credentials_from_settings()
valid_py_os = not (PY2 and sys.platform.startswith('linux'))
if username... | [
"Get",
"user",
"credentials",
"with",
"the",
"login",
"dialog",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L223-L280 | [
"def",
"get_user_credentials",
"(",
"self",
")",
":",
"password",
"=",
"None",
"token",
"=",
"None",
"(",
"username",
",",
"remember_me",
",",
"remember_token",
")",
"=",
"self",
".",
"_get_credentials_from_settings",
"(",
")",
"valid_py_os",
"=",
"not",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ToolTipWidget.show_tip | Attempts to show the specified tip at the current cursor location. | spyder/widgets/calltip.py | def show_tip(self, point, tip):
"""
Attempts to show the specified tip at the current cursor location.
"""
# Don't attempt to show it if it's already visible and the text
# to be displayed is the same as the one displayed before.
if self.isVisible():
if self.t... | def show_tip(self, point, tip):
"""
Attempts to show the specified tip at the current cursor location.
"""
# Don't attempt to show it if it's already visible and the text
# to be displayed is the same as the one displayed before.
if self.isVisible():
if self.t... | [
"Attempts",
"to",
"show",
"the",
"specified",
"tip",
"at",
"the",
"current",
"cursor",
"location",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L73-L91 | [
"def",
"show_tip",
"(",
"self",
",",
"point",
",",
"tip",
")",
":",
"# Don't attempt to show it if it's already visible and the text",
"# to be displayed is the same as the one displayed before.",
"if",
"self",
".",
"isVisible",
"(",
")",
":",
"if",
"self",
".",
"tip",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ToolTipWidget.leaveEvent | Override Qt method to hide the tooltip on leave. | spyder/widgets/calltip.py | def leaveEvent(self, event):
"""Override Qt method to hide the tooltip on leave."""
super(ToolTipWidget, self).leaveEvent(event)
self.hide() | def leaveEvent(self, event):
"""Override Qt method to hide the tooltip on leave."""
super(ToolTipWidget, self).leaveEvent(event)
self.hide() | [
"Override",
"Qt",
"method",
"to",
"hide",
"the",
"tooltip",
"on",
"leave",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L105-L108 | [
"def",
"leaveEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"ToolTipWidget",
",",
"self",
")",
".",
"leaveEvent",
"(",
"event",
")",
"self",
".",
"hide",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.eventFilter | Reimplemented to hide on certain key presses and on text edit focus
changes. | spyder/widgets/calltip.py | def eventFilter(self, obj, event):
""" Reimplemented to hide on certain key presses and on text edit focus
changes.
"""
if obj == self._text_edit:
etype = event.type()
if etype == QEvent.KeyPress:
key = event.key()
cursor = sel... | def eventFilter(self, obj, event):
""" Reimplemented to hide on certain key presses and on text edit focus
changes.
"""
if obj == self._text_edit:
etype = event.type()
if etype == QEvent.KeyPress:
key = event.key()
cursor = sel... | [
"Reimplemented",
"to",
"hide",
"on",
"certain",
"key",
"presses",
"and",
"on",
"text",
"edit",
"focus",
"changes",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L144-L176 | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"if",
"obj",
"==",
"self",
".",
"_text_edit",
":",
"etype",
"=",
"event",
".",
"type",
"(",
")",
"if",
"etype",
"==",
"QEvent",
".",
"KeyPress",
":",
"key",
"=",
"event",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.timerEvent | Reimplemented to hide the widget when the hide timer fires. | spyder/widgets/calltip.py | def timerEvent(self, event):
""" Reimplemented to hide the widget when the hide timer fires.
"""
if event.timerId() == self._hide_timer.timerId():
self._hide_timer.stop()
self.hide() | def timerEvent(self, event):
""" Reimplemented to hide the widget when the hide timer fires.
"""
if event.timerId() == self._hide_timer.timerId():
self._hide_timer.stop()
self.hide() | [
"Reimplemented",
"to",
"hide",
"the",
"widget",
"when",
"the",
"hide",
"timer",
"fires",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L178-L183 | [
"def",
"timerEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"timerId",
"(",
")",
"==",
"self",
".",
"_hide_timer",
".",
"timerId",
"(",
")",
":",
"self",
".",
"_hide_timer",
".",
"stop",
"(",
")",
"self",
".",
"hide",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.enterEvent | Reimplemented to cancel the hide timer. | spyder/widgets/calltip.py | def enterEvent(self, event):
""" Reimplemented to cancel the hide timer.
"""
super(CallTipWidget, self).enterEvent(event)
if self.as_tooltip:
self.hide()
if (self._hide_timer.isActive() and
self.app.topLevelAt(QCursor.pos()) == self):
self._hide... | def enterEvent(self, event):
""" Reimplemented to cancel the hide timer.
"""
super(CallTipWidget, self).enterEvent(event)
if self.as_tooltip:
self.hide()
if (self._hide_timer.isActive() and
self.app.topLevelAt(QCursor.pos()) == self):
self._hide... | [
"Reimplemented",
"to",
"cancel",
"the",
"hide",
"timer",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L189-L198 | [
"def",
"enterEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"CallTipWidget",
",",
"self",
")",
".",
"enterEvent",
"(",
"event",
")",
"if",
"self",
".",
"as_tooltip",
":",
"self",
".",
"hide",
"(",
")",
"if",
"(",
"self",
".",
"_hide_timer... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.hideEvent | Reimplemented to disconnect signal handlers and event filter. | spyder/widgets/calltip.py | def hideEvent(self, event):
""" Reimplemented to disconnect signal handlers and event filter.
"""
super(CallTipWidget, self).hideEvent(event)
self._text_edit.cursorPositionChanged.disconnect(
self._cursor_position_changed)
self._text_edit.removeEventFilter(self) | def hideEvent(self, event):
""" Reimplemented to disconnect signal handlers and event filter.
"""
super(CallTipWidget, self).hideEvent(event)
self._text_edit.cursorPositionChanged.disconnect(
self._cursor_position_changed)
self._text_edit.removeEventFilter(self) | [
"Reimplemented",
"to",
"disconnect",
"signal",
"handlers",
"and",
"event",
"filter",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L200-L206 | [
"def",
"hideEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"CallTipWidget",
",",
"self",
")",
".",
"hideEvent",
"(",
"event",
")",
"self",
".",
"_text_edit",
".",
"cursorPositionChanged",
".",
"disconnect",
"(",
"self",
".",
"_cursor_position_cha... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.leaveEvent | Reimplemented to start the hide timer. | spyder/widgets/calltip.py | def leaveEvent(self, event):
""" Reimplemented to start the hide timer.
"""
super(CallTipWidget, self).leaveEvent(event)
self._leave_event_hide() | def leaveEvent(self, event):
""" Reimplemented to start the hide timer.
"""
super(CallTipWidget, self).leaveEvent(event)
self._leave_event_hide() | [
"Reimplemented",
"to",
"start",
"the",
"hide",
"timer",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L208-L212 | [
"def",
"leaveEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"CallTipWidget",
",",
"self",
")",
".",
"leaveEvent",
"(",
"event",
")",
"self",
".",
"_leave_event_hide",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.showEvent | Reimplemented to connect signal handlers and event filter. | spyder/widgets/calltip.py | def showEvent(self, event):
""" Reimplemented to connect signal handlers and event filter.
"""
super(CallTipWidget, self).showEvent(event)
self._text_edit.cursorPositionChanged.connect(
self._cursor_position_changed)
self._text_edit.installEventFilter(self) | def showEvent(self, event):
""" Reimplemented to connect signal handlers and event filter.
"""
super(CallTipWidget, self).showEvent(event)
self._text_edit.cursorPositionChanged.connect(
self._cursor_position_changed)
self._text_edit.installEventFilter(self) | [
"Reimplemented",
"to",
"connect",
"signal",
"handlers",
"and",
"event",
"filter",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L234-L240 | [
"def",
"showEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"CallTipWidget",
",",
"self",
")",
".",
"showEvent",
"(",
"event",
")",
"self",
".",
"_text_edit",
".",
"cursorPositionChanged",
".",
"connect",
"(",
"self",
".",
"_cursor_position_change... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget.show_tip | Attempts to show the specified tip at the current cursor location. | spyder/widgets/calltip.py | def show_tip(self, point, tip, wrapped_tiplines):
""" Attempts to show the specified tip at the current cursor location.
"""
# Don't attempt to show it if it's already visible and the text
# to be displayed is the same as the one displayed before.
if self.isVisible():
... | def show_tip(self, point, tip, wrapped_tiplines):
""" Attempts to show the specified tip at the current cursor location.
"""
# Don't attempt to show it if it's already visible and the text
# to be displayed is the same as the one displayed before.
if self.isVisible():
... | [
"Attempts",
"to",
"show",
"the",
"specified",
"tip",
"at",
"the",
"current",
"cursor",
"location",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L252-L346 | [
"def",
"show_tip",
"(",
"self",
",",
"point",
",",
"tip",
",",
"wrapped_tiplines",
")",
":",
"# Don't attempt to show it if it's already visible and the text",
"# to be displayed is the same as the one displayed before.",
"if",
"self",
".",
"isVisible",
"(",
")",
":",
"if",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget._leave_event_hide | Hides the tooltip after some time has passed (assuming the cursor is
not over the tooltip). | spyder/widgets/calltip.py | def _leave_event_hide(self):
""" Hides the tooltip after some time has passed (assuming the cursor is
not over the tooltip).
"""
if (self.hide_timer_on and not self._hide_timer.isActive() and
# If Enter events always came after Leave events, we wouldn't need
#... | def _leave_event_hide(self):
""" Hides the tooltip after some time has passed (assuming the cursor is
not over the tooltip).
"""
if (self.hide_timer_on and not self._hide_timer.isActive() and
# If Enter events always came after Leave events, we wouldn't need
#... | [
"Hides",
"the",
"tooltip",
"after",
"some",
"time",
"has",
"passed",
"(",
"assuming",
"the",
"cursor",
"is",
"not",
"over",
"the",
"tooltip",
")",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L381-L390 | [
"def",
"_leave_event_hide",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"hide_timer_on",
"and",
"not",
"self",
".",
"_hide_timer",
".",
"isActive",
"(",
")",
"and",
"# If Enter events always came after Leave events, we wouldn't need",
"# this check. But on Mac OS, it s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | CallTipWidget._cursor_position_changed | Updates the tip based on user cursor movement. | spyder/widgets/calltip.py | def _cursor_position_changed(self):
""" Updates the tip based on user cursor movement.
"""
cursor = self._text_edit.textCursor()
position = cursor.position()
document = self._text_edit.document()
char = to_text_string(document.characterAt(position - 1))
if positio... | def _cursor_position_changed(self):
""" Updates the tip based on user cursor movement.
"""
cursor = self._text_edit.textCursor()
position = cursor.position()
document = self._text_edit.document()
char = to_text_string(document.characterAt(position - 1))
if positio... | [
"Updates",
"the",
"tip",
"based",
"on",
"user",
"cursor",
"movement",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L394-L406 | [
"def",
"_cursor_position_changed",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"_text_edit",
".",
"textCursor",
"(",
")",
"position",
"=",
"cursor",
".",
"position",
"(",
")",
"document",
"=",
"self",
".",
"_text_edit",
".",
"document",
"(",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | has_mixed_eol_chars | Detect if text has mixed EOL characters | spyder/utils/sourcecode.py | def has_mixed_eol_chars(text):
"""Detect if text has mixed EOL characters"""
eol_chars = get_eol_chars(text)
if eol_chars is None:
return False
correct_text = eol_chars.join((text+eol_chars).splitlines())
return repr(correct_text) != repr(text) | def has_mixed_eol_chars(text):
"""Detect if text has mixed EOL characters"""
eol_chars = get_eol_chars(text)
if eol_chars is None:
return False
correct_text = eol_chars.join((text+eol_chars).splitlines())
return repr(correct_text) != repr(text) | [
"Detect",
"if",
"text",
"has",
"mixed",
"EOL",
"characters"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L44-L50 | [
"def",
"has_mixed_eol_chars",
"(",
"text",
")",
":",
"eol_chars",
"=",
"get_eol_chars",
"(",
"text",
")",
"if",
"eol_chars",
"is",
"None",
":",
"return",
"False",
"correct_text",
"=",
"eol_chars",
".",
"join",
"(",
"(",
"text",
"+",
"eol_chars",
")",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | normalize_eols | Use the same eol's in text | spyder/utils/sourcecode.py | def normalize_eols(text, eol='\n'):
"""Use the same eol's in text"""
for eol_char, _ in EOL_CHARS:
if eol_char != eol:
text = text.replace(eol_char, eol)
return text | def normalize_eols(text, eol='\n'):
"""Use the same eol's in text"""
for eol_char, _ in EOL_CHARS:
if eol_char != eol:
text = text.replace(eol_char, eol)
return text | [
"Use",
"the",
"same",
"eol",
"s",
"in",
"text"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L53-L58 | [
"def",
"normalize_eols",
"(",
"text",
",",
"eol",
"=",
"'\\n'",
")",
":",
"for",
"eol_char",
",",
"_",
"in",
"EOL_CHARS",
":",
"if",
"eol_char",
"!=",
"eol",
":",
"text",
"=",
"text",
".",
"replace",
"(",
"eol_char",
",",
"eol",
")",
"return",
"text"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | is_builtin | Test if passed string is the name of a Python builtin object | spyder/utils/sourcecode.py | def is_builtin(text):
"""Test if passed string is the name of a Python builtin object"""
from spyder.py3compat import builtins
return text in [str(name) for name in dir(builtins)
if not name.startswith('_')] | def is_builtin(text):
"""Test if passed string is the name of a Python builtin object"""
from spyder.py3compat import builtins
return text in [str(name) for name in dir(builtins)
if not name.startswith('_')] | [
"Test",
"if",
"passed",
"string",
"is",
"the",
"name",
"of",
"a",
"Python",
"builtin",
"object"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L66-L70 | [
"def",
"is_builtin",
"(",
"text",
")",
":",
"from",
"spyder",
".",
"py3compat",
"import",
"builtins",
"return",
"text",
"in",
"[",
"str",
"(",
"name",
")",
"for",
"name",
"in",
"dir",
"(",
"builtins",
")",
"if",
"not",
"name",
".",
"startswith",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.