id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,000 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForStack.remove_autosave_file | def remove_autosave_file(self, fileinfo):
"""
Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag.
"""
filename = fileinfo.filename
if filename not in self.name_mapping:
... | python | def remove_autosave_file(self, fileinfo):
"""
Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag.
"""
filename = fileinfo.filename
if filename not in self.name_mapping:
... | [
"def",
"remove_autosave_file",
"(",
"self",
",",
"fileinfo",
")",
":",
"filename",
"=",
"fileinfo",
".",
"filename",
"if",
"filename",
"not",
"in",
"self",
".",
"name_mapping",
":",
"return",
"autosave_filename",
"=",
"self",
".",
"name_mapping",
"[",
"filenam... | Remove autosave file for specified file.
This function also updates `self.autosave_mapping` and clears the
`changed_since_autosave` flag. | [
"Remove",
"autosave",
"file",
"for",
"specified",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L154-L175 |
31,001 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForStack.get_autosave_filename | def get_autosave_filename(self, filename):
"""
Get name of autosave file for specified file name.
This function uses the dict in `self.name_mapping`. If `filename` is
in the mapping, then return the corresponding autosave file name.
Otherwise, construct a unique file name and up... | python | def get_autosave_filename(self, filename):
"""
Get name of autosave file for specified file name.
This function uses the dict in `self.name_mapping`. If `filename` is
in the mapping, then return the corresponding autosave file name.
Otherwise, construct a unique file name and up... | [
"def",
"get_autosave_filename",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"autosave_filename",
"=",
"self",
".",
"name_mapping",
"[",
"filename",
"]",
"except",
"KeyError",
":",
"autosave_dir",
"=",
"get_conf_path",
"(",
"'autosave'",
")",
"if",
"not... | Get name of autosave file for specified file name.
This function uses the dict in `self.name_mapping`. If `filename` is
in the mapping, then return the corresponding autosave file name.
Otherwise, construct a unique file name and update the mapping.
Args:
filename (str): or... | [
"Get",
"name",
"of",
"autosave",
"file",
"for",
"specified",
"file",
"name",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L177-L205 |
31,002 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForStack.autosave | def autosave(self, index):
"""
Autosave a file.
Do nothing if the `changed_since_autosave` flag is not set or the file
is newly created (and thus not named by the user). Otherwise, save a
copy of the file with the name given by `self.get_autosave_filename()`
and clear th... | python | def autosave(self, index):
"""
Autosave a file.
Do nothing if the `changed_since_autosave` flag is not set or the file
is newly created (and thus not named by the user). Otherwise, save a
copy of the file with the name given by `self.get_autosave_filename()`
and clear th... | [
"def",
"autosave",
"(",
"self",
",",
"index",
")",
":",
"finfo",
"=",
"self",
".",
"stack",
".",
"data",
"[",
"index",
"]",
"document",
"=",
"finfo",
".",
"editor",
".",
"document",
"(",
")",
"if",
"not",
"document",
".",
"changed_since_autosave",
"or"... | Autosave a file.
Do nothing if the `changed_since_autosave` flag is not set or the file
is newly created (and thus not named by the user). Otherwise, save a
copy of the file with the name given by `self.get_autosave_filename()`
and clear the `changed_since_autosave` flag. Errors raised ... | [
"Autosave",
"a",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L207-L233 |
31,003 | spyder-ide/spyder | spyder/plugins/editor/utils/autosave.py | AutosaveForStack.autosave_all | def autosave_all(self):
"""Autosave all opened files."""
for index in range(self.stack.get_stack_count()):
self.autosave(index) | python | def autosave_all(self):
"""Autosave all opened files."""
for index in range(self.stack.get_stack_count()):
self.autosave(index) | [
"def",
"autosave_all",
"(",
"self",
")",
":",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"stack",
".",
"get_stack_count",
"(",
")",
")",
":",
"self",
".",
"autosave",
"(",
"index",
")"
] | Autosave all opened files. | [
"Autosave",
"all",
"opened",
"files",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/autosave.py#L235-L238 |
31,004 | spyder-ide/spyder | spyder/utils/fixtures.py | tmpconfig | def tmpconfig(request):
"""
Fixtures that returns a temporary CONF element.
"""
SUBFOLDER = tempfile.mkdtemp()
CONF = UserConfig('spyder-test',
defaults=DEFAULTS,
version=CONF_VERSION,
subfolder=SUBFOLDER,
raw_mo... | python | def tmpconfig(request):
"""
Fixtures that returns a temporary CONF element.
"""
SUBFOLDER = tempfile.mkdtemp()
CONF = UserConfig('spyder-test',
defaults=DEFAULTS,
version=CONF_VERSION,
subfolder=SUBFOLDER,
raw_mo... | [
"def",
"tmpconfig",
"(",
"request",
")",
":",
"SUBFOLDER",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"CONF",
"=",
"UserConfig",
"(",
"'spyder-test'",
",",
"defaults",
"=",
"DEFAULTS",
",",
"version",
"=",
"CONF_VERSION",
",",
"subfolder",
"=",
"SUBFOLDER",
... | Fixtures that returns a temporary CONF element. | [
"Fixtures",
"that",
"returns",
"a",
"temporary",
"CONF",
"element",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/fixtures.py#L27-L46 |
31,005 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.offset | def offset(self):
"""This property holds the vertical offset of the scroll flag area
relative to the top of the text editor."""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in which t... | python | def offset(self):
"""This property holds the vertical offset of the scroll flag area
relative to the top of the text editor."""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in which t... | [
"def",
"offset",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",
"QStyleOptionSlider",
"(",
")",
"vsb",
".",
"initStyleOption",
"(",
"opt",
")",
"#... | This property holds the vertical offset of the scroll flag area
relative to the top of the text editor. | [
"This",
"property",
"holds",
"the",
"vertical",
"offset",
"of",
"the",
"scroll",
"flag",
"area",
"relative",
"to",
"the",
"top",
"of",
"the",
"text",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L49-L61 |
31,006 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.paintEvent | def paintEvent(self, event):
"""
Override Qt method.
Painting the scroll flag area
"""
make_flag = self.make_flag_qrect
# Fill the whole painting area
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
# Paint wa... | python | def paintEvent(self, event):
"""
Override Qt method.
Painting the scroll flag area
"""
make_flag = self.make_flag_qrect
# Fill the whole painting area
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
# Paint wa... | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"make_flag",
"=",
"self",
".",
"make_flag_qrect",
"# Fill the whole painting area",
"painter",
"=",
"QPainter",
"(",
"self",
")",
"painter",
".",
"fillRect",
"(",
"event",
".",
"rect",
"(",
")",
",",
... | Override Qt method.
Painting the scroll flag area | [
"Override",
"Qt",
"method",
".",
"Painting",
"the",
"scroll",
"flag",
"area"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L67-L138 |
31,007 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.get_scrollbar_position_height | def get_scrollbar_position_height(self):
"""Return the pixel span height of the scrollbar area in which
the slider handle may move"""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in w... | python | def get_scrollbar_position_height(self):
"""Return the pixel span height of the scrollbar area in which
the slider handle may move"""
vsb = self.editor.verticalScrollBar()
style = vsb.style()
opt = QStyleOptionSlider()
vsb.initStyleOption(opt)
# Get the area in w... | [
"def",
"get_scrollbar_position_height",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",
"QStyleOptionSlider",
"(",
")",
"vsb",
".",
"initStyleOption",
"(... | Return the pixel span height of the scrollbar area in which
the slider handle may move | [
"Return",
"the",
"pixel",
"span",
"height",
"of",
"the",
"scrollbar",
"area",
"in",
"which",
"the",
"slider",
"handle",
"may",
"move"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L171-L183 |
31,008 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.get_scrollbar_value_height | def get_scrollbar_value_height(self):
"""Return the value span height of the scrollbar"""
vsb = self.editor.verticalScrollBar()
return vsb.maximum()-vsb.minimum()+vsb.pageStep() | python | def get_scrollbar_value_height(self):
"""Return the value span height of the scrollbar"""
vsb = self.editor.verticalScrollBar()
return vsb.maximum()-vsb.minimum()+vsb.pageStep() | [
"def",
"get_scrollbar_value_height",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"return",
"vsb",
".",
"maximum",
"(",
")",
"-",
"vsb",
".",
"minimum",
"(",
")",
"+",
"vsb",
".",
"pageStep",
"(",
")"
] | Return the value span height of the scrollbar | [
"Return",
"the",
"value",
"span",
"height",
"of",
"the",
"scrollbar"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L185-L188 |
31,009 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.value_to_position | def value_to_position(self, y):
"""Convert value to position in pixels"""
vsb = self.editor.verticalScrollBar()
return (y-vsb.minimum())*self.get_scale_factor()+self.offset | python | def value_to_position(self, y):
"""Convert value to position in pixels"""
vsb = self.editor.verticalScrollBar()
return (y-vsb.minimum())*self.get_scale_factor()+self.offset | [
"def",
"value_to_position",
"(",
"self",
",",
"y",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"return",
"(",
"y",
"-",
"vsb",
".",
"minimum",
"(",
")",
")",
"*",
"self",
".",
"get_scale_factor",
"(",
")",
"+",
... | Convert value to position in pixels | [
"Convert",
"value",
"to",
"position",
"in",
"pixels"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L196-L199 |
31,010 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.position_to_value | def position_to_value(self, y):
"""Convert position in pixels to value"""
vsb = self.editor.verticalScrollBar()
return vsb.minimum()+max([0, (y-self.offset)/self.get_scale_factor()]) | python | def position_to_value(self, y):
"""Convert position in pixels to value"""
vsb = self.editor.verticalScrollBar()
return vsb.minimum()+max([0, (y-self.offset)/self.get_scale_factor()]) | [
"def",
"position_to_value",
"(",
"self",
",",
"y",
")",
":",
"vsb",
"=",
"self",
".",
"editor",
".",
"verticalScrollBar",
"(",
")",
"return",
"vsb",
".",
"minimum",
"(",
")",
"+",
"max",
"(",
"[",
"0",
",",
"(",
"y",
"-",
"self",
".",
"offset",
"... | Convert position in pixels to value | [
"Convert",
"position",
"in",
"pixels",
"to",
"value"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L201-L204 |
31,011 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.make_flag_qrect | def make_flag_qrect(self, value):
"""Make flag QRect"""
if self.slider:
position = self.value_to_position(value+0.5)
# The 0.5 offset is used to align the flags with the center of
# their corresponding text edit block before scaling.
return QRect(self.FLA... | python | def make_flag_qrect(self, value):
"""Make flag QRect"""
if self.slider:
position = self.value_to_position(value+0.5)
# The 0.5 offset is used to align the flags with the center of
# their corresponding text edit block before scaling.
return QRect(self.FLA... | [
"def",
"make_flag_qrect",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"slider",
":",
"position",
"=",
"self",
".",
"value_to_position",
"(",
"value",
"+",
"0.5",
")",
"# The 0.5 offset is used to align the flags with the center of",
"# their corresponding ... | Make flag QRect | [
"Make",
"flag",
"QRect"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L206-L226 |
31,012 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.make_slider_range | def make_slider_range(self, cursor_pos):
"""Make slider range QRect"""
# The slider range indicator position follows the mouse vertical
# position while its height corresponds to the part of the file that
# is currently visible on screen.
vsb = self.editor.verticalScrollBar()
... | python | def make_slider_range(self, cursor_pos):
"""Make slider range QRect"""
# The slider range indicator position follows the mouse vertical
# position while its height corresponds to the part of the file that
# is currently visible on screen.
vsb = self.editor.verticalScrollBar()
... | [
"def",
"make_slider_range",
"(",
"self",
",",
"cursor_pos",
")",
":",
"# The slider range indicator position follows the mouse vertical",
"# position while its height corresponds to the part of the file that",
"# is currently visible on screen.",
"vsb",
"=",
"self",
".",
"editor",
".... | Make slider range QRect | [
"Make",
"slider",
"range",
"QRect"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L228-L247 |
31,013 | spyder-ide/spyder | spyder/plugins/editor/panels/scrollflag.py | ScrollFlagArea.set_painter | def set_painter(self, painter, light_color):
"""Set scroll flag area painter pen and brush colors"""
painter.setPen(QColor(light_color).darker(120))
painter.setBrush(QBrush(QColor(light_color))) | python | def set_painter(self, painter, light_color):
"""Set scroll flag area painter pen and brush colors"""
painter.setPen(QColor(light_color).darker(120))
painter.setBrush(QBrush(QColor(light_color))) | [
"def",
"set_painter",
"(",
"self",
",",
"painter",
",",
"light_color",
")",
":",
"painter",
".",
"setPen",
"(",
"QColor",
"(",
"light_color",
")",
".",
"darker",
"(",
"120",
")",
")",
"painter",
".",
"setBrush",
"(",
"QBrush",
"(",
"QColor",
"(",
"ligh... | Set scroll flag area painter pen and brush colors | [
"Set",
"scroll",
"flag",
"area",
"painter",
"pen",
"and",
"brush",
"colors"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/scrollflag.py#L253-L256 |
31,014 | spyder-ide/spyder | spyder/plugins/profiler/plugin.py | Profiler.on_first_registration | def on_first_registration(self):
"""Action to be performed on first plugin registration"""
self.main.tabify_plugins(self.main.help, self)
self.dockwidget.hide() | python | def on_first_registration(self):
"""Action to be performed on first plugin registration"""
self.main.tabify_plugins(self.main.help, self)
self.dockwidget.hide() | [
"def",
"on_first_registration",
"(",
"self",
")",
":",
"self",
".",
"main",
".",
"tabify_plugins",
"(",
"self",
".",
"main",
".",
"help",
",",
"self",
")",
"self",
".",
"dockwidget",
".",
"hide",
"(",
")"
] | Action to be performed on first plugin registration | [
"Action",
"to",
"be",
"performed",
"on",
"first",
"plugin",
"registration"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/profiler/plugin.py#L75-L78 |
31,015 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | drift_color | def drift_color(base_color, factor=110):
"""
Return color that is lighter or darker than the base color.
If base_color.lightness is higher than 128, the returned color is darker
otherwise is is lighter.
:param base_color: The base color to drift from
;:param factor: drift factor (%)
:retur... | python | def drift_color(base_color, factor=110):
"""
Return color that is lighter or darker than the base color.
If base_color.lightness is higher than 128, the returned color is darker
otherwise is is lighter.
:param base_color: The base color to drift from
;:param factor: drift factor (%)
:retur... | [
"def",
"drift_color",
"(",
"base_color",
",",
"factor",
"=",
"110",
")",
":",
"base_color",
"=",
"QColor",
"(",
"base_color",
")",
"if",
"base_color",
".",
"lightness",
"(",
")",
">",
"128",
":",
"return",
"base_color",
".",
"darker",
"(",
"factor",
")",... | Return color that is lighter or darker than the base color.
If base_color.lightness is higher than 128, the returned color is darker
otherwise is is lighter.
:param base_color: The base color to drift from
;:param factor: drift factor (%)
:return A lighter or darker color. | [
"Return",
"color",
"that",
"is",
"lighter",
"or",
"darker",
"than",
"the",
"base",
"color",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L33-L51 |
31,016 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | get_block_symbol_data | def get_block_symbol_data(editor, block):
"""
Gets the list of ParenthesisInfo for specific text block.
:param editor: Code editor instance
:param block: block to parse
"""
def list_symbols(editor, block, character):
"""
Retuns a list of symbols found in the block text
... | python | def get_block_symbol_data(editor, block):
"""
Gets the list of ParenthesisInfo for specific text block.
:param editor: Code editor instance
:param block: block to parse
"""
def list_symbols(editor, block, character):
"""
Retuns a list of symbols found in the block text
... | [
"def",
"get_block_symbol_data",
"(",
"editor",
",",
"block",
")",
":",
"def",
"list_symbols",
"(",
"editor",
",",
"block",
",",
"character",
")",
":",
"\"\"\"\n Retuns a list of symbols found in the block text\n\n :param editor: code editor instance\n :param... | Gets the list of ParenthesisInfo for specific text block.
:param editor: Code editor instance
:param block: block to parse | [
"Gets",
"the",
"list",
"of",
"ParenthesisInfo",
"for",
"specific",
"text",
"block",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1035-L1076 |
31,017 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | keep_tc_pos | def keep_tc_pos(func):
"""
Cache text cursor position and restore it when the wrapped
function exits.
This decorator can only be used on modes or panels.
:param func: wrapped function
"""
@functools.wraps(func)
def wrapper(editor, *args, **kwds):
""" Decorator """
sb = ... | python | def keep_tc_pos(func):
"""
Cache text cursor position and restore it when the wrapped
function exits.
This decorator can only be used on modes or panels.
:param func: wrapped function
"""
@functools.wraps(func)
def wrapper(editor, *args, **kwds):
""" Decorator """
sb = ... | [
"def",
"keep_tc_pos",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"editor",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"\"\"\" Decorator \"\"\"",
"sb",
"=",
"editor",
".",
"verticalScrollBar",
... | Cache text cursor position and restore it when the wrapped
function exits.
This decorator can only be used on modes or panels.
:param func: wrapped function | [
"Cache",
"text",
"cursor",
"position",
"and",
"restore",
"it",
"when",
"the",
"wrapped",
"function",
"exits",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1079-L1100 |
31,018 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | with_wait_cursor | def with_wait_cursor(func):
"""
Show a wait cursor while the wrapped function is running. The cursor is
restored as soon as the function exits.
:param func: wrapped function
"""
@functools.wraps(func)
def wrapper(*args, **kwargs):
QApplication.setOverrideCursor(
QCursor(... | python | def with_wait_cursor(func):
"""
Show a wait cursor while the wrapped function is running. The cursor is
restored as soon as the function exits.
:param func: wrapped function
"""
@functools.wraps(func)
def wrapper(*args, **kwargs):
QApplication.setOverrideCursor(
QCursor(... | [
"def",
"with_wait_cursor",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"QApplication",
".",
"setOverrideCursor",
"(",
"QCursor",
"(",
"Qt",
".",
"WaitCu... | Show a wait cursor while the wrapped function is running. The cursor is
restored as soon as the function exits.
:param func: wrapped function | [
"Show",
"a",
"wait",
"cursor",
"while",
"the",
"wrapped",
"function",
"is",
"running",
".",
"The",
"cursor",
"is",
"restored",
"as",
"soon",
"as",
"the",
"function",
"exits",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1103-L1119 |
31,019 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | BlockUserData.is_empty | def is_empty(self):
"""Return whether the block of user data is empty."""
return (not self.breakpoint and not self.code_analysis
and not self.todo and not self.bookmarks) | python | def is_empty(self):
"""Return whether the block of user data is empty."""
return (not self.breakpoint and not self.code_analysis
and not self.todo and not self.bookmarks) | [
"def",
"is_empty",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"breakpoint",
"and",
"not",
"self",
".",
"code_analysis",
"and",
"not",
"self",
".",
"todo",
"and",
"not",
"self",
".",
"bookmarks",
")"
] | Return whether the block of user data is empty. | [
"Return",
"whether",
"the",
"block",
"of",
"user",
"data",
"is",
"empty",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L67-L70 |
31,020 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | DelayJobRunner.request_job | def request_job(self, job, *args, **kwargs):
"""
Request a job execution.
The job will be executed after the delay specified in the
DelayJobRunner contructor elapsed if no other job is requested until
then.
:param job: job.
:type job: callable
:param arg... | python | def request_job(self, job, *args, **kwargs):
"""
Request a job execution.
The job will be executed after the delay specified in the
DelayJobRunner contructor elapsed if no other job is requested until
then.
:param job: job.
:type job: callable
:param arg... | [
"def",
"request_job",
"(",
"self",
",",
"job",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"cancel_requests",
"(",
")",
"self",
".",
"_job",
"=",
"job",
"self",
".",
"_args",
"=",
"args",
"self",
".",
"_kwargs",
"=",
"kwargs",... | Request a job execution.
The job will be executed after the delay specified in the
DelayJobRunner contructor elapsed if no other job is requested until
then.
:param job: job.
:type job: callable
:param args: job's position arguments
:param kwargs: job's keyworde... | [
"Request",
"a",
"job",
"execution",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L100-L117 |
31,021 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | DelayJobRunner.cancel_requests | def cancel_requests(self):
"""Cancels pending requests."""
self._timer.stop()
self._job = None
self._args = None
self._kwargs = None | python | def cancel_requests(self):
"""Cancels pending requests."""
self._timer.stop()
self._job = None
self._args = None
self._kwargs = None | [
"def",
"cancel_requests",
"(",
"self",
")",
":",
"self",
".",
"_timer",
".",
"stop",
"(",
")",
"self",
".",
"_job",
"=",
"None",
"self",
".",
"_args",
"=",
"None",
"self",
".",
"_kwargs",
"=",
"None"
] | Cancels pending requests. | [
"Cancels",
"pending",
"requests",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L119-L124 |
31,022 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | DelayJobRunner._exec_requested_job | def _exec_requested_job(self):
"""Execute the requested job after the timer has timeout."""
self._timer.stop()
self._job(*self._args, **self._kwargs) | python | def _exec_requested_job(self):
"""Execute the requested job after the timer has timeout."""
self._timer.stop()
self._job(*self._args, **self._kwargs) | [
"def",
"_exec_requested_job",
"(",
"self",
")",
":",
"self",
".",
"_timer",
".",
"stop",
"(",
")",
"self",
".",
"_job",
"(",
"*",
"self",
".",
"_args",
",",
"*",
"*",
"self",
".",
"_kwargs",
")"
] | Execute the requested job after the timer has timeout. | [
"Execute",
"the",
"requested",
"job",
"after",
"the",
"timer",
"has",
"timeout",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L126-L129 |
31,023 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.goto_line | def goto_line(self, line, column=0, end_column=0, move=True, word=''):
"""
Moves the text cursor to the specified position.
:param line: Number of the line to go to (0 based)
:param column: Optional column number. Default is 0 (start of line).
:param move: True to move the curso... | python | def goto_line(self, line, column=0, end_column=0, move=True, word=''):
"""
Moves the text cursor to the specified position.
:param line: Number of the line to go to (0 based)
:param column: Optional column number. Default is 0 (start of line).
:param move: True to move the curso... | [
"def",
"goto_line",
"(",
"self",
",",
"line",
",",
"column",
"=",
"0",
",",
"end_column",
"=",
"0",
",",
"move",
"=",
"True",
",",
"word",
"=",
"''",
")",
":",
"line",
"=",
"min",
"(",
"line",
",",
"self",
".",
"line_count",
"(",
")",
")",
"tex... | Moves the text cursor to the specified position.
:param line: Number of the line to go to (0 based)
:param column: Optional column number. Default is 0 (start of line).
:param move: True to move the cursor. False will return the cursor
without setting it on the editor.
... | [
"Moves",
"the",
"text",
"cursor",
"to",
"the",
"specified",
"position",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L154-L186 |
31,024 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.unfold_if_colapsed | def unfold_if_colapsed(self, block):
"""Unfold parent fold trigger if the block is collapsed.
:param block: Block to unfold.
"""
try:
folding_panel = self._editor.panels.get('FoldingPanel')
except KeyError:
pass
else:
from spyder.plugi... | python | def unfold_if_colapsed(self, block):
"""Unfold parent fold trigger if the block is collapsed.
:param block: Block to unfold.
"""
try:
folding_panel = self._editor.panels.get('FoldingPanel')
except KeyError:
pass
else:
from spyder.plugi... | [
"def",
"unfold_if_colapsed",
"(",
"self",
",",
"block",
")",
":",
"try",
":",
"folding_panel",
"=",
"self",
".",
"_editor",
".",
"panels",
".",
"get",
"(",
"'FoldingPanel'",
")",
"except",
"KeyError",
":",
"pass",
"else",
":",
"from",
"spyder",
".",
"plu... | Unfold parent fold trigger if the block is collapsed.
:param block: Block to unfold. | [
"Unfold",
"parent",
"fold",
"trigger",
"if",
"the",
"block",
"is",
"collapsed",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L188-L202 |
31,025 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.line_text | def line_text(self, line_nbr):
"""
Gets the text of the specified line.
:param line_nbr: The line number of the text to get
:return: Entire line's text
:rtype: str
"""
doc = self._editor.document()
block = doc.findBlockByNumber(line_nbr)
return b... | python | def line_text(self, line_nbr):
"""
Gets the text of the specified line.
:param line_nbr: The line number of the text to get
:return: Entire line's text
:rtype: str
"""
doc = self._editor.document()
block = doc.findBlockByNumber(line_nbr)
return b... | [
"def",
"line_text",
"(",
"self",
",",
"line_nbr",
")",
":",
"doc",
"=",
"self",
".",
"_editor",
".",
"document",
"(",
")",
"block",
"=",
"doc",
".",
"findBlockByNumber",
"(",
"line_nbr",
")",
"return",
"block",
".",
"text",
"(",
")"
] | Gets the text of the specified line.
:param line_nbr: The line number of the text to get
:return: Entire line's text
:rtype: str | [
"Gets",
"the",
"text",
"of",
"the",
"specified",
"line",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L312-L323 |
31,026 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.set_line_text | def set_line_text(self, line_nbr, new_text):
"""
Replace an entire line with ``new_text``.
:param line_nbr: line number of the line to change.
:param new_text: The replacement text.
"""
editor = self._editor
text_cursor = self._move_cursor_to(line_nbr)
t... | python | def set_line_text(self, line_nbr, new_text):
"""
Replace an entire line with ``new_text``.
:param line_nbr: line number of the line to change.
:param new_text: The replacement text.
"""
editor = self._editor
text_cursor = self._move_cursor_to(line_nbr)
t... | [
"def",
"set_line_text",
"(",
"self",
",",
"line_nbr",
",",
"new_text",
")",
":",
"editor",
"=",
"self",
".",
"_editor",
"text_cursor",
"=",
"self",
".",
"_move_cursor_to",
"(",
"line_nbr",
")",
"text_cursor",
".",
"select",
"(",
"text_cursor",
".",
"LineUnde... | Replace an entire line with ``new_text``.
:param line_nbr: line number of the line to change.
:param new_text: The replacement text. | [
"Replace",
"an",
"entire",
"line",
"with",
"new_text",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L342-L354 |
31,027 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.remove_last_line | def remove_last_line(self):
"""Removes the last line of the document."""
editor = self._editor
text_cursor = editor.textCursor()
text_cursor.movePosition(text_cursor.End, text_cursor.MoveAnchor)
text_cursor.select(text_cursor.LineUnderCursor)
text_cursor.removeSelectedTex... | python | def remove_last_line(self):
"""Removes the last line of the document."""
editor = self._editor
text_cursor = editor.textCursor()
text_cursor.movePosition(text_cursor.End, text_cursor.MoveAnchor)
text_cursor.select(text_cursor.LineUnderCursor)
text_cursor.removeSelectedTex... | [
"def",
"remove_last_line",
"(",
"self",
")",
":",
"editor",
"=",
"self",
".",
"_editor",
"text_cursor",
"=",
"editor",
".",
"textCursor",
"(",
")",
"text_cursor",
".",
"movePosition",
"(",
"text_cursor",
".",
"End",
",",
"text_cursor",
".",
"MoveAnchor",
")"... | Removes the last line of the document. | [
"Removes",
"the",
"last",
"line",
"of",
"the",
"document",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L356-L364 |
31,028 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.clean_document | def clean_document(self):
"""
Removes trailing whitespaces and ensure one single blank line at the
end of the QTextDocument.
FIXME: It was deprecated in pyqode, maybe It should be deleted
"""
editor = self._editor
value = editor.verticalScrollBar().value()
... | python | def clean_document(self):
"""
Removes trailing whitespaces and ensure one single blank line at the
end of the QTextDocument.
FIXME: It was deprecated in pyqode, maybe It should be deleted
"""
editor = self._editor
value = editor.verticalScrollBar().value()
... | [
"def",
"clean_document",
"(",
"self",
")",
":",
"editor",
"=",
"self",
".",
"_editor",
"value",
"=",
"editor",
".",
"verticalScrollBar",
"(",
")",
".",
"value",
"(",
")",
"pos",
"=",
"self",
".",
"cursor_position",
"(",
")",
"editor",
".",
"textCursor",
... | Removes trailing whitespaces and ensure one single blank line at the
end of the QTextDocument.
FIXME: It was deprecated in pyqode, maybe It should be deleted | [
"Removes",
"trailing",
"whitespaces",
"and",
"ensure",
"one",
"single",
"blank",
"line",
"at",
"the",
"end",
"of",
"the",
"QTextDocument",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L366-L427 |
31,029 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.select_whole_line | def select_whole_line(self, line=None, apply_selection=True):
"""
Selects an entire line.
:param line: Line to select. If None, the current line will be selected
:param apply_selection: True to apply selection on the text editor
widget, False to just return the text cursor w... | python | def select_whole_line(self, line=None, apply_selection=True):
"""
Selects an entire line.
:param line: Line to select. If None, the current line will be selected
:param apply_selection: True to apply selection on the text editor
widget, False to just return the text cursor w... | [
"def",
"select_whole_line",
"(",
"self",
",",
"line",
"=",
"None",
",",
"apply_selection",
"=",
"True",
")",
":",
"if",
"line",
"is",
"None",
":",
"line",
"=",
"self",
".",
"current_line_nbr",
"(",
")",
"return",
"self",
".",
"select_lines",
"(",
"line",... | Selects an entire line.
:param line: Line to select. If None, the current line will be selected
:param apply_selection: True to apply selection on the text editor
widget, False to just return the text cursor without setting it
on the editor.
:return: QTextCursor | [
"Selects",
"an",
"entire",
"line",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L429-L441 |
31,030 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.line_nbr_from_position | def line_nbr_from_position(self, y_pos):
"""
Returns the line number from the y_pos.
:param y_pos: Y pos in the editor
:return: Line number (0 based), -1 if out of range
"""
editor = self._editor
height = editor.fontMetrics().height()
for top, line, block... | python | def line_nbr_from_position(self, y_pos):
"""
Returns the line number from the y_pos.
:param y_pos: Y pos in the editor
:return: Line number (0 based), -1 if out of range
"""
editor = self._editor
height = editor.fontMetrics().height()
for top, line, block... | [
"def",
"line_nbr_from_position",
"(",
"self",
",",
"y_pos",
")",
":",
"editor",
"=",
"self",
".",
"_editor",
"height",
"=",
"editor",
".",
"fontMetrics",
"(",
")",
".",
"height",
"(",
")",
"for",
"top",
",",
"line",
",",
"block",
"in",
"editor",
".",
... | Returns the line number from the y_pos.
:param y_pos: Y pos in the editor
:return: Line number (0 based), -1 if out of range | [
"Returns",
"the",
"line",
"number",
"from",
"the",
"y_pos",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L530-L542 |
31,031 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.get_right_character | def get_right_character(self, cursor=None):
"""
Gets the character that is on the right of the text cursor.
:param cursor: QTextCursor that defines the position where the search
will start.
"""
next_char = self.get_right_word(cursor=cursor)
if len(next_char):... | python | def get_right_character(self, cursor=None):
"""
Gets the character that is on the right of the text cursor.
:param cursor: QTextCursor that defines the position where the search
will start.
"""
next_char = self.get_right_word(cursor=cursor)
if len(next_char):... | [
"def",
"get_right_character",
"(",
"self",
",",
"cursor",
"=",
"None",
")",
":",
"next_char",
"=",
"self",
".",
"get_right_word",
"(",
"cursor",
"=",
"cursor",
")",
"if",
"len",
"(",
"next_char",
")",
":",
"next_char",
"=",
"next_char",
"[",
"0",
"]",
... | Gets the character that is on the right of the text cursor.
:param cursor: QTextCursor that defines the position where the search
will start. | [
"Gets",
"the",
"character",
"that",
"is",
"on",
"the",
"right",
"of",
"the",
"text",
"cursor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L585-L597 |
31,032 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.insert_text | def insert_text(self, text, keep_position=True):
"""
Inserts text at the cursor position.
:param text: text to insert
:param keep_position: Flag that specifies if the cursor position must
be kept. Pass False for a regular insert (the cursor will be at
the end of ... | python | def insert_text(self, text, keep_position=True):
"""
Inserts text at the cursor position.
:param text: text to insert
:param keep_position: Flag that specifies if the cursor position must
be kept. Pass False for a regular insert (the cursor will be at
the end of ... | [
"def",
"insert_text",
"(",
"self",
",",
"text",
",",
"keep_position",
"=",
"True",
")",
":",
"text_cursor",
"=",
"self",
".",
"_editor",
".",
"textCursor",
"(",
")",
"if",
"keep_position",
":",
"s",
"=",
"text_cursor",
".",
"selectionStart",
"(",
")",
"e... | Inserts text at the cursor position.
:param text: text to insert
:param keep_position: Flag that specifies if the cursor position must
be kept. Pass False for a regular insert (the cursor will be at
the end of the inserted text). | [
"Inserts",
"text",
"at",
"the",
"cursor",
"position",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L599-L616 |
31,033 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.clear_selection | def clear_selection(self):
"""Clears text cursor selection."""
text_cursor = self._editor.textCursor()
text_cursor.clearSelection()
self._editor.setTextCursor(text_cursor) | python | def clear_selection(self):
"""Clears text cursor selection."""
text_cursor = self._editor.textCursor()
text_cursor.clearSelection()
self._editor.setTextCursor(text_cursor) | [
"def",
"clear_selection",
"(",
"self",
")",
":",
"text_cursor",
"=",
"self",
".",
"_editor",
".",
"textCursor",
"(",
")",
"text_cursor",
".",
"clearSelection",
"(",
")",
"self",
".",
"_editor",
".",
"setTextCursor",
"(",
"text_cursor",
")"
] | Clears text cursor selection. | [
"Clears",
"text",
"cursor",
"selection",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L618-L622 |
31,034 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.move_right | def move_right(self, keep_anchor=False, nb_chars=1):
"""
Moves the cursor on the right.
:param keep_anchor: True to keep anchor (to select text) or False to
move the anchor (no selection)
:param nb_chars: Number of characters to move.
"""
text_cursor = self._... | python | def move_right(self, keep_anchor=False, nb_chars=1):
"""
Moves the cursor on the right.
:param keep_anchor: True to keep anchor (to select text) or False to
move the anchor (no selection)
:param nb_chars: Number of characters to move.
"""
text_cursor = self._... | [
"def",
"move_right",
"(",
"self",
",",
"keep_anchor",
"=",
"False",
",",
"nb_chars",
"=",
"1",
")",
":",
"text_cursor",
"=",
"self",
".",
"_editor",
".",
"textCursor",
"(",
")",
"text_cursor",
".",
"movePosition",
"(",
"text_cursor",
".",
"Right",
",",
"... | Moves the cursor on the right.
:param keep_anchor: True to keep anchor (to select text) or False to
move the anchor (no selection)
:param nb_chars: Number of characters to move. | [
"Moves",
"the",
"cursor",
"on",
"the",
"right",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L624-L636 |
31,035 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextHelper.select_extended_word | def select_extended_word(self, continuation_chars=('.',)):
"""
Performs extended word selection. Extended selection consists in
selecting the word under cursor and any other words that are linked
by a ``continuation_chars``.
:param continuation_chars: the list of characters that... | python | def select_extended_word(self, continuation_chars=('.',)):
"""
Performs extended word selection. Extended selection consists in
selecting the word under cursor and any other words that are linked
by a ``continuation_chars``.
:param continuation_chars: the list of characters that... | [
"def",
"select_extended_word",
"(",
"self",
",",
"continuation_chars",
"=",
"(",
"'.'",
",",
")",
")",
":",
"cursor",
"=",
"self",
".",
"_editor",
".",
"textCursor",
"(",
")",
"original_pos",
"=",
"cursor",
".",
"position",
"(",
")",
"start_pos",
"=",
"N... | Performs extended word selection. Extended selection consists in
selecting the word under cursor and any other words that are linked
by a ``continuation_chars``.
:param continuation_chars: the list of characters that may extend a
word. | [
"Performs",
"extended",
"word",
"selection",
".",
"Extended",
"selection",
"consists",
"in",
"selecting",
"the",
"word",
"under",
"cursor",
"and",
"any",
"other",
"words",
"that",
"are",
"linked",
"by",
"a",
"continuation_chars",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L720-L765 |
31,036 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextBlockHelper.set_state | def set_state(block, state):
"""
Sets the user state, generally used for syntax highlighting.
:param block: block to modify
:param state: new state value.
:return:
"""
if block is None:
return
user_state = block.userState()
if user_sta... | python | def set_state(block, state):
"""
Sets the user state, generally used for syntax highlighting.
:param block: block to modify
:param state: new state value.
:return:
"""
if block is None:
return
user_state = block.userState()
if user_sta... | [
"def",
"set_state",
"(",
"block",
",",
"state",
")",
":",
"if",
"block",
"is",
"None",
":",
"return",
"user_state",
"=",
"block",
".",
"userState",
"(",
")",
"if",
"user_state",
"==",
"-",
"1",
":",
"user_state",
"=",
"0",
"higher_part",
"=",
"user_sta... | Sets the user state, generally used for syntax highlighting.
:param block: block to modify
:param state: new state value.
:return: | [
"Sets",
"the",
"user",
"state",
"generally",
"used",
"for",
"syntax",
"highlighting",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L905-L921 |
31,037 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextBlockHelper.set_fold_lvl | def set_fold_lvl(block, val):
"""
Sets the block fold level.
:param block: block to modify
:param val: The new fold level [0-7]
"""
if block is None:
return
state = block.userState()
if state == -1:
state = 0
if val >= 0x3F... | python | def set_fold_lvl(block, val):
"""
Sets the block fold level.
:param block: block to modify
:param val: The new fold level [0-7]
"""
if block is None:
return
state = block.userState()
if state == -1:
state = 0
if val >= 0x3F... | [
"def",
"set_fold_lvl",
"(",
"block",
",",
"val",
")",
":",
"if",
"block",
"is",
"None",
":",
"return",
"state",
"=",
"block",
".",
"userState",
"(",
")",
"if",
"state",
"==",
"-",
"1",
":",
"state",
"=",
"0",
"if",
"val",
">=",
"0x3FF",
":",
"val... | Sets the block fold level.
:param block: block to modify
:param val: The new fold level [0-7] | [
"Sets",
"the",
"block",
"fold",
"level",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L939-L955 |
31,038 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextBlockHelper.is_fold_trigger | def is_fold_trigger(block):
"""
Checks if the block is a fold trigger.
:param block: block to check
:return: True if the block is a fold trigger (represented as a node in
the fold panel)
"""
if block is None:
return False
state = block.use... | python | def is_fold_trigger(block):
"""
Checks if the block is a fold trigger.
:param block: block to check
:return: True if the block is a fold trigger (represented as a node in
the fold panel)
"""
if block is None:
return False
state = block.use... | [
"def",
"is_fold_trigger",
"(",
"block",
")",
":",
"if",
"block",
"is",
"None",
":",
"return",
"False",
"state",
"=",
"block",
".",
"userState",
"(",
")",
"if",
"state",
"==",
"-",
"1",
":",
"state",
"=",
"0",
"return",
"bool",
"(",
"state",
"&",
"0... | Checks if the block is a fold trigger.
:param block: block to check
:return: True if the block is a fold trigger (represented as a node in
the fold panel) | [
"Checks",
"if",
"the",
"block",
"is",
"a",
"fold",
"trigger",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L958-L971 |
31,039 | spyder-ide/spyder | spyder/plugins/editor/utils/editor.py | TextBlockHelper.is_collapsed | def is_collapsed(block):
"""
Checks if the block is expanded or collased.
:param block: QTextBlock
:return: False for an open trigger, True for for closed trigger
"""
if block is None:
return False
state = block.userState()
if state == -1:
... | python | def is_collapsed(block):
"""
Checks if the block is expanded or collased.
:param block: QTextBlock
:return: False for an open trigger, True for for closed trigger
"""
if block is None:
return False
state = block.userState()
if state == -1:
... | [
"def",
"is_collapsed",
"(",
"block",
")",
":",
"if",
"block",
"is",
"None",
":",
"return",
"False",
"state",
"=",
"block",
".",
"userState",
"(",
")",
"if",
"state",
"==",
"-",
"1",
":",
"state",
"=",
"0",
"return",
"bool",
"(",
"state",
"&",
"0x08... | Checks if the block is expanded or collased.
:param block: QTextBlock
:return: False for an open trigger, True for for closed trigger | [
"Checks",
"if",
"the",
"block",
"is",
"expanded",
"or",
"collased",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L992-L1004 |
31,040 | spyder-ide/spyder | spyder/widgets/status.py | StatusBarWidget.set_value | def set_value(self, value):
"""Set formatted text value."""
self.value = value
if self.isVisible():
self.label_value.setText(value) | python | def set_value(self, value):
"""Set formatted text value."""
self.value = value
if self.isVisible():
self.label_value.setText(value) | [
"def",
"set_value",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"value",
"=",
"value",
"if",
"self",
".",
"isVisible",
"(",
")",
":",
"self",
".",
"label_value",
".",
"setText",
"(",
"value",
")"
] | Set formatted text value. | [
"Set",
"formatted",
"text",
"value",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L74-L78 |
31,041 | spyder-ide/spyder | spyder/widgets/status.py | BaseTimerStatus.setVisible | def setVisible(self, value):
"""Override Qt method to stops timers if widget is not visible."""
if self.timer is not None:
if value:
self.timer.start(self._interval)
else:
self.timer.stop()
super(BaseTimerStatus, self).setVisible(value) | python | def setVisible(self, value):
"""Override Qt method to stops timers if widget is not visible."""
if self.timer is not None:
if value:
self.timer.start(self._interval)
else:
self.timer.stop()
super(BaseTimerStatus, self).setVisible(value) | [
"def",
"setVisible",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"timer",
"is",
"not",
"None",
":",
"if",
"value",
":",
"self",
".",
"timer",
".",
"start",
"(",
"self",
".",
"_interval",
")",
"else",
":",
"self",
".",
"timer",
".",
"s... | Override Qt method to stops timers if widget is not visible. | [
"Override",
"Qt",
"method",
"to",
"stops",
"timers",
"if",
"widget",
"is",
"not",
"visible",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L102-L109 |
31,042 | spyder-ide/spyder | spyder/widgets/status.py | MemoryStatus.get_value | def get_value(self):
"""Return memory usage."""
from spyder.utils.system import memory_usage
text = '%d%%' % memory_usage()
return 'Mem ' + text.rjust(3) | python | def get_value(self):
"""Return memory usage."""
from spyder.utils.system import memory_usage
text = '%d%%' % memory_usage()
return 'Mem ' + text.rjust(3) | [
"def",
"get_value",
"(",
"self",
")",
":",
"from",
"spyder",
".",
"utils",
".",
"system",
"import",
"memory_usage",
"text",
"=",
"'%d%%'",
"%",
"memory_usage",
"(",
")",
"return",
"'Mem '",
"+",
"text",
".",
"rjust",
"(",
"3",
")"
] | Return memory usage. | [
"Return",
"memory",
"usage",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L150-L154 |
31,043 | spyder-ide/spyder | spyder/plugins/help/utils/sphinxify.py | warning | def warning(message, css_path=CSS_PATH):
"""Print a warning message on the rich text view"""
env = Environment()
env.loader = FileSystemLoader(osp.join(CONFDIR_PATH, 'templates'))
warning = env.get_template("warning.html")
return warning.render(css_path=css_path, text=message) | python | def warning(message, css_path=CSS_PATH):
"""Print a warning message on the rich text view"""
env = Environment()
env.loader = FileSystemLoader(osp.join(CONFDIR_PATH, 'templates'))
warning = env.get_template("warning.html")
return warning.render(css_path=css_path, text=message) | [
"def",
"warning",
"(",
"message",
",",
"css_path",
"=",
"CSS_PATH",
")",
":",
"env",
"=",
"Environment",
"(",
")",
"env",
".",
"loader",
"=",
"FileSystemLoader",
"(",
"osp",
".",
"join",
"(",
"CONFDIR_PATH",
",",
"'templates'",
")",
")",
"warning",
"=",
... | Print a warning message on the rich text view | [
"Print",
"a",
"warning",
"message",
"on",
"the",
"rich",
"text",
"view"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L77-L82 |
31,044 | spyder-ide/spyder | spyder/plugins/help/utils/sphinxify.py | usage | def usage(title, message, tutorial_message, tutorial, css_path=CSS_PATH):
"""Print a usage message on the rich text view"""
env = Environment()
env.loader = FileSystemLoader(osp.join(CONFDIR_PATH, 'templates'))
usage = env.get_template("usage.html")
return usage.render(css_path=css_path, title=title... | python | def usage(title, message, tutorial_message, tutorial, css_path=CSS_PATH):
"""Print a usage message on the rich text view"""
env = Environment()
env.loader = FileSystemLoader(osp.join(CONFDIR_PATH, 'templates'))
usage = env.get_template("usage.html")
return usage.render(css_path=css_path, title=title... | [
"def",
"usage",
"(",
"title",
",",
"message",
",",
"tutorial_message",
",",
"tutorial",
",",
"css_path",
"=",
"CSS_PATH",
")",
":",
"env",
"=",
"Environment",
"(",
")",
"env",
".",
"loader",
"=",
"FileSystemLoader",
"(",
"osp",
".",
"join",
"(",
"CONFDIR... | Print a usage message on the rich text view | [
"Print",
"a",
"usage",
"message",
"on",
"the",
"rich",
"text",
"view"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L85-L91 |
31,045 | spyder-ide/spyder | spyder/plugins/help/utils/sphinxify.py | generate_context | def generate_context(name='', argspec='', note='', math=False, collapse=False,
img_path='', css_path=CSS_PATH):
"""
Generate the html_context dictionary for our Sphinx conf file.
This is a set of variables to be passed to the Jinja template engine and
that are used to control h... | python | def generate_context(name='', argspec='', note='', math=False, collapse=False,
img_path='', css_path=CSS_PATH):
"""
Generate the html_context dictionary for our Sphinx conf file.
This is a set of variables to be passed to the Jinja template engine and
that are used to control h... | [
"def",
"generate_context",
"(",
"name",
"=",
"''",
",",
"argspec",
"=",
"''",
",",
"note",
"=",
"''",
",",
"math",
"=",
"False",
",",
"collapse",
"=",
"False",
",",
"img_path",
"=",
"''",
",",
"css_path",
"=",
"CSS_PATH",
")",
":",
"if",
"img_path",
... | Generate the html_context dictionary for our Sphinx conf file.
This is a set of variables to be passed to the Jinja template engine and
that are used to control how the webpage is rendered in connection with
Sphinx
Parameters
----------
name : str
Object's name.
note : str
... | [
"Generate",
"the",
"html_context",
"dictionary",
"for",
"our",
"Sphinx",
"conf",
"file",
".",
"This",
"is",
"a",
"set",
"of",
"variables",
"to",
"be",
"passed",
"to",
"the",
"Jinja",
"template",
"engine",
"and",
"that",
"are",
"used",
"to",
"control",
"how... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L94-L146 |
31,046 | spyder-ide/spyder | spyder/plugins/help/utils/sphinxify.py | sphinxify | def sphinxify(docstring, context, buildername='html'):
"""
Runs Sphinx on a docstring and outputs the processed documentation.
Parameters
----------
docstring : str
a ReST-formatted docstring
context : dict
Variables to be passed to the layout template to control how its
... | python | def sphinxify(docstring, context, buildername='html'):
"""
Runs Sphinx on a docstring and outputs the processed documentation.
Parameters
----------
docstring : str
a ReST-formatted docstring
context : dict
Variables to be passed to the layout template to control how its
... | [
"def",
"sphinxify",
"(",
"docstring",
",",
"context",
",",
"buildername",
"=",
"'html'",
")",
":",
"srcdir",
"=",
"mkdtemp",
"(",
")",
"srcdir",
"=",
"encoding",
".",
"to_unicode_from_fs",
"(",
"srcdir",
")",
"destdir",
"=",
"osp",
".",
"join",
"(",
"src... | Runs Sphinx on a docstring and outputs the processed documentation.
Parameters
----------
docstring : str
a ReST-formatted docstring
context : dict
Variables to be passed to the layout template to control how its
rendered (through the Sphinx variable *html_context*).
build... | [
"Runs",
"Sphinx",
"on",
"a",
"docstring",
"and",
"outputs",
"the",
"processed",
"documentation",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L149-L239 |
31,047 | spyder-ide/spyder | spyder/plugins/help/utils/sphinxify.py | generate_configuration | def generate_configuration(directory):
"""
Generates a Sphinx configuration in `directory`.
Parameters
----------
directory : str
Base directory to use
"""
# conf.py file for Sphinx
conf = osp.join(get_module_source_path('spyder.plugins.help.utils'),
'co... | python | def generate_configuration(directory):
"""
Generates a Sphinx configuration in `directory`.
Parameters
----------
directory : str
Base directory to use
"""
# conf.py file for Sphinx
conf = osp.join(get_module_source_path('spyder.plugins.help.utils'),
'co... | [
"def",
"generate_configuration",
"(",
"directory",
")",
":",
"# conf.py file for Sphinx",
"conf",
"=",
"osp",
".",
"join",
"(",
"get_module_source_path",
"(",
"'spyder.plugins.help.utils'",
")",
",",
"'conf.py'",
")",
"# Docstring layout page (in Jinja):",
"layout",
"=",
... | Generates a Sphinx configuration in `directory`.
Parameters
----------
directory : str
Base directory to use | [
"Generates",
"a",
"Sphinx",
"configuration",
"in",
"directory",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L242-L264 |
31,048 | spyder-ide/spyder | spyder/plugins/editor/widgets/status.py | EOLStatus.update_eol | def update_eol(self, os_name):
"""Update end of line status."""
os_name = to_text_string(os_name)
value = {"nt": "CRLF", "posix": "LF"}.get(os_name, "CR")
self.set_value(value) | python | def update_eol(self, os_name):
"""Update end of line status."""
os_name = to_text_string(os_name)
value = {"nt": "CRLF", "posix": "LF"}.get(os_name, "CR")
self.set_value(value) | [
"def",
"update_eol",
"(",
"self",
",",
"os_name",
")",
":",
"os_name",
"=",
"to_text_string",
"(",
"os_name",
")",
"value",
"=",
"{",
"\"nt\"",
":",
"\"CRLF\"",
",",
"\"posix\"",
":",
"\"LF\"",
"}",
".",
"get",
"(",
"os_name",
",",
"\"CR\"",
")",
"self... | Update end of line status. | [
"Update",
"end",
"of",
"line",
"status",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L34-L38 |
31,049 | spyder-ide/spyder | spyder/plugins/editor/widgets/status.py | EncodingStatus.update_encoding | def update_encoding(self, encoding):
"""Update encoding of current file."""
value = str(encoding).upper()
self.set_value(value) | python | def update_encoding(self, encoding):
"""Update encoding of current file."""
value = str(encoding).upper()
self.set_value(value) | [
"def",
"update_encoding",
"(",
"self",
",",
"encoding",
")",
":",
"value",
"=",
"str",
"(",
"encoding",
")",
".",
"upper",
"(",
")",
"self",
".",
"set_value",
"(",
"value",
")"
] | Update encoding of current file. | [
"Update",
"encoding",
"of",
"current",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L45-L48 |
31,050 | spyder-ide/spyder | spyder/plugins/editor/widgets/status.py | CursorPositionStatus.update_cursor_position | def update_cursor_position(self, line, index):
"""Update cursor position."""
value = 'Line {}, Col {}'.format(line + 1, index + 1)
self.set_value(value) | python | def update_cursor_position(self, line, index):
"""Update cursor position."""
value = 'Line {}, Col {}'.format(line + 1, index + 1)
self.set_value(value) | [
"def",
"update_cursor_position",
"(",
"self",
",",
"line",
",",
"index",
")",
":",
"value",
"=",
"'Line {}, Col {}'",
".",
"format",
"(",
"line",
"+",
"1",
",",
"index",
"+",
"1",
")",
"self",
".",
"set_value",
"(",
"value",
")"
] | Update cursor position. | [
"Update",
"cursor",
"position",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L55-L58 |
31,051 | spyder-ide/spyder | spyder/plugins/editor/widgets/status.py | VCSStatus.update_vcs | def update_vcs(self, fname, index):
"""Update vcs status."""
fpath = os.path.dirname(fname)
branches, branch, files_modified = get_git_refs(fpath)
text = branch if branch else ''
if len(files_modified):
text = text + ' [{}]'.format(len(files_modified))
self.... | python | def update_vcs(self, fname, index):
"""Update vcs status."""
fpath = os.path.dirname(fname)
branches, branch, files_modified = get_git_refs(fpath)
text = branch if branch else ''
if len(files_modified):
text = text + ' [{}]'.format(len(files_modified))
self.... | [
"def",
"update_vcs",
"(",
"self",
",",
"fname",
",",
"index",
")",
":",
"fpath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fname",
")",
"branches",
",",
"branch",
",",
"files_modified",
"=",
"get_git_refs",
"(",
"fpath",
")",
"text",
"=",
"branch",... | Update vcs status. | [
"Update",
"vcs",
"status",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L73-L83 |
31,052 | spyder-ide/spyder | spyder/plugins/variableexplorer/plugin.py | VariableExplorer.free_memory | def free_memory(self):
"""Free memory signal."""
self.main.free_memory()
QTimer.singleShot(self.INITIAL_FREE_MEMORY_TIME_TRIGGER,
lambda: self.main.free_memory())
QTimer.singleShot(self.SECONDARY_FREE_MEMORY_TIME_TRIGGER,
lambda: ... | python | def free_memory(self):
"""Free memory signal."""
self.main.free_memory()
QTimer.singleShot(self.INITIAL_FREE_MEMORY_TIME_TRIGGER,
lambda: self.main.free_memory())
QTimer.singleShot(self.SECONDARY_FREE_MEMORY_TIME_TRIGGER,
lambda: ... | [
"def",
"free_memory",
"(",
"self",
")",
":",
"self",
".",
"main",
".",
"free_memory",
"(",
")",
"QTimer",
".",
"singleShot",
"(",
"self",
".",
"INITIAL_FREE_MEMORY_TIME_TRIGGER",
",",
"lambda",
":",
"self",
".",
"main",
".",
"free_memory",
"(",
")",
")",
... | Free memory signal. | [
"Free",
"memory",
"signal",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L96-L102 |
31,053 | spyder-ide/spyder | spyder/plugins/variableexplorer/plugin.py | VariableExplorer.add_shellwidget | def add_shellwidget(self, shellwidget):
"""
Register shell with variable explorer.
This function opens a new NamespaceBrowser for browsing the variables
in the shell.
"""
shellwidget_id = id(shellwidget)
if shellwidget_id not in self.shellwidgets:
... | python | def add_shellwidget(self, shellwidget):
"""
Register shell with variable explorer.
This function opens a new NamespaceBrowser for browsing the variables
in the shell.
"""
shellwidget_id = id(shellwidget)
if shellwidget_id not in self.shellwidgets:
... | [
"def",
"add_shellwidget",
"(",
"self",
",",
"shellwidget",
")",
":",
"shellwidget_id",
"=",
"id",
"(",
"shellwidget",
")",
"if",
"shellwidget_id",
"not",
"in",
"self",
".",
"shellwidgets",
":",
"self",
".",
"options_button",
".",
"setVisible",
"(",
"True",
"... | Register shell with variable explorer.
This function opens a new NamespaceBrowser for browsing the variables
in the shell. | [
"Register",
"shell",
"with",
"variable",
"explorer",
".",
"This",
"function",
"opens",
"a",
"new",
"NamespaceBrowser",
"for",
"browsing",
"the",
"variables",
"in",
"the",
"shell",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L125-L143 |
31,054 | spyder-ide/spyder | spyder/plugins/variableexplorer/plugin.py | VariableExplorer.import_data | def import_data(self, fname):
"""Import data in current namespace"""
if self.count():
nsb = self.current_widget()
nsb.refresh_table()
nsb.import_data(filenames=fname)
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVi... | python | def import_data(self, fname):
"""Import data in current namespace"""
if self.count():
nsb = self.current_widget()
nsb.refresh_table()
nsb.import_data(filenames=fname)
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVi... | [
"def",
"import_data",
"(",
"self",
",",
"fname",
")",
":",
"if",
"self",
".",
"count",
"(",
")",
":",
"nsb",
"=",
"self",
".",
"current_widget",
"(",
")",
"nsb",
".",
"refresh_table",
"(",
")",
"nsb",
".",
"import_data",
"(",
"filenames",
"=",
"fname... | Import data in current namespace | [
"Import",
"data",
"in",
"current",
"namespace"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L158-L166 |
31,055 | spyder-ide/spyder | spyder/plugins/help/widgets.py | ObjectComboBox.validate | def validate(self, qstr, editing=True):
"""Reimplemented to avoid formatting actions"""
valid = self.is_valid(qstr)
if self.hasFocus() and valid is not None:
if editing and not valid:
# Combo box text is being modified: invalidate the entry
self.show_t... | python | def validate(self, qstr, editing=True):
"""Reimplemented to avoid formatting actions"""
valid = self.is_valid(qstr)
if self.hasFocus() and valid is not None:
if editing and not valid:
# Combo box text is being modified: invalidate the entry
self.show_t... | [
"def",
"validate",
"(",
"self",
",",
"qstr",
",",
"editing",
"=",
"True",
")",
":",
"valid",
"=",
"self",
".",
"is_valid",
"(",
"qstr",
")",
"if",
"self",
".",
"hasFocus",
"(",
")",
"and",
"valid",
"is",
"not",
"None",
":",
"if",
"editing",
"and",
... | Reimplemented to avoid formatting actions | [
"Reimplemented",
"to",
"avoid",
"formatting",
"actions"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/widgets.py#L78-L91 |
31,056 | spyder-ide/spyder | spyder/utils/codeanalysis.py | check_with_pyflakes | def check_with_pyflakes(source_code, filename=None):
"""Check source code with pyflakes
Returns an empty list if pyflakes is not installed"""
try:
if filename is None:
filename = '<string>'
try:
source_code += '\n'
except TypeError:
# Pyth... | python | def check_with_pyflakes(source_code, filename=None):
"""Check source code with pyflakes
Returns an empty list if pyflakes is not installed"""
try:
if filename is None:
filename = '<string>'
try:
source_code += '\n'
except TypeError:
# Pyth... | [
"def",
"check_with_pyflakes",
"(",
"source_code",
",",
"filename",
"=",
"None",
")",
":",
"try",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"'<string>'",
"try",
":",
"source_code",
"+=",
"'\\n'",
"except",
"TypeError",
":",
"# Python 3\r",
"s... | Check source code with pyflakes
Returns an empty list if pyflakes is not installed | [
"Check",
"source",
"code",
"with",
"pyflakes",
"Returns",
"an",
"empty",
"list",
"if",
"pyflakes",
"is",
"not",
"installed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L41-L88 |
31,057 | spyder-ide/spyder | spyder/utils/codeanalysis.py | get_checker_executable | def get_checker_executable(name):
"""Return checker executable in the form of a list of arguments
for subprocess.Popen"""
if programs.is_program_installed(name):
# Checker is properly installed
return [name]
else:
path1 = programs.python_script_exists(package=None,
... | python | def get_checker_executable(name):
"""Return checker executable in the form of a list of arguments
for subprocess.Popen"""
if programs.is_program_installed(name):
# Checker is properly installed
return [name]
else:
path1 = programs.python_script_exists(package=None,
... | [
"def",
"get_checker_executable",
"(",
"name",
")",
":",
"if",
"programs",
".",
"is_program_installed",
"(",
"name",
")",
":",
"# Checker is properly installed\r",
"return",
"[",
"name",
"]",
"else",
":",
"path1",
"=",
"programs",
".",
"python_script_exists",
"(",
... | Return checker executable in the form of a list of arguments
for subprocess.Popen | [
"Return",
"checker",
"executable",
"in",
"the",
"form",
"of",
"a",
"list",
"of",
"arguments",
"for",
"subprocess",
".",
"Popen"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L96-L113 |
31,058 | spyder-ide/spyder | spyder/utils/codeanalysis.py | check_with_pep8 | def check_with_pep8(source_code, filename=None):
"""Check source code with pycodestyle"""
try:
args = get_checker_executable('pycodestyle')
results = check(args, source_code, filename=filename, options=['-r'])
except Exception:
# Never return None to avoid lock in spyder/widget... | python | def check_with_pep8(source_code, filename=None):
"""Check source code with pycodestyle"""
try:
args = get_checker_executable('pycodestyle')
results = check(args, source_code, filename=filename, options=['-r'])
except Exception:
# Never return None to avoid lock in spyder/widget... | [
"def",
"check_with_pep8",
"(",
"source_code",
",",
"filename",
"=",
"None",
")",
":",
"try",
":",
"args",
"=",
"get_checker_executable",
"(",
"'pycodestyle'",
")",
"results",
"=",
"check",
"(",
"args",
",",
"source_code",
",",
"filename",
"=",
"filename",
",... | Check source code with pycodestyle | [
"Check",
"source",
"code",
"with",
"pycodestyle"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L164-L175 |
31,059 | spyder-ide/spyder | spyder/utils/qthelpers.py | get_image_label | def get_image_label(name, default="not_found.png"):
"""Return image inside a QLabel object"""
label = QLabel()
label.setPixmap(QPixmap(get_image_path(name, default)))
return label | python | def get_image_label(name, default="not_found.png"):
"""Return image inside a QLabel object"""
label = QLabel()
label.setPixmap(QPixmap(get_image_path(name, default)))
return label | [
"def",
"get_image_label",
"(",
"name",
",",
"default",
"=",
"\"not_found.png\"",
")",
":",
"label",
"=",
"QLabel",
"(",
")",
"label",
".",
"setPixmap",
"(",
"QPixmap",
"(",
"get_image_path",
"(",
"name",
",",
"default",
")",
")",
")",
"return",
"label"
] | Return image inside a QLabel object | [
"Return",
"image",
"inside",
"a",
"QLabel",
"object"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L44-L48 |
31,060 | spyder-ide/spyder | spyder/utils/qthelpers.py | file_uri | def file_uri(fname):
"""Select the right file uri scheme according to the operating system"""
if os.name == 'nt':
# Local file
if re.search(r'^[a-zA-Z]:', fname):
return 'file:///' + fname
# UNC based path
else:
return 'file://' + fname
else:
... | python | def file_uri(fname):
"""Select the right file uri scheme according to the operating system"""
if os.name == 'nt':
# Local file
if re.search(r'^[a-zA-Z]:', fname):
return 'file:///' + fname
# UNC based path
else:
return 'file://' + fname
else:
... | [
"def",
"file_uri",
"(",
"fname",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"# Local file\r",
"if",
"re",
".",
"search",
"(",
"r'^[a-zA-Z]:'",
",",
"fname",
")",
":",
"return",
"'file:///'",
"+",
"fname",
"# UNC based path\r",
"else",
":",
"re... | Select the right file uri scheme according to the operating system | [
"Select",
"the",
"right",
"file",
"uri",
"scheme",
"according",
"to",
"the",
"operating",
"system"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L97-L107 |
31,061 | spyder-ide/spyder | spyder/utils/qthelpers.py | install_translator | def install_translator(qapp):
"""Install Qt translator to the QApplication instance"""
global QT_TRANSLATOR
if QT_TRANSLATOR is None:
qt_translator = QTranslator()
if qt_translator.load("qt_"+QLocale.system().name(),
QLibraryInfo.location(QLibraryInfo.Translations... | python | def install_translator(qapp):
"""Install Qt translator to the QApplication instance"""
global QT_TRANSLATOR
if QT_TRANSLATOR is None:
qt_translator = QTranslator()
if qt_translator.load("qt_"+QLocale.system().name(),
QLibraryInfo.location(QLibraryInfo.Translations... | [
"def",
"install_translator",
"(",
"qapp",
")",
":",
"global",
"QT_TRANSLATOR",
"if",
"QT_TRANSLATOR",
"is",
"None",
":",
"qt_translator",
"=",
"QTranslator",
"(",
")",
"if",
"qt_translator",
".",
"load",
"(",
"\"qt_\"",
"+",
"QLocale",
".",
"system",
"(",
")... | Install Qt translator to the QApplication instance | [
"Install",
"Qt",
"translator",
"to",
"the",
"QApplication",
"instance"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L111-L120 |
31,062 | spyder-ide/spyder | spyder/utils/qthelpers.py | keyevent2tuple | def keyevent2tuple(event):
"""Convert QKeyEvent instance into a tuple"""
return (event.type(), event.key(), event.modifiers(), event.text(),
event.isAutoRepeat(), event.count()) | python | def keyevent2tuple(event):
"""Convert QKeyEvent instance into a tuple"""
return (event.type(), event.key(), event.modifiers(), event.text(),
event.isAutoRepeat(), event.count()) | [
"def",
"keyevent2tuple",
"(",
"event",
")",
":",
"return",
"(",
"event",
".",
"type",
"(",
")",
",",
"event",
".",
"key",
"(",
")",
",",
"event",
".",
"modifiers",
"(",
")",
",",
"event",
".",
"text",
"(",
")",
",",
"event",
".",
"isAutoRepeat",
... | Convert QKeyEvent instance into a tuple | [
"Convert",
"QKeyEvent",
"instance",
"into",
"a",
"tuple"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L166-L169 |
31,063 | spyder-ide/spyder | spyder/utils/qthelpers.py | create_toolbutton | def create_toolbutton(parent, text=None, shortcut=None, icon=None, tip=None,
toggled=None, triggered=None,
autoraise=True, text_beside_icon=False):
"""Create a QToolButton"""
button = QToolButton(parent)
if text is not None:
button.setText(text)
... | python | def create_toolbutton(parent, text=None, shortcut=None, icon=None, tip=None,
toggled=None, triggered=None,
autoraise=True, text_beside_icon=False):
"""Create a QToolButton"""
button = QToolButton(parent)
if text is not None:
button.setText(text)
... | [
"def",
"create_toolbutton",
"(",
"parent",
",",
"text",
"=",
"None",
",",
"shortcut",
"=",
"None",
",",
"icon",
"=",
"None",
",",
"tip",
"=",
"None",
",",
"toggled",
"=",
"None",
",",
"triggered",
"=",
"None",
",",
"autoraise",
"=",
"True",
",",
"tex... | Create a QToolButton | [
"Create",
"a",
"QToolButton"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L190-L213 |
31,064 | spyder-ide/spyder | spyder/utils/qthelpers.py | action2button | def action2button(action, autoraise=True, text_beside_icon=False, parent=None):
"""Create a QToolButton directly from a QAction object"""
if parent is None:
parent = action.parent()
button = QToolButton(parent)
button.setDefaultAction(action)
button.setAutoRaise(autoraise)
if text... | python | def action2button(action, autoraise=True, text_beside_icon=False, parent=None):
"""Create a QToolButton directly from a QAction object"""
if parent is None:
parent = action.parent()
button = QToolButton(parent)
button.setDefaultAction(action)
button.setAutoRaise(autoraise)
if text... | [
"def",
"action2button",
"(",
"action",
",",
"autoraise",
"=",
"True",
",",
"text_beside_icon",
"=",
"False",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"None",
":",
"parent",
"=",
"action",
".",
"parent",
"(",
")",
"button",
"=",
"QToo... | Create a QToolButton directly from a QAction object | [
"Create",
"a",
"QToolButton",
"directly",
"from",
"a",
"QAction",
"object"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L216-L225 |
31,065 | spyder-ide/spyder | spyder/utils/qthelpers.py | add_shortcut_to_tooltip | def add_shortcut_to_tooltip(action, context, name):
"""Add the shortcut associated with a given action to its tooltip"""
action.setToolTip(action.toolTip() + ' (%s)' %
get_shortcut(context=context, name=name)) | python | def add_shortcut_to_tooltip(action, context, name):
"""Add the shortcut associated with a given action to its tooltip"""
action.setToolTip(action.toolTip() + ' (%s)' %
get_shortcut(context=context, name=name)) | [
"def",
"add_shortcut_to_tooltip",
"(",
"action",
",",
"context",
",",
"name",
")",
":",
"action",
".",
"setToolTip",
"(",
"action",
".",
"toolTip",
"(",
")",
"+",
"' (%s)'",
"%",
"get_shortcut",
"(",
"context",
"=",
"context",
",",
"name",
"=",
"name",
"... | Add the shortcut associated with a given action to its tooltip | [
"Add",
"the",
"shortcut",
"associated",
"with",
"a",
"given",
"action",
"to",
"its",
"tooltip"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L281-L284 |
31,066 | spyder-ide/spyder | spyder/utils/qthelpers.py | add_actions | def add_actions(target, actions, insert_before=None):
"""Add actions to a QMenu or a QToolBar."""
previous_action = None
target_actions = list(target.actions())
if target_actions:
previous_action = target_actions[-1]
if previous_action.isSeparator():
previous_action = ... | python | def add_actions(target, actions, insert_before=None):
"""Add actions to a QMenu or a QToolBar."""
previous_action = None
target_actions = list(target.actions())
if target_actions:
previous_action = target_actions[-1]
if previous_action.isSeparator():
previous_action = ... | [
"def",
"add_actions",
"(",
"target",
",",
"actions",
",",
"insert_before",
"=",
"None",
")",
":",
"previous_action",
"=",
"None",
"target_actions",
"=",
"list",
"(",
"target",
".",
"actions",
"(",
")",
")",
"if",
"target_actions",
":",
"previous_action",
"="... | Add actions to a QMenu or a QToolBar. | [
"Add",
"actions",
"to",
"a",
"QMenu",
"or",
"a",
"QToolBar",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L287-L322 |
31,067 | spyder-ide/spyder | spyder/utils/qthelpers.py | create_bookmark_action | def create_bookmark_action(parent, url, title, icon=None, shortcut=None):
"""Create bookmark action"""
@Slot()
def open_url():
return programs.start_file(url)
return create_action( parent, title, shortcut=shortcut, icon=icon,
triggered=open_url) | python | def create_bookmark_action(parent, url, title, icon=None, shortcut=None):
"""Create bookmark action"""
@Slot()
def open_url():
return programs.start_file(url)
return create_action( parent, title, shortcut=shortcut, icon=icon,
triggered=open_url) | [
"def",
"create_bookmark_action",
"(",
"parent",
",",
"url",
",",
"title",
",",
"icon",
"=",
"None",
",",
"shortcut",
"=",
"None",
")",
":",
"@",
"Slot",
"(",
")",
"def",
"open_url",
"(",
")",
":",
"return",
"programs",
".",
"start_file",
"(",
"url",
... | Create bookmark action | [
"Create",
"bookmark",
"action"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L335-L343 |
31,068 | spyder-ide/spyder | spyder/utils/qthelpers.py | create_program_action | def create_program_action(parent, text, name, icon=None, nt_name=None):
"""Create action to run a program"""
if is_text_string(icon):
icon = get_icon(icon)
if os.name == 'nt' and nt_name is not None:
name = nt_name
path = programs.find_program(name)
if path is not None:
... | python | def create_program_action(parent, text, name, icon=None, nt_name=None):
"""Create action to run a program"""
if is_text_string(icon):
icon = get_icon(icon)
if os.name == 'nt' and nt_name is not None:
name = nt_name
path = programs.find_program(name)
if path is not None:
... | [
"def",
"create_program_action",
"(",
"parent",
",",
"text",
",",
"name",
",",
"icon",
"=",
"None",
",",
"nt_name",
"=",
"None",
")",
":",
"if",
"is_text_string",
"(",
"icon",
")",
":",
"icon",
"=",
"get_icon",
"(",
"icon",
")",
"if",
"os",
".",
"name... | Create action to run a program | [
"Create",
"action",
"to",
"run",
"a",
"program"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L365-L374 |
31,069 | spyder-ide/spyder | spyder/utils/qthelpers.py | create_python_script_action | def create_python_script_action(parent, text, icon, package, module, args=[]):
"""Create action to run a GUI based Python script"""
if is_text_string(icon):
icon = get_icon(icon)
if programs.python_script_exists(package, module):
return create_action(parent, text, icon=icon,
... | python | def create_python_script_action(parent, text, icon, package, module, args=[]):
"""Create action to run a GUI based Python script"""
if is_text_string(icon):
icon = get_icon(icon)
if programs.python_script_exists(package, module):
return create_action(parent, text, icon=icon,
... | [
"def",
"create_python_script_action",
"(",
"parent",
",",
"text",
",",
"icon",
",",
"package",
",",
"module",
",",
"args",
"=",
"[",
"]",
")",
":",
"if",
"is_text_string",
"(",
"icon",
")",
":",
"icon",
"=",
"get_icon",
"(",
"icon",
")",
"if",
"program... | Create action to run a GUI based Python script | [
"Create",
"action",
"to",
"run",
"a",
"GUI",
"based",
"Python",
"script"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L377-L384 |
31,070 | spyder-ide/spyder | spyder/utils/qthelpers.py | get_filetype_icon | def get_filetype_icon(fname):
"""Return file type icon"""
ext = osp.splitext(fname)[1]
if ext.startswith('.'):
ext = ext[1:]
return get_icon( "%s.png" % ext, ima.icon('FileIcon') ) | python | def get_filetype_icon(fname):
"""Return file type icon"""
ext = osp.splitext(fname)[1]
if ext.startswith('.'):
ext = ext[1:]
return get_icon( "%s.png" % ext, ima.icon('FileIcon') ) | [
"def",
"get_filetype_icon",
"(",
"fname",
")",
":",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
"if",
"ext",
".",
"startswith",
"(",
"'.'",
")",
":",
"ext",
"=",
"ext",
"[",
"1",
":",
"]",
"return",
"get_icon",
"(",
"\"%... | Return file type icon | [
"Return",
"file",
"type",
"icon"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L423-L428 |
31,071 | spyder-ide/spyder | spyder/utils/qthelpers.py | show_std_icons | def show_std_icons():
"""
Show all standard Icons
"""
app = qapplication()
dialog = ShowStdIcons(None)
dialog.show()
sys.exit(app.exec_()) | python | def show_std_icons():
"""
Show all standard Icons
"""
app = qapplication()
dialog = ShowStdIcons(None)
dialog.show()
sys.exit(app.exec_()) | [
"def",
"show_std_icons",
"(",
")",
":",
"app",
"=",
"qapplication",
"(",
")",
"dialog",
"=",
"ShowStdIcons",
"(",
"None",
")",
"dialog",
".",
"show",
"(",
")",
"sys",
".",
"exit",
"(",
"app",
".",
"exec_",
"(",
")",
")"
] | Show all standard Icons | [
"Show",
"all",
"standard",
"Icons"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L501-L508 |
31,072 | spyder-ide/spyder | spyder/utils/qthelpers.py | DialogManager.show | def show(self, dialog):
"""Generic method to show a non-modal dialog and keep reference
to the Qt C++ object"""
for dlg in list(self.dialogs.values()):
if to_text_string(dlg.windowTitle()) \
== to_text_string(dialog.windowTitle()):
dlg.show()
... | python | def show(self, dialog):
"""Generic method to show a non-modal dialog and keep reference
to the Qt C++ object"""
for dlg in list(self.dialogs.values()):
if to_text_string(dlg.windowTitle()) \
== to_text_string(dialog.windowTitle()):
dlg.show()
... | [
"def",
"show",
"(",
"self",
",",
"dialog",
")",
":",
"for",
"dlg",
"in",
"list",
"(",
"self",
".",
"dialogs",
".",
"values",
"(",
")",
")",
":",
"if",
"to_text_string",
"(",
"dlg",
".",
"windowTitle",
"(",
")",
")",
"==",
"to_text_string",
"(",
"di... | Generic method to show a non-modal dialog and keep reference
to the Qt C++ object | [
"Generic",
"method",
"to",
"show",
"a",
"non",
"-",
"modal",
"dialog",
"and",
"keep",
"reference",
"to",
"the",
"Qt",
"C",
"++",
"object"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L396-L411 |
31,073 | spyder-ide/spyder | spyder/dependencies.py | add | def add(modname, features, required_version, installed_version=None,
optional=False):
"""Add Spyder dependency"""
global DEPENDENCIES
for dependency in DEPENDENCIES:
if dependency.modname == modname:
raise ValueError("Dependency has already been registered: %s"\
... | python | def add(modname, features, required_version, installed_version=None,
optional=False):
"""Add Spyder dependency"""
global DEPENDENCIES
for dependency in DEPENDENCIES:
if dependency.modname == modname:
raise ValueError("Dependency has already been registered: %s"\
... | [
"def",
"add",
"(",
"modname",
",",
"features",
",",
"required_version",
",",
"installed_version",
"=",
"None",
",",
"optional",
"=",
"False",
")",
":",
"global",
"DEPENDENCIES",
"for",
"dependency",
"in",
"DEPENDENCIES",
":",
"if",
"dependency",
".",
"modname"... | Add Spyder dependency | [
"Add",
"Spyder",
"dependency"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L66-L75 |
31,074 | spyder-ide/spyder | spyder/dependencies.py | check | def check(modname):
"""Check if required dependency is installed"""
for dependency in DEPENDENCIES:
if dependency.modname == modname:
return dependency.check()
else:
raise RuntimeError("Unkwown dependency %s" % modname) | python | def check(modname):
"""Check if required dependency is installed"""
for dependency in DEPENDENCIES:
if dependency.modname == modname:
return dependency.check()
else:
raise RuntimeError("Unkwown dependency %s" % modname) | [
"def",
"check",
"(",
"modname",
")",
":",
"for",
"dependency",
"in",
"DEPENDENCIES",
":",
"if",
"dependency",
".",
"modname",
"==",
"modname",
":",
"return",
"dependency",
".",
"check",
"(",
")",
"else",
":",
"raise",
"RuntimeError",
"(",
"\"Unkwown dependen... | Check if required dependency is installed | [
"Check",
"if",
"required",
"dependency",
"is",
"installed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L78-L84 |
31,075 | spyder-ide/spyder | spyder/dependencies.py | status | def status(deps=DEPENDENCIES, linesep=os.linesep):
"""Return a status of dependencies"""
maxwidth = 0
col1 = []
col2 = []
for dependency in deps:
title1 = dependency.modname
title1 += ' ' + dependency.required_version
col1.append(title1)
maxwidth = max([maxwi... | python | def status(deps=DEPENDENCIES, linesep=os.linesep):
"""Return a status of dependencies"""
maxwidth = 0
col1 = []
col2 = []
for dependency in deps:
title1 = dependency.modname
title1 += ' ' + dependency.required_version
col1.append(title1)
maxwidth = max([maxwi... | [
"def",
"status",
"(",
"deps",
"=",
"DEPENDENCIES",
",",
"linesep",
"=",
"os",
".",
"linesep",
")",
":",
"maxwidth",
"=",
"0",
"col1",
"=",
"[",
"]",
"col2",
"=",
"[",
"]",
"for",
"dependency",
"in",
"deps",
":",
"title1",
"=",
"dependency",
".",
"m... | Return a status of dependencies | [
"Return",
"a",
"status",
"of",
"dependencies"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L87-L101 |
31,076 | spyder-ide/spyder | spyder/dependencies.py | Dependency.check | def check(self):
"""Check if dependency is installed"""
return programs.is_module_installed(self.modname,
self.required_version,
self.installed_version) | python | def check(self):
"""Check if dependency is installed"""
return programs.is_module_installed(self.modname,
self.required_version,
self.installed_version) | [
"def",
"check",
"(",
"self",
")",
":",
"return",
"programs",
".",
"is_module_installed",
"(",
"self",
".",
"modname",
",",
"self",
".",
"required_version",
",",
"self",
".",
"installed_version",
")"
] | Check if dependency is installed | [
"Check",
"if",
"dependency",
"is",
"installed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L42-L46 |
31,077 | spyder-ide/spyder | spyder/otherplugins.py | get_spyderplugins_mods | def get_spyderplugins_mods(io=False):
"""Import modules from plugins package and return the list"""
# Create user directory
user_plugin_path = osp.join(get_conf_path(), USER_PLUGIN_DIR)
if not osp.isdir(user_plugin_path):
os.makedirs(user_plugin_path)
modlist, modnames = [], []
... | python | def get_spyderplugins_mods(io=False):
"""Import modules from plugins package and return the list"""
# Create user directory
user_plugin_path = osp.join(get_conf_path(), USER_PLUGIN_DIR)
if not osp.isdir(user_plugin_path):
os.makedirs(user_plugin_path)
modlist, modnames = [], []
... | [
"def",
"get_spyderplugins_mods",
"(",
"io",
"=",
"False",
")",
":",
"# Create user directory\r",
"user_plugin_path",
"=",
"osp",
".",
"join",
"(",
"get_conf_path",
"(",
")",
",",
"USER_PLUGIN_DIR",
")",
"if",
"not",
"osp",
".",
"isdir",
"(",
"user_plugin_path",
... | Import modules from plugins package and return the list | [
"Import",
"modules",
"from",
"plugins",
"package",
"and",
"return",
"the",
"list"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L31-L43 |
31,078 | spyder-ide/spyder | spyder/otherplugins.py | _get_spyderplugins | def _get_spyderplugins(plugin_path, is_io, modnames, modlist):
"""Scan the directory `plugin_path` for plugin packages and loads them."""
if not osp.isdir(plugin_path):
return
for name in os.listdir(plugin_path):
# This is needed in order to register the spyder_io_hdf5 plugin.
... | python | def _get_spyderplugins(plugin_path, is_io, modnames, modlist):
"""Scan the directory `plugin_path` for plugin packages and loads them."""
if not osp.isdir(plugin_path):
return
for name in os.listdir(plugin_path):
# This is needed in order to register the spyder_io_hdf5 plugin.
... | [
"def",
"_get_spyderplugins",
"(",
"plugin_path",
",",
"is_io",
",",
"modnames",
",",
"modlist",
")",
":",
"if",
"not",
"osp",
".",
"isdir",
"(",
"plugin_path",
")",
":",
"return",
"for",
"name",
"in",
"os",
".",
"listdir",
"(",
"plugin_path",
")",
":",
... | Scan the directory `plugin_path` for plugin packages and loads them. | [
"Scan",
"the",
"directory",
"plugin_path",
"for",
"plugin",
"packages",
"and",
"loads",
"them",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L46-L69 |
31,079 | spyder-ide/spyder | spyder/otherplugins.py | _import_plugin | def _import_plugin(module_name, plugin_path, modnames, modlist):
"""Import the plugin `module_name` from `plugin_path`, add it to `modlist`
and adds its name to `modnames`.
"""
if module_name in modnames:
return
try:
# First add a mock module with the LOCALEPATH attribute so t... | python | def _import_plugin(module_name, plugin_path, modnames, modlist):
"""Import the plugin `module_name` from `plugin_path`, add it to `modlist`
and adds its name to `modnames`.
"""
if module_name in modnames:
return
try:
# First add a mock module with the LOCALEPATH attribute so t... | [
"def",
"_import_plugin",
"(",
"module_name",
",",
"plugin_path",
",",
"modnames",
",",
"modlist",
")",
":",
"if",
"module_name",
"in",
"modnames",
":",
"return",
"try",
":",
"# First add a mock module with the LOCALEPATH attribute so that the\r",
"# helper method can find t... | Import the plugin `module_name` from `plugin_path`, add it to `modlist`
and adds its name to `modnames`. | [
"Import",
"the",
"plugin",
"module_name",
"from",
"plugin_path",
"add",
"it",
"to",
"modlist",
"and",
"adds",
"its",
"name",
"to",
"modnames",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L72-L98 |
31,080 | spyder-ide/spyder | spyder/otherplugins.py | _import_module_from_path | def _import_module_from_path(module_name, plugin_path):
"""Imports `module_name` from `plugin_path`.
Return None if no module is found.
"""
module = None
try:
if PY2:
info = imp.find_module(module_name, [plugin_path])
if info:
module = imp.l... | python | def _import_module_from_path(module_name, plugin_path):
"""Imports `module_name` from `plugin_path`.
Return None if no module is found.
"""
module = None
try:
if PY2:
info = imp.find_module(module_name, [plugin_path])
if info:
module = imp.l... | [
"def",
"_import_module_from_path",
"(",
"module_name",
",",
"plugin_path",
")",
":",
"module",
"=",
"None",
"try",
":",
"if",
"PY2",
":",
"info",
"=",
"imp",
".",
"find_module",
"(",
"module_name",
",",
"[",
"plugin_path",
"]",
")",
"if",
"info",
":",
"m... | Imports `module_name` from `plugin_path`.
Return None if no module is found. | [
"Imports",
"module_name",
"from",
"plugin_path",
".",
"Return",
"None",
"if",
"no",
"module",
"is",
"found",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L101-L121 |
31,081 | spyder-ide/spyder | spyder/utils/icon_manager.py | get_icon | def get_icon(name, default=None, resample=False):
"""Return image inside a QIcon object.
default: default image name or icon
resample: if True, manually resample icon pixmaps for usual sizes
(16, 24, 32, 48, 96, 128, 256). This is recommended for QMainWindow icons
created from SVG images on non-Win... | python | def get_icon(name, default=None, resample=False):
"""Return image inside a QIcon object.
default: default image name or icon
resample: if True, manually resample icon pixmaps for usual sizes
(16, 24, 32, 48, 96, 128, 256). This is recommended for QMainWindow icons
created from SVG images on non-Win... | [
"def",
"get_icon",
"(",
"name",
",",
"default",
"=",
"None",
",",
"resample",
"=",
"False",
")",
":",
"icon_path",
"=",
"get_image_path",
"(",
"name",
",",
"default",
"=",
"None",
")",
"if",
"icon_path",
"is",
"not",
"None",
":",
"icon",
"=",
"QIcon",
... | Return image inside a QIcon object.
default: default image name or icon
resample: if True, manually resample icon pixmaps for usual sizes
(16, 24, 32, 48, 96, 128, 256). This is recommended for QMainWindow icons
created from SVG images on non-Windows platforms due to a Qt bug (see
Issue 1314). | [
"Return",
"image",
"inside",
"a",
"QIcon",
"object",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/icon_manager.py#L358-L386 |
31,082 | spyder-ide/spyder | spyder/utils/icon_manager.py | get_icon_by_extension | def get_icon_by_extension(fname, scale_factor):
"""Return the icon depending on the file extension"""
application_icons = {}
application_icons.update(BIN_FILES)
application_icons.update(DOCUMENT_FILES)
if osp.isdir(fname):
return icon('DirOpenIcon', scale_factor)
else:
basename =... | python | def get_icon_by_extension(fname, scale_factor):
"""Return the icon depending on the file extension"""
application_icons = {}
application_icons.update(BIN_FILES)
application_icons.update(DOCUMENT_FILES)
if osp.isdir(fname):
return icon('DirOpenIcon', scale_factor)
else:
basename =... | [
"def",
"get_icon_by_extension",
"(",
"fname",
",",
"scale_factor",
")",
":",
"application_icons",
"=",
"{",
"}",
"application_icons",
".",
"update",
"(",
"BIN_FILES",
")",
"application_icons",
".",
"update",
"(",
"DOCUMENT_FILES",
")",
"if",
"osp",
".",
"isdir",... | Return the icon depending on the file extension | [
"Return",
"the",
"icon",
"depending",
"on",
"the",
"file",
"extension"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/icon_manager.py#L409-L459 |
31,083 | spyder-ide/spyder | spyder/plugins/editor/widgets/autosaveerror.py | AutosaveErrorDialog.accept | def accept(self):
"""
Update `show_errors` and hide dialog box.
Overrides method of `QDialogBox`.
"""
AutosaveErrorDialog.show_errors = not self.dismiss_box.isChecked()
return QDialog.accept(self) | python | def accept(self):
"""
Update `show_errors` and hide dialog box.
Overrides method of `QDialogBox`.
"""
AutosaveErrorDialog.show_errors = not self.dismiss_box.isChecked()
return QDialog.accept(self) | [
"def",
"accept",
"(",
"self",
")",
":",
"AutosaveErrorDialog",
".",
"show_errors",
"=",
"not",
"self",
".",
"dismiss_box",
".",
"isChecked",
"(",
")",
"return",
"QDialog",
".",
"accept",
"(",
"self",
")"
] | Update `show_errors` and hide dialog box.
Overrides method of `QDialogBox`. | [
"Update",
"show_errors",
"and",
"hide",
"dialog",
"box",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/autosaveerror.py#L78-L85 |
31,084 | spyder-ide/spyder | spyder/widgets/onecolumntree.py | OneColumnTree.get_menu_actions | def get_menu_actions(self):
"""Returns a list of menu actions"""
items = self.selectedItems()
actions = self.get_actions_from_items(items)
if actions:
actions.append(None)
actions += self.common_actions
return actions | python | def get_menu_actions(self):
"""Returns a list of menu actions"""
items = self.selectedItems()
actions = self.get_actions_from_items(items)
if actions:
actions.append(None)
actions += self.common_actions
return actions | [
"def",
"get_menu_actions",
"(",
"self",
")",
":",
"items",
"=",
"self",
".",
"selectedItems",
"(",
")",
"actions",
"=",
"self",
".",
"get_actions_from_items",
"(",
"items",
")",
"if",
"actions",
":",
"actions",
".",
"append",
"(",
"None",
")",
"actions",
... | Returns a list of menu actions | [
"Returns",
"a",
"list",
"of",
"menu",
"actions"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/onecolumntree.py#L76-L83 |
31,085 | spyder-ide/spyder | spyder/widgets/onecolumntree.py | OneColumnTree.item_selection_changed | def item_selection_changed(self):
"""Item selection has changed"""
is_selection = len(self.selectedItems()) > 0
self.expand_selection_action.setEnabled(is_selection)
self.collapse_selection_action.setEnabled(is_selection) | python | def item_selection_changed(self):
"""Item selection has changed"""
is_selection = len(self.selectedItems()) > 0
self.expand_selection_action.setEnabled(is_selection)
self.collapse_selection_action.setEnabled(is_selection) | [
"def",
"item_selection_changed",
"(",
"self",
")",
":",
"is_selection",
"=",
"len",
"(",
"self",
".",
"selectedItems",
"(",
")",
")",
">",
"0",
"self",
".",
"expand_selection_action",
".",
"setEnabled",
"(",
"is_selection",
")",
"self",
".",
"collapse_selectio... | Item selection has changed | [
"Item",
"selection",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/onecolumntree.py#L139-L143 |
31,086 | spyder-ide/spyder | spyder/widgets/onecolumntree.py | OneColumnTree.sort_top_level_items | def sort_top_level_items(self, key):
"""Sorting tree wrt top level items"""
self.save_expanded_state()
items = sorted([self.takeTopLevelItem(0)
for index in range(self.topLevelItemCount())], key=key)
for index, item in enumerate(items):
self.inse... | python | def sort_top_level_items(self, key):
"""Sorting tree wrt top level items"""
self.save_expanded_state()
items = sorted([self.takeTopLevelItem(0)
for index in range(self.topLevelItemCount())], key=key)
for index, item in enumerate(items):
self.inse... | [
"def",
"sort_top_level_items",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"save_expanded_state",
"(",
")",
"items",
"=",
"sorted",
"(",
"[",
"self",
".",
"takeTopLevelItem",
"(",
"0",
")",
"for",
"index",
"in",
"range",
"(",
"self",
".",
"topLevelIt... | Sorting tree wrt top level items | [
"Sorting",
"tree",
"wrt",
"top",
"level",
"items"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/onecolumntree.py#L204-L211 |
31,087 | spyder-ide/spyder | spyder/plugins/editor/api/folding.py | print_tree | def print_tree(editor, file=sys.stdout, print_blocks=False, return_list=False):
"""
Prints the editor fold tree to stdout, for debugging purpose.
:param editor: CodeEditor instance.
:param file: file handle where the tree will be printed. Default is stdout.
:param print_blocks: True to print all bl... | python | def print_tree(editor, file=sys.stdout, print_blocks=False, return_list=False):
"""
Prints the editor fold tree to stdout, for debugging purpose.
:param editor: CodeEditor instance.
:param file: file handle where the tree will be printed. Default is stdout.
:param print_blocks: True to print all bl... | [
"def",
"print_tree",
"(",
"editor",
",",
"file",
"=",
"sys",
".",
"stdout",
",",
"print_blocks",
"=",
"False",
",",
"return_list",
"=",
"False",
")",
":",
"output_list",
"=",
"[",
"]",
"block",
"=",
"editor",
".",
"document",
"(",
")",
".",
"firstBlock... | Prints the editor fold tree to stdout, for debugging purpose.
:param editor: CodeEditor instance.
:param file: file handle where the tree will be printed. Default is stdout.
:param print_blocks: True to print all blocks, False to only print blocks
that are fold triggers | [
"Prints",
"the",
"editor",
"fold",
"tree",
"to",
"stdout",
"for",
"debugging",
"purpose",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/api/folding.py#L29-L63 |
31,088 | spyder-ide/spyder | spyder/utils/environ.py | main | def main():
"""Run Windows environment variable editor"""
from spyder.utils.qthelpers import qapplication
app = qapplication()
if os.name == 'nt':
dialog = WinUserEnvDialog()
else:
dialog = EnvDialog()
dialog.show()
app.exec_() | python | def main():
"""Run Windows environment variable editor"""
from spyder.utils.qthelpers import qapplication
app = qapplication()
if os.name == 'nt':
dialog = WinUserEnvDialog()
else:
dialog = EnvDialog()
dialog.show()
app.exec_() | [
"def",
"main",
"(",
")",
":",
"from",
"spyder",
".",
"utils",
".",
"qthelpers",
"import",
"qapplication",
"app",
"=",
"qapplication",
"(",
")",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"dialog",
"=",
"WinUserEnvDialog",
"(",
")",
"else",
":",
"dialo... | Run Windows environment variable editor | [
"Run",
"Windows",
"environment",
"variable",
"editor"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/environ.py#L141-L150 |
31,089 | spyder-ide/spyder | spyder/widgets/arraybuilder.py | NumpyArrayInline.event | def event(self, event):
"""
Qt override.
This is needed to be able to intercept the Tab key press event.
"""
if event.type() == QEvent.KeyPress:
if (event.key() == Qt.Key_Tab or event.key() == Qt.Key_Space):
text = self.text()
... | python | def event(self, event):
"""
Qt override.
This is needed to be able to intercept the Tab key press event.
"""
if event.type() == QEvent.KeyPress:
if (event.key() == Qt.Key_Tab or event.key() == Qt.Key_Space):
text = self.text()
... | [
"def",
"event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"KeyPress",
":",
"if",
"(",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Tab",
"or",
"event",
".",
"key",
"(",
")",
"==",
... | Qt override.
This is needed to be able to intercept the Tab key press event. | [
"Qt",
"override",
".",
"This",
"is",
"needed",
"to",
"be",
"able",
"to",
"intercept",
"the",
"Tab",
"key",
"press",
"event",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/arraybuilder.py#L59-L79 |
31,090 | spyder-ide/spyder | spyder/widgets/arraybuilder.py | NumpyArrayTable.reset_headers | def reset_headers(self):
"""
Update the column and row numbering in the headers.
"""
rows = self.rowCount()
cols = self.columnCount()
for r in range(rows):
self.setVerticalHeaderItem(r, QTableWidgetItem(str(r)))
for c in range(cols):
... | python | def reset_headers(self):
"""
Update the column and row numbering in the headers.
"""
rows = self.rowCount()
cols = self.columnCount()
for r in range(rows):
self.setVerticalHeaderItem(r, QTableWidgetItem(str(r)))
for c in range(cols):
... | [
"def",
"reset_headers",
"(",
"self",
")",
":",
"rows",
"=",
"self",
".",
"rowCount",
"(",
")",
"cols",
"=",
"self",
".",
"columnCount",
"(",
")",
"for",
"r",
"in",
"range",
"(",
"rows",
")",
":",
"self",
".",
"setVerticalHeaderItem",
"(",
"r",
",",
... | Update the column and row numbering in the headers. | [
"Update",
"the",
"column",
"and",
"row",
"numbering",
"in",
"the",
"headers",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/arraybuilder.py#L124-L135 |
31,091 | spyder-ide/spyder | spyder/widgets/arraybuilder.py | NumpyArrayTable.text | def text(self):
"""
Return the entered array in a parseable form.
"""
text = []
rows = self.rowCount()
cols = self.columnCount()
# handle empty table case
if rows == 2 and cols == 2:
item = self.item(0, 0)
if item is Non... | python | def text(self):
"""
Return the entered array in a parseable form.
"""
text = []
rows = self.rowCount()
cols = self.columnCount()
# handle empty table case
if rows == 2 and cols == 2:
item = self.item(0, 0)
if item is Non... | [
"def",
"text",
"(",
"self",
")",
":",
"text",
"=",
"[",
"]",
"rows",
"=",
"self",
".",
"rowCount",
"(",
")",
"cols",
"=",
"self",
".",
"columnCount",
"(",
")",
"# handle empty table case\r",
"if",
"rows",
"==",
"2",
"and",
"cols",
"==",
"2",
":",
"... | Return the entered array in a parseable form. | [
"Return",
"the",
"entered",
"array",
"in",
"a",
"parseable",
"form",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/arraybuilder.py#L137-L166 |
31,092 | spyder-ide/spyder | spyder/widgets/arraybuilder.py | NumpyArrayDialog.event | def event(self, event):
"""
Qt Override.
Usefull when in line edit mode.
"""
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
return False
return QWidget.event(self, event) | python | def event(self, event):
"""
Qt Override.
Usefull when in line edit mode.
"""
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
return False
return QWidget.event(self, event) | [
"def",
"event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"KeyPress",
"and",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Tab",
":",
"return",
"False",
"return",
"QWidget",
".",
"event",... | Qt Override.
Usefull when in line edit mode. | [
"Qt",
"Override",
".",
"Usefull",
"when",
"in",
"line",
"edit",
"mode",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/arraybuilder.py#L287-L295 |
31,093 | spyder-ide/spyder | spyder/widgets/arraybuilder.py | NumpyArrayDialog.process_text | def process_text(self, array=True):
"""
Construct the text based on the entered content in the widget.
"""
if array:
prefix = 'np.array([['
else:
prefix = 'np.matrix([['
suffix = ']])'
values = self._widget.text().strip()
... | python | def process_text(self, array=True):
"""
Construct the text based on the entered content in the widget.
"""
if array:
prefix = 'np.array([['
else:
prefix = 'np.matrix([['
suffix = ']])'
values = self._widget.text().strip()
... | [
"def",
"process_text",
"(",
"self",
",",
"array",
"=",
"True",
")",
":",
"if",
"array",
":",
"prefix",
"=",
"'np.array([['",
"else",
":",
"prefix",
"=",
"'np.matrix([['",
"suffix",
"=",
"']])'",
"values",
"=",
"self",
".",
"_widget",
".",
"text",
"(",
... | Construct the text based on the entered content in the widget. | [
"Construct",
"the",
"text",
"based",
"on",
"the",
"entered",
"content",
"in",
"the",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/arraybuilder.py#L297-L369 |
31,094 | spyder-ide/spyder | spyder/widgets/arraybuilder.py | NumpyArrayDialog.update_warning | def update_warning(self):
"""
Updates the icon and tip based on the validity of the array content.
"""
widget = self._button_warning
if not self.is_valid():
tip = _('Array dimensions not valid')
widget.setIcon(ima.icon('MessageBoxWarning'))
... | python | def update_warning(self):
"""
Updates the icon and tip based on the validity of the array content.
"""
widget = self._button_warning
if not self.is_valid():
tip = _('Array dimensions not valid')
widget.setIcon(ima.icon('MessageBoxWarning'))
... | [
"def",
"update_warning",
"(",
"self",
")",
":",
"widget",
"=",
"self",
".",
"_button_warning",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"tip",
"=",
"_",
"(",
"'Array dimensions not valid'",
")",
"widget",
".",
"setIcon",
"(",
"ima",
".",
"ico... | Updates the icon and tip based on the validity of the array content. | [
"Updates",
"the",
"icon",
"and",
"tip",
"based",
"on",
"the",
"validity",
"of",
"the",
"array",
"content",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/arraybuilder.py#L371-L382 |
31,095 | spyder-ide/spyder | spyder/preferences/general.py | MainConfigPage._save_lang | def _save_lang(self):
"""
Get selected language setting and save to language configuration file.
"""
for combobox, (option, _default) in list(self.comboboxes.items()):
if option == 'interface_language':
data = combobox.itemData(combobox.currentIndex())
... | python | def _save_lang(self):
"""
Get selected language setting and save to language configuration file.
"""
for combobox, (option, _default) in list(self.comboboxes.items()):
if option == 'interface_language':
data = combobox.itemData(combobox.currentIndex())
... | [
"def",
"_save_lang",
"(",
"self",
")",
":",
"for",
"combobox",
",",
"(",
"option",
",",
"_default",
")",
"in",
"list",
"(",
"self",
".",
"comboboxes",
".",
"items",
"(",
")",
")",
":",
"if",
"option",
"==",
"'interface_language'",
":",
"data",
"=",
"... | Get selected language setting and save to language configuration file. | [
"Get",
"selected",
"language",
"setting",
"and",
"save",
"to",
"language",
"configuration",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/general.py#L262-L281 |
31,096 | spyder-ide/spyder | spyder/plugins/projects/widgets/projectdialog.py | is_writable | def is_writable(path):
"""Check if path has write access"""
try:
testfile = tempfile.TemporaryFile(dir=path)
testfile.close()
except OSError as e:
if e.errno == errno.EACCES: # 13
return False
return True | python | def is_writable(path):
"""Check if path has write access"""
try:
testfile = tempfile.TemporaryFile(dir=path)
testfile.close()
except OSError as e:
if e.errno == errno.EACCES: # 13
return False
return True | [
"def",
"is_writable",
"(",
"path",
")",
":",
"try",
":",
"testfile",
"=",
"tempfile",
".",
"TemporaryFile",
"(",
"dir",
"=",
"path",
")",
"testfile",
".",
"close",
"(",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"errno",
"==",
"errno",... | Check if path has write access | [
"Check",
"if",
"path",
"has",
"write",
"access"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/widgets/projectdialog.py#L35-L43 |
31,097 | spyder-ide/spyder | spyder/plugins/projects/widgets/projectdialog.py | ProjectDialog._get_project_types | def _get_project_types(self):
"""Get all available project types."""
project_types = get_available_project_types()
projects = []
for project in project_types:
projects.append(project.PROJECT_TYPE_NAME)
return projects | python | def _get_project_types(self):
"""Get all available project types."""
project_types = get_available_project_types()
projects = []
for project in project_types:
projects.append(project.PROJECT_TYPE_NAME)
return projects | [
"def",
"_get_project_types",
"(",
"self",
")",
":",
"project_types",
"=",
"get_available_project_types",
"(",
")",
"projects",
"=",
"[",
"]",
"for",
"project",
"in",
"project_types",
":",
"projects",
".",
"append",
"(",
"project",
".",
"PROJECT_TYPE_NAME",
")",
... | Get all available project types. | [
"Get",
"all",
"available",
"project",
"types",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/widgets/projectdialog.py#L143-L151 |
31,098 | spyder-ide/spyder | spyder/plugins/projects/widgets/projectdialog.py | ProjectDialog.select_location | def select_location(self):
"""Select directory."""
location = osp.normpath(getexistingdirectory(self,
_("Select directory"),
self.location))
if location:
if is_writable(l... | python | def select_location(self):
"""Select directory."""
location = osp.normpath(getexistingdirectory(self,
_("Select directory"),
self.location))
if location:
if is_writable(l... | [
"def",
"select_location",
"(",
"self",
")",
":",
"location",
"=",
"osp",
".",
"normpath",
"(",
"getexistingdirectory",
"(",
"self",
",",
"_",
"(",
"\"Select directory\"",
")",
",",
"self",
".",
"location",
")",
")",
"if",
"location",
":",
"if",
"is_writabl... | Select directory. | [
"Select",
"directory",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/widgets/projectdialog.py#L153-L162 |
31,099 | spyder-ide/spyder | spyder/plugins/projects/widgets/projectdialog.py | ProjectDialog.update_location | def update_location(self, text=''):
"""Update text of location."""
self.text_project_name.setEnabled(self.radio_new_dir.isChecked())
name = self.text_project_name.text().strip()
if name and self.radio_new_dir.isChecked():
path = osp.join(self.location, name)
... | python | def update_location(self, text=''):
"""Update text of location."""
self.text_project_name.setEnabled(self.radio_new_dir.isChecked())
name = self.text_project_name.text().strip()
if name and self.radio_new_dir.isChecked():
path = osp.join(self.location, name)
... | [
"def",
"update_location",
"(",
"self",
",",
"text",
"=",
"''",
")",
":",
"self",
".",
"text_project_name",
".",
"setEnabled",
"(",
"self",
".",
"radio_new_dir",
".",
"isChecked",
"(",
")",
")",
"name",
"=",
"self",
".",
"text_project_name",
".",
"text",
... | Update text of location. | [
"Update",
"text",
"of",
"location",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/projects/widgets/projectdialog.py#L164-L179 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.