id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,400 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutFinder.set_text | def set_text(self, text):
"""Set the filter text."""
text = text.strip()
new_text = self.text() + text
self.setText(new_text) | python | def set_text(self, text):
"""Set the filter text."""
text = text.strip()
new_text = self.text() + text
self.setText(new_text) | [
"def",
"set_text",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"text",
".",
"strip",
"(",
")",
"new_text",
"=",
"self",
".",
"text",
"(",
")",
"+",
"text",
"self",
".",
"setText",
"(",
"new_text",
")"
] | Set the filter text. | [
"Set",
"the",
"filter",
"text",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L136-L140 |
31,401 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutEditor.check_singlekey | def check_singlekey(self):
"""Check if the first sub-sequence of the new key sequence is valid."""
if len(self._qsequences) == 0:
return True
else:
keystr = self._qsequences[0]
valid_single_keys = (EDITOR_SINGLE_KEYS if
... | python | def check_singlekey(self):
"""Check if the first sub-sequence of the new key sequence is valid."""
if len(self._qsequences) == 0:
return True
else:
keystr = self._qsequences[0]
valid_single_keys = (EDITOR_SINGLE_KEYS if
... | [
"def",
"check_singlekey",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_qsequences",
")",
"==",
"0",
":",
"return",
"True",
"else",
":",
"keystr",
"=",
"self",
".",
"_qsequences",
"[",
"0",
"]",
"valid_single_keys",
"=",
"(",
"EDITOR_SINGLE_KEY... | Check if the first sub-sequence of the new key sequence is valid. | [
"Check",
"if",
"the",
"first",
"sub",
"-",
"sequence",
"of",
"the",
"new",
"key",
"sequence",
"is",
"valid",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L372-L390 |
31,402 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutEditor.update_warning | def update_warning(self):
"""Update the warning label, buttons state and sequence text."""
new_qsequence = self.new_qsequence
new_sequence = self.new_sequence
self.text_new_sequence.setText(
new_qsequence.toString(QKeySequence.NativeText))
conflicts = self.che... | python | def update_warning(self):
"""Update the warning label, buttons state and sequence text."""
new_qsequence = self.new_qsequence
new_sequence = self.new_sequence
self.text_new_sequence.setText(
new_qsequence.toString(QKeySequence.NativeText))
conflicts = self.che... | [
"def",
"update_warning",
"(",
"self",
")",
":",
"new_qsequence",
"=",
"self",
".",
"new_qsequence",
"new_sequence",
"=",
"self",
".",
"new_sequence",
"self",
".",
"text_new_sequence",
".",
"setText",
"(",
"new_qsequence",
".",
"toString",
"(",
"QKeySequence",
".... | Update the warning label, buttons state and sequence text. | [
"Update",
"the",
"warning",
"label",
"buttons",
"state",
"and",
"sequence",
"text",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L392-L446 |
31,403 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutEditor.set_sequence_from_str | def set_sequence_from_str(self, sequence):
"""
This is a convenience method to set the new QKeySequence of the
shortcut editor from a string.
"""
self._qsequences = [QKeySequence(s) for s in sequence.split(', ')]
self.update_warning() | python | def set_sequence_from_str(self, sequence):
"""
This is a convenience method to set the new QKeySequence of the
shortcut editor from a string.
"""
self._qsequences = [QKeySequence(s) for s in sequence.split(', ')]
self.update_warning() | [
"def",
"set_sequence_from_str",
"(",
"self",
",",
"sequence",
")",
":",
"self",
".",
"_qsequences",
"=",
"[",
"QKeySequence",
"(",
"s",
")",
"for",
"s",
"in",
"sequence",
".",
"split",
"(",
"', '",
")",
"]",
"self",
".",
"update_warning",
"(",
")"
] | This is a convenience method to set the new QKeySequence of the
shortcut editor from a string. | [
"This",
"is",
"a",
"convenience",
"method",
"to",
"set",
"the",
"new",
"QKeySequence",
"of",
"the",
"shortcut",
"editor",
"from",
"a",
"string",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L448-L454 |
31,404 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutEditor.set_sequence_to_default | def set_sequence_to_default(self):
"""Set the new sequence to the default value defined in the config."""
sequence = CONF.get_default(
'shortcuts', "{}/{}".format(self.context, self.name))
self._qsequences = sequence.split(', ')
self.update_warning() | python | def set_sequence_to_default(self):
"""Set the new sequence to the default value defined in the config."""
sequence = CONF.get_default(
'shortcuts', "{}/{}".format(self.context, self.name))
self._qsequences = sequence.split(', ')
self.update_warning() | [
"def",
"set_sequence_to_default",
"(",
"self",
")",
":",
"sequence",
"=",
"CONF",
".",
"get_default",
"(",
"'shortcuts'",
",",
"\"{}/{}\"",
".",
"format",
"(",
"self",
".",
"context",
",",
"self",
".",
"name",
")",
")",
"self",
".",
"_qsequences",
"=",
"... | Set the new sequence to the default value defined in the config. | [
"Set",
"the",
"new",
"sequence",
"to",
"the",
"default",
"value",
"defined",
"in",
"the",
"config",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L456-L461 |
31,405 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutEditor.accept_override | def accept_override(self):
"""Unbind all conflicted shortcuts, and accept the new one"""
conflicts = self.check_conflicts()
if conflicts:
for shortcut in conflicts:
shortcut.key = ''
self.accept() | python | def accept_override(self):
"""Unbind all conflicted shortcuts, and accept the new one"""
conflicts = self.check_conflicts()
if conflicts:
for shortcut in conflicts:
shortcut.key = ''
self.accept() | [
"def",
"accept_override",
"(",
"self",
")",
":",
"conflicts",
"=",
"self",
".",
"check_conflicts",
"(",
")",
"if",
"conflicts",
":",
"for",
"shortcut",
"in",
"conflicts",
":",
"shortcut",
".",
"key",
"=",
"''",
"self",
".",
"accept",
"(",
")"
] | Unbind all conflicted shortcuts, and accept the new one | [
"Unbind",
"all",
"conflicted",
"shortcuts",
"and",
"accept",
"the",
"new",
"one"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L478-L484 |
31,406 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsModel.current_index | def current_index(self):
"""Get the currently selected index in the parent table view."""
i = self._parent.proxy_model.mapToSource(self._parent.currentIndex())
return i | python | def current_index(self):
"""Get the currently selected index in the parent table view."""
i = self._parent.proxy_model.mapToSource(self._parent.currentIndex())
return i | [
"def",
"current_index",
"(",
"self",
")",
":",
"i",
"=",
"self",
".",
"_parent",
".",
"proxy_model",
".",
"mapToSource",
"(",
"self",
".",
"_parent",
".",
"currentIndex",
"(",
")",
")",
"return",
"i"
] | Get the currently selected index in the parent table view. | [
"Get",
"the",
"currently",
"selected",
"index",
"in",
"the",
"parent",
"table",
"view",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L537-L540 |
31,407 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsModel.update_search_letters | def update_search_letters(self, text):
"""Update search letters with text input in search box."""
self.letters = text
names = [shortcut.name for shortcut in self.shortcuts]
results = get_search_scores(text, names, template='<b>{0}</b>')
self.normal_text, self.rich_text, self... | python | def update_search_letters(self, text):
"""Update search letters with text input in search box."""
self.letters = text
names = [shortcut.name for shortcut in self.shortcuts]
results = get_search_scores(text, names, template='<b>{0}</b>')
self.normal_text, self.rich_text, self... | [
"def",
"update_search_letters",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"letters",
"=",
"text",
"names",
"=",
"[",
"shortcut",
".",
"name",
"for",
"shortcut",
"in",
"self",
".",
"shortcuts",
"]",
"results",
"=",
"get_search_scores",
"(",
"text",
... | Update search letters with text input in search box. | [
"Update",
"search",
"letters",
"with",
"text",
"input",
"in",
"search",
"box",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L629-L635 |
31,408 | spyder-ide/spyder | spyder/preferences/shortcuts.py | CustomSortFilterProxy.set_filter | def set_filter(self, text):
"""Set regular expression for filter."""
self.pattern = get_search_regex(text)
if self.pattern:
self._parent.setSortingEnabled(False)
else:
self._parent.setSortingEnabled(True)
self.invalidateFilter() | python | def set_filter(self, text):
"""Set regular expression for filter."""
self.pattern = get_search_regex(text)
if self.pattern:
self._parent.setSortingEnabled(False)
else:
self._parent.setSortingEnabled(True)
self.invalidateFilter() | [
"def",
"set_filter",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"pattern",
"=",
"get_search_regex",
"(",
"text",
")",
"if",
"self",
".",
"pattern",
":",
"self",
".",
"_parent",
".",
"setSortingEnabled",
"(",
"False",
")",
"else",
":",
"self",
"."... | Set regular expression for filter. | [
"Set",
"regular",
"expression",
"for",
"filter",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L659-L666 |
31,409 | spyder-ide/spyder | spyder/preferences/shortcuts.py | CustomSortFilterProxy.filterAcceptsRow | def filterAcceptsRow(self, row_num, parent):
"""Qt override.
Reimplemented from base class to allow the use of custom filtering.
"""
model = self.sourceModel()
name = model.row(row_num).name
r = re.search(self.pattern, name)
if r is None:
r... | python | def filterAcceptsRow(self, row_num, parent):
"""Qt override.
Reimplemented from base class to allow the use of custom filtering.
"""
model = self.sourceModel()
name = model.row(row_num).name
r = re.search(self.pattern, name)
if r is None:
r... | [
"def",
"filterAcceptsRow",
"(",
"self",
",",
"row_num",
",",
"parent",
")",
":",
"model",
"=",
"self",
".",
"sourceModel",
"(",
")",
"name",
"=",
"model",
".",
"row",
"(",
"row_num",
")",
".",
"name",
"r",
"=",
"re",
".",
"search",
"(",
"self",
"."... | Qt override.
Reimplemented from base class to allow the use of custom filtering. | [
"Qt",
"override",
".",
"Reimplemented",
"from",
"base",
"class",
"to",
"allow",
"the",
"use",
"of",
"custom",
"filtering",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L668-L680 |
31,410 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsTable.load_shortcuts | def load_shortcuts(self):
"""Load shortcuts and assign to table model."""
shortcuts = []
for context, name, keystr in iter_shortcuts():
shortcut = Shortcut(context, name, keystr)
shortcuts.append(shortcut)
shortcuts = sorted(shortcuts, key=lambda x: x.contex... | python | def load_shortcuts(self):
"""Load shortcuts and assign to table model."""
shortcuts = []
for context, name, keystr in iter_shortcuts():
shortcut = Shortcut(context, name, keystr)
shortcuts.append(shortcut)
shortcuts = sorted(shortcuts, key=lambda x: x.contex... | [
"def",
"load_shortcuts",
"(",
"self",
")",
":",
"shortcuts",
"=",
"[",
"]",
"for",
"context",
",",
"name",
",",
"keystr",
"in",
"iter_shortcuts",
"(",
")",
":",
"shortcut",
"=",
"Shortcut",
"(",
"context",
",",
"name",
",",
"keystr",
")",
"shortcuts",
... | Load shortcuts and assign to table model. | [
"Load",
"shortcuts",
"and",
"assign",
"to",
"table",
"model",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L737-L752 |
31,411 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsTable.save_shortcuts | def save_shortcuts(self):
"""Save shortcuts from table model."""
self.check_shortcuts()
for shortcut in self.source_model.shortcuts:
shortcut.save() | python | def save_shortcuts(self):
"""Save shortcuts from table model."""
self.check_shortcuts()
for shortcut in self.source_model.shortcuts:
shortcut.save() | [
"def",
"save_shortcuts",
"(",
"self",
")",
":",
"self",
".",
"check_shortcuts",
"(",
")",
"for",
"shortcut",
"in",
"self",
".",
"source_model",
".",
"shortcuts",
":",
"shortcut",
".",
"save",
"(",
")"
] | Save shortcuts from table model. | [
"Save",
"shortcuts",
"from",
"table",
"model",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L777-L781 |
31,412 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsTable.show_editor | def show_editor(self):
"""Create, setup and display the shortcut editor dialog."""
index = self.proxy_model.mapToSource(self.currentIndex())
row, column = index.row(), index.column()
shortcuts = self.source_model.shortcuts
context = shortcuts[row].context
name = sho... | python | def show_editor(self):
"""Create, setup and display the shortcut editor dialog."""
index = self.proxy_model.mapToSource(self.currentIndex())
row, column = index.row(), index.column()
shortcuts = self.source_model.shortcuts
context = shortcuts[row].context
name = sho... | [
"def",
"show_editor",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"proxy_model",
".",
"mapToSource",
"(",
"self",
".",
"currentIndex",
"(",
")",
")",
"row",
",",
"column",
"=",
"index",
".",
"row",
"(",
")",
",",
"index",
".",
"column",
"(",
... | Create, setup and display the shortcut editor dialog. | [
"Create",
"setup",
"and",
"display",
"the",
"shortcut",
"editor",
"dialog",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L783-L798 |
31,413 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsTable.set_regex | def set_regex(self, regex=None, reset=False):
"""Update the regex text for the shortcut finder."""
if reset:
text = ''
else:
text = self.finder.text().replace(' ', '').lower()
self.proxy_model.set_filter(text)
self.source_model.update_search_lette... | python | def set_regex(self, regex=None, reset=False):
"""Update the regex text for the shortcut finder."""
if reset:
text = ''
else:
text = self.finder.text().replace(' ', '').lower()
self.proxy_model.set_filter(text)
self.source_model.update_search_lette... | [
"def",
"set_regex",
"(",
"self",
",",
"regex",
"=",
"None",
",",
"reset",
"=",
"False",
")",
":",
"if",
"reset",
":",
"text",
"=",
"''",
"else",
":",
"text",
"=",
"self",
".",
"finder",
".",
"text",
"(",
")",
".",
"replace",
"(",
"' '",
",",
"'... | Update the regex text for the shortcut finder. | [
"Update",
"the",
"regex",
"text",
"for",
"the",
"shortcut",
"finder",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L800-L813 |
31,414 | spyder-ide/spyder | spyder/preferences/shortcuts.py | ShortcutsConfigPage.reset_to_default | def reset_to_default(self):
"""Reset to default values of the shortcuts making a confirmation."""
reset = QMessageBox.warning(self, _("Shortcuts reset"),
_("Do you want to reset "
"to default values?"),
... | python | def reset_to_default(self):
"""Reset to default values of the shortcuts making a confirmation."""
reset = QMessageBox.warning(self, _("Shortcuts reset"),
_("Do you want to reset "
"to default values?"),
... | [
"def",
"reset_to_default",
"(",
"self",
")",
":",
"reset",
"=",
"QMessageBox",
".",
"warning",
"(",
"self",
",",
"_",
"(",
"\"Shortcuts reset\"",
")",
",",
"_",
"(",
"\"Do you want to reset \"",
"\"to default values?\"",
")",
",",
"QMessageBox",
".",
"Yes",
"|... | Reset to default values of the shortcuts making a confirmation. | [
"Reset",
"to",
"default",
"values",
"of",
"the",
"shortcuts",
"making",
"a",
"confirmation",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L895-L907 |
31,415 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | get_color_scheme | def get_color_scheme(name):
"""Get a color scheme from config using its name"""
name = name.lower()
scheme = {}
for key in COLOR_SCHEME_KEYS:
try:
scheme[key] = CONF.get('appearance', name+'/'+key)
except:
scheme[key] = CONF.get('appearance', 'spyder/'+key... | python | def get_color_scheme(name):
"""Get a color scheme from config using its name"""
name = name.lower()
scheme = {}
for key in COLOR_SCHEME_KEYS:
try:
scheme[key] = CONF.get('appearance', name+'/'+key)
except:
scheme[key] = CONF.get('appearance', 'spyder/'+key... | [
"def",
"get_color_scheme",
"(",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"scheme",
"=",
"{",
"}",
"for",
"key",
"in",
"COLOR_SCHEME_KEYS",
":",
"try",
":",
"scheme",
"[",
"key",
"]",
"=",
"CONF",
".",
"get",
"(",
"'appearance'",... | Get a color scheme from config using its name | [
"Get",
"a",
"color",
"scheme",
"from",
"config",
"using",
"its",
"name"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L88-L97 |
31,416 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | get_code_cell_name | def get_code_cell_name(text):
"""Returns a code cell name from a code cell comment."""
name = text.strip().lstrip("#% ")
if name.startswith("<codecell>"):
name = name[10:].lstrip()
elif name.startswith("In["):
name = name[2:]
if name.endswith("]:"):
name = nam... | python | def get_code_cell_name(text):
"""Returns a code cell name from a code cell comment."""
name = text.strip().lstrip("#% ")
if name.startswith("<codecell>"):
name = name[10:].lstrip()
elif name.startswith("In["):
name = name[2:]
if name.endswith("]:"):
name = nam... | [
"def",
"get_code_cell_name",
"(",
"text",
")",
":",
"name",
"=",
"text",
".",
"strip",
"(",
")",
".",
"lstrip",
"(",
"\"#% \"",
")",
"if",
"name",
".",
"startswith",
"(",
"\"<codecell>\"",
")",
":",
"name",
"=",
"name",
"[",
"10",
":",
"]",
".",
"l... | Returns a code cell name from a code cell comment. | [
"Returns",
"a",
"code",
"cell",
"name",
"from",
"a",
"code",
"cell",
"comment",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L392-L402 |
31,417 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | make_yaml_patterns | def make_yaml_patterns():
"Strongly inspired from sublime highlighter "
kw = any("keyword", [r":|>|-|\||\[|\]|[A-Za-z][\w\s\-\_ ]+(?=:)"])
links = any("normal", [r"#:[^\n]*"])
comment = any("comment", [r"#[^\n]*"])
number = any("number",
[r"\b[+-]?[0-9]+[lL]?\b",
... | python | def make_yaml_patterns():
"Strongly inspired from sublime highlighter "
kw = any("keyword", [r":|>|-|\||\[|\]|[A-Za-z][\w\s\-\_ ]+(?=:)"])
links = any("normal", [r"#:[^\n]*"])
comment = any("comment", [r"#[^\n]*"])
number = any("number",
[r"\b[+-]?[0-9]+[lL]?\b",
... | [
"def",
"make_yaml_patterns",
"(",
")",
":",
"kw",
"=",
"any",
"(",
"\"keyword\"",
",",
"[",
"r\":|>|-|\\||\\[|\\]|[A-Za-z][\\w\\s\\-\\_ ]+(?=:)\"",
"]",
")",
"links",
"=",
"any",
"(",
"\"normal\"",
",",
"[",
"r\"#:[^\\n]*\"",
"]",
")",
"comment",
"=",
"any",
"... | Strongly inspired from sublime highlighter | [
"Strongly",
"inspired",
"from",
"sublime",
"highlighter"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L878-L891 |
31,418 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | guess_pygments_highlighter | def guess_pygments_highlighter(filename):
"""Factory to generate syntax highlighter for the given filename.
If a syntax highlighter is not available for a particular file, this
function will attempt to generate one based on the lexers in Pygments. If
Pygments is not available or does not have an ... | python | def guess_pygments_highlighter(filename):
"""Factory to generate syntax highlighter for the given filename.
If a syntax highlighter is not available for a particular file, this
function will attempt to generate one based on the lexers in Pygments. If
Pygments is not available or does not have an ... | [
"def",
"guess_pygments_highlighter",
"(",
"filename",
")",
":",
"try",
":",
"from",
"pygments",
".",
"lexers",
"import",
"get_lexer_for_filename",
",",
"get_lexer_by_name",
"except",
"Exception",
":",
"return",
"TextSH",
"root",
",",
"ext",
"=",
"os",
".",
"path... | Factory to generate syntax highlighter for the given filename.
If a syntax highlighter is not available for a particular file, this
function will attempt to generate one based on the lexers in Pygments. If
Pygments is not available or does not have an appropriate lexer, TextSH
will be returned in... | [
"Factory",
"to",
"generate",
"syntax",
"highlighter",
"for",
"the",
"given",
"filename",
".",
"If",
"a",
"syntax",
"highlighter",
"is",
"not",
"available",
"for",
"a",
"particular",
"file",
"this",
"function",
"will",
"attempt",
"to",
"generate",
"one",
"based... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1233-L1259 |
31,419 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | FortranSH.highlight_block | def highlight_block(self, text):
"""Implement highlight specific for Fortran."""
text = to_text_string(text)
self.setFormat(0, len(text), self.formats["normal"])
match = self.PROG.search(text)
index = 0
while match:
for key, value in list(matc... | python | def highlight_block(self, text):
"""Implement highlight specific for Fortran."""
text = to_text_string(text)
self.setFormat(0, len(text), self.formats["normal"])
match = self.PROG.search(text)
index = 0
while match:
for key, value in list(matc... | [
"def",
"highlight_block",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"to_text_string",
"(",
"text",
")",
"self",
".",
"setFormat",
"(",
"0",
",",
"len",
"(",
"text",
")",
",",
"self",
".",
"formats",
"[",
"\"normal\"",
"]",
")",
"match",
"=",
... | Implement highlight specific for Fortran. | [
"Implement",
"highlight",
"specific",
"for",
"Fortran",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L733-L755 |
31,420 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | Fortran77SH.highlight_block | def highlight_block(self, text):
"""Implement highlight specific for Fortran77."""
text = to_text_string(text)
if text.startswith(("c", "C")):
self.setFormat(0, len(text), self.formats["comment"])
self.highlight_spaces(text)
else:
FortranSH.high... | python | def highlight_block(self, text):
"""Implement highlight specific for Fortran77."""
text = to_text_string(text)
if text.startswith(("c", "C")):
self.setFormat(0, len(text), self.formats["comment"])
self.highlight_spaces(text)
else:
FortranSH.high... | [
"def",
"highlight_block",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"to_text_string",
"(",
"text",
")",
"if",
"text",
".",
"startswith",
"(",
"(",
"\"c\"",
",",
"\"C\"",
")",
")",
":",
"self",
".",
"setFormat",
"(",
"0",
",",
"len",
"(",
"te... | Implement highlight specific for Fortran77. | [
"Implement",
"highlight",
"specific",
"for",
"Fortran77",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L759-L769 |
31,421 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | BaseWebSH.highlight_block | def highlight_block(self, text):
"""Implement highlight specific for CSS and HTML."""
text = to_text_string(text)
previous_state = tbh.get_state(self.currentBlock().previous())
if previous_state == self.COMMENT:
self.setFormat(0, len(text), self.formats["commen... | python | def highlight_block(self, text):
"""Implement highlight specific for CSS and HTML."""
text = to_text_string(text)
previous_state = tbh.get_state(self.currentBlock().previous())
if previous_state == self.COMMENT:
self.setFormat(0, len(text), self.formats["commen... | [
"def",
"highlight_block",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"to_text_string",
"(",
"text",
")",
"previous_state",
"=",
"tbh",
".",
"get_state",
"(",
"self",
".",
"currentBlock",
"(",
")",
".",
"previous",
"(",
")",
")",
"if",
"previous_sta... | Implement highlight specific for CSS and HTML. | [
"Implement",
"highlight",
"specific",
"for",
"CSS",
"and",
"HTML",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L911-L960 |
31,422 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | PygmentsSH.make_charlist | def make_charlist(self):
"""Parses the complete text and stores format for each character."""
def worker_output(worker, output, error):
"""Worker finished callback."""
self._charlist = output
if error is None and output:
self._allow_highlight =... | python | def make_charlist(self):
"""Parses the complete text and stores format for each character."""
def worker_output(worker, output, error):
"""Worker finished callback."""
self._charlist = output
if error is None and output:
self._allow_highlight =... | [
"def",
"make_charlist",
"(",
"self",
")",
":",
"def",
"worker_output",
"(",
"worker",
",",
"output",
",",
"error",
")",
":",
"\"\"\"Worker finished callback.\"\"\"",
"self",
".",
"_charlist",
"=",
"output",
"if",
"error",
"is",
"None",
"and",
"output",
":",
... | Parses the complete text and stores format for each character. | [
"Parses",
"the",
"complete",
"text",
"and",
"stores",
"format",
"for",
"each",
"character",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1161-L1186 |
31,423 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | PygmentsSH._make_charlist | def _make_charlist(self, tokens, tokmap, formats):
"""
Parses the complete text and stores format for each character.
Uses the attached lexer to parse into a list of tokens and Pygments
token types. Then breaks tokens into individual letters, each with a
Spyder token type... | python | def _make_charlist(self, tokens, tokmap, formats):
"""
Parses the complete text and stores format for each character.
Uses the attached lexer to parse into a list of tokens and Pygments
token types. Then breaks tokens into individual letters, each with a
Spyder token type... | [
"def",
"_make_charlist",
"(",
"self",
",",
"tokens",
",",
"tokmap",
",",
"formats",
")",
":",
"def",
"_get_fmt",
"(",
"typ",
")",
":",
"\"\"\"Get the Spyder format code for the given Pygments token type.\"\"\"",
"# Exact matches first\r",
"if",
"typ",
"in",
"tokmap",
... | Parses the complete text and stores format for each character.
Uses the attached lexer to parse into a list of tokens and Pygments
token types. Then breaks tokens into individual letters, each with a
Spyder token type attached. Stores this list as self._charlist.
It's attached ... | [
"Parses",
"the",
"complete",
"text",
"and",
"stores",
"format",
"for",
"each",
"character",
".",
"Uses",
"the",
"attached",
"lexer",
"to",
"parse",
"into",
"a",
"list",
"of",
"tokens",
"and",
"Pygments",
"token",
"types",
".",
"Then",
"breaks",
"tokens",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1188-L1218 |
31,424 | spyder-ide/spyder | spyder/utils/syntaxhighlighters.py | PygmentsSH.highlightBlock | def highlightBlock(self, text):
""" Actually highlight the block"""
# Note that an undefined blockstate is equal to -1, so the first block
# will have the correct behaviour of starting at 0.
if self._allow_highlight:
start = self.previousBlockState() + 1
end... | python | def highlightBlock(self, text):
""" Actually highlight the block"""
# Note that an undefined blockstate is equal to -1, so the first block
# will have the correct behaviour of starting at 0.
if self._allow_highlight:
start = self.previousBlockState() + 1
end... | [
"def",
"highlightBlock",
"(",
"self",
",",
"text",
")",
":",
"# Note that an undefined blockstate is equal to -1, so the first block\r",
"# will have the correct behaviour of starting at 0.\r",
"if",
"self",
".",
"_allow_highlight",
":",
"start",
"=",
"self",
".",
"previousBloc... | Actually highlight the block | [
"Actually",
"highlight",
"the",
"block"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1220-L1230 |
31,425 | spyder-ide/spyder | spyder/utils/introspection/module_completion.py | get_submodules | def get_submodules(mod):
"""Get all submodules of a given module"""
def catch_exceptions(module):
pass
try:
m = __import__(mod)
submodules = [mod]
submods = pkgutil.walk_packages(m.__path__, m.__name__ + '.',
catch_exceptions)
... | python | def get_submodules(mod):
"""Get all submodules of a given module"""
def catch_exceptions(module):
pass
try:
m = __import__(mod)
submodules = [mod]
submods = pkgutil.walk_packages(m.__path__, m.__name__ + '.',
catch_exceptions)
... | [
"def",
"get_submodules",
"(",
"mod",
")",
":",
"def",
"catch_exceptions",
"(",
"module",
")",
":",
"pass",
"try",
":",
"m",
"=",
"__import__",
"(",
"mod",
")",
"submodules",
"=",
"[",
"mod",
"]",
"submods",
"=",
"pkgutil",
".",
"walk_packages",
"(",
"m... | Get all submodules of a given module | [
"Get",
"all",
"submodules",
"of",
"a",
"given",
"module"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/module_completion.py#L34-L51 |
31,426 | spyder-ide/spyder | spyder/utils/introspection/module_completion.py | get_preferred_submodules | def get_preferred_submodules():
"""
Get all submodules of the main scientific modules and others of our
interest
"""
# Path to the modules database
modules_path = get_conf_path('db')
# Modules database
modules_db = PickleShareDB(modules_path)
if 'submodules' in modules_d... | python | def get_preferred_submodules():
"""
Get all submodules of the main scientific modules and others of our
interest
"""
# Path to the modules database
modules_path = get_conf_path('db')
# Modules database
modules_db = PickleShareDB(modules_path)
if 'submodules' in modules_d... | [
"def",
"get_preferred_submodules",
"(",
")",
":",
"# Path to the modules database\r",
"modules_path",
"=",
"get_conf_path",
"(",
"'db'",
")",
"# Modules database\r",
"modules_db",
"=",
"PickleShareDB",
"(",
"modules_path",
")",
"if",
"'submodules'",
"in",
"modules_db",
... | Get all submodules of the main scientific modules and others of our
interest | [
"Get",
"all",
"submodules",
"of",
"the",
"main",
"scientific",
"modules",
"and",
"others",
"of",
"our",
"interest"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/introspection/module_completion.py#L54-L75 |
31,427 | spyder-ide/spyder | spyder/config/base.py | use_dev_config_dir | def use_dev_config_dir(use_dev_config_dir=USE_DEV_CONFIG_DIR):
"""Return whether the dev configuration directory should used."""
if use_dev_config_dir is not None:
if use_dev_config_dir.lower() in {'false', '0'}:
use_dev_config_dir = False
else:
use_dev_config_dir = DEV or ... | python | def use_dev_config_dir(use_dev_config_dir=USE_DEV_CONFIG_DIR):
"""Return whether the dev configuration directory should used."""
if use_dev_config_dir is not None:
if use_dev_config_dir.lower() in {'false', '0'}:
use_dev_config_dir = False
else:
use_dev_config_dir = DEV or ... | [
"def",
"use_dev_config_dir",
"(",
"use_dev_config_dir",
"=",
"USE_DEV_CONFIG_DIR",
")",
":",
"if",
"use_dev_config_dir",
"is",
"not",
"None",
":",
"if",
"use_dev_config_dir",
".",
"lower",
"(",
")",
"in",
"{",
"'false'",
",",
"'0'",
"}",
":",
"use_dev_config_dir... | Return whether the dev configuration directory should used. | [
"Return",
"whether",
"the",
"dev",
"configuration",
"directory",
"should",
"used",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L77-L84 |
31,428 | spyder-ide/spyder | spyder/config/base.py | debug_print | def debug_print(*message):
"""Output debug messages to stdout"""
warnings.warn("debug_print is deprecated; use the logging module instead.")
if get_debug_level():
ss = STDOUT
if PY3:
# This is needed after restarting and using debug_print
for m in message:
... | python | def debug_print(*message):
"""Output debug messages to stdout"""
warnings.warn("debug_print is deprecated; use the logging module instead.")
if get_debug_level():
ss = STDOUT
if PY3:
# This is needed after restarting and using debug_print
for m in message:
... | [
"def",
"debug_print",
"(",
"*",
"message",
")",
":",
"warnings",
".",
"warn",
"(",
"\"debug_print is deprecated; use the logging module instead.\"",
")",
"if",
"get_debug_level",
"(",
")",
":",
"ss",
"=",
"STDOUT",
"if",
"PY3",
":",
"# This is needed after restarting ... | Output debug messages to stdout | [
"Output",
"debug",
"messages",
"to",
"stdout"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L102-L113 |
31,429 | spyder-ide/spyder | spyder/config/base.py | get_home_dir | def get_home_dir():
"""
Return user home directory
"""
try:
# expanduser() returns a raw byte string which needs to be
# decoded with the codec that the OS is using to represent
# file paths.
path = encoding.to_unicode_from_fs(osp.expanduser('~'))
except Exce... | python | def get_home_dir():
"""
Return user home directory
"""
try:
# expanduser() returns a raw byte string which needs to be
# decoded with the codec that the OS is using to represent
# file paths.
path = encoding.to_unicode_from_fs(osp.expanduser('~'))
except Exce... | [
"def",
"get_home_dir",
"(",
")",
":",
"try",
":",
"# expanduser() returns a raw byte string which needs to be\r",
"# decoded with the codec that the OS is using to represent\r",
"# file paths.\r",
"path",
"=",
"encoding",
".",
"to_unicode_from_fs",
"(",
"osp",
".",
"expanduser",
... | Return user home directory | [
"Return",
"user",
"home",
"directory"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L145-L174 |
31,430 | spyder-ide/spyder | spyder/config/base.py | get_clean_conf_dir | def get_clean_conf_dir():
"""
Return the path to a temp clean configuration dir, for tests and safe mode.
"""
if sys.platform.startswith("win"):
current_user = ''
else:
current_user = '-' + str(getpass.getuser())
conf_dir = osp.join(str(tempfile.gettempdir()),
... | python | def get_clean_conf_dir():
"""
Return the path to a temp clean configuration dir, for tests and safe mode.
"""
if sys.platform.startswith("win"):
current_user = ''
else:
current_user = '-' + str(getpass.getuser())
conf_dir = osp.join(str(tempfile.gettempdir()),
... | [
"def",
"get_clean_conf_dir",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"current_user",
"=",
"''",
"else",
":",
"current_user",
"=",
"'-'",
"+",
"str",
"(",
"getpass",
".",
"getuser",
"(",
")",
")",
"conf_... | Return the path to a temp clean configuration dir, for tests and safe mode. | [
"Return",
"the",
"path",
"to",
"a",
"temp",
"clean",
"configuration",
"dir",
"for",
"tests",
"and",
"safe",
"mode",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L177-L189 |
31,431 | spyder-ide/spyder | spyder/config/base.py | get_conf_path | def get_conf_path(filename=None):
"""Return absolute path to the config file with the specified filename."""
# Define conf_dir
if running_under_pytest() or SAFE_MODE:
# Use clean config dir if running tests or the user requests it.
conf_dir = get_clean_conf_dir()
elif sys.platform.... | python | def get_conf_path(filename=None):
"""Return absolute path to the config file with the specified filename."""
# Define conf_dir
if running_under_pytest() or SAFE_MODE:
# Use clean config dir if running tests or the user requests it.
conf_dir = get_clean_conf_dir()
elif sys.platform.... | [
"def",
"get_conf_path",
"(",
"filename",
"=",
"None",
")",
":",
"# Define conf_dir\r",
"if",
"running_under_pytest",
"(",
")",
"or",
"SAFE_MODE",
":",
"# Use clean config dir if running tests or the user requests it.\r",
"conf_dir",
"=",
"get_clean_conf_dir",
"(",
")",
"e... | Return absolute path to the config file with the specified filename. | [
"Return",
"absolute",
"path",
"to",
"the",
"config",
"file",
"with",
"the",
"specified",
"filename",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L192-L219 |
31,432 | spyder-ide/spyder | spyder/config/base.py | get_image_path | def get_image_path(name, default="not_found.png"):
"""Return image absolute path"""
for img_path in IMG_PATH:
full_path = osp.join(img_path, name)
if osp.isfile(full_path):
return osp.abspath(full_path)
if default is not None:
img_path = osp.join(get_module_path('s... | python | def get_image_path(name, default="not_found.png"):
"""Return image absolute path"""
for img_path in IMG_PATH:
full_path = osp.join(img_path, name)
if osp.isfile(full_path):
return osp.abspath(full_path)
if default is not None:
img_path = osp.join(get_module_path('s... | [
"def",
"get_image_path",
"(",
"name",
",",
"default",
"=",
"\"not_found.png\"",
")",
":",
"for",
"img_path",
"in",
"IMG_PATH",
":",
"full_path",
"=",
"osp",
".",
"join",
"(",
"img_path",
",",
"name",
")",
"if",
"osp",
".",
"isfile",
"(",
"full_path",
")"... | Return image absolute path | [
"Return",
"image",
"absolute",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L289-L297 |
31,433 | spyder-ide/spyder | spyder/config/base.py | get_available_translations | def get_available_translations():
"""
List available translations for spyder based on the folders found in the
locale folder. This function checks if LANGUAGE_CODES contain the same
information that is found in the 'locale' folder to ensure that when a new
language is added, LANGUAGE_CODES is u... | python | def get_available_translations():
"""
List available translations for spyder based on the folders found in the
locale folder. This function checks if LANGUAGE_CODES contain the same
information that is found in the 'locale' folder to ensure that when a new
language is added, LANGUAGE_CODES is u... | [
"def",
"get_available_translations",
"(",
")",
":",
"locale_path",
"=",
"get_module_data_path",
"(",
"\"spyder\"",
",",
"relpath",
"=",
"\"locale\"",
",",
"attr_name",
"=",
"'LOCALEPATH'",
")",
"listdir",
"=",
"os",
".",
"listdir",
"(",
"locale_path",
")",
"lang... | List available translations for spyder based on the folders found in the
locale folder. This function checks if LANGUAGE_CODES contain the same
information that is found in the 'locale' folder to ensure that when a new
language is added, LANGUAGE_CODES is updated. | [
"List",
"available",
"translations",
"for",
"spyder",
"based",
"on",
"the",
"folders",
"found",
"in",
"the",
"locale",
"folder",
".",
"This",
"function",
"checks",
"if",
"LANGUAGE_CODES",
"contain",
"the",
"same",
"information",
"that",
"is",
"found",
"in",
"t... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L322-L346 |
31,434 | spyder-ide/spyder | spyder/config/base.py | load_lang_conf | def load_lang_conf():
"""
Load language setting from language config file if it exists, otherwise
try to use the local settings if Spyder provides a translation, or
return the default if no translation provided.
"""
if osp.isfile(LANG_FILE):
with open(LANG_FILE, 'r') as f:
... | python | def load_lang_conf():
"""
Load language setting from language config file if it exists, otherwise
try to use the local settings if Spyder provides a translation, or
return the default if no translation provided.
"""
if osp.isfile(LANG_FILE):
with open(LANG_FILE, 'r') as f:
... | [
"def",
"load_lang_conf",
"(",
")",
":",
"if",
"osp",
".",
"isfile",
"(",
"LANG_FILE",
")",
":",
"with",
"open",
"(",
"LANG_FILE",
",",
"'r'",
")",
"as",
"f",
":",
"lang",
"=",
"f",
".",
"read",
"(",
")",
"else",
":",
"lang",
"=",
"get_interface_lan... | Load language setting from language config file if it exists, otherwise
try to use the local settings if Spyder provides a translation, or
return the default if no translation provided. | [
"Load",
"language",
"setting",
"from",
"language",
"config",
"file",
"if",
"it",
"exists",
"otherwise",
"try",
"to",
"use",
"the",
"local",
"settings",
"if",
"Spyder",
"provides",
"a",
"translation",
"or",
"return",
"the",
"default",
"if",
"no",
"translation",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L401-L419 |
31,435 | spyder-ide/spyder | spyder/config/base.py | reset_config_files | def reset_config_files():
"""Remove all config files"""
print("*** Reset Spyder settings to defaults ***", file=STDERR)
for fname in SAVED_CONFIG_FILES:
cfg_fname = get_conf_path(fname)
if osp.isfile(cfg_fname) or osp.islink(cfg_fname):
os.remove(cfg_fname)
elif os... | python | def reset_config_files():
"""Remove all config files"""
print("*** Reset Spyder settings to defaults ***", file=STDERR)
for fname in SAVED_CONFIG_FILES:
cfg_fname = get_conf_path(fname)
if osp.isfile(cfg_fname) or osp.islink(cfg_fname):
os.remove(cfg_fname)
elif os... | [
"def",
"reset_config_files",
"(",
")",
":",
"print",
"(",
"\"*** Reset Spyder settings to defaults ***\"",
",",
"file",
"=",
"STDERR",
")",
"for",
"fname",
"in",
"SAVED_CONFIG_FILES",
":",
"cfg_fname",
"=",
"get_conf_path",
"(",
"fname",
")",
"if",
"osp",
".",
"... | Remove all config files | [
"Remove",
"all",
"config",
"files"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/base.py#L512-L523 |
31,436 | spyder-ide/spyder | spyder/plugins/explorer/plugin.py | Explorer.refresh_plugin | def refresh_plugin(self, new_path=None, force_current=True):
"""Refresh explorer widget"""
self.fileexplorer.treewidget.update_history(new_path)
self.fileexplorer.treewidget.refresh(new_path,
force_current=force_current) | python | def refresh_plugin(self, new_path=None, force_current=True):
"""Refresh explorer widget"""
self.fileexplorer.treewidget.update_history(new_path)
self.fileexplorer.treewidget.refresh(new_path,
force_current=force_current) | [
"def",
"refresh_plugin",
"(",
"self",
",",
"new_path",
"=",
"None",
",",
"force_current",
"=",
"True",
")",
":",
"self",
".",
"fileexplorer",
".",
"treewidget",
".",
"update_history",
"(",
"new_path",
")",
"self",
".",
"fileexplorer",
".",
"treewidget",
".",... | Refresh explorer widget | [
"Refresh",
"explorer",
"widget"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/plugin.py#L108-L112 |
31,437 | spyder-ide/spyder | spyder/py3compat.py | is_type_text_string | def is_type_text_string(obj):
"""Return True if `obj` is type text string, False if it is anything else,
like an instance of a class that extends the basestring class."""
if PY2:
# Python 2
return type(obj) in [str, unicode]
else:
# Python 3
return type(obj) in [s... | python | def is_type_text_string(obj):
"""Return True if `obj` is type text string, False if it is anything else,
like an instance of a class that extends the basestring class."""
if PY2:
# Python 2
return type(obj) in [str, unicode]
else:
# Python 3
return type(obj) in [s... | [
"def",
"is_type_text_string",
"(",
"obj",
")",
":",
"if",
"PY2",
":",
"# Python 2\r",
"return",
"type",
"(",
"obj",
")",
"in",
"[",
"str",
",",
"unicode",
"]",
"else",
":",
"# Python 3\r",
"return",
"type",
"(",
"obj",
")",
"in",
"[",
"str",
",",
"by... | Return True if `obj` is type text string, False if it is anything else,
like an instance of a class that extends the basestring class. | [
"Return",
"True",
"if",
"obj",
"is",
"type",
"text",
"string",
"False",
"if",
"it",
"is",
"anything",
"else",
"like",
"an",
"instance",
"of",
"a",
"class",
"that",
"extends",
"the",
"basestring",
"class",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/py3compat.py#L87-L95 |
31,438 | spyder-ide/spyder | spyder/plugins/onlinehelp/onlinehelp.py | OnlineHelp.get_focus_widget | def get_focus_widget(self):
"""
Return the widget to give focus to when
this plugin's dockwidget is raised on top-level
"""
self.pydocbrowser.url_combo.lineEdit().selectAll()
return self.pydocbrowser.url_combo | python | def get_focus_widget(self):
"""
Return the widget to give focus to when
this plugin's dockwidget is raised on top-level
"""
self.pydocbrowser.url_combo.lineEdit().selectAll()
return self.pydocbrowser.url_combo | [
"def",
"get_focus_widget",
"(",
"self",
")",
":",
"self",
".",
"pydocbrowser",
".",
"url_combo",
".",
"lineEdit",
"(",
")",
".",
"selectAll",
"(",
")",
"return",
"self",
".",
"pydocbrowser",
".",
"url_combo"
] | Return the widget to give focus to when
this plugin's dockwidget is raised on top-level | [
"Return",
"the",
"widget",
"to",
"give",
"focus",
"to",
"when",
"this",
"plugin",
"s",
"dockwidget",
"is",
"raised",
"on",
"top",
"-",
"level"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/onlinehelp/onlinehelp.py#L75-L81 |
31,439 | spyder-ide/spyder | spyder/widgets/pathmanager.py | PathManager.update_list | def update_list(self):
"""Update path list"""
self.listwidget.clear()
for name in self.pathlist+self.ro_pathlist:
item = QListWidgetItem(name)
item.setIcon(ima.icon('DirClosedIcon'))
if name in self.ro_pathlist:
item.setFlags(Qt.NoItemFl... | python | def update_list(self):
"""Update path list"""
self.listwidget.clear()
for name in self.pathlist+self.ro_pathlist:
item = QListWidgetItem(name)
item.setIcon(ima.icon('DirClosedIcon'))
if name in self.ro_pathlist:
item.setFlags(Qt.NoItemFl... | [
"def",
"update_list",
"(",
"self",
")",
":",
"self",
".",
"listwidget",
".",
"clear",
"(",
")",
"for",
"name",
"in",
"self",
".",
"pathlist",
"+",
"self",
".",
"ro_pathlist",
":",
"item",
"=",
"QListWidgetItem",
"(",
"name",
")",
"item",
".",
"setIcon"... | Update path list | [
"Update",
"path",
"list"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/pathmanager.py#L204-L220 |
31,440 | spyder-ide/spyder | spyder/widgets/tabs.py | EditTabNamePopup.eventFilter | def eventFilter(self, widget, event):
"""Catch clicks outside the object and ESC key press."""
if ((event.type() == QEvent.MouseButtonPress and
not self.geometry().contains(event.globalPos())) or
(event.type() == QEvent.KeyPress and
event.key() == Q... | python | def eventFilter(self, widget, event):
"""Catch clicks outside the object and ESC key press."""
if ((event.type() == QEvent.MouseButtonPress and
not self.geometry().contains(event.globalPos())) or
(event.type() == QEvent.KeyPress and
event.key() == Q... | [
"def",
"eventFilter",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"if",
"(",
"(",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"MouseButtonPress",
"and",
"not",
"self",
".",
"geometry",
"(",
")",
".",
"contains",
"(",
"event",
".",
... | Catch clicks outside the object and ESC key press. | [
"Catch",
"clicks",
"outside",
"the",
"object",
"and",
"ESC",
"key",
"press",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L77-L89 |
31,441 | spyder-ide/spyder | spyder/widgets/tabs.py | EditTabNamePopup.edit_tab | def edit_tab(self, index):
"""Activate the edit tab."""
# Sets focus, shows cursor
self.setFocus(True)
# Updates tab index
self.tab_index = index
# Gets tab size and shrinks to avoid overlapping tab borders
rect = self.main.tabRect(index)
rec... | python | def edit_tab(self, index):
"""Activate the edit tab."""
# Sets focus, shows cursor
self.setFocus(True)
# Updates tab index
self.tab_index = index
# Gets tab size and shrinks to avoid overlapping tab borders
rect = self.main.tabRect(index)
rec... | [
"def",
"edit_tab",
"(",
"self",
",",
"index",
")",
":",
"# Sets focus, shows cursor\r",
"self",
".",
"setFocus",
"(",
"True",
")",
"# Updates tab index\r",
"self",
".",
"tab_index",
"=",
"index",
"# Gets tab size and shrinks to avoid overlapping tab borders\r",
"rect",
... | Activate the edit tab. | [
"Activate",
"the",
"edit",
"tab",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L91-L121 |
31,442 | spyder-ide/spyder | spyder/widgets/tabs.py | EditTabNamePopup.edit_finished | def edit_finished(self):
"""On clean exit, update tab name."""
# Hides editor
self.hide()
if isinstance(self.tab_index, int) and self.tab_index >= 0:
# We are editing a valid tab, update name
tab_text = to_text_string(self.text())
self.main.se... | python | def edit_finished(self):
"""On clean exit, update tab name."""
# Hides editor
self.hide()
if isinstance(self.tab_index, int) and self.tab_index >= 0:
# We are editing a valid tab, update name
tab_text = to_text_string(self.text())
self.main.se... | [
"def",
"edit_finished",
"(",
"self",
")",
":",
"# Hides editor\r",
"self",
".",
"hide",
"(",
")",
"if",
"isinstance",
"(",
"self",
".",
"tab_index",
",",
"int",
")",
"and",
"self",
".",
"tab_index",
">=",
"0",
":",
"# We are editing a valid tab, update name\r"... | On clean exit, update tab name. | [
"On",
"clean",
"exit",
"update",
"tab",
"name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L123-L132 |
31,443 | spyder-ide/spyder | spyder/widgets/tabs.py | TabBar.mouseDoubleClickEvent | def mouseDoubleClickEvent(self, event):
"""Override Qt method to trigger the tab name editor."""
if self.rename_tabs is True and \
event.buttons() == Qt.MouseButtons(Qt.LeftButton):
# Tab index
index = self.tabAt(event.pos())
if index >= 0:
... | python | def mouseDoubleClickEvent(self, event):
"""Override Qt method to trigger the tab name editor."""
if self.rename_tabs is True and \
event.buttons() == Qt.MouseButtons(Qt.LeftButton):
# Tab index
index = self.tabAt(event.pos())
if index >= 0:
... | [
"def",
"mouseDoubleClickEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"rename_tabs",
"is",
"True",
"and",
"event",
".",
"buttons",
"(",
")",
"==",
"Qt",
".",
"MouseButtons",
"(",
"Qt",
".",
"LeftButton",
")",
":",
"# Tab index\r",
"inde... | Override Qt method to trigger the tab name editor. | [
"Override",
"Qt",
"method",
"to",
"trigger",
"the",
"tab",
"name",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L230-L241 |
31,444 | spyder-ide/spyder | spyder/widgets/tabs.py | BaseTabs.update_browse_tabs_menu | def update_browse_tabs_menu(self):
"""Update browse tabs menu"""
self.browse_tabs_menu.clear()
names = []
dirnames = []
for index in range(self.count()):
if self.menu_use_tooltips:
text = to_text_string(self.tabToolTip(index))
else:... | python | def update_browse_tabs_menu(self):
"""Update browse tabs menu"""
self.browse_tabs_menu.clear()
names = []
dirnames = []
for index in range(self.count()):
if self.menu_use_tooltips:
text = to_text_string(self.tabToolTip(index))
else:... | [
"def",
"update_browse_tabs_menu",
"(",
"self",
")",
":",
"self",
".",
"browse_tabs_menu",
".",
"clear",
"(",
")",
"names",
"=",
"[",
"]",
"dirnames",
"=",
"[",
"]",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"count",
"(",
")",
")",
":",
"if",
... | Update browse tabs menu | [
"Update",
"browse",
"tabs",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L288-L322 |
31,445 | spyder-ide/spyder | spyder/widgets/tabs.py | BaseTabs.tab_navigate | def tab_navigate(self, delta=1):
"""Ctrl+Tab"""
if delta > 0 and self.currentIndex() == self.count()-1:
index = delta-1
elif delta < 0 and self.currentIndex() == 0:
index = self.count()+delta
else:
index = self.currentIndex()+delta
self... | python | def tab_navigate(self, delta=1):
"""Ctrl+Tab"""
if delta > 0 and self.currentIndex() == self.count()-1:
index = delta-1
elif delta < 0 and self.currentIndex() == 0:
index = self.count()+delta
else:
index = self.currentIndex()+delta
self... | [
"def",
"tab_navigate",
"(",
"self",
",",
"delta",
"=",
"1",
")",
":",
"if",
"delta",
">",
"0",
"and",
"self",
".",
"currentIndex",
"(",
")",
"==",
"self",
".",
"count",
"(",
")",
"-",
"1",
":",
"index",
"=",
"delta",
"-",
"1",
"elif",
"delta",
... | Ctrl+Tab | [
"Ctrl",
"+",
"Tab"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L394-L402 |
31,446 | spyder-ide/spyder | spyder/widgets/tabs.py | BaseTabs.set_close_function | def set_close_function(self, func):
"""Setting Tabs close function
None -> tabs are not closable"""
state = func is not None
if state:
self.sig_close_tab.connect(func)
try:
# Assuming Qt >= 4.5
QTabWidget.setTabsClosable(self, state)
... | python | def set_close_function(self, func):
"""Setting Tabs close function
None -> tabs are not closable"""
state = func is not None
if state:
self.sig_close_tab.connect(func)
try:
# Assuming Qt >= 4.5
QTabWidget.setTabsClosable(self, state)
... | [
"def",
"set_close_function",
"(",
"self",
",",
"func",
")",
":",
"state",
"=",
"func",
"is",
"not",
"None",
"if",
"state",
":",
"self",
".",
"sig_close_tab",
".",
"connect",
"(",
"func",
")",
"try",
":",
"# Assuming Qt >= 4.5\r",
"QTabWidget",
".",
"setTab... | Setting Tabs close function
None -> tabs are not closable | [
"Setting",
"Tabs",
"close",
"function",
"None",
"-",
">",
"tabs",
"are",
"not",
"closable"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L404-L419 |
31,447 | spyder-ide/spyder | spyder/widgets/tabs.py | Tabs.move_tab | def move_tab(self, index_from, index_to):
"""Move tab inside a tabwidget"""
self.move_data.emit(index_from, index_to)
tip, text = self.tabToolTip(index_from), self.tabText(index_from)
icon, widget = self.tabIcon(index_from), self.widget(index_from)
current_widget = self.cu... | python | def move_tab(self, index_from, index_to):
"""Move tab inside a tabwidget"""
self.move_data.emit(index_from, index_to)
tip, text = self.tabToolTip(index_from), self.tabText(index_from)
icon, widget = self.tabIcon(index_from), self.widget(index_from)
current_widget = self.cu... | [
"def",
"move_tab",
"(",
"self",
",",
"index_from",
",",
"index_to",
")",
":",
"self",
".",
"move_data",
".",
"emit",
"(",
"index_from",
",",
"index_to",
")",
"tip",
",",
"text",
"=",
"self",
".",
"tabToolTip",
"(",
"index_from",
")",
",",
"self",
".",
... | Move tab inside a tabwidget | [
"Move",
"tab",
"inside",
"a",
"tabwidget"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L454-L467 |
31,448 | spyder-ide/spyder | spyder/widgets/tabs.py | Tabs.move_tab_from_another_tabwidget | def move_tab_from_another_tabwidget(self, tabwidget_from,
index_from, index_to):
"""Move tab from a tabwidget to another"""
# We pass self object IDs as QString objs, because otherwise it would
# depend on the platform: long for 64bit, i... | python | def move_tab_from_another_tabwidget(self, tabwidget_from,
index_from, index_to):
"""Move tab from a tabwidget to another"""
# We pass self object IDs as QString objs, because otherwise it would
# depend on the platform: long for 64bit, i... | [
"def",
"move_tab_from_another_tabwidget",
"(",
"self",
",",
"tabwidget_from",
",",
"index_from",
",",
"index_to",
")",
":",
"# We pass self object IDs as QString objs, because otherwise it would \r",
"# depend on the platform: long for 64bit, int for 32bit. Replacing \r",
"# by long all ... | Move tab from a tabwidget to another | [
"Move",
"tab",
"from",
"a",
"tabwidget",
"to",
"another"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/tabs.py#L470-L479 |
31,449 | spyder-ide/spyder | spyder/preferences/runconfig.py | BaseRunConfigDialog.add_button_box | def add_button_box(self, stdbtns):
"""Create dialog button box and add it to the dialog layout"""
bbox = QDialogButtonBox(stdbtns)
run_btn = bbox.addButton(_("Run"), QDialogButtonBox.AcceptRole)
run_btn.clicked.connect(self.run_btn_clicked)
bbox.accepted.connect(self.accept)... | python | def add_button_box(self, stdbtns):
"""Create dialog button box and add it to the dialog layout"""
bbox = QDialogButtonBox(stdbtns)
run_btn = bbox.addButton(_("Run"), QDialogButtonBox.AcceptRole)
run_btn.clicked.connect(self.run_btn_clicked)
bbox.accepted.connect(self.accept)... | [
"def",
"add_button_box",
"(",
"self",
",",
"stdbtns",
")",
":",
"bbox",
"=",
"QDialogButtonBox",
"(",
"stdbtns",
")",
"run_btn",
"=",
"bbox",
".",
"addButton",
"(",
"_",
"(",
"\"Run\"",
")",
",",
"QDialogButtonBox",
".",
"AcceptRole",
")",
"run_btn",
".",
... | Create dialog button box and add it to the dialog layout | [
"Create",
"dialog",
"button",
"box",
"and",
"add",
"it",
"to",
"the",
"dialog",
"layout"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/runconfig.py#L351-L361 |
31,450 | spyder-ide/spyder | spyder/plugins/editor/panels/linenumber.py | LineNumberArea.compute_width | def compute_width(self):
"""Compute and return line number area width"""
if not self._enabled:
return 0
digits = 1
maxb = max(1, self.editor.blockCount())
while maxb >= 10:
maxb /= 10
digits += 1
if self._margin:
margin = 3+... | python | def compute_width(self):
"""Compute and return line number area width"""
if not self._enabled:
return 0
digits = 1
maxb = max(1, self.editor.blockCount())
while maxb >= 10:
maxb /= 10
digits += 1
if self._margin:
margin = 3+... | [
"def",
"compute_width",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_enabled",
":",
"return",
"0",
"digits",
"=",
"1",
"maxb",
"=",
"max",
"(",
"1",
",",
"self",
".",
"editor",
".",
"blockCount",
"(",
")",
")",
"while",
"maxb",
">=",
"10",
... | Compute and return line number area width | [
"Compute",
"and",
"return",
"line",
"number",
"area",
"width"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/linenumber.py#L159-L172 |
31,451 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | process_python_symbol_data | def process_python_symbol_data(oedata):
"""Returns a list with line number, definition name, fold and token."""
symbol_list = []
for key in oedata:
val = oedata[key]
if val and key != 'found_cell_separators':
if val.is_class_or_function():
symbol_list.append((key,... | python | def process_python_symbol_data(oedata):
"""Returns a list with line number, definition name, fold and token."""
symbol_list = []
for key in oedata:
val = oedata[key]
if val and key != 'found_cell_separators':
if val.is_class_or_function():
symbol_list.append((key,... | [
"def",
"process_python_symbol_data",
"(",
"oedata",
")",
":",
"symbol_list",
"=",
"[",
"]",
"for",
"key",
"in",
"oedata",
":",
"val",
"=",
"oedata",
"[",
"key",
"]",
"if",
"val",
"and",
"key",
"!=",
"'found_cell_separators'",
":",
"if",
"val",
".",
"is_c... | Returns a list with line number, definition name, fold and token. | [
"Returns",
"a",
"list",
"with",
"line",
"number",
"definition",
"name",
"fold",
"and",
"token",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L32-L41 |
31,452 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | get_python_symbol_icons | def get_python_symbol_icons(oedata):
"""Return a list of icons for oedata of a python file."""
class_icon = ima.icon('class')
method_icon = ima.icon('method')
function_icon = ima.icon('function')
private_icon = ima.icon('private1')
super_private_icon = ima.icon('private2')
symbols = process... | python | def get_python_symbol_icons(oedata):
"""Return a list of icons for oedata of a python file."""
class_icon = ima.icon('class')
method_icon = ima.icon('method')
function_icon = ima.icon('function')
private_icon = ima.icon('private1')
super_private_icon = ima.icon('private2')
symbols = process... | [
"def",
"get_python_symbol_icons",
"(",
"oedata",
")",
":",
"class_icon",
"=",
"ima",
".",
"icon",
"(",
"'class'",
")",
"method_icon",
"=",
"ima",
".",
"icon",
"(",
"'method'",
")",
"function_icon",
"=",
"ima",
".",
"icon",
"(",
"'function'",
")",
"private_... | Return a list of icons for oedata of a python file. | [
"Return",
"a",
"list",
"of",
"icons",
"for",
"oedata",
"of",
"a",
"python",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L44-L92 |
31,453 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FilesFilterLine.focusOutEvent | def focusOutEvent(self, event):
"""
Detect when the focus goes out of this widget.
This is used to make the file switcher leave focus on the
last selected file by the user.
"""
self.clicked_outside = True
return super(QLineEdit, self).focusOutEvent(event) | python | def focusOutEvent(self, event):
"""
Detect when the focus goes out of this widget.
This is used to make the file switcher leave focus on the
last selected file by the user.
"""
self.clicked_outside = True
return super(QLineEdit, self).focusOutEvent(event) | [
"def",
"focusOutEvent",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"clicked_outside",
"=",
"True",
"return",
"super",
"(",
"QLineEdit",
",",
"self",
")",
".",
"focusOutEvent",
"(",
"event",
")"
] | Detect when the focus goes out of this widget.
This is used to make the file switcher leave focus on the
last selected file by the user. | [
"Detect",
"when",
"the",
"focus",
"goes",
"out",
"of",
"this",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L218-L226 |
31,454 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.save_initial_state | def save_initial_state(self):
"""Save initial cursors and initial active widget."""
paths = self.paths
self.initial_widget = self.get_widget()
self.initial_cursors = {}
for i, editor in enumerate(self.widgets):
if editor is self.initial_widget:
self.i... | python | def save_initial_state(self):
"""Save initial cursors and initial active widget."""
paths = self.paths
self.initial_widget = self.get_widget()
self.initial_cursors = {}
for i, editor in enumerate(self.widgets):
if editor is self.initial_widget:
self.i... | [
"def",
"save_initial_state",
"(",
"self",
")",
":",
"paths",
"=",
"self",
".",
"paths",
"self",
".",
"initial_widget",
"=",
"self",
".",
"get_widget",
"(",
")",
"self",
".",
"initial_cursors",
"=",
"{",
"}",
"for",
"i",
",",
"editor",
"in",
"enumerate",
... | Save initial cursors and initial active widget. | [
"Save",
"initial",
"cursors",
"and",
"initial",
"active",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L380-L394 |
31,455 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.restore_initial_state | def restore_initial_state(self):
"""Restores initial cursors and initial active editor."""
self.list.clear()
self.is_visible = False
widgets = self.widgets_by_path
if not self.edit.clicked_outside:
for path in self.initial_cursors:
cursor = self.initi... | python | def restore_initial_state(self):
"""Restores initial cursors and initial active editor."""
self.list.clear()
self.is_visible = False
widgets = self.widgets_by_path
if not self.edit.clicked_outside:
for path in self.initial_cursors:
cursor = self.initi... | [
"def",
"restore_initial_state",
"(",
"self",
")",
":",
"self",
".",
"list",
".",
"clear",
"(",
")",
"self",
".",
"is_visible",
"=",
"False",
"widgets",
"=",
"self",
".",
"widgets_by_path",
"if",
"not",
"self",
".",
"edit",
".",
"clicked_outside",
":",
"f... | Restores initial cursors and initial active editor. | [
"Restores",
"initial",
"cursors",
"and",
"initial",
"active",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L401-L415 |
31,456 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.set_dialog_position | def set_dialog_position(self):
"""Positions the file switcher dialog."""
parent = self.parent()
geo = parent.geometry()
width = self.list.width() # This has been set in setup
left = parent.geometry().width()/2 - width/2
# Note: the +1 pixel on the top makes it look bette... | python | def set_dialog_position(self):
"""Positions the file switcher dialog."""
parent = self.parent()
geo = parent.geometry()
width = self.list.width() # This has been set in setup
left = parent.geometry().width()/2 - width/2
# Note: the +1 pixel on the top makes it look bette... | [
"def",
"set_dialog_position",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"parent",
"(",
")",
"geo",
"=",
"parent",
".",
"geometry",
"(",
")",
"width",
"=",
"self",
".",
"list",
".",
"width",
"(",
")",
"# This has been set in setup",
"left",
"=",
... | Positions the file switcher dialog. | [
"Positions",
"the",
"file",
"switcher",
"dialog",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L417-L436 |
31,457 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.fix_size | def fix_size(self, content):
"""
Adjusts the width and height of the file switcher
based on the relative size of the parent and content.
"""
# Update size of dialog based on relative size of the parent
if content:
width, height = self.get_item_size(content)
... | python | def fix_size(self, content):
"""
Adjusts the width and height of the file switcher
based on the relative size of the parent and content.
"""
# Update size of dialog based on relative size of the parent
if content:
width, height = self.get_item_size(content)
... | [
"def",
"fix_size",
"(",
"self",
",",
"content",
")",
":",
"# Update size of dialog based on relative size of the parent",
"if",
"content",
":",
"width",
",",
"height",
"=",
"self",
".",
"get_item_size",
"(",
"content",
")",
"# Width",
"parent",
"=",
"self",
".",
... | Adjusts the width and height of the file switcher
based on the relative size of the parent and content. | [
"Adjusts",
"the",
"width",
"and",
"height",
"of",
"the",
"file",
"switcher",
"based",
"on",
"the",
"relative",
"size",
"of",
"the",
"parent",
"and",
"content",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L453-L478 |
31,458 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.select_row | def select_row(self, steps):
"""Select row in list widget based on a number of steps with direction.
Steps can be positive (next rows) or negative (previous rows).
"""
row = self.current_row() + steps
if 0 <= row < self.count():
self.set_current_row(row) | python | def select_row(self, steps):
"""Select row in list widget based on a number of steps with direction.
Steps can be positive (next rows) or negative (previous rows).
"""
row = self.current_row() + steps
if 0 <= row < self.count():
self.set_current_row(row) | [
"def",
"select_row",
"(",
"self",
",",
"steps",
")",
":",
"row",
"=",
"self",
".",
"current_row",
"(",
")",
"+",
"steps",
"if",
"0",
"<=",
"row",
"<",
"self",
".",
"count",
"(",
")",
":",
"self",
".",
"set_current_row",
"(",
"row",
")"
] | Select row in list widget based on a number of steps with direction.
Steps can be positive (next rows) or negative (previous rows). | [
"Select",
"row",
"in",
"list",
"widget",
"based",
"on",
"a",
"number",
"of",
"steps",
"with",
"direction",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L493-L500 |
31,459 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.previous_row | def previous_row(self):
"""Select previous row in list widget."""
if self.mode == self.SYMBOL_MODE:
self.select_row(-1)
return
prev_row = self.current_row() - 1
if prev_row >= 0:
title = self.list.item(prev_row).text()
else:
title =... | python | def previous_row(self):
"""Select previous row in list widget."""
if self.mode == self.SYMBOL_MODE:
self.select_row(-1)
return
prev_row = self.current_row() - 1
if prev_row >= 0:
title = self.list.item(prev_row).text()
else:
title =... | [
"def",
"previous_row",
"(",
"self",
")",
":",
"if",
"self",
".",
"mode",
"==",
"self",
".",
"SYMBOL_MODE",
":",
"self",
".",
"select_row",
"(",
"-",
"1",
")",
"return",
"prev_row",
"=",
"self",
".",
"current_row",
"(",
")",
"-",
"1",
"if",
"prev_row"... | Select previous row in list widget. | [
"Select",
"previous",
"row",
"in",
"list",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L502-L518 |
31,460 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.next_row | def next_row(self):
"""Select next row in list widget."""
if self.mode == self.SYMBOL_MODE:
self.select_row(+1)
return
next_row = self.current_row() + 1
if next_row < self.count():
if '</b></big><br>' in self.list.item(next_row).text():
... | python | def next_row(self):
"""Select next row in list widget."""
if self.mode == self.SYMBOL_MODE:
self.select_row(+1)
return
next_row = self.current_row() + 1
if next_row < self.count():
if '</b></big><br>' in self.list.item(next_row).text():
... | [
"def",
"next_row",
"(",
"self",
")",
":",
"if",
"self",
".",
"mode",
"==",
"self",
".",
"SYMBOL_MODE",
":",
"self",
".",
"select_row",
"(",
"+",
"1",
")",
"return",
"next_row",
"=",
"self",
".",
"current_row",
"(",
")",
"+",
"1",
"if",
"next_row",
... | Select next row in list widget. | [
"Select",
"next",
"row",
"in",
"list",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L520-L531 |
31,461 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_stack_index | def get_stack_index(self, stack_index, plugin_index):
"""Get the real index of the selected item."""
other_plugins_count = sum([other_tabs[0].count() \
for other_tabs in \
self.plugins_tabs[:plugin_index]])
real_index = stack_... | python | def get_stack_index(self, stack_index, plugin_index):
"""Get the real index of the selected item."""
other_plugins_count = sum([other_tabs[0].count() \
for other_tabs in \
self.plugins_tabs[:plugin_index]])
real_index = stack_... | [
"def",
"get_stack_index",
"(",
"self",
",",
"stack_index",
",",
"plugin_index",
")",
":",
"other_plugins_count",
"=",
"sum",
"(",
"[",
"other_tabs",
"[",
"0",
"]",
".",
"count",
"(",
")",
"for",
"other_tabs",
"in",
"self",
".",
"plugins_tabs",
"[",
":",
... | Get the real index of the selected item. | [
"Get",
"the",
"real",
"index",
"of",
"the",
"selected",
"item",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L533-L540 |
31,462 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_plugin_data | def get_plugin_data(self, plugin):
"""Get the data object of the plugin's current tab manager."""
# The data object is named "data" in the editor plugin while it is
# named "clients" in the notebook plugin.
try:
data = plugin.get_current_tab_manager().data
except Attr... | python | def get_plugin_data(self, plugin):
"""Get the data object of the plugin's current tab manager."""
# The data object is named "data" in the editor plugin while it is
# named "clients" in the notebook plugin.
try:
data = plugin.get_current_tab_manager().data
except Attr... | [
"def",
"get_plugin_data",
"(",
"self",
",",
"plugin",
")",
":",
"# The data object is named \"data\" in the editor plugin while it is",
"# named \"clients\" in the notebook plugin.",
"try",
":",
"data",
"=",
"plugin",
".",
"get_current_tab_manager",
"(",
")",
".",
"data",
"... | Get the data object of the plugin's current tab manager. | [
"Get",
"the",
"data",
"object",
"of",
"the",
"plugin",
"s",
"current",
"tab",
"manager",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L543-L552 |
31,463 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_plugin_tabwidget | def get_plugin_tabwidget(self, plugin):
"""Get the tabwidget of the plugin's current tab manager."""
# The tab widget is named "tabs" in the editor plugin while it is
# named "tabwidget" in the notebook plugin.
try:
tabwidget = plugin.get_current_tab_manager().tabs
ex... | python | def get_plugin_tabwidget(self, plugin):
"""Get the tabwidget of the plugin's current tab manager."""
# The tab widget is named "tabs" in the editor plugin while it is
# named "tabwidget" in the notebook plugin.
try:
tabwidget = plugin.get_current_tab_manager().tabs
ex... | [
"def",
"get_plugin_tabwidget",
"(",
"self",
",",
"plugin",
")",
":",
"# The tab widget is named \"tabs\" in the editor plugin while it is",
"# named \"tabwidget\" in the notebook plugin.",
"try",
":",
"tabwidget",
"=",
"plugin",
".",
"get_current_tab_manager",
"(",
")",
".",
... | Get the tabwidget of the plugin's current tab manager. | [
"Get",
"the",
"tabwidget",
"of",
"the",
"plugin",
"s",
"current",
"tab",
"manager",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L554-L563 |
31,464 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_widget | def get_widget(self, index=None, path=None, tabs=None):
"""Get widget by index.
If no tabs and index specified the current active widget is returned.
"""
if (index and tabs) or (path and tabs):
return tabs.widget(index)
elif self.plugin:
return self.get_p... | python | def get_widget(self, index=None, path=None, tabs=None):
"""Get widget by index.
If no tabs and index specified the current active widget is returned.
"""
if (index and tabs) or (path and tabs):
return tabs.widget(index)
elif self.plugin:
return self.get_p... | [
"def",
"get_widget",
"(",
"self",
",",
"index",
"=",
"None",
",",
"path",
"=",
"None",
",",
"tabs",
"=",
"None",
")",
":",
"if",
"(",
"index",
"and",
"tabs",
")",
"or",
"(",
"path",
"and",
"tabs",
")",
":",
"return",
"tabs",
".",
"widget",
"(",
... | Get widget by index.
If no tabs and index specified the current active widget is returned. | [
"Get",
"widget",
"by",
"index",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L565-L575 |
31,465 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.set_editor_cursor | def set_editor_cursor(self, editor, cursor):
"""Set the cursor of an editor."""
pos = cursor.position()
anchor = cursor.anchor()
new_cursor = QTextCursor()
if pos == anchor:
new_cursor.movePosition(pos)
else:
new_cursor.movePosition(anchor)
... | python | def set_editor_cursor(self, editor, cursor):
"""Set the cursor of an editor."""
pos = cursor.position()
anchor = cursor.anchor()
new_cursor = QTextCursor()
if pos == anchor:
new_cursor.movePosition(pos)
else:
new_cursor.movePosition(anchor)
... | [
"def",
"set_editor_cursor",
"(",
"self",
",",
"editor",
",",
"cursor",
")",
":",
"pos",
"=",
"cursor",
".",
"position",
"(",
")",
"anchor",
"=",
"cursor",
".",
"anchor",
"(",
")",
"new_cursor",
"=",
"QTextCursor",
"(",
")",
"if",
"pos",
"==",
"anchor",... | Set the cursor of an editor. | [
"Set",
"the",
"cursor",
"of",
"an",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L577-L588 |
31,466 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.goto_line | def goto_line(self, line_number):
"""Go to specified line number in current active editor."""
if line_number:
line_number = int(line_number)
try:
self.plugin.go_to_line(line_number)
except AttributeError:
pass | python | def goto_line(self, line_number):
"""Go to specified line number in current active editor."""
if line_number:
line_number = int(line_number)
try:
self.plugin.go_to_line(line_number)
except AttributeError:
pass | [
"def",
"goto_line",
"(",
"self",
",",
"line_number",
")",
":",
"if",
"line_number",
":",
"line_number",
"=",
"int",
"(",
"line_number",
")",
"try",
":",
"self",
".",
"plugin",
".",
"go_to_line",
"(",
"line_number",
")",
"except",
"AttributeError",
":",
"pa... | Go to specified line number in current active editor. | [
"Go",
"to",
"specified",
"line",
"number",
"in",
"current",
"active",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L590-L597 |
31,467 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.item_selection_changed | def item_selection_changed(self):
"""List widget item selection change handler."""
row = self.current_row()
if self.count() and row >= 0:
if '</b></big><br>' in self.list.currentItem().text() and row == 0:
self.next_row()
if self.mode == self.FILE_MODE:
... | python | def item_selection_changed(self):
"""List widget item selection change handler."""
row = self.current_row()
if self.count() and row >= 0:
if '</b></big><br>' in self.list.currentItem().text() and row == 0:
self.next_row()
if self.mode == self.FILE_MODE:
... | [
"def",
"item_selection_changed",
"(",
"self",
")",
":",
"row",
"=",
"self",
".",
"current_row",
"(",
")",
"if",
"self",
".",
"count",
"(",
")",
"and",
"row",
">=",
"0",
":",
"if",
"'</b></big><br>'",
"in",
"self",
".",
"list",
".",
"currentItem",
"(",
... | List widget item selection change handler. | [
"List",
"widget",
"item",
"selection",
"change",
"handler",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L609-L631 |
31,468 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.setup_symbol_list | def setup_symbol_list(self, filter_text, current_path):
"""Setup list widget content for symbol list display."""
# Get optional symbol name
filter_text, symbol_text = filter_text.split('@')
# Fetch the Outline explorer data, get the icons and values
oedata = self.get_symbol_list... | python | def setup_symbol_list(self, filter_text, current_path):
"""Setup list widget content for symbol list display."""
# Get optional symbol name
filter_text, symbol_text = filter_text.split('@')
# Fetch the Outline explorer data, get the icons and values
oedata = self.get_symbol_list... | [
"def",
"setup_symbol_list",
"(",
"self",
",",
"filter_text",
",",
"current_path",
")",
":",
"# Get optional symbol name",
"filter_text",
",",
"symbol_text",
"=",
"filter_text",
".",
"split",
"(",
"'@'",
")",
"# Fetch the Outline explorer data, get the icons and values",
"... | Setup list widget content for symbol list display. | [
"Setup",
"list",
"widget",
"content",
"for",
"symbol",
"list",
"display",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L769-L820 |
31,469 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.setup | def setup(self):
"""Setup list widget content."""
if len(self.plugins_tabs) == 0:
self.close()
return
self.list.clear()
current_path = self.current_path
filter_text = self.filter_text
# Get optional line or symbol to define mode and method handle... | python | def setup(self):
"""Setup list widget content."""
if len(self.plugins_tabs) == 0:
self.close()
return
self.list.clear()
current_path = self.current_path
filter_text = self.filter_text
# Get optional line or symbol to define mode and method handle... | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"plugins_tabs",
")",
"==",
"0",
":",
"self",
".",
"close",
"(",
")",
"return",
"self",
".",
"list",
".",
"clear",
"(",
")",
"current_path",
"=",
"self",
".",
"current_path",
"fil... | Setup list widget content. | [
"Setup",
"list",
"widget",
"content",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L831-L852 |
31,470 | spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.add_plugin | def add_plugin(self, plugin, tabs, data, icon):
"""Add a plugin to display its files."""
self.plugins_tabs.append((tabs, plugin))
self.plugins_data.append((data, icon))
self.plugins_instances.append(plugin) | python | def add_plugin(self, plugin, tabs, data, icon):
"""Add a plugin to display its files."""
self.plugins_tabs.append((tabs, plugin))
self.plugins_data.append((data, icon))
self.plugins_instances.append(plugin) | [
"def",
"add_plugin",
"(",
"self",
",",
"plugin",
",",
"tabs",
",",
"data",
",",
"icon",
")",
":",
"self",
".",
"plugins_tabs",
".",
"append",
"(",
"(",
"tabs",
",",
"plugin",
")",
")",
"self",
".",
"plugins_data",
".",
"append",
"(",
"(",
"data",
"... | Add a plugin to display its files. | [
"Add",
"a",
"plugin",
"to",
"display",
"its",
"files",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L862-L866 |
31,471 | spyder-ide/spyder | spyder/utils/vcs.py | get_vcs_info | def get_vcs_info(path):
"""Return support status dict if path is under VCS root"""
for info in SUPPORTED:
vcs_path = osp.join(path, info['rootdir'])
if osp.isdir(vcs_path):
return info | python | def get_vcs_info(path):
"""Return support status dict if path is under VCS root"""
for info in SUPPORTED:
vcs_path = osp.join(path, info['rootdir'])
if osp.isdir(vcs_path):
return info | [
"def",
"get_vcs_info",
"(",
"path",
")",
":",
"for",
"info",
"in",
"SUPPORTED",
":",
"vcs_path",
"=",
"osp",
".",
"join",
"(",
"path",
",",
"info",
"[",
"'rootdir'",
"]",
")",
"if",
"osp",
".",
"isdir",
"(",
"vcs_path",
")",
":",
"return",
"info"
] | Return support status dict if path is under VCS root | [
"Return",
"support",
"status",
"dict",
"if",
"path",
"is",
"under",
"VCS",
"root"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L52-L57 |
31,472 | spyder-ide/spyder | spyder/utils/vcs.py | get_vcs_root | def get_vcs_root(path):
"""Return VCS root directory path
Return None if path is not within a supported VCS repository"""
previous_path = path
while get_vcs_info(path) is None:
path = abspardir(path)
if path == previous_path:
return
else:
previous... | python | def get_vcs_root(path):
"""Return VCS root directory path
Return None if path is not within a supported VCS repository"""
previous_path = path
while get_vcs_info(path) is None:
path = abspardir(path)
if path == previous_path:
return
else:
previous... | [
"def",
"get_vcs_root",
"(",
"path",
")",
":",
"previous_path",
"=",
"path",
"while",
"get_vcs_info",
"(",
"path",
")",
"is",
"None",
":",
"path",
"=",
"abspardir",
"(",
"path",
")",
"if",
"path",
"==",
"previous_path",
":",
"return",
"else",
":",
"previo... | Return VCS root directory path
Return None if path is not within a supported VCS repository | [
"Return",
"VCS",
"root",
"directory",
"path",
"Return",
"None",
"if",
"path",
"is",
"not",
"within",
"a",
"supported",
"VCS",
"repository"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L60-L70 |
31,473 | spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.event | def event(self, event):
"""Qt Override.
Filter tab keys and process double tab keys.
"""
if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
self.sig_tab_pressed.emit(True)
self.numpress += 1
if self.numpress == 1:
... | python | def event(self, event):
"""Qt Override.
Filter tab keys and process double tab keys.
"""
if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
self.sig_tab_pressed.emit(True)
self.numpress += 1
if self.numpress == 1:
... | [
"def",
"event",
"(",
"self",
",",
"event",
")",
":",
"if",
"(",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"KeyPress",
")",
"and",
"(",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Tab",
")",
":",
"self",
".",
"sig_tab_pressed",... | Qt Override.
Filter tab keys and process double tab keys. | [
"Qt",
"Override",
".",
"Filter",
"tab",
"keys",
"and",
"process",
"double",
"tab",
"keys",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L46-L57 |
31,474 | spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.keyPressEvent | def keyPressEvent(self, event):
"""Qt Override.
Handle key press events.
"""
if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
if self.add_current_text_if_valid():
self.selected()
self.hide_completer()
elif event... | python | def keyPressEvent(self, event):
"""Qt Override.
Handle key press events.
"""
if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
if self.add_current_text_if_valid():
self.selected()
self.hide_completer()
elif event... | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Return",
"or",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Enter",
":",
"if",
"self",
".",
"add_current_text_if_valid",
"... | Qt Override.
Handle key press events. | [
"Qt",
"Override",
".",
"Handle",
"key",
"press",
"events",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L59-L72 |
31,475 | spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.handle_keypress | def handle_keypress(self):
"""When hitting tab, it handles if single or double tab"""
if self.numpress == 2:
self.sig_double_tab_pressed.emit(True)
self.numpress = 0 | python | def handle_keypress(self):
"""When hitting tab, it handles if single or double tab"""
if self.numpress == 2:
self.sig_double_tab_pressed.emit(True)
self.numpress = 0 | [
"def",
"handle_keypress",
"(",
"self",
")",
":",
"if",
"self",
".",
"numpress",
"==",
"2",
":",
"self",
".",
"sig_double_tab_pressed",
".",
"emit",
"(",
"True",
")",
"self",
".",
"numpress",
"=",
"0"
] | When hitting tab, it handles if single or double tab | [
"When",
"hitting",
"tab",
"it",
"handles",
"if",
"single",
"or",
"double",
"tab"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L75-L79 |
31,476 | spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.add_current_text_if_valid | def add_current_text_if_valid(self):
"""Add current text to combo box history if valid"""
valid = self.is_valid(self.currentText())
if valid or valid is None:
self.add_current_text()
return True
else:
self.set_current_text(self.selected_text) | python | def add_current_text_if_valid(self):
"""Add current text to combo box history if valid"""
valid = self.is_valid(self.currentText())
if valid or valid is None:
self.add_current_text()
return True
else:
self.set_current_text(self.selected_text) | [
"def",
"add_current_text_if_valid",
"(",
"self",
")",
":",
"valid",
"=",
"self",
".",
"is_valid",
"(",
"self",
".",
"currentText",
"(",
")",
")",
"if",
"valid",
"or",
"valid",
"is",
"None",
":",
"self",
".",
"add_current_text",
"(",
")",
"return",
"True"... | Add current text to combo box history if valid | [
"Add",
"current",
"text",
"to",
"combo",
"box",
"history",
"if",
"valid"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L120-L127 |
31,477 | spyder-ide/spyder | spyder/widgets/comboboxes.py | EditableComboBox.validate | def validate(self, qstr, editing=True):
"""Validate entered path"""
if self.selected_text == qstr and qstr != '':
self.valid.emit(True, True)
return
valid = self.is_valid(qstr)
if editing:
if valid:
self.valid.emit(True, False... | python | def validate(self, qstr, editing=True):
"""Validate entered path"""
if self.selected_text == qstr and qstr != '':
self.valid.emit(True, True)
return
valid = self.is_valid(qstr)
if editing:
if valid:
self.valid.emit(True, False... | [
"def",
"validate",
"(",
"self",
",",
"qstr",
",",
"editing",
"=",
"True",
")",
":",
"if",
"self",
".",
"selected_text",
"==",
"qstr",
"and",
"qstr",
"!=",
"''",
":",
"self",
".",
"valid",
".",
"emit",
"(",
"True",
",",
"True",
")",
"return",
"valid... | Validate entered path | [
"Validate",
"entered",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L177-L188 |
31,478 | spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.focusInEvent | def focusInEvent(self, event):
"""Handle focus in event restoring to display the status icon."""
show_status = getattr(self.lineEdit(), 'show_status_icon', None)
if show_status:
show_status()
QComboBox.focusInEvent(self, event) | python | def focusInEvent(self, event):
"""Handle focus in event restoring to display the status icon."""
show_status = getattr(self.lineEdit(), 'show_status_icon', None)
if show_status:
show_status()
QComboBox.focusInEvent(self, event) | [
"def",
"focusInEvent",
"(",
"self",
",",
"event",
")",
":",
"show_status",
"=",
"getattr",
"(",
"self",
".",
"lineEdit",
"(",
")",
",",
"'show_status_icon'",
",",
"None",
")",
"if",
"show_status",
":",
"show_status",
"(",
")",
"QComboBox",
".",
"focusInEve... | Handle focus in event restoring to display the status icon. | [
"Handle",
"focus",
"in",
"event",
"restoring",
"to",
"display",
"the",
"status",
"icon",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L220-L225 |
31,479 | spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.focusOutEvent | def focusOutEvent(self, event):
"""Handle focus out event restoring the last valid selected path."""
# Calling asynchronously the 'add_current_text' to avoid crash
# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
if not self.is_valid():
l... | python | def focusOutEvent(self, event):
"""Handle focus out event restoring the last valid selected path."""
# Calling asynchronously the 'add_current_text' to avoid crash
# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
if not self.is_valid():
l... | [
"def",
"focusOutEvent",
"(",
"self",
",",
"event",
")",
":",
"# Calling asynchronously the 'add_current_text' to avoid crash\r",
"# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd\r",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"lineedit",... | Handle focus out event restoring the last valid selected path. | [
"Handle",
"focus",
"out",
"event",
"restoring",
"the",
"last",
"valid",
"selected",
"path",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L227-L238 |
31,480 | spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox._complete_options | def _complete_options(self):
"""Find available completion options."""
text = to_text_string(self.currentText())
opts = glob.glob(text + "*")
opts = sorted([opt for opt in opts if osp.isdir(opt)])
self.setCompleter(QCompleter(opts, self))
return opts | python | def _complete_options(self):
"""Find available completion options."""
text = to_text_string(self.currentText())
opts = glob.glob(text + "*")
opts = sorted([opt for opt in opts if osp.isdir(opt)])
self.setCompleter(QCompleter(opts, self))
return opts | [
"def",
"_complete_options",
"(",
"self",
")",
":",
"text",
"=",
"to_text_string",
"(",
"self",
".",
"currentText",
"(",
")",
")",
"opts",
"=",
"glob",
".",
"glob",
"(",
"text",
"+",
"\"*\"",
")",
"opts",
"=",
"sorted",
"(",
"[",
"opt",
"for",
"opt",
... | Find available completion options. | [
"Find",
"available",
"completion",
"options",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L241-L247 |
31,481 | spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.double_tab_complete | def double_tab_complete(self):
"""If several options available a double tab displays options."""
opts = self._complete_options()
if len(opts) > 1:
self.completer().complete() | python | def double_tab_complete(self):
"""If several options available a double tab displays options."""
opts = self._complete_options()
if len(opts) > 1:
self.completer().complete() | [
"def",
"double_tab_complete",
"(",
"self",
")",
":",
"opts",
"=",
"self",
".",
"_complete_options",
"(",
")",
"if",
"len",
"(",
"opts",
")",
">",
"1",
":",
"self",
".",
"completer",
"(",
")",
".",
"complete",
"(",
")"
] | If several options available a double tab displays options. | [
"If",
"several",
"options",
"available",
"a",
"double",
"tab",
"displays",
"options",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L249-L253 |
31,482 | spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.tab_complete | def tab_complete(self):
"""
If there is a single option available one tab completes the option.
"""
opts = self._complete_options()
if len(opts) == 1:
self.set_current_text(opts[0] + os.sep)
self.hide_completer() | python | def tab_complete(self):
"""
If there is a single option available one tab completes the option.
"""
opts = self._complete_options()
if len(opts) == 1:
self.set_current_text(opts[0] + os.sep)
self.hide_completer() | [
"def",
"tab_complete",
"(",
"self",
")",
":",
"opts",
"=",
"self",
".",
"_complete_options",
"(",
")",
"if",
"len",
"(",
"opts",
")",
"==",
"1",
":",
"self",
".",
"set_current_text",
"(",
"opts",
"[",
"0",
"]",
"+",
"os",
".",
"sep",
")",
"self",
... | If there is a single option available one tab completes the option. | [
"If",
"there",
"is",
"a",
"single",
"option",
"available",
"one",
"tab",
"completes",
"the",
"option",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L255-L262 |
31,483 | spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.add_tooltip_to_highlighted_item | def add_tooltip_to_highlighted_item(self, index):
"""
Add a tooltip showing the full path of the currently highlighted item
of the PathComboBox.
"""
self.setItemData(index, self.itemText(index), Qt.ToolTipRole) | python | def add_tooltip_to_highlighted_item(self, index):
"""
Add a tooltip showing the full path of the currently highlighted item
of the PathComboBox.
"""
self.setItemData(index, self.itemText(index), Qt.ToolTipRole) | [
"def",
"add_tooltip_to_highlighted_item",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"setItemData",
"(",
"index",
",",
"self",
".",
"itemText",
"(",
"index",
")",
",",
"Qt",
".",
"ToolTipRole",
")"
] | Add a tooltip showing the full path of the currently highlighted item
of the PathComboBox. | [
"Add",
"a",
"tooltip",
"showing",
"the",
"full",
"path",
"of",
"the",
"currently",
"highlighted",
"item",
"of",
"the",
"PathComboBox",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L287-L292 |
31,484 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.set_historylog | def set_historylog(self, historylog):
"""Bind historylog instance to this console
Not used anymore since v2.0"""
historylog.add_history(self.shell.history_filename)
self.shell.append_to_history.connect(historylog.append_to_history) | python | def set_historylog(self, historylog):
"""Bind historylog instance to this console
Not used anymore since v2.0"""
historylog.add_history(self.shell.history_filename)
self.shell.append_to_history.connect(historylog.append_to_history) | [
"def",
"set_historylog",
"(",
"self",
",",
"historylog",
")",
":",
"historylog",
".",
"add_history",
"(",
"self",
".",
"shell",
".",
"history_filename",
")",
"self",
".",
"shell",
".",
"append_to_history",
".",
"connect",
"(",
"historylog",
".",
"append_to_his... | Bind historylog instance to this console
Not used anymore since v2.0 | [
"Bind",
"historylog",
"instance",
"to",
"this",
"console",
"Not",
"used",
"anymore",
"since",
"v2",
".",
"0"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L106-L110 |
31,485 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.exception_occurred | def exception_occurred(self, text, is_traceback):
"""
Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user.
"""
# Skip errors without traceback or dismiss
if (not is_traceback and self.error_dlg is None) or self.dismis... | python | def exception_occurred(self, text, is_traceback):
"""
Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user.
"""
# Skip errors without traceback or dismiss
if (not is_traceback and self.error_dlg is None) or self.dismis... | [
"def",
"exception_occurred",
"(",
"self",
",",
"text",
",",
"is_traceback",
")",
":",
"# Skip errors without traceback or dismiss\r",
"if",
"(",
"not",
"is_traceback",
"and",
"self",
".",
"error_dlg",
"is",
"None",
")",
"or",
"self",
".",
"dismiss_error",
":",
"... | Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user. | [
"Exception",
"ocurred",
"in",
"the",
"internal",
"console",
".",
"Show",
"a",
"QDialog",
"or",
"the",
"internal",
"console",
"to",
"warn",
"the",
"user",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L200-L220 |
31,486 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.close_error_dlg | def close_error_dlg(self):
"""Close error dialog."""
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() | python | def close_error_dlg(self):
"""Close error dialog."""
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() | [
"def",
"close_error_dlg",
"(",
"self",
")",
":",
"if",
"self",
".",
"error_dlg",
".",
"dismiss_box",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"dismiss_error",
"=",
"True",
"self",
".",
"error_dlg",
".",
"reject",
"(",
")"
] | Close error dialog. | [
"Close",
"error",
"dialog",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L222-L226 |
31,487 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.show_syspath | def show_syspath(self):
"""Show sys.path"""
editor = CollectionsEditor(parent=self)
editor.setup(sys.path, title="sys.path", readonly=True,
width=600, icon=ima.icon('syspath'))
self.dialog_manager.show(editor) | python | def show_syspath(self):
"""Show sys.path"""
editor = CollectionsEditor(parent=self)
editor.setup(sys.path, title="sys.path", readonly=True,
width=600, icon=ima.icon('syspath'))
self.dialog_manager.show(editor) | [
"def",
"show_syspath",
"(",
"self",
")",
":",
"editor",
"=",
"CollectionsEditor",
"(",
"parent",
"=",
"self",
")",
"editor",
".",
"setup",
"(",
"sys",
".",
"path",
",",
"title",
"=",
"\"sys.path\"",
",",
"readonly",
"=",
"True",
",",
"width",
"=",
"600... | Show sys.path | [
"Show",
"sys",
".",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L244-L249 |
31,488 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.run_script | def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
"""Run a Python script"""
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(
self, _("Run Python script"), g... | python | def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
"""Run a Python script"""
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(
self, _("Run Python script"), g... | [
"def",
"run_script",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"silent",
"=",
"False",
",",
"set_focus",
"=",
"False",
",",
"args",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"self",
".",
"shell",
".",
"interpreter",
".",
"rest... | Run a Python script | [
"Run",
"a",
"Python",
"script"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L252-L276 |
31,489 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.execute_lines | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | python | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | [
"def",
"execute_lines",
"(",
"self",
",",
"lines",
")",
":",
"self",
".",
"shell",
".",
"execute_lines",
"(",
"to_text_string",
"(",
"lines",
")",
")",
"self",
".",
"shell",
".",
"setFocus",
"(",
")"
] | Execute lines and give focus to shell | [
"Execute",
"lines",
"and",
"give",
"focus",
"to",
"shell"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L296-L299 |
31,490 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.change_exteditor | def change_exteditor(self):
"""Change external editor path"""
path, valid = QInputDialog.getText(self, _('External editor'),
_('External editor executable path:'),
QLineEdit.Normal,
self.get_option('external_editor/path')... | python | def change_exteditor(self):
"""Change external editor path"""
path, valid = QInputDialog.getText(self, _('External editor'),
_('External editor executable path:'),
QLineEdit.Normal,
self.get_option('external_editor/path')... | [
"def",
"change_exteditor",
"(",
"self",
")",
":",
"path",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'External editor'",
")",
",",
"_",
"(",
"'External editor executable path:'",
")",
",",
"QLineEdit",
".",
"Normal",
",",... | Change external editor path | [
"Change",
"external",
"editor",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L313-L320 |
31,491 | spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.toggle_codecompletion | def toggle_codecompletion(self, checked):
"""Toggle automatic code completion"""
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) | python | def toggle_codecompletion(self, checked):
"""Toggle automatic code completion"""
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) | [
"def",
"toggle_codecompletion",
"(",
"self",
",",
"checked",
")",
":",
"self",
".",
"shell",
".",
"set_codecompletion_auto",
"(",
"checked",
")",
"self",
".",
"set_option",
"(",
"'codecompletion/auto'",
",",
"checked",
")"
] | Toggle automatic code completion | [
"Toggle",
"automatic",
"code",
"completion"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L329-L332 |
31,492 | spyder-ide/spyder | scripts/spyder_win_post_install.py | install | def install():
"""Function executed when running the script with the -install switch"""
# Create Spyder start menu folder
# Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights
# This is consistent with use of CSIDL_DESKTOPDIRECTORY below
# CSIDL_COMMON_PROGRAMS =
# C:\ProgramDa... | python | def install():
"""Function executed when running the script with the -install switch"""
# Create Spyder start menu folder
# Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights
# This is consistent with use of CSIDL_DESKTOPDIRECTORY below
# CSIDL_COMMON_PROGRAMS =
# C:\ProgramDa... | [
"def",
"install",
"(",
")",
":",
"# Create Spyder start menu folder\r",
"# Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights\r",
"# This is consistent with use of CSIDL_DESKTOPDIRECTORY below\r",
"# CSIDL_COMMON_PROGRAMS =\r",
"# C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Progr... | Function executed when running the script with the -install switch | [
"Function",
"executed",
"when",
"running",
"the",
"script",
"with",
"the",
"-",
"install",
"switch"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/scripts/spyder_win_post_install.py#L113-L170 |
31,493 | spyder-ide/spyder | scripts/spyder_win_post_install.py | remove | def remove():
"""Function executed when running the script with the -remove switch"""
current = True # only affects current user
root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
for key in (KEY_C1 % ("", EWS), KEY_C1 % ("NoCon", EWS),
KEY_C0 % ("", EWS), KE... | python | def remove():
"""Function executed when running the script with the -remove switch"""
current = True # only affects current user
root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
for key in (KEY_C1 % ("", EWS), KEY_C1 % ("NoCon", EWS),
KEY_C0 % ("", EWS), KE... | [
"def",
"remove",
"(",
")",
":",
"current",
"=",
"True",
"# only affects current user\r",
"root",
"=",
"winreg",
".",
"HKEY_CURRENT_USER",
"if",
"current",
"else",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
"for",
"key",
"in",
"(",
"KEY_C1",
"%",
"(",
"\"\"",
",",
... | Function executed when running the script with the -remove switch | [
"Function",
"executed",
"when",
"running",
"the",
"script",
"with",
"the",
"-",
"remove",
"switch"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/scripts/spyder_win_post_install.py#L173-L222 |
31,494 | spyder-ide/spyder | spyder/app/tour.py | FadingTipBox.mousePressEvent | def mousePressEvent(self, event):
"""override Qt method"""
# Raise the main application window on click
self.parent.raise_()
self.raise_()
if event.button() == Qt.RightButton:
pass | python | def mousePressEvent(self, event):
"""override Qt method"""
# Raise the main application window on click
self.parent.raise_()
self.raise_()
if event.button() == Qt.RightButton:
pass | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"# Raise the main application window on click\r",
"self",
".",
"parent",
".",
"raise_",
"(",
")",
"self",
".",
"raise_",
"(",
")",
"if",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"Righ... | override Qt method | [
"override",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L804-L811 |
31,495 | spyder-ide/spyder | spyder/app/tour.py | AnimatedTour._set_data | def _set_data(self):
"""Set data that is displayed in each step of the tour."""
self.setting_data = True
step, steps, frames = self.step_current, self.steps, self.frames
current = '{0}/{1}'.format(step + 1, steps)
frame = frames[step]
combobox_frames = [u"{0}. {1}... | python | def _set_data(self):
"""Set data that is displayed in each step of the tour."""
self.setting_data = True
step, steps, frames = self.step_current, self.steps, self.frames
current = '{0}/{1}'.format(step + 1, steps)
frame = frames[step]
combobox_frames = [u"{0}. {1}... | [
"def",
"_set_data",
"(",
"self",
")",
":",
"self",
".",
"setting_data",
"=",
"True",
"step",
",",
"steps",
",",
"frames",
"=",
"self",
".",
"step_current",
",",
"self",
".",
"steps",
",",
"self",
".",
"frames",
"current",
"=",
"'{0}/{1}'",
".",
"format... | Set data that is displayed in each step of the tour. | [
"Set",
"data",
"that",
"is",
"displayed",
"in",
"each",
"step",
"of",
"the",
"tour",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1001-L1061 |
31,496 | spyder-ide/spyder | spyder/app/tour.py | AnimatedTour.lost_focus | def lost_focus(self):
"""Confirm if the tour loses focus and hides the tips."""
if (self.is_running and not self.any_has_focus() and
not self.setting_data and not self.hidden):
self.hide_tips() | python | def lost_focus(self):
"""Confirm if the tour loses focus and hides the tips."""
if (self.is_running and not self.any_has_focus() and
not self.setting_data and not self.hidden):
self.hide_tips() | [
"def",
"lost_focus",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"is_running",
"and",
"not",
"self",
".",
"any_has_focus",
"(",
")",
"and",
"not",
"self",
".",
"setting_data",
"and",
"not",
"self",
".",
"hidden",
")",
":",
"self",
".",
"hide_tips",
... | Confirm if the tour loses focus and hides the tips. | [
"Confirm",
"if",
"the",
"tour",
"loses",
"focus",
"and",
"hides",
"the",
"tips",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1239-L1243 |
31,497 | spyder-ide/spyder | spyder/app/tour.py | AnimatedTour.gain_focus | def gain_focus(self):
"""Confirm if the tour regains focus and unhides the tips."""
if (self.is_running and self.any_has_focus() and
not self.setting_data and self.hidden):
self.unhide_tips() | python | def gain_focus(self):
"""Confirm if the tour regains focus and unhides the tips."""
if (self.is_running and self.any_has_focus() and
not self.setting_data and self.hidden):
self.unhide_tips() | [
"def",
"gain_focus",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"is_running",
"and",
"self",
".",
"any_has_focus",
"(",
")",
"and",
"not",
"self",
".",
"setting_data",
"and",
"self",
".",
"hidden",
")",
":",
"self",
".",
"unhide_tips",
"(",
")"
] | Confirm if the tour regains focus and unhides the tips. | [
"Confirm",
"if",
"the",
"tour",
"regains",
"focus",
"and",
"unhides",
"the",
"tips",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1245-L1249 |
31,498 | spyder-ide/spyder | spyder/app/tour.py | AnimatedTour.any_has_focus | def any_has_focus(self):
"""Returns if tour or any of its components has focus."""
f = (self.hasFocus() or self.parent.hasFocus() or
self.tips.hasFocus() or self.canvas.hasFocus())
return f | python | def any_has_focus(self):
"""Returns if tour or any of its components has focus."""
f = (self.hasFocus() or self.parent.hasFocus() or
self.tips.hasFocus() or self.canvas.hasFocus())
return f | [
"def",
"any_has_focus",
"(",
"self",
")",
":",
"f",
"=",
"(",
"self",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"parent",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"tips",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"canvas",
".",
"hasF... | Returns if tour or any of its components has focus. | [
"Returns",
"if",
"tour",
"or",
"any",
"of",
"its",
"components",
"has",
"focus",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1251-L1255 |
31,499 | spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/figurebrowser.py | FigureBrowserWidget._handle_display_data | def _handle_display_data(self, msg):
"""
Reimplemented to handle communications between the figure explorer
and the kernel.
"""
img = None
data = msg['content']['data']
if 'image/svg+xml' in data:
fmt = 'image/svg+xml'
img = data['image/svg... | python | def _handle_display_data(self, msg):
"""
Reimplemented to handle communications between the figure explorer
and the kernel.
"""
img = None
data = msg['content']['data']
if 'image/svg+xml' in data:
fmt = 'image/svg+xml'
img = data['image/svg... | [
"def",
"_handle_display_data",
"(",
"self",
",",
"msg",
")",
":",
"img",
"=",
"None",
"data",
"=",
"msg",
"[",
"'content'",
"]",
"[",
"'data'",
"]",
"if",
"'image/svg+xml'",
"in",
"data",
":",
"fmt",
"=",
"'image/svg+xml'",
"img",
"=",
"data",
"[",
"'i... | Reimplemented to handle communications between the figure explorer
and the kernel. | [
"Reimplemented",
"to",
"handle",
"communications",
"between",
"the",
"figure",
"explorer",
"and",
"the",
"kernel",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/figurebrowser.py#L40-L76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.