repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.show_tree | def show_tree(self):
"""Populate the tree with profiler data and display it."""
self.initialize_view() # Clear before re-populating
self.setItemsExpandable(True)
self.setSortingEnabled(False)
rootkey = self.find_root() # This root contains profiler overhead
if root... | python | def show_tree(self):
"""Populate the tree with profiler data and display it."""
self.initialize_view() # Clear before re-populating
self.setItemsExpandable(True)
self.setSortingEnabled(False)
rootkey = self.find_root() # This root contains profiler overhead
if root... | [
"def",
"show_tree",
"(",
"self",
")",
":",
"self",
".",
"initialize_view",
"(",
")",
"# Clear before re-populating\r",
"self",
".",
"setItemsExpandable",
"(",
"True",
")",
"self",
".",
"setSortingEnabled",
"(",
"False",
")",
"rootkey",
"=",
"self",
".",
"find_... | Populate the tree with profiler data and display it. | [
"Populate",
"the",
"tree",
"with",
"profiler",
"data",
"and",
"display",
"it",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L536-L547 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.function_info | def function_info(self, functionKey):
"""Returns processed information about the function's name and file."""
node_type = 'function'
filename, line_number, function_name = functionKey
if function_name == '<module>':
modulePath, moduleName = osp.split(filename)
... | python | def function_info(self, functionKey):
"""Returns processed information about the function's name and file."""
node_type = 'function'
filename, line_number, function_name = functionKey
if function_name == '<module>':
modulePath, moduleName = osp.split(filename)
... | [
"def",
"function_info",
"(",
"self",
",",
"functionKey",
")",
":",
"node_type",
"=",
"'function'",
"filename",
",",
"line_number",
",",
"function_name",
"=",
"functionKey",
"if",
"function_name",
"==",
"'<module>'",
":",
"modulePath",
",",
"moduleName",
"=",
"os... | Returns processed information about the function's name and file. | [
"Returns",
"processed",
"information",
"about",
"the",
"function",
"s",
"name",
"and",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L549-L566 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.format_measure | def format_measure(measure):
"""Get format and units for data coming from profiler task."""
# Convert to a positive value.
measure = abs(measure)
# For number of calls
if isinstance(measure, int):
return to_text_string(measure)
# For time measuremen... | python | def format_measure(measure):
"""Get format and units for data coming from profiler task."""
# Convert to a positive value.
measure = abs(measure)
# For number of calls
if isinstance(measure, int):
return to_text_string(measure)
# For time measuremen... | [
"def",
"format_measure",
"(",
"measure",
")",
":",
"# Convert to a positive value.\r",
"measure",
"=",
"abs",
"(",
"measure",
")",
"# For number of calls\r",
"if",
"isinstance",
"(",
"measure",
",",
"int",
")",
":",
"return",
"to_text_string",
"(",
"measure",
")",... | Get format and units for data coming from profiler task. | [
"Get",
"format",
"and",
"units",
"for",
"data",
"coming",
"from",
"profiler",
"task",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L569-L598 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.color_string | def color_string(self, x):
"""Return a string formatted delta for the values in x.
Args:
x: 2-item list of integers (representing number of calls) or
2-item list of floats (representing seconds of runtime).
Returns:
A list with [formatted x[0], [c... | python | def color_string(self, x):
"""Return a string formatted delta for the values in x.
Args:
x: 2-item list of integers (representing number of calls) or
2-item list of floats (representing seconds of runtime).
Returns:
A list with [formatted x[0], [c... | [
"def",
"color_string",
"(",
"self",
",",
"x",
")",
":",
"diff_str",
"=",
"\"\"",
"color",
"=",
"\"black\"",
"if",
"len",
"(",
"x",
")",
"==",
"2",
"and",
"self",
".",
"compare_file",
"is",
"not",
"None",
":",
"difference",
"=",
"x",
"[",
"0",
"]",
... | Return a string formatted delta for the values in x.
Args:
x: 2-item list of integers (representing number of calls) or
2-item list of floats (representing seconds of runtime).
Returns:
A list with [formatted x[0], [color, formatted delta]], where
... | [
"Return",
"a",
"string",
"formatted",
"delta",
"for",
"the",
"values",
"in",
"x",
".",
"Args",
":",
"x",
":",
"2",
"-",
"item",
"list",
"of",
"integers",
"(",
"representing",
"number",
"of",
"calls",
")",
"or",
"2",
"-",
"item",
"list",
"of",
"floats... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L600-L620 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.format_output | def format_output(self, child_key):
""" Formats the data.
self.stats1 contains a list of one or two pstat.Stats() instances, with
the first being the current run and the second, the saved run, if it
exists. Each Stats instance is a dictionary mapping a function to
5 data ... | python | def format_output(self, child_key):
""" Formats the data.
self.stats1 contains a list of one or two pstat.Stats() instances, with
the first being the current run and the second, the saved run, if it
exists. Each Stats instance is a dictionary mapping a function to
5 data ... | [
"def",
"format_output",
"(",
"self",
",",
"child_key",
")",
":",
"data",
"=",
"[",
"x",
".",
"stats",
".",
"get",
"(",
"child_key",
",",
"[",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"{",
"}",
"]",
")",
"for",
"x",
"in",
"self",
".",
"stats1",... | Formats the data.
self.stats1 contains a list of one or two pstat.Stats() instances, with
the first being the current run and the second, the saved run, if it
exists. Each Stats instance is a dictionary mapping a function to
5 data points - cumulative calls, number of calls, total... | [
"Formats",
"the",
"data",
".",
"self",
".",
"stats1",
"contains",
"a",
"list",
"of",
"one",
"or",
"two",
"pstat",
".",
"Stats",
"()",
"instances",
"with",
"the",
"first",
"being",
"the",
"current",
"run",
"and",
"the",
"second",
"the",
"saved",
"run",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L622-L635 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.populate_tree | def populate_tree(self, parentItem, children_list):
"""Recursive method to create each item (and associated data) in the tree."""
for child_key in children_list:
self.item_depth += 1
(filename, line_number, function_name, file_and_line, node_type
) = self.functi... | python | def populate_tree(self, parentItem, children_list):
"""Recursive method to create each item (and associated data) in the tree."""
for child_key in children_list:
self.item_depth += 1
(filename, line_number, function_name, file_and_line, node_type
) = self.functi... | [
"def",
"populate_tree",
"(",
"self",
",",
"parentItem",
",",
"children_list",
")",
":",
"for",
"child_key",
"in",
"children_list",
":",
"self",
".",
"item_depth",
"+=",
"1",
"(",
"filename",
",",
"line_number",
",",
"function_name",
",",
"file_and_line",
",",
... | Recursive method to create each item (and associated data) in the tree. | [
"Recursive",
"method",
"to",
"create",
"each",
"item",
"(",
"and",
"associated",
"data",
")",
"in",
"the",
"tree",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L637-L699 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.is_recursive | def is_recursive(self, child_item):
"""Returns True is a function is a descendant of itself."""
ancestor = child_item.parent()
# FIXME: indexes to data should be defined by a dictionary on init
while ancestor:
if (child_item.data(0, Qt.DisplayRole
... | python | def is_recursive(self, child_item):
"""Returns True is a function is a descendant of itself."""
ancestor = child_item.parent()
# FIXME: indexes to data should be defined by a dictionary on init
while ancestor:
if (child_item.data(0, Qt.DisplayRole
... | [
"def",
"is_recursive",
"(",
"self",
",",
"child_item",
")",
":",
"ancestor",
"=",
"child_item",
".",
"parent",
"(",
")",
"# FIXME: indexes to data should be defined by a dictionary on init\r",
"while",
"ancestor",
":",
"if",
"(",
"child_item",
".",
"data",
"(",
"0",... | Returns True is a function is a descendant of itself. | [
"Returns",
"True",
"is",
"a",
"function",
"is",
"a",
"descendant",
"of",
"itself",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L710-L722 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.get_items | def get_items(self, maxlevel):
"""Return all items with a level <= `maxlevel`"""
itemlist = []
def add_to_itemlist(item, maxlevel, level=1):
level += 1
for index in range(item.childCount()):
citem = item.child(index)
itemlist.append(... | python | def get_items(self, maxlevel):
"""Return all items with a level <= `maxlevel`"""
itemlist = []
def add_to_itemlist(item, maxlevel, level=1):
level += 1
for index in range(item.childCount()):
citem = item.child(index)
itemlist.append(... | [
"def",
"get_items",
"(",
"self",
",",
"maxlevel",
")",
":",
"itemlist",
"=",
"[",
"]",
"def",
"add_to_itemlist",
"(",
"item",
",",
"maxlevel",
",",
"level",
"=",
"1",
")",
":",
"level",
"+=",
"1",
"for",
"index",
"in",
"range",
"(",
"item",
".",
"c... | Return all items with a level <= `maxlevel` | [
"Return",
"all",
"items",
"with",
"a",
"level",
"<",
"=",
"maxlevel"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L728-L742 | train |
spyder-ide/spyder | spyder/plugins/profiler/widgets/profilergui.py | ProfilerDataTree.change_view | def change_view(self, change_in_depth):
"""Change the view depth by expand or collapsing all same-level nodes"""
self.current_view_depth += change_in_depth
if self.current_view_depth < 0:
self.current_view_depth = 0
self.collapseAll()
if self.current_view_depth ... | python | def change_view(self, change_in_depth):
"""Change the view depth by expand or collapsing all same-level nodes"""
self.current_view_depth += change_in_depth
if self.current_view_depth < 0:
self.current_view_depth = 0
self.collapseAll()
if self.current_view_depth ... | [
"def",
"change_view",
"(",
"self",
",",
"change_in_depth",
")",
":",
"self",
".",
"current_view_depth",
"+=",
"change_in_depth",
"if",
"self",
".",
"current_view_depth",
"<",
"0",
":",
"self",
".",
"current_view_depth",
"=",
"0",
"self",
".",
"collapseAll",
"(... | Change the view depth by expand or collapsing all same-level nodes | [
"Change",
"the",
"view",
"depth",
"by",
"expand",
"or",
"collapsing",
"all",
"same",
"-",
"level",
"nodes"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/widgets/profilergui.py#L744-L752 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/utils/style.py | create_qss_style | def create_qss_style(color_scheme):
"""Returns a QSS stylesheet with Spyder color scheme settings.
The stylesheet can contain classes for:
Qt: QPlainTextEdit, QFrame, QWidget, etc
Pygments: .c, .k, .o, etc. (see PygmentsHighlighter)
IPython: .error, .in-prompt, .out-prompt, etc
"""
... | python | def create_qss_style(color_scheme):
"""Returns a QSS stylesheet with Spyder color scheme settings.
The stylesheet can contain classes for:
Qt: QPlainTextEdit, QFrame, QWidget, etc
Pygments: .c, .k, .o, etc. (see PygmentsHighlighter)
IPython: .error, .in-prompt, .out-prompt, etc
"""
... | [
"def",
"create_qss_style",
"(",
"color_scheme",
")",
":",
"def",
"give_font_weight",
"(",
"is_bold",
")",
":",
"if",
"is_bold",
":",
"return",
"'bold'",
"else",
":",
"return",
"'normal'",
"def",
"give_font_style",
"(",
"is_italic",
")",
":",
"if",
"is_italic",... | Returns a QSS stylesheet with Spyder color scheme settings.
The stylesheet can contain classes for:
Qt: QPlainTextEdit, QFrame, QWidget, etc
Pygments: .c, .k, .o, etc. (see PygmentsHighlighter)
IPython: .error, .in-prompt, .out-prompt, etc | [
"Returns",
"a",
"QSS",
"stylesheet",
"with",
"Spyder",
"color",
"scheme",
"settings",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/utils/style.py#L22-L80 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/utils/style.py | create_pygments_dict | def create_pygments_dict(color_scheme_name):
"""
Create a dictionary that saves the given color scheme as a
Pygments style.
"""
def give_font_weight(is_bold):
if is_bold:
return 'bold'
else:
return ''
def give_font_style(is_italic):
if is_italic:... | python | def create_pygments_dict(color_scheme_name):
"""
Create a dictionary that saves the given color scheme as a
Pygments style.
"""
def give_font_weight(is_bold):
if is_bold:
return 'bold'
else:
return ''
def give_font_style(is_italic):
if is_italic:... | [
"def",
"create_pygments_dict",
"(",
"color_scheme_name",
")",
":",
"def",
"give_font_weight",
"(",
"is_bold",
")",
":",
"if",
"is_bold",
":",
"return",
"'bold'",
"else",
":",
"return",
"''",
"def",
"give_font_style",
"(",
"is_italic",
")",
":",
"if",
"is_itali... | Create a dictionary that saves the given color scheme as a
Pygments style. | [
"Create",
"a",
"dictionary",
"that",
"saves",
"the",
"given",
"color",
"scheme",
"as",
"a",
"Pygments",
"style",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/utils/style.py#L83-L165 | train |
spyder-ide/spyder | spyder/utils/misc.py | __remove_pyc_pyo | def __remove_pyc_pyo(fname):
"""Eventually remove .pyc and .pyo files associated to a Python script"""
if osp.splitext(fname)[1] == '.py':
for ending in ('c', 'o'):
if osp.exists(fname+ending):
os.remove(fname+ending) | python | def __remove_pyc_pyo(fname):
"""Eventually remove .pyc and .pyo files associated to a Python script"""
if osp.splitext(fname)[1] == '.py':
for ending in ('c', 'o'):
if osp.exists(fname+ending):
os.remove(fname+ending) | [
"def",
"__remove_pyc_pyo",
"(",
"fname",
")",
":",
"if",
"osp",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
"==",
"'.py'",
":",
"for",
"ending",
"in",
"(",
"'c'",
",",
"'o'",
")",
":",
"if",
"osp",
".",
"exists",
"(",
"fname",
"+",
"ending... | Eventually remove .pyc and .pyo files associated to a Python script | [
"Eventually",
"remove",
".",
"pyc",
"and",
".",
"pyo",
"files",
"associated",
"to",
"a",
"Python",
"script"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L24-L29 | train |
spyder-ide/spyder | spyder/utils/misc.py | move_file | def move_file(source, dest):
"""
Move file from *source* to *dest*
If file is a Python script, also rename .pyc and .pyo files if any
"""
import shutil
shutil.copy(source, dest)
remove_file(source) | python | def move_file(source, dest):
"""
Move file from *source* to *dest*
If file is a Python script, also rename .pyc and .pyo files if any
"""
import shutil
shutil.copy(source, dest)
remove_file(source) | [
"def",
"move_file",
"(",
"source",
",",
"dest",
")",
":",
"import",
"shutil",
"shutil",
".",
"copy",
"(",
"source",
",",
"dest",
")",
"remove_file",
"(",
"source",
")"
] | Move file from *source* to *dest*
If file is a Python script, also rename .pyc and .pyo files if any | [
"Move",
"file",
"from",
"*",
"source",
"*",
"to",
"*",
"dest",
"*",
"If",
"file",
"is",
"a",
"Python",
"script",
"also",
"rename",
".",
"pyc",
"and",
".",
"pyo",
"files",
"if",
"any"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L50-L57 | train |
spyder-ide/spyder | spyder/utils/misc.py | onerror | def onerror(function, path, excinfo):
"""Error handler for `shutil.rmtree`.
If the error is due to an access error (read-only file), it
attempts to add write permission and then retries.
If the error is for another reason, it re-raises the error.
Usage: `shutil.rmtree(path, onerror=onerror)... | python | def onerror(function, path, excinfo):
"""Error handler for `shutil.rmtree`.
If the error is due to an access error (read-only file), it
attempts to add write permission and then retries.
If the error is for another reason, it re-raises the error.
Usage: `shutil.rmtree(path, onerror=onerror)... | [
"def",
"onerror",
"(",
"function",
",",
"path",
",",
"excinfo",
")",
":",
"if",
"not",
"os",
".",
"access",
"(",
"path",
",",
"os",
".",
"W_OK",
")",
":",
"# Is the error an access error?\r",
"os",
".",
"chmod",
"(",
"path",
",",
"stat",
".",
"S_IWUSR"... | Error handler for `shutil.rmtree`.
If the error is due to an access error (read-only file), it
attempts to add write permission and then retries.
If the error is for another reason, it re-raises the error.
Usage: `shutil.rmtree(path, onerror=onerror) | [
"Error",
"handler",
"for",
"shutil",
".",
"rmtree",
".",
"If",
"the",
"error",
"is",
"due",
"to",
"an",
"access",
"error",
"(",
"read",
"-",
"only",
"file",
")",
"it",
"attempts",
"to",
"add",
"write",
"permission",
"and",
"then",
"retries",
".",
"If",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L60-L73 | train |
spyder-ide/spyder | spyder/utils/misc.py | select_port | def select_port(default_port=20128):
"""Find and return a non used port"""
import socket
while True:
try:
sock = socket.socket(socket.AF_INET,
socket.SOCK_STREAM,
socket.IPPROTO_TCP)
# sock.setsockopt(so... | python | def select_port(default_port=20128):
"""Find and return a non used port"""
import socket
while True:
try:
sock = socket.socket(socket.AF_INET,
socket.SOCK_STREAM,
socket.IPPROTO_TCP)
# sock.setsockopt(so... | [
"def",
"select_port",
"(",
"default_port",
"=",
"20128",
")",
":",
"import",
"socket",
"while",
"True",
":",
"try",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
",",
"socket",
".",
"IPPROTO_... | Find and return a non used port | [
"Find",
"and",
"return",
"a",
"non",
"used",
"port"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L76-L93 | train |
spyder-ide/spyder | spyder/utils/misc.py | count_lines | def count_lines(path, extensions=None, excluded_dirnames=None):
"""Return number of source code lines for all filenames in subdirectories
of *path* with names ending with *extensions*
Directory names *excluded_dirnames* will be ignored"""
if extensions is None:
extensions = ['.py', '.pyw', ... | python | def count_lines(path, extensions=None, excluded_dirnames=None):
"""Return number of source code lines for all filenames in subdirectories
of *path* with names ending with *extensions*
Directory names *excluded_dirnames* will be ignored"""
if extensions is None:
extensions = ['.py', '.pyw', ... | [
"def",
"count_lines",
"(",
"path",
",",
"extensions",
"=",
"None",
",",
"excluded_dirnames",
"=",
"None",
")",
":",
"if",
"extensions",
"is",
"None",
":",
"extensions",
"=",
"[",
"'.py'",
",",
"'.pyw'",
",",
"'.ipy'",
",",
"'.enaml'",
",",
"'.c'",
",",
... | Return number of source code lines for all filenames in subdirectories
of *path* with names ending with *extensions*
Directory names *excluded_dirnames* will be ignored | [
"Return",
"number",
"of",
"source",
"code",
"lines",
"for",
"all",
"filenames",
"in",
"subdirectories",
"of",
"*",
"path",
"*",
"with",
"names",
"ending",
"with",
"*",
"extensions",
"*",
"Directory",
"names",
"*",
"excluded_dirnames",
"*",
"will",
"be",
"ign... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L96-L131 | train |
spyder-ide/spyder | spyder/utils/misc.py | remove_backslashes | def remove_backslashes(path):
"""Remove backslashes in *path*
For Windows platforms only.
Returns the path unchanged on other platforms.
This is especially useful when formatting path strings on
Windows platforms for which folder paths may contain backslashes
and provoke unicode decodi... | python | def remove_backslashes(path):
"""Remove backslashes in *path*
For Windows platforms only.
Returns the path unchanged on other platforms.
This is especially useful when formatting path strings on
Windows platforms for which folder paths may contain backslashes
and provoke unicode decodi... | [
"def",
"remove_backslashes",
"(",
"path",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"# Removing trailing single backslash\r",
"if",
"path",
".",
"endswith",
"(",
"'\\\\'",
")",
"and",
"not",
"path",
".",
"endswith",
"(",
"'\\\\\\\\'",
")",
":",
... | Remove backslashes in *path*
For Windows platforms only.
Returns the path unchanged on other platforms.
This is especially useful when formatting path strings on
Windows platforms for which folder paths may contain backslashes
and provoke unicode decoding errors in Python 3 (or in Python 2
... | [
"Remove",
"backslashes",
"in",
"*",
"path",
"*",
"For",
"Windows",
"platforms",
"only",
".",
"Returns",
"the",
"path",
"unchanged",
"on",
"other",
"platforms",
".",
"This",
"is",
"especially",
"useful",
"when",
"formatting",
"path",
"strings",
"on",
"Windows",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L134-L151 | train |
spyder-ide/spyder | spyder/utils/misc.py | monkeypatch_method | def monkeypatch_method(cls, patch_name):
# This function's code was inspired from the following thread:
# "[Python-Dev] Monkeypatching idioms -- elegant or ugly?"
# by Robert Brewer <fumanchu at aminus.org>
# (Tue Jan 15 19:13:25 CET 2008)
"""
Add the decorated method to the given class; r... | python | def monkeypatch_method(cls, patch_name):
# This function's code was inspired from the following thread:
# "[Python-Dev] Monkeypatching idioms -- elegant or ugly?"
# by Robert Brewer <fumanchu at aminus.org>
# (Tue Jan 15 19:13:25 CET 2008)
"""
Add the decorated method to the given class; r... | [
"def",
"monkeypatch_method",
"(",
"cls",
",",
"patch_name",
")",
":",
"# This function's code was inspired from the following thread:\r",
"# \"[Python-Dev] Monkeypatching idioms -- elegant or ugly?\"\r",
"# by Robert Brewer <fumanchu at aminus.org>\r",
"# (Tue Jan 15 19:13:25 CET 2008)\r",
"... | Add the decorated method to the given class; replace as needed.
If the named method already exists on the given class, it will
be replaced, and a reference to the old method is created as
cls._old<patch_name><name>. If the "_old_<patch_name>_<name>" attribute
already exists, KeyError is raised. | [
"Add",
"the",
"decorated",
"method",
"to",
"the",
"given",
"class",
";",
"replace",
"as",
"needed",
".",
"If",
"the",
"named",
"method",
"already",
"exists",
"on",
"the",
"given",
"class",
"it",
"will",
"be",
"replaced",
"and",
"a",
"reference",
"to",
"t... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L169-L197 | train |
spyder-ide/spyder | spyder/utils/misc.py | get_common_path | def get_common_path(pathlist):
"""Return common path for all paths in pathlist"""
common = osp.normpath(osp.commonprefix(pathlist))
if len(common) > 1:
if not osp.isdir(common):
return abspardir(common)
else:
for path in pathlist:
if not osp.is... | python | def get_common_path(pathlist):
"""Return common path for all paths in pathlist"""
common = osp.normpath(osp.commonprefix(pathlist))
if len(common) > 1:
if not osp.isdir(common):
return abspardir(common)
else:
for path in pathlist:
if not osp.is... | [
"def",
"get_common_path",
"(",
"pathlist",
")",
":",
"common",
"=",
"osp",
".",
"normpath",
"(",
"osp",
".",
"commonprefix",
"(",
"pathlist",
")",
")",
"if",
"len",
"(",
"common",
")",
">",
"1",
":",
"if",
"not",
"osp",
".",
"isdir",
"(",
"common",
... | Return common path for all paths in pathlist | [
"Return",
"common",
"path",
"for",
"all",
"paths",
"in",
"pathlist"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L210-L222 | train |
spyder-ide/spyder | spyder/utils/misc.py | memoize | def memoize(obj):
"""
Memoize objects to trade memory for execution speed
Use a limited size cache to store the value, which takes into account
The calling args and kwargs
See https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
"""
cache = obj.cache = {}
@functools.... | python | def memoize(obj):
"""
Memoize objects to trade memory for execution speed
Use a limited size cache to store the value, which takes into account
The calling args and kwargs
See https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
"""
cache = obj.cache = {}
@functools.... | [
"def",
"memoize",
"(",
"obj",
")",
":",
"cache",
"=",
"obj",
".",
"cache",
"=",
"{",
"}",
"@",
"functools",
".",
"wraps",
"(",
"obj",
")",
"def",
"memoizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"key",
"=",
"str",
"(",
"args",
... | Memoize objects to trade memory for execution speed
Use a limited size cache to store the value, which takes into account
The calling args and kwargs
See https://wiki.python.org/moin/PythonDecoratorLibrary#Memoize | [
"Memoize",
"objects",
"to",
"trade",
"memory",
"for",
"execution",
"speed",
"Use",
"a",
"limited",
"size",
"cache",
"to",
"store",
"the",
"value",
"which",
"takes",
"into",
"account",
"The",
"calling",
"args",
"and",
"kwargs",
"See",
"https",
":",
"//",
"w... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L252-L272 | train |
spyder-ide/spyder | spyder/utils/misc.py | regexp_error_msg | def regexp_error_msg(pattern):
"""
Return None if the pattern is a valid regular expression or
a string describing why the pattern is invalid.
"""
try:
re.compile(pattern)
except re.error as e:
return str(e)
return None | python | def regexp_error_msg(pattern):
"""
Return None if the pattern is a valid regular expression or
a string describing why the pattern is invalid.
"""
try:
re.compile(pattern)
except re.error as e:
return str(e)
return None | [
"def",
"regexp_error_msg",
"(",
"pattern",
")",
":",
"try",
":",
"re",
".",
"compile",
"(",
"pattern",
")",
"except",
"re",
".",
"error",
"as",
"e",
":",
"return",
"str",
"(",
"e",
")",
"return",
"None"
] | Return None if the pattern is a valid regular expression or
a string describing why the pattern is invalid. | [
"Return",
"None",
"if",
"the",
"pattern",
"is",
"a",
"valid",
"regular",
"expression",
"or",
"a",
"string",
"describing",
"why",
"the",
"pattern",
"is",
"invalid",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/misc.py#L289-L298 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.get_range | def get_range(self, ignore_blank_lines=True):
"""
Gets the fold region range (start and end line).
.. note:: Start line do no encompass the trigger line.
:param ignore_blank_lines: True to ignore blank lines at the end of the
scope (the method will rewind to find that last ... | python | def get_range(self, ignore_blank_lines=True):
"""
Gets the fold region range (start and end line).
.. note:: Start line do no encompass the trigger line.
:param ignore_blank_lines: True to ignore blank lines at the end of the
scope (the method will rewind to find that last ... | [
"def",
"get_range",
"(",
"self",
",",
"ignore_blank_lines",
"=",
"True",
")",
":",
"ref_lvl",
"=",
"self",
".",
"trigger_level",
"first_line",
"=",
"self",
".",
"_trigger",
".",
"blockNumber",
"(",
")",
"block",
"=",
"self",
".",
"_trigger",
".",
"next",
... | Gets the fold region range (start and end line).
.. note:: Start line do no encompass the trigger line.
:param ignore_blank_lines: True to ignore blank lines at the end of the
scope (the method will rewind to find that last meaningful block
that is part of the fold scope).
... | [
"Gets",
"the",
"fold",
"region",
"range",
"(",
"start",
"and",
"end",
"line",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L71-L100 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.fold | def fold(self):
"""Folds the region."""
start, end = self.get_range()
TextBlockHelper.set_collapsed(self._trigger, True)
block = self._trigger.next()
while block.blockNumber() <= end and block.isValid():
block.setVisible(False)
block = block.next() | python | def fold(self):
"""Folds the region."""
start, end = self.get_range()
TextBlockHelper.set_collapsed(self._trigger, True)
block = self._trigger.next()
while block.blockNumber() <= end and block.isValid():
block.setVisible(False)
block = block.next() | [
"def",
"fold",
"(",
"self",
")",
":",
"start",
",",
"end",
"=",
"self",
".",
"get_range",
"(",
")",
"TextBlockHelper",
".",
"set_collapsed",
"(",
"self",
".",
"_trigger",
",",
"True",
")",
"block",
"=",
"self",
".",
"_trigger",
".",
"next",
"(",
")",... | Folds the region. | [
"Folds",
"the",
"region",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L102-L109 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.unfold | def unfold(self):
"""Unfolds the region."""
# set all direct child blocks which are not triggers to be visible
self._trigger.setVisible(True)
TextBlockHelper.set_collapsed(self._trigger, False)
for block in self.blocks(ignore_blank_lines=False):
block.setVisible(True)... | python | def unfold(self):
"""Unfolds the region."""
# set all direct child blocks which are not triggers to be visible
self._trigger.setVisible(True)
TextBlockHelper.set_collapsed(self._trigger, False)
for block in self.blocks(ignore_blank_lines=False):
block.setVisible(True)... | [
"def",
"unfold",
"(",
"self",
")",
":",
"# set all direct child blocks which are not triggers to be visible",
"self",
".",
"_trigger",
".",
"setVisible",
"(",
"True",
")",
"TextBlockHelper",
".",
"set_collapsed",
"(",
"self",
".",
"_trigger",
",",
"False",
")",
"for... | Unfolds the region. | [
"Unfolds",
"the",
"region",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L111-L119 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.blocks | def blocks(self, ignore_blank_lines=True):
"""
This generator generates the list of blocks directly under the fold
region. This list does not contain blocks from child regions.
:param ignore_blank_lines: True to ignore last blank lines.
"""
start, end = self.get_range(ig... | python | def blocks(self, ignore_blank_lines=True):
"""
This generator generates the list of blocks directly under the fold
region. This list does not contain blocks from child regions.
:param ignore_blank_lines: True to ignore last blank lines.
"""
start, end = self.get_range(ig... | [
"def",
"blocks",
"(",
"self",
",",
"ignore_blank_lines",
"=",
"True",
")",
":",
"start",
",",
"end",
"=",
"self",
".",
"get_range",
"(",
"ignore_blank_lines",
"=",
"ignore_blank_lines",
")",
"block",
"=",
"self",
".",
"_trigger",
".",
"next",
"(",
")",
"... | This generator generates the list of blocks directly under the fold
region. This list does not contain blocks from child regions.
:param ignore_blank_lines: True to ignore last blank lines. | [
"This",
"generator",
"generates",
"the",
"list",
"of",
"blocks",
"directly",
"under",
"the",
"fold",
"region",
".",
"This",
"list",
"does",
"not",
"contain",
"blocks",
"from",
"child",
"regions",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L121-L132 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.child_regions | def child_regions(self):
"""This generator generates the list of direct child regions."""
start, end = self.get_range()
block = self._trigger.next()
ref_lvl = self.scope_level
while block.blockNumber() <= end and block.isValid():
lvl = TextBlockHelper.get_fold_lvl(blo... | python | def child_regions(self):
"""This generator generates the list of direct child regions."""
start, end = self.get_range()
block = self._trigger.next()
ref_lvl = self.scope_level
while block.blockNumber() <= end and block.isValid():
lvl = TextBlockHelper.get_fold_lvl(blo... | [
"def",
"child_regions",
"(",
"self",
")",
":",
"start",
",",
"end",
"=",
"self",
".",
"get_range",
"(",
")",
"block",
"=",
"self",
".",
"_trigger",
".",
"next",
"(",
")",
"ref_lvl",
"=",
"self",
".",
"scope_level",
"while",
"block",
".",
"blockNumber",... | This generator generates the list of direct child regions. | [
"This",
"generator",
"generates",
"the",
"list",
"of",
"direct",
"child",
"regions",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L134-L144 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.parent | def parent(self):
"""
Return the parent scope.
:return: FoldScope or None
"""
if TextBlockHelper.get_fold_lvl(self._trigger) > 0 and \
self._trigger.blockNumber():
block = self._trigger.previous()
ref_lvl = self.trigger_level - 1
... | python | def parent(self):
"""
Return the parent scope.
:return: FoldScope or None
"""
if TextBlockHelper.get_fold_lvl(self._trigger) > 0 and \
self._trigger.blockNumber():
block = self._trigger.previous()
ref_lvl = self.trigger_level - 1
... | [
"def",
"parent",
"(",
"self",
")",
":",
"if",
"TextBlockHelper",
".",
"get_fold_lvl",
"(",
"self",
".",
"_trigger",
")",
">",
"0",
"and",
"self",
".",
"_trigger",
".",
"blockNumber",
"(",
")",
":",
"block",
"=",
"self",
".",
"_trigger",
".",
"previous"... | Return the parent scope.
:return: FoldScope or None | [
"Return",
"the",
"parent",
"scope",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L146-L164 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | FoldScope.text | def text(self, max_lines=sys.maxsize):
"""
Get the scope text, with a possible maximum number of lines.
:param max_lines: limit the number of lines returned to a maximum.
:return: str
"""
ret_val = []
block = self._trigger.next()
_, end = self.get_range()... | python | def text(self, max_lines=sys.maxsize):
"""
Get the scope text, with a possible maximum number of lines.
:param max_lines: limit the number of lines returned to a maximum.
:return: str
"""
ret_val = []
block = self._trigger.next()
_, end = self.get_range()... | [
"def",
"text",
"(",
"self",
",",
"max_lines",
"=",
"sys",
".",
"maxsize",
")",
":",
"ret_val",
"=",
"[",
"]",
"block",
"=",
"self",
".",
"_trigger",
".",
"next",
"(",
")",
"_",
",",
"end",
"=",
"self",
".",
"get_range",
"(",
")",
"while",
"(",
... | Get the scope text, with a possible maximum number of lines.
:param max_lines: limit the number of lines returned to a maximum.
:return: str | [
"Get",
"the",
"scope",
"text",
"with",
"a",
"possible",
"maximum",
"number",
"of",
"lines",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L166-L180 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/folding.py | IndentFoldDetector.detect_fold_level | def detect_fold_level(self, prev_block, block):
"""
Detects fold level by looking at the block indentation.
:param prev_block: previous text block
:param block: current block to highlight
"""
text = block.text()
prev_lvl = TextBlockHelper().get_fold_lvl(prev_bloc... | python | def detect_fold_level(self, prev_block, block):
"""
Detects fold level by looking at the block indentation.
:param prev_block: previous text block
:param block: current block to highlight
"""
text = block.text()
prev_lvl = TextBlockHelper().get_fold_lvl(prev_bloc... | [
"def",
"detect_fold_level",
"(",
"self",
",",
"prev_block",
",",
"block",
")",
":",
"text",
"=",
"block",
".",
"text",
"(",
")",
"prev_lvl",
"=",
"TextBlockHelper",
"(",
")",
".",
"get_fold_lvl",
"(",
"prev_block",
")",
"# round down to previous indentation guid... | Detects fold level by looking at the block indentation.
:param prev_block: previous text block
:param block: current block to highlight | [
"Detects",
"fold",
"level",
"by",
"looking",
"at",
"the",
"block",
"indentation",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/folding.py#L216-L236 | train |
spyder-ide/spyder | spyder/plugins/editor/extensions/manager.py | EditorExtensionsManager.add | def add(self, extension):
"""
Add a extension to the editor.
:param extension: The extension instance to add.
"""
logger.debug('adding extension {}'.format(extension.name))
self._extensions[extension.name] = extension
extension.on_install(self.editor)
re... | python | def add(self, extension):
"""
Add a extension to the editor.
:param extension: The extension instance to add.
"""
logger.debug('adding extension {}'.format(extension.name))
self._extensions[extension.name] = extension
extension.on_install(self.editor)
re... | [
"def",
"add",
"(",
"self",
",",
"extension",
")",
":",
"logger",
".",
"debug",
"(",
"'adding extension {}'",
".",
"format",
"(",
"extension",
".",
"name",
")",
")",
"self",
".",
"_extensions",
"[",
"extension",
".",
"name",
"]",
"=",
"extension",
"extens... | Add a extension to the editor.
:param extension: The extension instance to add. | [
"Add",
"a",
"extension",
"to",
"the",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/manager.py#L37-L47 | train |
spyder-ide/spyder | spyder/plugins/editor/extensions/manager.py | EditorExtensionsManager.remove | def remove(self, name_or_klass):
"""
Remove a extension from the editor.
:param name_or_klass: The name (or class) of the extension to remove.
:returns: The removed extension.
"""
logger.debug('removing extension {}'.format(name_or_klass))
extension = self.get(na... | python | def remove(self, name_or_klass):
"""
Remove a extension from the editor.
:param name_or_klass: The name (or class) of the extension to remove.
:returns: The removed extension.
"""
logger.debug('removing extension {}'.format(name_or_klass))
extension = self.get(na... | [
"def",
"remove",
"(",
"self",
",",
"name_or_klass",
")",
":",
"logger",
".",
"debug",
"(",
"'removing extension {}'",
".",
"format",
"(",
"name_or_klass",
")",
")",
"extension",
"=",
"self",
".",
"get",
"(",
"name_or_klass",
")",
"extension",
".",
"on_uninst... | Remove a extension from the editor.
:param name_or_klass: The name (or class) of the extension to remove.
:returns: The removed extension. | [
"Remove",
"a",
"extension",
"from",
"the",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/manager.py#L49-L60 | train |
spyder-ide/spyder | spyder/plugins/editor/extensions/manager.py | EditorExtensionsManager.clear | def clear(self):
"""
Remove all extensions from the editor.
All extensions are removed fromlist and deleted.
"""
while len(self._extensions):
key = sorted(list(self._extensions.keys()))[0]
self.remove(key) | python | def clear(self):
"""
Remove all extensions from the editor.
All extensions are removed fromlist and deleted.
"""
while len(self._extensions):
key = sorted(list(self._extensions.keys()))[0]
self.remove(key) | [
"def",
"clear",
"(",
"self",
")",
":",
"while",
"len",
"(",
"self",
".",
"_extensions",
")",
":",
"key",
"=",
"sorted",
"(",
"list",
"(",
"self",
".",
"_extensions",
".",
"keys",
"(",
")",
")",
")",
"[",
"0",
"]",
"self",
".",
"remove",
"(",
"k... | Remove all extensions from the editor.
All extensions are removed fromlist and deleted. | [
"Remove",
"all",
"extensions",
"from",
"the",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/manager.py#L62-L70 | train |
spyder-ide/spyder | spyder/plugins/editor/extensions/manager.py | EditorExtensionsManager.get | def get(self, name_or_klass):
"""
Get a extension by name (or class).
:param name_or_klass: The name or the class of the extension to get
:type name_or_klass: str or type
:rtype: spyder.api.mode.EditorExtension
"""
if not isinstance(name_or_klass, str):
... | python | def get(self, name_or_klass):
"""
Get a extension by name (or class).
:param name_or_klass: The name or the class of the extension to get
:type name_or_klass: str or type
:rtype: spyder.api.mode.EditorExtension
"""
if not isinstance(name_or_klass, str):
... | [
"def",
"get",
"(",
"self",
",",
"name_or_klass",
")",
":",
"if",
"not",
"isinstance",
"(",
"name_or_klass",
",",
"str",
")",
":",
"name_or_klass",
"=",
"name_or_klass",
".",
"__name__",
"return",
"self",
".",
"_extensions",
"[",
"name_or_klass",
"]"
] | Get a extension by name (or class).
:param name_or_klass: The name or the class of the extension to get
:type name_or_klass: str or type
:rtype: spyder.api.mode.EditorExtension | [
"Get",
"a",
"extension",
"by",
"name",
"(",
"or",
"class",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/extensions/manager.py#L72-L82 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | insert_text_to | def insert_text_to(cursor, text, fmt):
"""Helper to print text, taking into account backspaces"""
while True:
index = text.find(chr(8)) # backspace
if index == -1:
break
cursor.insertText(text[:index], fmt)
if cursor.positionInBlock() > 0:
cursor.deletePr... | python | def insert_text_to(cursor, text, fmt):
"""Helper to print text, taking into account backspaces"""
while True:
index = text.find(chr(8)) # backspace
if index == -1:
break
cursor.insertText(text[:index], fmt)
if cursor.positionInBlock() > 0:
cursor.deletePr... | [
"def",
"insert_text_to",
"(",
"cursor",
",",
"text",
",",
"fmt",
")",
":",
"while",
"True",
":",
"index",
"=",
"text",
".",
"find",
"(",
"chr",
"(",
"8",
")",
")",
"# backspace",
"if",
"index",
"==",
"-",
"1",
":",
"break",
"cursor",
".",
"insertTe... | Helper to print text, taking into account backspaces | [
"Helper",
"to",
"print",
"text",
"taking",
"into",
"account",
"backspaces"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L35-L45 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | QtANSIEscapeCodeHandler.set_color_scheme | def set_color_scheme(self, foreground_color, background_color):
"""Set color scheme (foreground and background)."""
if dark_color(foreground_color):
self.default_foreground_color = 30
else:
self.default_foreground_color = 37
if dark_color(background_color):
... | python | def set_color_scheme(self, foreground_color, background_color):
"""Set color scheme (foreground and background)."""
if dark_color(foreground_color):
self.default_foreground_color = 30
else:
self.default_foreground_color = 37
if dark_color(background_color):
... | [
"def",
"set_color_scheme",
"(",
"self",
",",
"foreground_color",
",",
"background_color",
")",
":",
"if",
"dark_color",
"(",
"foreground_color",
")",
":",
"self",
".",
"default_foreground_color",
"=",
"30",
"else",
":",
"self",
".",
"default_foreground_color",
"="... | Set color scheme (foreground and background). | [
"Set",
"color",
"scheme",
"(",
"foreground",
"and",
"background",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L54-L64 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | QtANSIEscapeCodeHandler.set_style | def set_style(self):
"""
Set font style with the following attributes:
'foreground_color', 'background_color', 'italic',
'bold' and 'underline'
"""
if self.current_format is None:
assert self.base_format is not None
self.current_format = QTextCharF... | python | def set_style(self):
"""
Set font style with the following attributes:
'foreground_color', 'background_color', 'italic',
'bold' and 'underline'
"""
if self.current_format is None:
assert self.base_format is not None
self.current_format = QTextCharF... | [
"def",
"set_style",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_format",
"is",
"None",
":",
"assert",
"self",
".",
"base_format",
"is",
"not",
"None",
"self",
".",
"current_format",
"=",
"QTextCharFormat",
"(",
"self",
".",
"base_format",
")",
"# Fo... | Set font style with the following attributes:
'foreground_color', 'background_color', 'italic',
'bold' and 'underline' | [
"Set",
"font",
"style",
"with",
"the",
"following",
"attributes",
":",
"foreground_color",
"background_color",
"italic",
"bold",
"and",
"underline"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L72-L115 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | ConsoleBaseWidget.set_color_scheme | def set_color_scheme(self, foreground_color, background_color):
"""Set color scheme of the console (foreground and background)."""
self.ansi_handler.set_color_scheme(foreground_color, background_color)
background_color = QColor(background_color)
foreground_color = QColor(foreground_colo... | python | def set_color_scheme(self, foreground_color, background_color):
"""Set color scheme of the console (foreground and background)."""
self.ansi_handler.set_color_scheme(foreground_color, background_color)
background_color = QColor(background_color)
foreground_color = QColor(foreground_colo... | [
"def",
"set_color_scheme",
"(",
"self",
",",
"foreground_color",
",",
"background_color",
")",
":",
"self",
".",
"ansi_handler",
".",
"set_color_scheme",
"(",
"foreground_color",
",",
"background_color",
")",
"background_color",
"=",
"QColor",
"(",
"background_color",... | Set color scheme of the console (foreground and background). | [
"Set",
"color",
"scheme",
"of",
"the",
"console",
"(",
"foreground",
"and",
"background",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L202-L212 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | ConsoleBaseWidget.insert_text | def insert_text(self, text):
"""Reimplement TextEditBaseWidget method"""
# Eventually this maybe should wrap to insert_text_to if
# backspace-handling is required
self.textCursor().insertText(text, self.default_style.format) | python | def insert_text(self, text):
"""Reimplement TextEditBaseWidget method"""
# Eventually this maybe should wrap to insert_text_to if
# backspace-handling is required
self.textCursor().insertText(text, self.default_style.format) | [
"def",
"insert_text",
"(",
"self",
",",
"text",
")",
":",
"# Eventually this maybe should wrap to insert_text_to if",
"# backspace-handling is required",
"self",
".",
"textCursor",
"(",
")",
".",
"insertText",
"(",
"text",
",",
"self",
".",
"default_style",
".",
"form... | Reimplement TextEditBaseWidget method | [
"Reimplement",
"TextEditBaseWidget",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L215-L219 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | ConsoleBaseWidget.paste | def paste(self):
"""Reimplement Qt method"""
if self.has_selected_text():
self.remove_selected_text()
self.insert_text(QApplication.clipboard().text()) | python | def paste(self):
"""Reimplement Qt method"""
if self.has_selected_text():
self.remove_selected_text()
self.insert_text(QApplication.clipboard().text()) | [
"def",
"paste",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_selected_text",
"(",
")",
":",
"self",
".",
"remove_selected_text",
"(",
")",
"self",
".",
"insert_text",
"(",
"QApplication",
".",
"clipboard",
"(",
")",
".",
"text",
"(",
")",
")"
] | Reimplement Qt method | [
"Reimplement",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L221-L225 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | ConsoleBaseWidget.append_text_to_shell | def append_text_to_shell(self, text, error, prompt):
"""
Append text to Python shell
In a way, this method overrides the method 'insert_text' when text is
inserted at the end of the text widget for a Python shell
Handles error messages and show blue underlined links
Hand... | python | def append_text_to_shell(self, text, error, prompt):
"""
Append text to Python shell
In a way, this method overrides the method 'insert_text' when text is
inserted at the end of the text widget for a Python shell
Handles error messages and show blue underlined links
Hand... | [
"def",
"append_text_to_shell",
"(",
"self",
",",
"text",
",",
"error",
",",
"prompt",
")",
":",
"cursor",
"=",
"self",
".",
"textCursor",
"(",
")",
"cursor",
".",
"movePosition",
"(",
"QTextCursor",
".",
"End",
")",
"if",
"'\\r'",
"in",
"text",
":",
"#... | Append text to Python shell
In a way, this method overrides the method 'insert_text' when text is
inserted at the end of the text widget for a Python shell
Handles error messages and show blue underlined links
Handles ANSI color sequences
Handles ANSI FF sequence | [
"Append",
"text",
"to",
"Python",
"shell",
"In",
"a",
"way",
"this",
"method",
"overrides",
"the",
"method",
"insert_text",
"when",
"text",
"is",
"inserted",
"at",
"the",
"end",
"of",
"the",
"text",
"widget",
"for",
"a",
"Python",
"shell"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L227-L289 | train |
spyder-ide/spyder | spyder/plugins/console/widgets/console.py | ConsoleBaseWidget.set_pythonshell_font | def set_pythonshell_font(self, font=None):
"""Python Shell only"""
if font is None:
font = QFont()
for style in self.font_styles:
style.apply_style(font=font,
is_default=style is self.default_style)
self.ansi_handler.set_base_format(s... | python | def set_pythonshell_font(self, font=None):
"""Python Shell only"""
if font is None:
font = QFont()
for style in self.font_styles:
style.apply_style(font=font,
is_default=style is self.default_style)
self.ansi_handler.set_base_format(s... | [
"def",
"set_pythonshell_font",
"(",
"self",
",",
"font",
"=",
"None",
")",
":",
"if",
"font",
"is",
"None",
":",
"font",
"=",
"QFont",
"(",
")",
"for",
"style",
"in",
"self",
".",
"font_styles",
":",
"style",
".",
"apply_style",
"(",
"font",
"=",
"fo... | Python Shell only | [
"Python",
"Shell",
"only"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/widgets/console.py#L291-L298 | train |
spyder-ide/spyder | spyder/plugins/pylint/plugin.py | Pylint.get_plugin_icon | def get_plugin_icon(self):
"""Return widget icon"""
path = osp.join(self.PLUGIN_PATH, self.IMG_PATH)
return ima.icon('pylint', icon_path=path) | python | def get_plugin_icon(self):
"""Return widget icon"""
path = osp.join(self.PLUGIN_PATH, self.IMG_PATH)
return ima.icon('pylint', icon_path=path) | [
"def",
"get_plugin_icon",
"(",
"self",
")",
":",
"path",
"=",
"osp",
".",
"join",
"(",
"self",
".",
"PLUGIN_PATH",
",",
"self",
".",
"IMG_PATH",
")",
"return",
"ima",
".",
"icon",
"(",
"'pylint'",
",",
"icon_path",
"=",
"path",
")"
] | Return widget icon | [
"Return",
"widget",
"icon"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/pylint/plugin.py#L75-L78 | train |
spyder-ide/spyder | spyder/plugins/pylint/plugin.py | Pylint.register_plugin | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.pylint.treewidget.sig_edit_goto.connect(self.main.editor.load)
self.pylint.redirect_stdio.connect(
self.main.redirect_internalshell_stdio)
self.main.add_dockwidget(self)
pyli... | python | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.pylint.treewidget.sig_edit_goto.connect(self.main.editor.load)
self.pylint.redirect_stdio.connect(
self.main.redirect_internalshell_stdio)
self.main.add_dockwidget(self)
pyli... | [
"def",
"register_plugin",
"(",
"self",
")",
":",
"self",
".",
"pylint",
".",
"treewidget",
".",
"sig_edit_goto",
".",
"connect",
"(",
"self",
".",
"main",
".",
"editor",
".",
"load",
")",
"self",
".",
"pylint",
".",
"redirect_stdio",
".",
"connect",
"(",... | Register plugin in Spyder's main window | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/pylint/plugin.py#L96-L110 | train |
spyder-ide/spyder | spyder/plugins/pylint/plugin.py | Pylint.run_pylint | def run_pylint(self):
"""Run pylint code analysis"""
if (self.get_option('save_before', True)
and not self.main.editor.save()):
return
self.switch_to_plugin()
self.analyze(self.main.editor.get_current_filename()) | python | def run_pylint(self):
"""Run pylint code analysis"""
if (self.get_option('save_before', True)
and not self.main.editor.save()):
return
self.switch_to_plugin()
self.analyze(self.main.editor.get_current_filename()) | [
"def",
"run_pylint",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"get_option",
"(",
"'save_before'",
",",
"True",
")",
"and",
"not",
"self",
".",
"main",
".",
"editor",
".",
"save",
"(",
")",
")",
":",
"return",
"self",
".",
"switch_to_plugin",
"(... | Run pylint code analysis | [
"Run",
"pylint",
"code",
"analysis"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/pylint/plugin.py#L138-L144 | train |
spyder-ide/spyder | spyder/plugins/pylint/plugin.py | Pylint.analyze | def analyze(self, filename):
"""Reimplement analyze method"""
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.setFocus()
self.dockwidget.raise_()
self.pylint.analyze(filename) | python | def analyze(self, filename):
"""Reimplement analyze method"""
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
self.dockwidget.setFocus()
self.dockwidget.raise_()
self.pylint.analyze(filename) | [
"def",
"analyze",
"(",
"self",
",",
"filename",
")",
":",
"if",
"self",
".",
"dockwidget",
"and",
"not",
"self",
".",
"ismaximized",
":",
"self",
".",
"dockwidget",
".",
"setVisible",
"(",
"True",
")",
"self",
".",
"dockwidget",
".",
"setFocus",
"(",
"... | Reimplement analyze method | [
"Reimplement",
"analyze",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/pylint/plugin.py#L146-L152 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.set_font | def set_font(self, font, option):
"""Set global font used in Spyder."""
# Update fonts in all plugins
set_font(font, option=option)
plugins = self.main.widgetlist + self.main.thirdparty_plugins
for plugin in plugins:
plugin.update_font() | python | def set_font(self, font, option):
"""Set global font used in Spyder."""
# Update fonts in all plugins
set_font(font, option=option)
plugins = self.main.widgetlist + self.main.thirdparty_plugins
for plugin in plugins:
plugin.update_font() | [
"def",
"set_font",
"(",
"self",
",",
"font",
",",
"option",
")",
":",
"# Update fonts in all plugins",
"set_font",
"(",
"font",
",",
"option",
"=",
"option",
")",
"plugins",
"=",
"self",
".",
"main",
".",
"widgetlist",
"+",
"self",
".",
"main",
".",
"thi... | Set global font used in Spyder. | [
"Set",
"global",
"font",
"used",
"in",
"Spyder",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L182-L188 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.update_qt_style_combobox | def update_qt_style_combobox(self):
"""Enable/disable the Qt style combobox."""
if is_dark_interface():
self.style_combobox.setEnabled(False)
else:
self.style_combobox.setEnabled(True) | python | def update_qt_style_combobox(self):
"""Enable/disable the Qt style combobox."""
if is_dark_interface():
self.style_combobox.setEnabled(False)
else:
self.style_combobox.setEnabled(True) | [
"def",
"update_qt_style_combobox",
"(",
"self",
")",
":",
"if",
"is_dark_interface",
"(",
")",
":",
"self",
".",
"style_combobox",
".",
"setEnabled",
"(",
"False",
")",
"else",
":",
"self",
".",
"style_combobox",
".",
"setEnabled",
"(",
"True",
")"
] | Enable/disable the Qt style combobox. | [
"Enable",
"/",
"disable",
"the",
"Qt",
"style",
"combobox",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L248-L253 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.update_combobox | def update_combobox(self):
"""Recreates the combobox contents."""
index = self.current_scheme_index
self.schemes_combobox.blockSignals(True)
names = self.get_option("names")
try:
names.pop(names.index(u'Custom'))
except ValueError:
pass
cus... | python | def update_combobox(self):
"""Recreates the combobox contents."""
index = self.current_scheme_index
self.schemes_combobox.blockSignals(True)
names = self.get_option("names")
try:
names.pop(names.index(u'Custom'))
except ValueError:
pass
cus... | [
"def",
"update_combobox",
"(",
"self",
")",
":",
"index",
"=",
"self",
".",
"current_scheme_index",
"self",
".",
"schemes_combobox",
".",
"blockSignals",
"(",
"True",
")",
"names",
"=",
"self",
".",
"get_option",
"(",
"\"names\"",
")",
"try",
":",
"names",
... | Recreates the combobox contents. | [
"Recreates",
"the",
"combobox",
"contents",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L255-L287 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.update_buttons | def update_buttons(self):
"""Updates the enable status of delete and reset buttons."""
current_scheme = self.current_scheme
names = self.get_option("names")
try:
names.pop(names.index(u'Custom'))
except ValueError:
pass
delete_enabled = current_sch... | python | def update_buttons(self):
"""Updates the enable status of delete and reset buttons."""
current_scheme = self.current_scheme
names = self.get_option("names")
try:
names.pop(names.index(u'Custom'))
except ValueError:
pass
delete_enabled = current_sch... | [
"def",
"update_buttons",
"(",
"self",
")",
":",
"current_scheme",
"=",
"self",
".",
"current_scheme",
"names",
"=",
"self",
".",
"get_option",
"(",
"\"names\"",
")",
"try",
":",
"names",
".",
"pop",
"(",
"names",
".",
"index",
"(",
"u'Custom'",
")",
")",... | Updates the enable status of delete and reset buttons. | [
"Updates",
"the",
"enable",
"status",
"of",
"delete",
"and",
"reset",
"buttons",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L289-L299 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.update_preview | def update_preview(self, index=None, scheme_name=None):
"""
Update the color scheme of the preview editor and adds text.
Note
----
'index' is needed, because this is triggered by a signal that sends
the selected index.
"""
text = ('"""A string"""\n\n'
... | python | def update_preview(self, index=None, scheme_name=None):
"""
Update the color scheme of the preview editor and adds text.
Note
----
'index' is needed, because this is triggered by a signal that sends
the selected index.
"""
text = ('"""A string"""\n\n'
... | [
"def",
"update_preview",
"(",
"self",
",",
"index",
"=",
"None",
",",
"scheme_name",
"=",
"None",
")",
":",
"text",
"=",
"(",
"'\"\"\"A string\"\"\"\\n\\n'",
"'# A comment\\n\\n'",
"'# %% A cell\\n\\n'",
"'class Foo(object):\\n'",
"' def __init__(self):\\n'",
"' ... | Update the color scheme of the preview editor and adds text.
Note
----
'index' is needed, because this is triggered by a signal that sends
the selected index. | [
"Update",
"the",
"color",
"scheme",
"of",
"the",
"preview",
"editor",
"and",
"adds",
"text",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L301-L330 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.create_new_scheme | def create_new_scheme(self):
"""Creates a new color scheme with a custom name."""
names = self.get_option('names')
custom_names = self.get_option('custom_names', [])
# Get the available number this new color scheme
counter = len(custom_names) - 1
custom_index = [int(n.sp... | python | def create_new_scheme(self):
"""Creates a new color scheme with a custom name."""
names = self.get_option('names')
custom_names = self.get_option('custom_names', [])
# Get the available number this new color scheme
counter = len(custom_names) - 1
custom_index = [int(n.sp... | [
"def",
"create_new_scheme",
"(",
"self",
")",
":",
"names",
"=",
"self",
".",
"get_option",
"(",
"'names'",
")",
"custom_names",
"=",
"self",
".",
"get_option",
"(",
"'custom_names'",
",",
"[",
"]",
")",
"# Get the available number this new color scheme",
"counter... | Creates a new color scheme with a custom name. | [
"Creates",
"a",
"new",
"color",
"scheme",
"with",
"a",
"custom",
"name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L334-L377 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.edit_scheme | def edit_scheme(self):
"""Edit current scheme."""
dlg = self.scheme_editor_dialog
dlg.set_scheme(self.current_scheme)
if dlg.exec_():
# Update temp scheme to reflect instant edits on the preview
temporal_color_scheme = dlg.get_edited_color_scheme()
fo... | python | def edit_scheme(self):
"""Edit current scheme."""
dlg = self.scheme_editor_dialog
dlg.set_scheme(self.current_scheme)
if dlg.exec_():
# Update temp scheme to reflect instant edits on the preview
temporal_color_scheme = dlg.get_edited_color_scheme()
fo... | [
"def",
"edit_scheme",
"(",
"self",
")",
":",
"dlg",
"=",
"self",
".",
"scheme_editor_dialog",
"dlg",
".",
"set_scheme",
"(",
"self",
".",
"current_scheme",
")",
"if",
"dlg",
".",
"exec_",
"(",
")",
":",
"# Update temp scheme to reflect instant edits on the preview... | Edit current scheme. | [
"Edit",
"current",
"scheme",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L379-L391 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.delete_scheme | def delete_scheme(self):
"""Deletes the currently selected custom color scheme."""
scheme_name = self.current_scheme
answer = QMessageBox.warning(self, _("Warning"),
_("Are you sure you want to delete "
"this scheme?"),... | python | def delete_scheme(self):
"""Deletes the currently selected custom color scheme."""
scheme_name = self.current_scheme
answer = QMessageBox.warning(self, _("Warning"),
_("Are you sure you want to delete "
"this scheme?"),... | [
"def",
"delete_scheme",
"(",
"self",
")",
":",
"scheme_name",
"=",
"self",
".",
"current_scheme",
"answer",
"=",
"QMessageBox",
".",
"warning",
"(",
"self",
",",
"_",
"(",
"\"Warning\"",
")",
",",
"_",
"(",
"\"Are you sure you want to delete \"",
"\"this scheme?... | Deletes the currently selected custom color scheme. | [
"Deletes",
"the",
"currently",
"selected",
"custom",
"color",
"scheme",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L393-L422 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | AppearanceConfigPage.reset_to_default | def reset_to_default(self):
"""Restore initial values for default color schemes."""
# Checks that this is indeed a default scheme
scheme = self.current_scheme
names = self.get_option('names')
if scheme in names:
for key in syntaxhighlighters.COLOR_SCHEME_KEYS:
... | python | def reset_to_default(self):
"""Restore initial values for default color schemes."""
# Checks that this is indeed a default scheme
scheme = self.current_scheme
names = self.get_option('names')
if scheme in names:
for key in syntaxhighlighters.COLOR_SCHEME_KEYS:
... | [
"def",
"reset_to_default",
"(",
"self",
")",
":",
"# Checks that this is indeed a default scheme",
"scheme",
"=",
"self",
".",
"current_scheme",
"names",
"=",
"self",
".",
"get_option",
"(",
"'names'",
")",
"if",
"scheme",
"in",
"names",
":",
"for",
"key",
"in",... | Restore initial values for default color schemes. | [
"Restore",
"initial",
"values",
"for",
"default",
"color",
"schemes",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L432-L443 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | SchemeEditor.set_scheme | def set_scheme(self, scheme_name):
"""Set the current stack by 'scheme_name'."""
self.stack.setCurrentIndex(self.order.index(scheme_name))
self.last_used_scheme = scheme_name | python | def set_scheme(self, scheme_name):
"""Set the current stack by 'scheme_name'."""
self.stack.setCurrentIndex(self.order.index(scheme_name))
self.last_used_scheme = scheme_name | [
"def",
"set_scheme",
"(",
"self",
",",
"scheme_name",
")",
":",
"self",
".",
"stack",
".",
"setCurrentIndex",
"(",
"self",
".",
"order",
".",
"index",
"(",
"scheme_name",
")",
")",
"self",
".",
"last_used_scheme",
"=",
"scheme_name"
] | Set the current stack by 'scheme_name'. | [
"Set",
"the",
"current",
"stack",
"by",
"scheme_name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L476-L479 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | SchemeEditor.get_edited_color_scheme | def get_edited_color_scheme(self):
"""
Get the values of the last edited color scheme to be used in an instant
preview in the preview editor, without using `apply`.
"""
color_scheme = {}
scheme_name = self.last_used_scheme
for key in self.widgets[scheme_name]:
... | python | def get_edited_color_scheme(self):
"""
Get the values of the last edited color scheme to be used in an instant
preview in the preview editor, without using `apply`.
"""
color_scheme = {}
scheme_name = self.last_used_scheme
for key in self.widgets[scheme_name]:
... | [
"def",
"get_edited_color_scheme",
"(",
"self",
")",
":",
"color_scheme",
"=",
"{",
"}",
"scheme_name",
"=",
"self",
".",
"last_used_scheme",
"for",
"key",
"in",
"self",
".",
"widgets",
"[",
"scheme_name",
"]",
":",
"items",
"=",
"self",
".",
"widgets",
"["... | Get the values of the last edited color scheme to be used in an instant
preview in the preview editor, without using `apply`. | [
"Get",
"the",
"values",
"of",
"the",
"last",
"edited",
"color",
"scheme",
"to",
"be",
"used",
"in",
"an",
"instant",
"preview",
"in",
"the",
"preview",
"editor",
"without",
"using",
"apply",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L488-L509 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | SchemeEditor.add_color_scheme_stack | def add_color_scheme_stack(self, scheme_name, custom=False):
"""Add a stack for a given scheme and connects the CONF values."""
color_scheme_groups = [
(_('Text'), ["normal", "comment", "string", "number", "keyword",
"builtin", "definition", "instance", ]),
... | python | def add_color_scheme_stack(self, scheme_name, custom=False):
"""Add a stack for a given scheme and connects the CONF values."""
color_scheme_groups = [
(_('Text'), ["normal", "comment", "string", "number", "keyword",
"builtin", "definition", "instance", ]),
... | [
"def",
"add_color_scheme_stack",
"(",
"self",
",",
"scheme_name",
",",
"custom",
"=",
"False",
")",
":",
"color_scheme_groups",
"=",
"[",
"(",
"_",
"(",
"'Text'",
")",
",",
"[",
"\"normal\"",
",",
"\"comment\"",
",",
"\"string\"",
",",
"\"number\"",
",",
"... | Add a stack for a given scheme and connects the CONF values. | [
"Add",
"a",
"stack",
"for",
"a",
"given",
"scheme",
"and",
"connects",
"the",
"CONF",
"values",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L513-L601 | train |
spyder-ide/spyder | spyder/preferences/appearance.py | SchemeEditor.delete_color_scheme_stack | def delete_color_scheme_stack(self, scheme_name):
"""Remove stack widget by 'scheme_name'."""
self.set_scheme(scheme_name)
widget = self.stack.currentWidget()
self.stack.removeWidget(widget)
index = self.order.index(scheme_name)
self.order.pop(index) | python | def delete_color_scheme_stack(self, scheme_name):
"""Remove stack widget by 'scheme_name'."""
self.set_scheme(scheme_name)
widget = self.stack.currentWidget()
self.stack.removeWidget(widget)
index = self.order.index(scheme_name)
self.order.pop(index) | [
"def",
"delete_color_scheme_stack",
"(",
"self",
",",
"scheme_name",
")",
":",
"self",
".",
"set_scheme",
"(",
"scheme_name",
")",
"widget",
"=",
"self",
".",
"stack",
".",
"currentWidget",
"(",
")",
"self",
".",
"stack",
".",
"removeWidget",
"(",
"widget",
... | Remove stack widget by 'scheme_name'. | [
"Remove",
"stack",
"widget",
"by",
"scheme_name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/appearance.py#L603-L609 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.get_plugin_actions | def get_plugin_actions(self):
"""Return a list of actions related to plugin"""
self.new_project_action = create_action(self,
_("New Project..."),
triggered=self.create_new_project)
self.open_project_action = create_acti... | python | def get_plugin_actions(self):
"""Return a list of actions related to plugin"""
self.new_project_action = create_action(self,
_("New Project..."),
triggered=self.create_new_project)
self.open_project_action = create_acti... | [
"def",
"get_plugin_actions",
"(",
"self",
")",
":",
"self",
".",
"new_project_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"\"New Project...\"",
")",
",",
"triggered",
"=",
"self",
".",
"create_new_project",
")",
"self",
".",
"open_project_action",... | Return a list of actions related to plugin | [
"Return",
"a",
"list",
"of",
"actions",
"related",
"to",
"plugin"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L80-L113 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.register_plugin | def register_plugin(self):
"""Register plugin in Spyder's main window"""
ipyconsole = self.main.ipyconsole
treewidget = self.explorer.treewidget
lspmgr = self.main.lspmanager
self.main.add_dockwidget(self)
self.explorer.sig_open_file.connect(self.main.open_file)
... | python | def register_plugin(self):
"""Register plugin in Spyder's main window"""
ipyconsole = self.main.ipyconsole
treewidget = self.explorer.treewidget
lspmgr = self.main.lspmanager
self.main.add_dockwidget(self)
self.explorer.sig_open_file.connect(self.main.open_file)
... | [
"def",
"register_plugin",
"(",
"self",
")",
":",
"ipyconsole",
"=",
"self",
".",
"main",
".",
"ipyconsole",
"treewidget",
"=",
"self",
".",
"explorer",
".",
"treewidget",
"lspmgr",
"=",
"self",
".",
"main",
".",
"lspmanager",
"self",
".",
"main",
".",
"a... | Register plugin in Spyder's main window | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L115-L166 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.closing_plugin | def closing_plugin(self, cancelable=False):
"""Perform actions before parent main window is closed"""
self.save_config()
self.explorer.closing_widget()
return True | python | def closing_plugin(self, cancelable=False):
"""Perform actions before parent main window is closed"""
self.save_config()
self.explorer.closing_widget()
return True | [
"def",
"closing_plugin",
"(",
"self",
",",
"cancelable",
"=",
"False",
")",
":",
"self",
".",
"save_config",
"(",
")",
"self",
".",
"explorer",
".",
"closing_widget",
"(",
")",
"return",
"True"
] | Perform actions before parent main window is closed | [
"Perform",
"actions",
"before",
"parent",
"main",
"window",
"is",
"closed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L172-L176 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.switch_to_plugin | def switch_to_plugin(self):
"""Switch to plugin."""
# Unmaxizime currently maximized plugin
if (self.main.last_plugin is not None and
self.main.last_plugin.ismaximized and
self.main.last_plugin is not self):
self.main.maximize_dockwidget()
... | python | def switch_to_plugin(self):
"""Switch to plugin."""
# Unmaxizime currently maximized plugin
if (self.main.last_plugin is not None and
self.main.last_plugin.ismaximized and
self.main.last_plugin is not self):
self.main.maximize_dockwidget()
... | [
"def",
"switch_to_plugin",
"(",
"self",
")",
":",
"# Unmaxizime currently maximized plugin\r",
"if",
"(",
"self",
".",
"main",
".",
"last_plugin",
"is",
"not",
"None",
"and",
"self",
".",
"main",
".",
"last_plugin",
".",
"ismaximized",
"and",
"self",
".",
"mai... | Switch to plugin. | [
"Switch",
"to",
"plugin",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L178-L190 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.setup_menu_actions | def setup_menu_actions(self):
"""Setup and update the menu actions."""
self.recent_project_menu.clear()
self.recent_projects_actions = []
if self.recent_projects:
for project in self.recent_projects:
if self.is_valid_project(project):
... | python | def setup_menu_actions(self):
"""Setup and update the menu actions."""
self.recent_project_menu.clear()
self.recent_projects_actions = []
if self.recent_projects:
for project in self.recent_projects:
if self.is_valid_project(project):
... | [
"def",
"setup_menu_actions",
"(",
"self",
")",
":",
"self",
".",
"recent_project_menu",
".",
"clear",
"(",
")",
"self",
".",
"recent_projects_actions",
"=",
"[",
"]",
"if",
"self",
".",
"recent_projects",
":",
"for",
"project",
"in",
"self",
".",
"recent_pro... | Setup and update the menu actions. | [
"Setup",
"and",
"update",
"the",
"menu",
"actions",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L193-L216 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.update_project_actions | def update_project_actions(self):
"""Update actions of the Projects menu"""
if self.recent_projects:
self.clear_recent_projects_action.setEnabled(True)
else:
self.clear_recent_projects_action.setEnabled(False)
active = bool(self.get_active_project_path())
... | python | def update_project_actions(self):
"""Update actions of the Projects menu"""
if self.recent_projects:
self.clear_recent_projects_action.setEnabled(True)
else:
self.clear_recent_projects_action.setEnabled(False)
active = bool(self.get_active_project_path())
... | [
"def",
"update_project_actions",
"(",
"self",
")",
":",
"if",
"self",
".",
"recent_projects",
":",
"self",
".",
"clear_recent_projects_action",
".",
"setEnabled",
"(",
"True",
")",
"else",
":",
"self",
".",
"clear_recent_projects_action",
".",
"setEnabled",
"(",
... | Update actions of the Projects menu | [
"Update",
"actions",
"of",
"the",
"Projects",
"menu"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L218-L228 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.edit_project_preferences | def edit_project_preferences(self):
"""Edit Spyder active project preferences"""
from spyder.plugins.projects.confpage import ProjectPreferences
if self.project_active:
active_project = self.project_list[0]
dlg = ProjectPreferences(self, active_project)
# ... | python | def edit_project_preferences(self):
"""Edit Spyder active project preferences"""
from spyder.plugins.projects.confpage import ProjectPreferences
if self.project_active:
active_project = self.project_list[0]
dlg = ProjectPreferences(self, active_project)
# ... | [
"def",
"edit_project_preferences",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"plugins",
".",
"projects",
".",
"confpage",
"import",
"ProjectPreferences",
"if",
"self",
".",
"project_active",
":",
"active_project",
"=",
"self",
".",
"project_list",
"[",
"0",
... | Edit Spyder active project preferences | [
"Edit",
"Spyder",
"active",
"project",
"preferences"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L230-L242 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.create_new_project | def create_new_project(self):
"""Create new project"""
self.switch_to_plugin()
active_project = self.current_active_project
dlg = ProjectDialog(self)
dlg.sig_project_creation_requested.connect(self._create_project)
dlg.sig_project_creation_requested.connect(self.sig... | python | def create_new_project(self):
"""Create new project"""
self.switch_to_plugin()
active_project = self.current_active_project
dlg = ProjectDialog(self)
dlg.sig_project_creation_requested.connect(self._create_project)
dlg.sig_project_creation_requested.connect(self.sig... | [
"def",
"create_new_project",
"(",
"self",
")",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"active_project",
"=",
"self",
".",
"current_active_project",
"dlg",
"=",
"ProjectDialog",
"(",
"self",
")",
"dlg",
".",
"sig_project_creation_requested",
".",
"connect"... | Create new project | [
"Create",
"new",
"project"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L245-L257 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects._create_project | def _create_project(self, path):
"""Create a new project."""
self.open_project(path=path)
self.setup_menu_actions()
self.add_to_recent(path) | python | def _create_project(self, path):
"""Create a new project."""
self.open_project(path=path)
self.setup_menu_actions()
self.add_to_recent(path) | [
"def",
"_create_project",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"open_project",
"(",
"path",
"=",
"path",
")",
"self",
".",
"setup_menu_actions",
"(",
")",
"self",
".",
"add_to_recent",
"(",
"path",
")"
] | Create a new project. | [
"Create",
"a",
"new",
"project",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L259-L263 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.open_project | def open_project(self, path=None, restart_consoles=True,
save_previous_files=True):
"""Open the project located in `path`"""
self.switch_to_plugin()
if path is None:
basedir = get_home_dir()
path = getexistingdirectory(parent=self,
... | python | def open_project(self, path=None, restart_consoles=True,
save_previous_files=True):
"""Open the project located in `path`"""
self.switch_to_plugin()
if path is None:
basedir = get_home_dir()
path = getexistingdirectory(parent=self,
... | [
"def",
"open_project",
"(",
"self",
",",
"path",
"=",
"None",
",",
"restart_consoles",
"=",
"True",
",",
"save_previous_files",
"=",
"True",
")",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"if",
"path",
"is",
"None",
":",
"basedir",
"=",
"get_home_dir... | Open the project located in `path` | [
"Open",
"the",
"project",
"located",
"in",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L265-L309 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.close_project | def close_project(self):
"""
Close current project and return to a window without an active
project
"""
if self.current_active_project:
self.switch_to_plugin()
if self.main.editor is not None:
self.set_project_filenames(
... | python | def close_project(self):
"""
Close current project and return to a window without an active
project
"""
if self.current_active_project:
self.switch_to_plugin()
if self.main.editor is not None:
self.set_project_filenames(
... | [
"def",
"close_project",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_active_project",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"if",
"self",
".",
"main",
".",
"editor",
"is",
"not",
"None",
":",
"self",
".",
"set_project_filenames",
"(",
"self... | Close current project and return to a window without an active
project | [
"Close",
"current",
"project",
"and",
"return",
"to",
"a",
"window",
"without",
"an",
"active",
"project"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L311-L335 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.delete_project | def delete_project(self):
"""
Delete the current project without deleting the files in the directory.
"""
if self.current_active_project:
self.switch_to_plugin()
path = self.current_active_project.root_path
buttons = QMessageBox.Yes | QMessageBo... | python | def delete_project(self):
"""
Delete the current project without deleting the files in the directory.
"""
if self.current_active_project:
self.switch_to_plugin()
path = self.current_active_project.root_path
buttons = QMessageBox.Yes | QMessageBo... | [
"def",
"delete_project",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_active_project",
":",
"self",
".",
"switch_to_plugin",
"(",
")",
"path",
"=",
"self",
".",
"current_active_project",
".",
"root_path",
"buttons",
"=",
"QMessageBox",
".",
"Yes",
"|",
... | Delete the current project without deleting the files in the directory. | [
"Delete",
"the",
"current",
"project",
"without",
"deleting",
"the",
"files",
"in",
"the",
"directory",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L337-L363 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.reopen_last_project | def reopen_last_project(self):
"""
Reopen the active project when Spyder was closed last time, if any
"""
current_project_path = self.get_option('current_project_path',
default=None)
# Needs a safer test of project existence!... | python | def reopen_last_project(self):
"""
Reopen the active project when Spyder was closed last time, if any
"""
current_project_path = self.get_option('current_project_path',
default=None)
# Needs a safer test of project existence!... | [
"def",
"reopen_last_project",
"(",
"self",
")",
":",
"current_project_path",
"=",
"self",
".",
"get_option",
"(",
"'current_project_path'",
",",
"default",
"=",
"None",
")",
"# Needs a safer test of project existence!\r",
"if",
"current_project_path",
"and",
"self",
"."... | Reopen the active project when Spyder was closed last time, if any | [
"Reopen",
"the",
"active",
"project",
"when",
"Spyder",
"was",
"closed",
"last",
"time",
"if",
"any"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L374-L387 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.get_project_filenames | def get_project_filenames(self):
"""Get the list of recent filenames of a project"""
recent_files = []
if self.current_active_project:
recent_files = self.current_active_project.get_recent_files()
elif self.latest_project:
recent_files = self.latest_project.... | python | def get_project_filenames(self):
"""Get the list of recent filenames of a project"""
recent_files = []
if self.current_active_project:
recent_files = self.current_active_project.get_recent_files()
elif self.latest_project:
recent_files = self.latest_project.... | [
"def",
"get_project_filenames",
"(",
"self",
")",
":",
"recent_files",
"=",
"[",
"]",
"if",
"self",
".",
"current_active_project",
":",
"recent_files",
"=",
"self",
".",
"current_active_project",
".",
"get_recent_files",
"(",
")",
"elif",
"self",
".",
"latest_pr... | Get the list of recent filenames of a project | [
"Get",
"the",
"list",
"of",
"recent",
"filenames",
"of",
"a",
"project"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L389-L396 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.set_project_filenames | def set_project_filenames(self, recent_files):
"""Set the list of open file names in a project"""
if (self.current_active_project
and self.is_valid_project(
self.current_active_project.root_path)):
self.current_active_project.set_recent_files(rece... | python | def set_project_filenames(self, recent_files):
"""Set the list of open file names in a project"""
if (self.current_active_project
and self.is_valid_project(
self.current_active_project.root_path)):
self.current_active_project.set_recent_files(rece... | [
"def",
"set_project_filenames",
"(",
"self",
",",
"recent_files",
")",
":",
"if",
"(",
"self",
".",
"current_active_project",
"and",
"self",
".",
"is_valid_project",
"(",
"self",
".",
"current_active_project",
".",
"root_path",
")",
")",
":",
"self",
".",
"cur... | Set the list of open file names in a project | [
"Set",
"the",
"list",
"of",
"open",
"file",
"names",
"in",
"a",
"project"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L398-L403 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.get_active_project_path | def get_active_project_path(self):
"""Get path of the active project"""
active_project_path = None
if self.current_active_project:
active_project_path = self.current_active_project.root_path
return active_project_path | python | def get_active_project_path(self):
"""Get path of the active project"""
active_project_path = None
if self.current_active_project:
active_project_path = self.current_active_project.root_path
return active_project_path | [
"def",
"get_active_project_path",
"(",
"self",
")",
":",
"active_project_path",
"=",
"None",
"if",
"self",
".",
"current_active_project",
":",
"active_project_path",
"=",
"self",
".",
"current_active_project",
".",
"root_path",
"return",
"active_project_path"
] | Get path of the active project | [
"Get",
"path",
"of",
"the",
"active",
"project"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L405-L410 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.get_pythonpath | def get_pythonpath(self, at_start=False):
"""Get project path as a list to be added to PYTHONPATH"""
if at_start:
current_path = self.get_option('current_project_path',
default=None)
else:
current_path = self.get_active_pro... | python | def get_pythonpath(self, at_start=False):
"""Get project path as a list to be added to PYTHONPATH"""
if at_start:
current_path = self.get_option('current_project_path',
default=None)
else:
current_path = self.get_active_pro... | [
"def",
"get_pythonpath",
"(",
"self",
",",
"at_start",
"=",
"False",
")",
":",
"if",
"at_start",
":",
"current_path",
"=",
"self",
".",
"get_option",
"(",
"'current_project_path'",
",",
"default",
"=",
"None",
")",
"else",
":",
"current_path",
"=",
"self",
... | Get project path as a list to be added to PYTHONPATH | [
"Get",
"project",
"path",
"as",
"a",
"list",
"to",
"be",
"added",
"to",
"PYTHONPATH"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L412-L422 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.save_config | def save_config(self):
"""
Save configuration: opened projects & tree widget state.
Also save whether dock widget is visible if a project is open.
"""
self.set_option('recent_projects', self.recent_projects)
self.set_option('expanded_state',
... | python | def save_config(self):
"""
Save configuration: opened projects & tree widget state.
Also save whether dock widget is visible if a project is open.
"""
self.set_option('recent_projects', self.recent_projects)
self.set_option('expanded_state',
... | [
"def",
"save_config",
"(",
"self",
")",
":",
"self",
".",
"set_option",
"(",
"'recent_projects'",
",",
"self",
".",
"recent_projects",
")",
"self",
".",
"set_option",
"(",
"'expanded_state'",
",",
"self",
".",
"explorer",
".",
"treewidget",
".",
"get_expanded_... | Save configuration: opened projects & tree widget state.
Also save whether dock widget is visible if a project is open. | [
"Save",
"configuration",
":",
"opened",
"projects",
"&",
"tree",
"widget",
"state",
".",
"Also",
"save",
"whether",
"dock",
"widget",
"is",
"visible",
"if",
"a",
"project",
"is",
"open",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L429-L442 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.show_explorer | def show_explorer(self):
"""Show the explorer"""
if self.dockwidget is not None:
if self.dockwidget.isHidden():
self.dockwidget.show()
self.dockwidget.raise_()
self.dockwidget.update() | python | def show_explorer(self):
"""Show the explorer"""
if self.dockwidget is not None:
if self.dockwidget.isHidden():
self.dockwidget.show()
self.dockwidget.raise_()
self.dockwidget.update() | [
"def",
"show_explorer",
"(",
"self",
")",
":",
"if",
"self",
".",
"dockwidget",
"is",
"not",
"None",
":",
"if",
"self",
".",
"dockwidget",
".",
"isHidden",
"(",
")",
":",
"self",
".",
"dockwidget",
".",
"show",
"(",
")",
"self",
".",
"dockwidget",
".... | Show the explorer | [
"Show",
"the",
"explorer"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L465-L471 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.is_valid_project | def is_valid_project(self, path):
"""Check if a directory is a valid Spyder project"""
spy_project_dir = osp.join(path, '.spyproject')
if osp.isdir(path) and osp.isdir(spy_project_dir):
return True
else:
return False | python | def is_valid_project(self, path):
"""Check if a directory is a valid Spyder project"""
spy_project_dir = osp.join(path, '.spyproject')
if osp.isdir(path) and osp.isdir(spy_project_dir):
return True
else:
return False | [
"def",
"is_valid_project",
"(",
"self",
",",
"path",
")",
":",
"spy_project_dir",
"=",
"osp",
".",
"join",
"(",
"path",
",",
"'.spyproject'",
")",
"if",
"osp",
".",
"isdir",
"(",
"path",
")",
"and",
"osp",
".",
"isdir",
"(",
"spy_project_dir",
")",
":"... | Check if a directory is a valid Spyder project | [
"Check",
"if",
"a",
"directory",
"is",
"a",
"valid",
"Spyder",
"project"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L478-L484 | train |
spyder-ide/spyder | spyder/plugins/projects/plugin.py | Projects.add_to_recent | def add_to_recent(self, project):
"""
Add an entry to recent projetcs
We only maintain the list of the 10 most recent projects
"""
if project not in self.recent_projects:
self.recent_projects.insert(0, project)
self.recent_projects = self.recent_p... | python | def add_to_recent(self, project):
"""
Add an entry to recent projetcs
We only maintain the list of the 10 most recent projects
"""
if project not in self.recent_projects:
self.recent_projects.insert(0, project)
self.recent_projects = self.recent_p... | [
"def",
"add_to_recent",
"(",
"self",
",",
"project",
")",
":",
"if",
"project",
"not",
"in",
"self",
".",
"recent_projects",
":",
"self",
".",
"recent_projects",
".",
"insert",
"(",
"0",
",",
"project",
")",
"self",
".",
"recent_projects",
"=",
"self",
"... | Add an entry to recent projetcs
We only maintain the list of the 10 most recent projects | [
"Add",
"an",
"entry",
"to",
"recent",
"projetcs",
"We",
"only",
"maintain",
"the",
"list",
"of",
"the",
"10",
"most",
"recent",
"projects"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/plugin.py#L486-L494 | train |
spyder-ide/spyder | spyder/utils/windows.py | set_attached_console_visible | def set_attached_console_visible(state):
"""Show/hide system console window attached to current process.
Return it's previous state.
Availability: Windows"""
flag = {True: SW_SHOW, False: SW_HIDE}
return bool(ShowWindow(console_window_handle, flag[state])) | python | def set_attached_console_visible(state):
"""Show/hide system console window attached to current process.
Return it's previous state.
Availability: Windows"""
flag = {True: SW_SHOW, False: SW_HIDE}
return bool(ShowWindow(console_window_handle, flag[state])) | [
"def",
"set_attached_console_visible",
"(",
"state",
")",
":",
"flag",
"=",
"{",
"True",
":",
"SW_SHOW",
",",
"False",
":",
"SW_HIDE",
"}",
"return",
"bool",
"(",
"ShowWindow",
"(",
"console_window_handle",
",",
"flag",
"[",
"state",
"]",
")",
")"
] | Show/hide system console window attached to current process.
Return it's previous state.
Availability: Windows | [
"Show",
"/",
"hide",
"system",
"console",
"window",
"attached",
"to",
"current",
"process",
".",
"Return",
"it",
"s",
"previous",
"state",
".",
"Availability",
":",
"Windows"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/windows.py#L27-L33 | train |
spyder-ide/spyder | spyder/config/gui.py | get_family | def get_family(families):
"""Return the first installed font family in family list"""
if not isinstance(families, list):
families = [ families ]
for family in families:
if font_is_installed(family):
return family
else:
print("Warning: None of the following fonts is in... | python | def get_family(families):
"""Return the first installed font family in family list"""
if not isinstance(families, list):
families = [ families ]
for family in families:
if font_is_installed(family):
return family
else:
print("Warning: None of the following fonts is in... | [
"def",
"get_family",
"(",
"families",
")",
":",
"if",
"not",
"isinstance",
"(",
"families",
",",
"list",
")",
":",
"families",
"=",
"[",
"families",
"]",
"for",
"family",
"in",
"families",
":",
"if",
"font_is_installed",
"(",
"family",
")",
":",
"return"... | Return the first installed font family in family list | [
"Return",
"the",
"first",
"installed",
"font",
"family",
"in",
"family",
"list"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L45-L54 | train |
spyder-ide/spyder | spyder/config/gui.py | get_font | def get_font(section='appearance', option='font', font_size_delta=0):
"""Get console font properties depending on OS and user options"""
font = FONT_CACHE.get((section, option))
if font is None:
families = CONF.get(section, option+"/family", None)
if families is None:
return QF... | python | def get_font(section='appearance', option='font', font_size_delta=0):
"""Get console font properties depending on OS and user options"""
font = FONT_CACHE.get((section, option))
if font is None:
families = CONF.get(section, option+"/family", None)
if families is None:
return QF... | [
"def",
"get_font",
"(",
"section",
"=",
"'appearance'",
",",
"option",
"=",
"'font'",
",",
"font_size_delta",
"=",
"0",
")",
":",
"font",
"=",
"FONT_CACHE",
".",
"get",
"(",
"(",
"section",
",",
"option",
")",
")",
"if",
"font",
"is",
"None",
":",
"f... | Get console font properties depending on OS and user options | [
"Get",
"console",
"font",
"properties",
"depending",
"on",
"OS",
"and",
"user",
"options"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L59-L83 | train |
spyder-ide/spyder | spyder/config/gui.py | set_font | def set_font(font, section='appearance', option='font'):
"""Set font"""
CONF.set(section, option+'/family', to_text_string(font.family()))
CONF.set(section, option+'/size', float(font.pointSize()))
CONF.set(section, option+'/italic', int(font.italic()))
CONF.set(section, option+'/bold', int(font.bol... | python | def set_font(font, section='appearance', option='font'):
"""Set font"""
CONF.set(section, option+'/family', to_text_string(font.family()))
CONF.set(section, option+'/size', float(font.pointSize()))
CONF.set(section, option+'/italic', int(font.italic()))
CONF.set(section, option+'/bold', int(font.bol... | [
"def",
"set_font",
"(",
"font",
",",
"section",
"=",
"'appearance'",
",",
"option",
"=",
"'font'",
")",
":",
"CONF",
".",
"set",
"(",
"section",
",",
"option",
"+",
"'/family'",
",",
"to_text_string",
"(",
"font",
".",
"family",
"(",
")",
")",
")",
"... | Set font | [
"Set",
"font"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L86-L92 | train |
spyder-ide/spyder | spyder/config/gui.py | fixed_shortcut | def fixed_shortcut(keystr, parent, action):
"""
DEPRECATED: This function will be removed in Spyder 4.0
Define a fixed shortcut according to a keysequence string
"""
sc = QShortcut(QKeySequence(keystr), parent, action)
sc.setContext(Qt.WidgetWithChildrenShortcut)
return sc | python | def fixed_shortcut(keystr, parent, action):
"""
DEPRECATED: This function will be removed in Spyder 4.0
Define a fixed shortcut according to a keysequence string
"""
sc = QShortcut(QKeySequence(keystr), parent, action)
sc.setContext(Qt.WidgetWithChildrenShortcut)
return sc | [
"def",
"fixed_shortcut",
"(",
"keystr",
",",
"parent",
",",
"action",
")",
":",
"sc",
"=",
"QShortcut",
"(",
"QKeySequence",
"(",
"keystr",
")",
",",
"parent",
",",
"action",
")",
"sc",
".",
"setContext",
"(",
"Qt",
".",
"WidgetWithChildrenShortcut",
")",
... | DEPRECATED: This function will be removed in Spyder 4.0
Define a fixed shortcut according to a keysequence string | [
"DEPRECATED",
":",
"This",
"function",
"will",
"be",
"removed",
"in",
"Spyder",
"4",
".",
"0"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L105-L113 | train |
spyder-ide/spyder | spyder/config/gui.py | config_shortcut | def config_shortcut(action, context, name, parent):
"""
Create a Shortcut namedtuple for a widget
The data contained in this tuple will be registered in
our shortcuts preferences page
"""
keystr = get_shortcut(context, name)
qsc = QShortcut(QKeySequence(keystr), parent, action)
qsc.... | python | def config_shortcut(action, context, name, parent):
"""
Create a Shortcut namedtuple for a widget
The data contained in this tuple will be registered in
our shortcuts preferences page
"""
keystr = get_shortcut(context, name)
qsc = QShortcut(QKeySequence(keystr), parent, action)
qsc.... | [
"def",
"config_shortcut",
"(",
"action",
",",
"context",
",",
"name",
",",
"parent",
")",
":",
"keystr",
"=",
"get_shortcut",
"(",
"context",
",",
"name",
")",
"qsc",
"=",
"QShortcut",
"(",
"QKeySequence",
"(",
"keystr",
")",
",",
"parent",
",",
"action"... | Create a Shortcut namedtuple for a widget
The data contained in this tuple will be registered in
our shortcuts preferences page | [
"Create",
"a",
"Shortcut",
"namedtuple",
"for",
"a",
"widget",
"The",
"data",
"contained",
"in",
"this",
"tuple",
"will",
"be",
"registered",
"in",
"our",
"shortcuts",
"preferences",
"page"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L116-L127 | train |
spyder-ide/spyder | spyder/config/gui.py | iter_shortcuts | def iter_shortcuts():
"""Iterate over keyboard shortcuts."""
for context_name, keystr in CONF.items('shortcuts'):
context, name = context_name.split("/", 1)
yield context, name, keystr | python | def iter_shortcuts():
"""Iterate over keyboard shortcuts."""
for context_name, keystr in CONF.items('shortcuts'):
context, name = context_name.split("/", 1)
yield context, name, keystr | [
"def",
"iter_shortcuts",
"(",
")",
":",
"for",
"context_name",
",",
"keystr",
"in",
"CONF",
".",
"items",
"(",
"'shortcuts'",
")",
":",
"context",
",",
"name",
"=",
"context_name",
".",
"split",
"(",
"\"/\"",
",",
"1",
")",
"yield",
"context",
",",
"na... | Iterate over keyboard shortcuts. | [
"Iterate",
"over",
"keyboard",
"shortcuts",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L130-L134 | train |
spyder-ide/spyder | spyder/config/gui.py | get_color_scheme | def get_color_scheme(name):
"""Get syntax color scheme"""
color_scheme = {}
for key in sh.COLOR_SCHEME_KEYS:
color_scheme[key] = CONF.get("appearance", "%s/%s" % (name, key))
return color_scheme | python | def get_color_scheme(name):
"""Get syntax color scheme"""
color_scheme = {}
for key in sh.COLOR_SCHEME_KEYS:
color_scheme[key] = CONF.get("appearance", "%s/%s" % (name, key))
return color_scheme | [
"def",
"get_color_scheme",
"(",
"name",
")",
":",
"color_scheme",
"=",
"{",
"}",
"for",
"key",
"in",
"sh",
".",
"COLOR_SCHEME_KEYS",
":",
"color_scheme",
"[",
"key",
"]",
"=",
"CONF",
".",
"get",
"(",
"\"appearance\"",
",",
"\"%s/%s\"",
"%",
"(",
"name",... | Get syntax color scheme | [
"Get",
"syntax",
"color",
"scheme"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L142-L147 | train |
spyder-ide/spyder | spyder/config/gui.py | set_color_scheme | def set_color_scheme(name, color_scheme, replace=True):
"""Set syntax color scheme"""
section = "appearance"
names = CONF.get("appearance", "names", [])
for key in sh.COLOR_SCHEME_KEYS:
option = "%s/%s" % (name, key)
value = CONF.get(section, option, default=None)
if value is Non... | python | def set_color_scheme(name, color_scheme, replace=True):
"""Set syntax color scheme"""
section = "appearance"
names = CONF.get("appearance", "names", [])
for key in sh.COLOR_SCHEME_KEYS:
option = "%s/%s" % (name, key)
value = CONF.get(section, option, default=None)
if value is Non... | [
"def",
"set_color_scheme",
"(",
"name",
",",
"color_scheme",
",",
"replace",
"=",
"True",
")",
":",
"section",
"=",
"\"appearance\"",
"names",
"=",
"CONF",
".",
"get",
"(",
"\"appearance\"",
",",
"\"names\"",
",",
"[",
"]",
")",
"for",
"key",
"in",
"sh",... | Set syntax color scheme | [
"Set",
"syntax",
"color",
"scheme"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L150-L160 | train |
spyder-ide/spyder | spyder/config/gui.py | set_default_color_scheme | def set_default_color_scheme(name, replace=True):
"""Reset color scheme to default values"""
assert name in sh.COLOR_SCHEME_NAMES
set_color_scheme(name, sh.get_color_scheme(name), replace=replace) | python | def set_default_color_scheme(name, replace=True):
"""Reset color scheme to default values"""
assert name in sh.COLOR_SCHEME_NAMES
set_color_scheme(name, sh.get_color_scheme(name), replace=replace) | [
"def",
"set_default_color_scheme",
"(",
"name",
",",
"replace",
"=",
"True",
")",
":",
"assert",
"name",
"in",
"sh",
".",
"COLOR_SCHEME_NAMES",
"set_color_scheme",
"(",
"name",
",",
"sh",
".",
"get_color_scheme",
"(",
"name",
")",
",",
"replace",
"=",
"repla... | Reset color scheme to default values | [
"Reset",
"color",
"scheme",
"to",
"default",
"values"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L163-L166 | train |
spyder-ide/spyder | spyder/config/gui.py | is_dark_font_color | def is_dark_font_color(color_scheme):
"""Check if the font color used in the color scheme is dark."""
color_scheme = get_color_scheme(color_scheme)
font_color, fon_fw, fon_fs = color_scheme['normal']
return dark_color(font_color) | python | def is_dark_font_color(color_scheme):
"""Check if the font color used in the color scheme is dark."""
color_scheme = get_color_scheme(color_scheme)
font_color, fon_fw, fon_fs = color_scheme['normal']
return dark_color(font_color) | [
"def",
"is_dark_font_color",
"(",
"color_scheme",
")",
":",
"color_scheme",
"=",
"get_color_scheme",
"(",
"color_scheme",
")",
"font_color",
",",
"fon_fw",
",",
"fon_fs",
"=",
"color_scheme",
"[",
"'normal'",
"]",
"return",
"dark_color",
"(",
"font_color",
")"
] | Check if the font color used in the color scheme is dark. | [
"Check",
"if",
"the",
"font",
"color",
"used",
"in",
"the",
"color",
"scheme",
"is",
"dark",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/config/gui.py#L169-L173 | train |
spyder-ide/spyder | spyder/widgets/dock.py | TabFilter.eventFilter | def eventFilter(self, obj, event):
"""Filter mouse press events.
Events that are captured and not propagated return True. Events that
are not captured and are propagated return False.
"""
event_type = event.type()
if event_type == QEvent.MouseButtonPress:
sel... | python | def eventFilter(self, obj, event):
"""Filter mouse press events.
Events that are captured and not propagated return True. Events that
are not captured and are propagated return False.
"""
event_type = event.type()
if event_type == QEvent.MouseButtonPress:
sel... | [
"def",
"eventFilter",
"(",
"self",
",",
"obj",
",",
"event",
")",
":",
"event_type",
"=",
"event",
".",
"type",
"(",
")",
"if",
"event_type",
"==",
"QEvent",
".",
"MouseButtonPress",
":",
"self",
".",
"tab_pressed",
"(",
"event",
")",
"return",
"False",
... | Filter mouse press events.
Events that are captured and not propagated return True. Events that
are not captured and are propagated return False. | [
"Filter",
"mouse",
"press",
"events",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/dock.py#L32-L42 | train |
spyder-ide/spyder | spyder/widgets/dock.py | TabFilter.tab_pressed | def tab_pressed(self, event):
"""Method called when a tab from a QTabBar has been pressed."""
self.from_index = self.dock_tabbar.tabAt(event.pos())
self.dock_tabbar.setCurrentIndex(self.from_index)
if event.button() == Qt.RightButton:
if self.from_index == -1:
... | python | def tab_pressed(self, event):
"""Method called when a tab from a QTabBar has been pressed."""
self.from_index = self.dock_tabbar.tabAt(event.pos())
self.dock_tabbar.setCurrentIndex(self.from_index)
if event.button() == Qt.RightButton:
if self.from_index == -1:
... | [
"def",
"tab_pressed",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"from_index",
"=",
"self",
".",
"dock_tabbar",
".",
"tabAt",
"(",
"event",
".",
"pos",
"(",
")",
")",
"self",
".",
"dock_tabbar",
".",
"setCurrentIndex",
"(",
"self",
".",
"from_in... | Method called when a tab from a QTabBar has been pressed. | [
"Method",
"called",
"when",
"a",
"tab",
"from",
"a",
"QTabBar",
"has",
"been",
"pressed",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/dock.py#L44-L53 | train |
spyder-ide/spyder | spyder/widgets/dock.py | TabFilter.show_nontab_menu | def show_nontab_menu(self, event):
"""Show the context menu assigned to nontabs section."""
menu = self.main.createPopupMenu()
menu.exec_(self.dock_tabbar.mapToGlobal(event.pos())) | python | def show_nontab_menu(self, event):
"""Show the context menu assigned to nontabs section."""
menu = self.main.createPopupMenu()
menu.exec_(self.dock_tabbar.mapToGlobal(event.pos())) | [
"def",
"show_nontab_menu",
"(",
"self",
",",
"event",
")",
":",
"menu",
"=",
"self",
".",
"main",
".",
"createPopupMenu",
"(",
")",
"menu",
".",
"exec_",
"(",
"self",
".",
"dock_tabbar",
".",
"mapToGlobal",
"(",
"event",
".",
"pos",
"(",
")",
")",
")... | Show the context menu assigned to nontabs section. | [
"Show",
"the",
"context",
"menu",
"assigned",
"to",
"nontabs",
"section",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/dock.py#L59-L62 | train |
spyder-ide/spyder | spyder/widgets/dock.py | SpyderDockWidget.install_tab_event_filter | def install_tab_event_filter(self, value):
"""
Install an event filter to capture mouse events in the tabs of a
QTabBar holding tabified dockwidgets.
"""
dock_tabbar = None
tabbars = self.main.findChildren(QTabBar)
for tabbar in tabbars:
for tab in ran... | python | def install_tab_event_filter(self, value):
"""
Install an event filter to capture mouse events in the tabs of a
QTabBar holding tabified dockwidgets.
"""
dock_tabbar = None
tabbars = self.main.findChildren(QTabBar)
for tabbar in tabbars:
for tab in ran... | [
"def",
"install_tab_event_filter",
"(",
"self",
",",
"value",
")",
":",
"dock_tabbar",
"=",
"None",
"tabbars",
"=",
"self",
".",
"main",
".",
"findChildren",
"(",
"QTabBar",
")",
"for",
"tabbar",
"in",
"tabbars",
":",
"for",
"tab",
"in",
"range",
"(",
"t... | Install an event filter to capture mouse events in the tabs of a
QTabBar holding tabified dockwidgets. | [
"Install",
"an",
"event",
"filter",
"to",
"capture",
"mouse",
"events",
"in",
"the",
"tabs",
"of",
"a",
"QTabBar",
"holding",
"tabified",
"dockwidgets",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/dock.py#L208-L227 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/bookmarks.py | _load_all_bookmarks | def _load_all_bookmarks():
"""Load all bookmarks from config."""
slots = CONF.get('editor', 'bookmarks', {})
for slot_num in list(slots.keys()):
if not osp.isfile(slots[slot_num][0]):
slots.pop(slot_num)
return slots | python | def _load_all_bookmarks():
"""Load all bookmarks from config."""
slots = CONF.get('editor', 'bookmarks', {})
for slot_num in list(slots.keys()):
if not osp.isfile(slots[slot_num][0]):
slots.pop(slot_num)
return slots | [
"def",
"_load_all_bookmarks",
"(",
")",
":",
"slots",
"=",
"CONF",
".",
"get",
"(",
"'editor'",
",",
"'bookmarks'",
",",
"{",
"}",
")",
"for",
"slot_num",
"in",
"list",
"(",
"slots",
".",
"keys",
"(",
")",
")",
":",
"if",
"not",
"osp",
".",
"isfile... | Load all bookmarks from config. | [
"Load",
"all",
"bookmarks",
"from",
"config",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/bookmarks.py#L17-L23 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/bookmarks.py | load_bookmarks | def load_bookmarks(filename):
"""Load all bookmarks for a specific file from config."""
bookmarks = _load_all_bookmarks()
return {k: v for k, v in bookmarks.items() if v[0] == filename} | python | def load_bookmarks(filename):
"""Load all bookmarks for a specific file from config."""
bookmarks = _load_all_bookmarks()
return {k: v for k, v in bookmarks.items() if v[0] == filename} | [
"def",
"load_bookmarks",
"(",
"filename",
")",
":",
"bookmarks",
"=",
"_load_all_bookmarks",
"(",
")",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"bookmarks",
".",
"items",
"(",
")",
"if",
"v",
"[",
"0",
"]",
"==",
"filename",
"}"
] | Load all bookmarks for a specific file from config. | [
"Load",
"all",
"bookmarks",
"for",
"a",
"specific",
"file",
"from",
"config",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/bookmarks.py#L26-L29 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/bookmarks.py | load_bookmarks_without_file | def load_bookmarks_without_file(filename):
"""Load all bookmarks but those from a specific file."""
bookmarks = _load_all_bookmarks()
return {k: v for k, v in bookmarks.items() if v[0] != filename} | python | def load_bookmarks_without_file(filename):
"""Load all bookmarks but those from a specific file."""
bookmarks = _load_all_bookmarks()
return {k: v for k, v in bookmarks.items() if v[0] != filename} | [
"def",
"load_bookmarks_without_file",
"(",
"filename",
")",
":",
"bookmarks",
"=",
"_load_all_bookmarks",
"(",
")",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"bookmarks",
".",
"items",
"(",
")",
"if",
"v",
"[",
"0",
"]",
"!=",
"filename... | Load all bookmarks but those from a specific file. | [
"Load",
"all",
"bookmarks",
"but",
"those",
"from",
"a",
"specific",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/bookmarks.py#L32-L35 | train |
spyder-ide/spyder | spyder/plugins/editor/utils/bookmarks.py | save_bookmarks | def save_bookmarks(filename, bookmarks):
"""Save all bookmarks from specific file to config."""
if not osp.isfile(filename):
return
slots = load_bookmarks_without_file(filename)
for slot_num, content in bookmarks.items():
slots[slot_num] = [filename, content[0], content[1]]
CONF.set(... | python | def save_bookmarks(filename, bookmarks):
"""Save all bookmarks from specific file to config."""
if not osp.isfile(filename):
return
slots = load_bookmarks_without_file(filename)
for slot_num, content in bookmarks.items():
slots[slot_num] = [filename, content[0], content[1]]
CONF.set(... | [
"def",
"save_bookmarks",
"(",
"filename",
",",
"bookmarks",
")",
":",
"if",
"not",
"osp",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"slots",
"=",
"load_bookmarks_without_file",
"(",
"filename",
")",
"for",
"slot_num",
",",
"content",
"in",
"bookmar... | Save all bookmarks from specific file to config. | [
"Save",
"all",
"bookmarks",
"from",
"specific",
"file",
"to",
"config",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/bookmarks.py#L38-L45 | train |
spyder-ide/spyder | spyder/plugins/editor/plugin.py | Editor.report_open_file | def report_open_file(self, options):
"""Request to start a LSP server to attend a language."""
filename = options['filename']
logger.debug('Call LSP for %s' % filename)
language = options['language']
callback = options['codeeditor']
stat = self.main.lspmanager.start... | python | def report_open_file(self, options):
"""Request to start a LSP server to attend a language."""
filename = options['filename']
logger.debug('Call LSP for %s' % filename)
language = options['language']
callback = options['codeeditor']
stat = self.main.lspmanager.start... | [
"def",
"report_open_file",
"(",
"self",
",",
"options",
")",
":",
"filename",
"=",
"options",
"[",
"'filename'",
"]",
"logger",
".",
"debug",
"(",
"'Call LSP for %s'",
"%",
"filename",
")",
"language",
"=",
"options",
"[",
"'language'",
"]",
"callback",
"=",... | Request to start a LSP server to attend a language. | [
"Request",
"to",
"start",
"a",
"LSP",
"server",
"to",
"attend",
"a",
"language",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L275-L291 | train |
spyder-ide/spyder | spyder/plugins/editor/plugin.py | Editor.register_lsp_server_settings | def register_lsp_server_settings(self, settings, language):
"""Register LSP server settings."""
self.lsp_editor_settings[language] = settings
logger.debug('LSP server settings for {!s} are: {!r}'.format(
language, settings))
self.lsp_server_ready(language, self.lsp_edito... | python | def register_lsp_server_settings(self, settings, language):
"""Register LSP server settings."""
self.lsp_editor_settings[language] = settings
logger.debug('LSP server settings for {!s} are: {!r}'.format(
language, settings))
self.lsp_server_ready(language, self.lsp_edito... | [
"def",
"register_lsp_server_settings",
"(",
"self",
",",
"settings",
",",
"language",
")",
":",
"self",
".",
"lsp_editor_settings",
"[",
"language",
"]",
"=",
"settings",
"logger",
".",
"debug",
"(",
"'LSP server settings for {!s} are: {!r}'",
".",
"format",
"(",
... | Register LSP server settings. | [
"Register",
"LSP",
"server",
"settings",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/plugin.py#L294-L299 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.