partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
psutil_phymem_usage
Return physical memory usage (float) Requires the cross-platform psutil (>=v0.3) library (https://github.com/giampaolo/psutil)
spyder/utils/system.py
def psutil_phymem_usage(): """ Return physical memory usage (float) Requires the cross-platform psutil (>=v0.3) library (https://github.com/giampaolo/psutil) """ import psutil # This is needed to avoid a deprecation warning error with # newer psutil versions try: pe...
def psutil_phymem_usage(): """ Return physical memory usage (float) Requires the cross-platform psutil (>=v0.3) library (https://github.com/giampaolo/psutil) """ import psutil # This is needed to avoid a deprecation warning error with # newer psutil versions try: pe...
[ "Return", "physical", "memory", "usage", "(", "float", ")", "Requires", "the", "cross", "-", "platform", "psutil", "(", ">", "=", "v0", ".", "3", ")", "library", "(", "https", ":", "//", "github", ".", "com", "/", "giampaolo", "/", "psutil", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/system.py#L45-L58
[ "def", "psutil_phymem_usage", "(", ")", ":", "import", "psutil", "# This is needed to avoid a deprecation warning error with\r", "# newer psutil versions\r", "try", ":", "percent", "=", "psutil", ".", "virtual_memory", "(", ")", ".", "percent", "except", ":", "percent", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
drift_color
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.
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Return", "color", "that", "is", "lighter", "or", "darker", "than", "the", "base", "color", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L33-L51
[ "def", "drift_color", "(", "base_color", ",", "factor", "=", "110", ")", ":", "base_color", "=", "QColor", "(", "base_color", ")", "if", "base_color", ".", "lightness", "(", ")", ">", "128", ":", "return", "base_color", ".", "darker", "(", "factor", ")",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_block_symbol_data
Gets the list of ParenthesisInfo for specific text block. :param editor: Code editor instance :param block: block to parse
spyder/plugins/editor/utils/editor.py
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): """ 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 ...
[ "Gets", "the", "list", "of", "ParenthesisInfo", "for", "specific", "text", "block", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1035-L1076
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
keep_tc_pos
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
spyder/plugins/editor/utils/editor.py
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): """ 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 = ...
[ "Cache", "text", "cursor", "position", "and", "restore", "it", "when", "the", "wrapped", "function", "exits", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1079-L1100
[ "def", "keep_tc_pos", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "editor", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "\"\"\" Decorator \"\"\"", "sb", "=", "editor", ".", "verticalScrollBar", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
with_wait_cursor
Show a wait cursor while the wrapped function is running. The cursor is restored as soon as the function exits. :param func: wrapped function
spyder/plugins/editor/utils/editor.py
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): """ 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(...
[ "Show", "a", "wait", "cursor", "while", "the", "wrapped", "function", "is", "running", ".", "The", "cursor", "is", "restored", "as", "soon", "as", "the", "function", "exits", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1103-L1119
[ "def", "with_wait_cursor", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "QApplication", ".", "setOverrideCursor", "(", "QCursor", "(", "Qt", ".", "WaitCu...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BlockUserData.is_empty
Return whether the block of user data is empty.
spyder/plugins/editor/utils/editor.py
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 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)
[ "Return", "whether", "the", "block", "of", "user", "data", "is", "empty", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L67-L70
[ "def", "is_empty", "(", "self", ")", ":", "return", "(", "not", "self", ".", "breakpoint", "and", "not", "self", ".", "code_analysis", "and", "not", "self", ".", "todo", "and", "not", "self", ".", "bookmarks", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
DelayJobRunner.request_job
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...
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Request", "a", "job", "execution", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L100-L117
[ "def", "request_job", "(", "self", ",", "job", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "cancel_requests", "(", ")", "self", ".", "_job", "=", "job", "self", ".", "_args", "=", "args", "self", ".", "_kwargs", "=", "kwargs",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
DelayJobRunner.cancel_requests
Cancels pending requests.
spyder/plugins/editor/utils/editor.py
def cancel_requests(self): """Cancels pending requests.""" self._timer.stop() self._job = None self._args = None self._kwargs = None
def cancel_requests(self): """Cancels pending requests.""" self._timer.stop() self._job = None self._args = None self._kwargs = None
[ "Cancels", "pending", "requests", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L119-L124
[ "def", "cancel_requests", "(", "self", ")", ":", "self", ".", "_timer", ".", "stop", "(", ")", "self", ".", "_job", "=", "None", "self", ".", "_args", "=", "None", "self", ".", "_kwargs", "=", "None" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
DelayJobRunner._exec_requested_job
Execute the requested job after the timer has timeout.
spyder/plugins/editor/utils/editor.py
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): """Execute the requested job after the timer has timeout.""" self._timer.stop() self._job(*self._args, **self._kwargs)
[ "Execute", "the", "requested", "job", "after", "the", "timer", "has", "timeout", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L126-L129
[ "def", "_exec_requested_job", "(", "self", ")", ":", "self", ".", "_timer", ".", "stop", "(", ")", "self", ".", "_job", "(", "*", "self", ".", "_args", ",", "*", "*", "self", ".", "_kwargs", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.goto_line
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. ...
spyder/plugins/editor/utils/editor.py
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=''): """ 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...
[ "Moves", "the", "text", "cursor", "to", "the", "specified", "position", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L154-L186
[ "def", "goto_line", "(", "self", ",", "line", ",", "column", "=", "0", ",", "end_column", "=", "0", ",", "move", "=", "True", ",", "word", "=", "''", ")", ":", "line", "=", "min", "(", "line", ",", "self", ".", "line_count", "(", ")", ")", "tex...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.unfold_if_colapsed
Unfold parent fold trigger if the block is collapsed. :param block: Block to unfold.
spyder/plugins/editor/utils/editor.py
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): """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...
[ "Unfold", "parent", "fold", "trigger", "if", "the", "block", "is", "collapsed", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L188-L202
[ "def", "unfold_if_colapsed", "(", "self", ",", "block", ")", ":", "try", ":", "folding_panel", "=", "self", ".", "_editor", ".", "panels", ".", "get", "(", "'FoldingPanel'", ")", "except", "KeyError", ":", "pass", "else", ":", "from", "spyder", ".", "plu...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.word_under_cursor
Gets the word under cursor using the separators defined by :attr:`spyder.plugins.editor.widgets.codeeditor.CodeEditor.word_separators`. FIXME: This is not working because CodeEditor have no attribute word_separators .. note: Instead of returning the word string, this function returns ...
spyder/plugins/editor/utils/editor.py
def word_under_cursor(self, select_whole_word=False, text_cursor=None): """ Gets the word under cursor using the separators defined by :attr:`spyder.plugins.editor.widgets.codeeditor.CodeEditor.word_separators`. FIXME: This is not working because CodeEditor have no attribute wor...
def word_under_cursor(self, select_whole_word=False, text_cursor=None): """ Gets the word under cursor using the separators defined by :attr:`spyder.plugins.editor.widgets.codeeditor.CodeEditor.word_separators`. FIXME: This is not working because CodeEditor have no attribute wor...
[ "Gets", "the", "word", "under", "cursor", "using", "the", "separators", "defined", "by", ":", "attr", ":", "spyder", ".", "plugins", ".", "editor", ".", "widgets", ".", "codeeditor", ".", "CodeEditor", ".", "word_separators", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L208-L265
[ "def", "word_under_cursor", "(", "self", ",", "select_whole_word", "=", "False", ",", "text_cursor", "=", "None", ")", ":", "editor", "=", "self", ".", "_editor", "if", "not", "text_cursor", ":", "text_cursor", "=", "editor", ".", "textCursor", "(", ")", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.word_under_mouse_cursor
Selects the word under the **mouse** cursor. :return: A QTextCursor with the word under mouse cursor selected.
spyder/plugins/editor/utils/editor.py
def word_under_mouse_cursor(self): """ Selects the word under the **mouse** cursor. :return: A QTextCursor with the word under mouse cursor selected. """ editor = self._editor text_cursor = editor.cursorForPosition(editor._last_mouse_pos) text_cursor = self.word_...
def word_under_mouse_cursor(self): """ Selects the word under the **mouse** cursor. :return: A QTextCursor with the word under mouse cursor selected. """ editor = self._editor text_cursor = editor.cursorForPosition(editor._last_mouse_pos) text_cursor = self.word_...
[ "Selects", "the", "word", "under", "the", "**", "mouse", "**", "cursor", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L267-L276
[ "def", "word_under_mouse_cursor", "(", "self", ")", ":", "editor", "=", "self", ".", "_editor", "text_cursor", "=", "editor", ".", "cursorForPosition", "(", "editor", ".", "_last_mouse_pos", ")", "text_cursor", "=", "self", ".", "word_under_cursor", "(", "True",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.cursor_position
Returns the QTextCursor position. The position is a tuple made up of the line number (0 based) and the column number (0 based). :return: tuple(line, column)
spyder/plugins/editor/utils/editor.py
def cursor_position(self): """ Returns the QTextCursor position. The position is a tuple made up of the line number (0 based) and the column number (0 based). :return: tuple(line, column) """ return (self._editor.textCursor().blockNumber(), self._editor.t...
def cursor_position(self): """ Returns the QTextCursor position. The position is a tuple made up of the line number (0 based) and the column number (0 based). :return: tuple(line, column) """ return (self._editor.textCursor().blockNumber(), self._editor.t...
[ "Returns", "the", "QTextCursor", "position", ".", "The", "position", "is", "a", "tuple", "made", "up", "of", "the", "line", "number", "(", "0", "based", ")", "and", "the", "column", "number", "(", "0", "based", ")", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L278-L286
[ "def", "cursor_position", "(", "self", ")", ":", "return", "(", "self", ".", "_editor", ".", "textCursor", "(", ")", ".", "blockNumber", "(", ")", ",", "self", ".", "_editor", ".", "textCursor", "(", ")", ".", "columnNumber", "(", ")", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.line_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
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Gets", "the", "text", "of", "the", "specified", "line", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L312-L323
[ "def", "line_text", "(", "self", ",", "line_nbr", ")", ":", "doc", "=", "self", ".", "_editor", ".", "document", "(", ")", "block", "=", "doc", ".", "findBlockByNumber", "(", "line_nbr", ")", "return", "block", ".", "text", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.set_line_text
Replace an entire line with ``new_text``. :param line_nbr: line number of the line to change. :param new_text: The replacement text.
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Replace", "an", "entire", "line", "with", "new_text", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L342-L354
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.remove_last_line
Removes the last line of the document.
spyder/plugins/editor/utils/editor.py
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): """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...
[ "Removes", "the", "last", "line", "of", "the", "document", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L356-L364
[ "def", "remove_last_line", "(", "self", ")", ":", "editor", "=", "self", ".", "_editor", "text_cursor", "=", "editor", ".", "textCursor", "(", ")", "text_cursor", ".", "movePosition", "(", "text_cursor", ".", "End", ",", "text_cursor", ".", "MoveAnchor", ")"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.clean_document
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
spyder/plugins/editor/utils/editor.py
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): """ 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() ...
[ "Removes", "trailing", "whitespaces", "and", "ensure", "one", "single", "blank", "line", "at", "the", "end", "of", "the", "QTextDocument", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L366-L427
[ "def", "clean_document", "(", "self", ")", ":", "editor", "=", "self", ".", "_editor", "value", "=", "editor", ".", "verticalScrollBar", "(", ")", ".", "value", "(", ")", "pos", "=", "self", ".", "cursor_position", "(", ")", "editor", ".", "textCursor", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.select_whole_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
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Selects", "an", "entire", "line", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L429-L441
[ "def", "select_whole_line", "(", "self", ",", "line", "=", "None", ",", "apply_selection", "=", "True", ")", ":", "if", "line", "is", "None", ":", "line", "=", "self", ".", "current_line_nbr", "(", ")", "return", "self", ".", "select_lines", "(", "line",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.selection_range
Returns the selected lines boundaries (start line, end line) :return: tuple(int, int)
spyder/plugins/editor/utils/editor.py
def selection_range(self): """ Returns the selected lines boundaries (start line, end line) :return: tuple(int, int) """ editor = self._editor doc = editor.document() start = doc.findBlock( editor.textCursor().selectionStart()).blockNumber() e...
def selection_range(self): """ Returns the selected lines boundaries (start line, end line) :return: tuple(int, int) """ editor = self._editor doc = editor.document() start = doc.findBlock( editor.textCursor().selectionStart()).blockNumber() e...
[ "Returns", "the", "selected", "lines", "boundaries", "(", "start", "line", "end", "line", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L492-L508
[ "def", "selection_range", "(", "self", ")", ":", "editor", "=", "self", ".", "_editor", "doc", "=", "editor", ".", "document", "(", ")", "start", "=", "doc", ".", "findBlock", "(", "editor", ".", "textCursor", "(", ")", ".", "selectionStart", "(", ")",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.line_pos_from_number
Computes line position on Y-Axis (at the center of the line) from line number. :param line_number: The line number for which we want to know the position in pixels. :return: The center position of the line.
spyder/plugins/editor/utils/editor.py
def line_pos_from_number(self, line_number): """ Computes line position on Y-Axis (at the center of the line) from line number. :param line_number: The line number for which we want to know the position in pixels. :return: The center position of the l...
def line_pos_from_number(self, line_number): """ Computes line position on Y-Axis (at the center of the line) from line number. :param line_number: The line number for which we want to know the position in pixels. :return: The center position of the l...
[ "Computes", "line", "position", "on", "Y", "-", "Axis", "(", "at", "the", "center", "of", "the", "line", ")", "from", "line", "number", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L510-L528
[ "def", "line_pos_from_number", "(", "self", ",", "line_number", ")", ":", "editor", "=", "self", ".", "_editor", "block", "=", "editor", ".", "document", "(", ")", ".", "findBlockByNumber", "(", "line_number", ")", "if", "block", ".", "isValid", "(", ")", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.line_nbr_from_position
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
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Returns", "the", "line", "number", "from", "the", "y_pos", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L530-L542
[ "def", "line_nbr_from_position", "(", "self", ",", "y_pos", ")", ":", "editor", "=", "self", ".", "_editor", "height", "=", "editor", ".", "fontMetrics", "(", ")", ".", "height", "(", ")", "for", "top", ",", "line", ",", "block", "in", "editor", ".", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.mark_whole_doc_dirty
Marks the whole document as dirty to force a full refresh. **SLOW**
spyder/plugins/editor/utils/editor.py
def mark_whole_doc_dirty(self): """ Marks the whole document as dirty to force a full refresh. **SLOW** """ text_cursor = self._editor.textCursor() text_cursor.select(text_cursor.Document) self._editor.document().markContentsDirty(text_cursor.selectionStart(), ...
def mark_whole_doc_dirty(self): """ Marks the whole document as dirty to force a full refresh. **SLOW** """ text_cursor = self._editor.textCursor() text_cursor.select(text_cursor.Document) self._editor.document().markContentsDirty(text_cursor.selectionStart(), ...
[ "Marks", "the", "whole", "document", "as", "dirty", "to", "force", "a", "full", "refresh", ".", "**", "SLOW", "**" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L544-L551
[ "def", "mark_whole_doc_dirty", "(", "self", ")", ":", "text_cursor", "=", "self", ".", "_editor", ".", "textCursor", "(", ")", "text_cursor", ".", "select", "(", "text_cursor", ".", "Document", ")", "self", ".", "_editor", ".", "document", "(", ")", ".", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.get_right_character
Gets the character that is on the right of the text cursor. :param cursor: QTextCursor that defines the position where the search will start.
spyder/plugins/editor/utils/editor.py
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): """ 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):...
[ "Gets", "the", "character", "that", "is", "on", "the", "right", "of", "the", "text", "cursor", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L585-L597
[ "def", "get_right_character", "(", "self", ",", "cursor", "=", "None", ")", ":", "next_char", "=", "self", ".", "get_right_word", "(", "cursor", "=", "cursor", ")", "if", "len", "(", "next_char", ")", ":", "next_char", "=", "next_char", "[", "0", "]", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.insert_text
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).
spyder/plugins/editor/utils/editor.py
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): """ 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 ...
[ "Inserts", "text", "at", "the", "cursor", "position", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L599-L616
[ "def", "insert_text", "(", "self", ",", "text", ",", "keep_position", "=", "True", ")", ":", "text_cursor", "=", "self", ".", "_editor", ".", "textCursor", "(", ")", "if", "keep_position", ":", "s", "=", "text_cursor", ".", "selectionStart", "(", ")", "e...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.clear_selection
Clears text cursor selection.
spyder/plugins/editor/utils/editor.py
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): """Clears text cursor selection.""" text_cursor = self._editor.textCursor() text_cursor.clearSelection() self._editor.setTextCursor(text_cursor)
[ "Clears", "text", "cursor", "selection", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L618-L622
[ "def", "clear_selection", "(", "self", ")", ":", "text_cursor", "=", "self", ".", "_editor", ".", "textCursor", "(", ")", "text_cursor", ".", "clearSelection", "(", ")", "self", ".", "_editor", ".", "setTextCursor", "(", "text_cursor", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.move_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.
spyder/plugins/editor/utils/editor.py
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): """ 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._...
[ "Moves", "the", "cursor", "on", "the", "right", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L624-L636
[ "def", "move_right", "(", "self", ",", "keep_anchor", "=", "False", ",", "nb_chars", "=", "1", ")", ":", "text_cursor", "=", "self", ".", "_editor", ".", "textCursor", "(", ")", "text_cursor", ".", "movePosition", "(", "text_cursor", ".", "Right", ",", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextHelper.select_extended_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``. :param continuation_chars: the list of characters that may extend a word.
spyder/plugins/editor/utils/editor.py
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=('.',)): """ 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...
[ "Performs", "extended", "word", "selection", ".", "Extended", "selection", "consists", "in", "selecting", "the", "word", "under", "cursor", "and", "any", "other", "words", "that", "are", "linked", "by", "a", "continuation_chars", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L720-L765
[ "def", "select_extended_word", "(", "self", ",", "continuation_chars", "=", "(", "'.'", ",", ")", ")", ":", "cursor", "=", "self", ".", "_editor", ".", "textCursor", "(", ")", "original_pos", "=", "cursor", ".", "position", "(", ")", "start_pos", "=", "N...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextBlockHelper.set_state
Sets the user state, generally used for syntax highlighting. :param block: block to modify :param state: new state value. :return:
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Sets", "the", "user", "state", "generally", "used", "for", "syntax", "highlighting", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L905-L921
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextBlockHelper.set_fold_lvl
Sets the block fold level. :param block: block to modify :param val: The new fold level [0-7]
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Sets", "the", "block", "fold", "level", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L939-L955
[ "def", "set_fold_lvl", "(", "block", ",", "val", ")", ":", "if", "block", "is", "None", ":", "return", "state", "=", "block", ".", "userState", "(", ")", "if", "state", "==", "-", "1", ":", "state", "=", "0", "if", "val", ">=", "0x3FF", ":", "val...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextBlockHelper.is_fold_trigger
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)
spyder/plugins/editor/utils/editor.py
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): """ 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...
[ "Checks", "if", "the", "block", "is", "a", "fold", "trigger", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L958-L971
[ "def", "is_fold_trigger", "(", "block", ")", ":", "if", "block", "is", "None", ":", "return", "False", "state", "=", "block", ".", "userState", "(", ")", "if", "state", "==", "-", "1", ":", "state", "=", "0", "return", "bool", "(", "state", "&", "0...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextBlockHelper.set_fold_trigger
Set the block fold trigger flag (True means the block is a fold trigger). :param block: block to set :param val: value to set
spyder/plugins/editor/utils/editor.py
def set_fold_trigger(block, val): """ Set the block fold trigger flag (True means the block is a fold trigger). :param block: block to set :param val: value to set """ if block is None: return state = block.userState() if state == -1: ...
def set_fold_trigger(block, val): """ Set the block fold trigger flag (True means the block is a fold trigger). :param block: block to set :param val: value to set """ if block is None: return state = block.userState() if state == -1: ...
[ "Set", "the", "block", "fold", "trigger", "flag", "(", "True", "means", "the", "block", "is", "a", "fold", "trigger", ")", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L974-L989
[ "def", "set_fold_trigger", "(", "block", ",", "val", ")", ":", "if", "block", "is", "None", ":", "return", "state", "=", "block", ".", "userState", "(", ")", "if", "state", "==", "-", "1", ":", "state", "=", "0", "state", "&=", "0x7BFFFFFF", "state",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextBlockHelper.is_collapsed
Checks if the block is expanded or collased. :param block: QTextBlock :return: False for an open trigger, True for for closed trigger
spyder/plugins/editor/utils/editor.py
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): """ 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: ...
[ "Checks", "if", "the", "block", "is", "expanded", "or", "collased", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L992-L1004
[ "def", "is_collapsed", "(", "block", ")", ":", "if", "block", "is", "None", ":", "return", "False", "state", "=", "block", ".", "userState", "(", ")", "if", "state", "==", "-", "1", ":", "state", "=", "0", "return", "bool", "(", "state", "&", "0x08...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TextBlockHelper.set_collapsed
Sets the fold trigger state (collapsed or expanded). :param block: The block to modify :param val: The new trigger state (True=collapsed, False=expanded)
spyder/plugins/editor/utils/editor.py
def set_collapsed(block, val): """ Sets the fold trigger state (collapsed or expanded). :param block: The block to modify :param val: The new trigger state (True=collapsed, False=expanded) """ if block is None: return state = block.userState() ...
def set_collapsed(block, val): """ Sets the fold trigger state (collapsed or expanded). :param block: The block to modify :param val: The new trigger state (True=collapsed, False=expanded) """ if block is None: return state = block.userState() ...
[ "Sets", "the", "fold", "trigger", "state", "(", "collapsed", "or", "expanded", ")", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/editor.py#L1007-L1021
[ "def", "set_collapsed", "(", "block", ",", "val", ")", ":", "if", "block", "is", "None", ":", "return", "state", "=", "block", ".", "userState", "(", ")", "if", "state", "==", "-", "1", ":", "state", "=", "0", "state", "&=", "0x77FFFFFF", "state", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_starting_chunk
:param filename: File to open and get the first little chunk of. :param length: Number of bytes to read, default 1024. :returns: Starting chunk of bytes.
spyder/utils/external/binaryornot/helpers.py
def get_starting_chunk(filename, length=1024): """ :param filename: File to open and get the first little chunk of. :param length: Number of bytes to read, default 1024. :returns: Starting chunk of bytes. """ # Ensure we open the file in binary mode with open(filename, 'rb') as f: ch...
def get_starting_chunk(filename, length=1024): """ :param filename: File to open and get the first little chunk of. :param length: Number of bytes to read, default 1024. :returns: Starting chunk of bytes. """ # Ensure we open the file in binary mode with open(filename, 'rb') as f: ch...
[ ":", "param", "filename", ":", "File", "to", "open", "and", "get", "the", "first", "little", "chunk", "of", ".", ":", "param", "length", ":", "Number", "of", "bytes", "to", "read", "default", "1024", ".", ":", "returns", ":", "Starting", "chunk", "of",...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/binaryornot/helpers.py#L34-L43
[ "def", "get_starting_chunk", "(", "filename", ",", "length", "=", "1024", ")", ":", "# Ensure we open the file in binary mode", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "f", ":", "chunk", "=", "f", ".", "read", "(", "length", ")", "return", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
is_binary_string
Uses a simplified version of the Perl detection algorithm, based roughly on Eli Bendersky's translation to Python: https://eli.thegreenplace.net/2011/10/19/perls-guess-if-file-is-text-or-binary-implemented-in-python/ This is biased slightly more in favour of deeming files as text files than the Perl al...
spyder/utils/external/binaryornot/helpers.py
def is_binary_string(bytes_to_check): """ Uses a simplified version of the Perl detection algorithm, based roughly on Eli Bendersky's translation to Python: https://eli.thegreenplace.net/2011/10/19/perls-guess-if-file-is-text-or-binary-implemented-in-python/ This is biased slightly more in favour o...
def is_binary_string(bytes_to_check): """ Uses a simplified version of the Perl detection algorithm, based roughly on Eli Bendersky's translation to Python: https://eli.thegreenplace.net/2011/10/19/perls-guess-if-file-is-text-or-binary-implemented-in-python/ This is biased slightly more in favour o...
[ "Uses", "a", "simplified", "version", "of", "the", "Perl", "detection", "algorithm", "based", "roughly", "on", "Eli", "Bendersky", "s", "translation", "to", "Python", ":", "https", ":", "//", "eli", ".", "thegreenplace", ".", "net", "/", "2011", "/", "10",...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/binaryornot/helpers.py#L57-L138
[ "def", "is_binary_string", "(", "bytes_to_check", ")", ":", "# Empty files are considered text files", "if", "not", "bytes_to_check", ":", "return", "False", "# Now check for a high percentage of ASCII control characters", "# Binary if control chars are > 30% of the string", "low_chars...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
StatusBarWidget.set_value
Set formatted text value.
spyder/widgets/status.py
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): """Set formatted text value.""" self.value = value if self.isVisible(): self.label_value.setText(value)
[ "Set", "formatted", "text", "value", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L74-L78
[ "def", "set_value", "(", "self", ",", "value", ")", ":", "self", ".", "value", "=", "value", "if", "self", ".", "isVisible", "(", ")", ":", "self", ".", "label_value", ".", "setText", "(", "value", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseTimerStatus.setVisible
Override Qt method to stops timers if widget is not visible.
spyder/widgets/status.py
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): """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)
[ "Override", "Qt", "method", "to", "stops", "timers", "if", "widget", "is", "not", "visible", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L102-L109
[ "def", "setVisible", "(", "self", ",", "value", ")", ":", "if", "self", ".", "timer", "is", "not", "None", ":", "if", "value", ":", "self", ".", "timer", ".", "start", "(", "self", ".", "_interval", ")", "else", ":", "self", ".", "timer", ".", "s...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseTimerStatus.set_interval
Set timer interval (ms).
spyder/widgets/status.py
def set_interval(self, interval): """Set timer interval (ms).""" self._interval = interval if self.timer is not None: self.timer.setInterval(interval)
def set_interval(self, interval): """Set timer interval (ms).""" self._interval = interval if self.timer is not None: self.timer.setInterval(interval)
[ "Set", "timer", "interval", "(", "ms", ")", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L111-L115
[ "def", "set_interval", "(", "self", ",", "interval", ")", ":", "self", ".", "_interval", "=", "interval", "if", "self", ".", "timer", "is", "not", "None", ":", "self", ".", "timer", ".", "setInterval", "(", "interval", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
MemoryStatus.get_value
Return memory usage.
spyder/widgets/status.py
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): """Return memory usage.""" from spyder.utils.system import memory_usage text = '%d%%' % memory_usage() return 'Mem ' + text.rjust(3)
[ "Return", "memory", "usage", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/status.py#L150-L154
[ "def", "get_value", "(", "self", ")", ":", "from", "spyder", ".", "utils", ".", "system", "import", "memory_usage", "text", "=", "'%d%%'", "%", "memory_usage", "(", ")", "return", "'Mem '", "+", "text", ".", "rjust", "(", "3", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
warning
Print a warning message on the rich text view
spyder/plugins/help/utils/sphinxify.py
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): """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)
[ "Print", "a", "warning", "message", "on", "the", "rich", "text", "view" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L77-L82
[ "def", "warning", "(", "message", ",", "css_path", "=", "CSS_PATH", ")", ":", "env", "=", "Environment", "(", ")", "env", ".", "loader", "=", "FileSystemLoader", "(", "osp", ".", "join", "(", "CONFDIR_PATH", ",", "'templates'", ")", ")", "warning", "=", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
usage
Print a usage message on the rich text view
spyder/plugins/help/utils/sphinxify.py
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): """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...
[ "Print", "a", "usage", "message", "on", "the", "rich", "text", "view" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L85-L91
[ "def", "usage", "(", "title", ",", "message", ",", "tutorial_message", ",", "tutorial", ",", "css_path", "=", "CSS_PATH", ")", ":", "env", "=", "Environment", "(", ")", "env", ".", "loader", "=", "FileSystemLoader", "(", "osp", ".", "join", "(", "CONFDIR...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
generate_context
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 ...
spyder/plugins/help/utils/sphinxify.py
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): """ 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...
[ "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...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L94-L146
[ "def", "generate_context", "(", "name", "=", "''", ",", "argspec", "=", "''", ",", "note", "=", "''", ",", "math", "=", "False", ",", "collapse", "=", "False", ",", "img_path", "=", "''", ",", "css_path", "=", "CSS_PATH", ")", ":", "if", "img_path", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
sphinxify
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...
spyder/plugins/help/utils/sphinxify.py
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'): """ 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 ...
[ "Runs", "Sphinx", "on", "a", "docstring", "and", "outputs", "the", "processed", "documentation", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L149-L239
[ "def", "sphinxify", "(", "docstring", ",", "context", ",", "buildername", "=", "'html'", ")", ":", "srcdir", "=", "mkdtemp", "(", ")", "srcdir", "=", "encoding", ".", "to_unicode_from_fs", "(", "srcdir", ")", "destdir", "=", "osp", ".", "join", "(", "src...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
generate_configuration
Generates a Sphinx configuration in `directory`. Parameters ---------- directory : str Base directory to use
spyder/plugins/help/utils/sphinxify.py
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): """ 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...
[ "Generates", "a", "Sphinx", "configuration", "in", "directory", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/utils/sphinxify.py#L242-L264
[ "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", "=", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
EOLStatus.update_eol
Update end of line status.
spyder/plugins/editor/widgets/status.py
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): """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)
[ "Update", "end", "of", "line", "status", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L34-L38
[ "def", "update_eol", "(", "self", ",", "os_name", ")", ":", "os_name", "=", "to_text_string", "(", "os_name", ")", "value", "=", "{", "\"nt\"", ":", "\"CRLF\"", ",", "\"posix\"", ":", "\"LF\"", "}", ".", "get", "(", "os_name", ",", "\"CR\"", ")", "self...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
EncodingStatus.update_encoding
Update encoding of current file.
spyder/plugins/editor/widgets/status.py
def update_encoding(self, encoding): """Update encoding of current file.""" value = str(encoding).upper() self.set_value(value)
def update_encoding(self, encoding): """Update encoding of current file.""" value = str(encoding).upper() self.set_value(value)
[ "Update", "encoding", "of", "current", "file", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L45-L48
[ "def", "update_encoding", "(", "self", ",", "encoding", ")", ":", "value", "=", "str", "(", "encoding", ")", ".", "upper", "(", ")", "self", ".", "set_value", "(", "value", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
CursorPositionStatus.update_cursor_position
Update cursor position.
spyder/plugins/editor/widgets/status.py
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): """Update cursor position.""" value = 'Line {}, Col {}'.format(line + 1, index + 1) self.set_value(value)
[ "Update", "cursor", "position", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L55-L58
[ "def", "update_cursor_position", "(", "self", ",", "line", ",", "index", ")", ":", "value", "=", "'Line {}, Col {}'", ".", "format", "(", "line", "+", "1", ",", "index", "+", "1", ")", "self", ".", "set_value", "(", "value", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
VCSStatus.update_vcs
Update vcs status.
spyder/plugins/editor/widgets/status.py
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): """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....
[ "Update", "vcs", "status", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/status.py#L73-L83
[ "def", "update_vcs", "(", "self", ",", "fname", ",", "index", ")", ":", "fpath", "=", "os", ".", "path", ".", "dirname", "(", "fname", ")", "branches", ",", "branch", ",", "files_modified", "=", "get_git_refs", "(", "fpath", ")", "text", "=", "branch",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
VariableExplorer.get_settings
Retrieve all Variable Explorer configuration settings. Specifically, return the settings in CONF_SECTION with keys in REMOTE_SETTINGS, and the setting 'dataframe_format'. Returns: dict: settings
spyder/plugins/variableexplorer/plugin.py
def get_settings(self): """ Retrieve all Variable Explorer configuration settings. Specifically, return the settings in CONF_SECTION with keys in REMOTE_SETTINGS, and the setting 'dataframe_format'. Returns: dict: settings """ ...
def get_settings(self): """ Retrieve all Variable Explorer configuration settings. Specifically, return the settings in CONF_SECTION with keys in REMOTE_SETTINGS, and the setting 'dataframe_format'. Returns: dict: settings """ ...
[ "Retrieve", "all", "Variable", "Explorer", "configuration", "settings", ".", "Specifically", "return", "the", "settings", "in", "CONF_SECTION", "with", "keys", "in", "REMOTE_SETTINGS", "and", "the", "setting", "dataframe_format", ".", "Returns", ":", "dict", ":", ...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L59-L77
[ "def", "get_settings", "(", "self", ")", ":", "settings", "=", "{", "}", "for", "name", "in", "REMOTE_SETTINGS", ":", "settings", "[", "name", "]", "=", "self", ".", "get_option", "(", "name", ")", "# dataframe_format is stored without percent sign in config\r", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
VariableExplorer.change_option
Change a config option. This function is called if sig_option_changed is received. If the option changed is the dataframe format, then the leading '%' character is stripped (because it can't be stored in the user config). Then, the signal is emitted again, so that the new value is ...
spyder/plugins/variableexplorer/plugin.py
def change_option(self, option_name, new_value): """ Change a config option. This function is called if sig_option_changed is received. If the option changed is the dataframe format, then the leading '%' character is stripped (because it can't be stored in the user config)...
def change_option(self, option_name, new_value): """ Change a config option. This function is called if sig_option_changed is received. If the option changed is the dataframe format, then the leading '%' character is stripped (because it can't be stored in the user config)...
[ "Change", "a", "config", "option", ".", "This", "function", "is", "called", "if", "sig_option_changed", "is", "received", ".", "If", "the", "option", "changed", "is", "the", "dataframe", "format", "then", "the", "leading", "%", "character", "is", "stripped", ...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L80-L93
[ "def", "change_option", "(", "self", ",", "option_name", ",", "new_value", ")", ":", "if", "option_name", "==", "'dataframe_format'", ":", "assert", "new_value", ".", "startswith", "(", "'%'", ")", "new_value", "=", "new_value", "[", "1", ":", "]", "self", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
VariableExplorer.free_memory
Free memory signal.
spyder/plugins/variableexplorer/plugin.py
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): """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: ...
[ "Free", "memory", "signal", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L96-L102
[ "def", "free_memory", "(", "self", ")", ":", "self", ".", "main", ".", "free_memory", "(", ")", "QTimer", ".", "singleShot", "(", "self", ".", "INITIAL_FREE_MEMORY_TIME_TRIGGER", ",", "lambda", ":", "self", ".", "main", ".", "free_memory", "(", ")", ")", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
VariableExplorer.add_shellwidget
Register shell with variable explorer. This function opens a new NamespaceBrowser for browsing the variables in the shell.
spyder/plugins/variableexplorer/plugin.py
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): """ 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: ...
[ "Register", "shell", "with", "variable", "explorer", ".", "This", "function", "opens", "a", "new", "NamespaceBrowser", "for", "browsing", "the", "variables", "in", "the", "shell", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L125-L143
[ "def", "add_shellwidget", "(", "self", ",", "shellwidget", ")", ":", "shellwidget_id", "=", "id", "(", "shellwidget", ")", "if", "shellwidget_id", "not", "in", "self", ".", "shellwidgets", ":", "self", ".", "options_button", ".", "setVisible", "(", "True", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
VariableExplorer.import_data
Import data in current namespace
spyder/plugins/variableexplorer/plugin.py
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): """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...
[ "Import", "data", "in", "current", "namespace" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/plugin.py#L158-L166
[ "def", "import_data", "(", "self", ",", "fname", ")", ":", "if", "self", ".", "count", "(", ")", ":", "nsb", "=", "self", ".", "current_widget", "(", ")", "nsb", ".", "refresh_table", "(", ")", "nsb", ".", "import_data", "(", "filenames", "=", "fname...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ObjectComboBox.is_valid
Return True if string is valid
spyder/plugins/help/widgets.py
def is_valid(self, qstr=None): """Return True if string is valid""" if not self.help.source_is_console(): return True if qstr is None: qstr = self.currentText() if not re.search(r'^[a-zA-Z0-9_\.]*$', str(qstr), 0): return False objtxt = to_text...
def is_valid(self, qstr=None): """Return True if string is valid""" if not self.help.source_is_console(): return True if qstr is None: qstr = self.currentText() if not re.search(r'^[a-zA-Z0-9_\.]*$', str(qstr), 0): return False objtxt = to_text...
[ "Return", "True", "if", "string", "is", "valid" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/widgets.py#L47-L73
[ "def", "is_valid", "(", "self", ",", "qstr", "=", "None", ")", ":", "if", "not", "self", ".", "help", ".", "source_is_console", "(", ")", ":", "return", "True", "if", "qstr", "is", "None", ":", "qstr", "=", "self", ".", "currentText", "(", ")", "if...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ObjectComboBox.validate
Reimplemented to avoid formatting actions
spyder/plugins/help/widgets.py
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): """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...
[ "Reimplemented", "to", "avoid", "formatting", "actions" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/widgets.py#L78-L91
[ "def", "validate", "(", "self", ",", "qstr", ",", "editing", "=", "True", ")", ":", "valid", "=", "self", ".", "is_valid", "(", "qstr", ")", "if", "self", ".", "hasFocus", "(", ")", "and", "valid", "is", "not", "None", ":", "if", "editing", "and", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
RichText.set_font
Set font
spyder/plugins/help/widgets.py
def set_font(self, font, fixed_font=None): """Set font""" self.webview.set_font(font, fixed_font=fixed_font)
def set_font(self, font, fixed_font=None): """Set font""" self.webview.set_font(font, fixed_font=fixed_font)
[ "Set", "font" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/widgets.py#L118-L120
[ "def", "set_font", "(", "self", ",", "font", ",", "fixed_font", "=", "None", ")", ":", "self", ".", "webview", ".", "set_font", "(", "font", ",", "fixed_font", "=", "fixed_font", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
PlainText.set_font
Set font
spyder/plugins/help/widgets.py
def set_font(self, font, color_scheme=None): """Set font""" self.editor.set_font(font, color_scheme=color_scheme)
def set_font(self, font, color_scheme=None): """Set font""" self.editor.set_font(font, color_scheme=color_scheme)
[ "Set", "font" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/help/widgets.py#L159-L161
[ "def", "set_font", "(", "self", ",", "font", ",", "color_scheme", "=", "None", ")", ":", "self", ".", "editor", ".", "set_font", "(", "font", ",", "color_scheme", "=", "color_scheme", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
find_tasks
Find tasks in source code (TODO, FIXME, XXX, ...)
spyder/utils/codeanalysis.py
def find_tasks(source_code): """Find tasks in source code (TODO, FIXME, XXX, ...)""" results = [] for line, text in enumerate(source_code.splitlines()): for todo in re.findall(TASKS_PATTERN, text): todo_text = (todo[-1].strip(' :').capitalize() if todo[-1] ...
def find_tasks(source_code): """Find tasks in source code (TODO, FIXME, XXX, ...)""" results = [] for line, text in enumerate(source_code.splitlines()): for todo in re.findall(TASKS_PATTERN, text): todo_text = (todo[-1].strip(' :').capitalize() if todo[-1] ...
[ "Find", "tasks", "in", "source", "code", "(", "TODO", "FIXME", "XXX", "...", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L30-L38
[ "def", "find_tasks", "(", "source_code", ")", ":", "results", "=", "[", "]", "for", "line", ",", "text", "in", "enumerate", "(", "source_code", ".", "splitlines", "(", ")", ")", ":", "for", "todo", "in", "re", ".", "findall", "(", "TASKS_PATTERN", ",",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
check_with_pyflakes
Check source code with pyflakes Returns an empty list if pyflakes is not installed
spyder/utils/codeanalysis.py
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): """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...
[ "Check", "source", "code", "with", "pyflakes", "Returns", "an", "empty", "list", "if", "pyflakes", "is", "not", "installed" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L41-L88
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_checker_executable
Return checker executable in the form of a list of arguments for subprocess.Popen
spyder/utils/codeanalysis.py
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): """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, ...
[ "Return", "checker", "executable", "in", "the", "form", "of", "a", "list", "of", "arguments", "for", "subprocess", ".", "Popen" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L96-L113
[ "def", "get_checker_executable", "(", "name", ")", ":", "if", "programs", ".", "is_program_installed", "(", "name", ")", ":", "# Checker is properly installed\r", "return", "[", "name", "]", "else", ":", "path1", "=", "programs", ".", "python_script_exists", "(", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
check
Check source code with checker defined with *args* (list) Returns an empty list if checker is not installed
spyder/utils/codeanalysis.py
def check(args, source_code, filename=None, options=None): """Check source code with checker defined with *args* (list) Returns an empty list if checker is not installed""" if args is None: return [] if options is not None: args += options if any(['pyflakes' in arg for arg in ...
def check(args, source_code, filename=None, options=None): """Check source code with checker defined with *args* (list) Returns an empty list if checker is not installed""" if args is None: return [] if options is not None: args += options if any(['pyflakes' in arg for arg in ...
[ "Check", "source", "code", "with", "checker", "defined", "with", "*", "args", "*", "(", "list", ")", "Returns", "an", "empty", "list", "if", "checker", "is", "not", "installed" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L116-L161
[ "def", "check", "(", "args", ",", "source_code", ",", "filename", "=", "None", ",", "options", "=", "None", ")", ":", "if", "args", "is", "None", ":", "return", "[", "]", "if", "options", "is", "not", "None", ":", "args", "+=", "options", "if", "an...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
check_with_pep8
Check source code with pycodestyle
spyder/utils/codeanalysis.py
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): """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...
[ "Check", "source", "code", "with", "pycodestyle" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/codeanalysis.py#L164-L175
[ "def", "check_with_pep8", "(", "source_code", ",", "filename", "=", "None", ")", ":", "try", ":", "args", "=", "get_checker_executable", "(", "'pycodestyle'", ")", "results", "=", "check", "(", "args", ",", "source_code", ",", "filename", "=", "filename", ",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_image_label
Return image inside a QLabel object
spyder/utils/qthelpers.py
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"): """Return image inside a QLabel object""" label = QLabel() label.setPixmap(QPixmap(get_image_path(name, default))) return label
[ "Return", "image", "inside", "a", "QLabel", "object" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L44-L48
[ "def", "get_image_label", "(", "name", ",", "default", "=", "\"not_found.png\"", ")", ":", "label", "=", "QLabel", "(", ")", "label", ".", "setPixmap", "(", "QPixmap", "(", "get_image_path", "(", "name", ",", "default", ")", ")", ")", "return", "label" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
qapplication
Return QApplication instance Creates it if it doesn't already exist test_time: Time to maintain open the application when testing. It's given in seconds
spyder/utils/qthelpers.py
def qapplication(translate=True, test_time=3): """ Return QApplication instance Creates it if it doesn't already exist test_time: Time to maintain open the application when testing. It's given in seconds """ if running_in_mac_app(): SpyderApplication = MacApplication ...
def qapplication(translate=True, test_time=3): """ Return QApplication instance Creates it if it doesn't already exist test_time: Time to maintain open the application when testing. It's given in seconds """ if running_in_mac_app(): SpyderApplication = MacApplication ...
[ "Return", "QApplication", "instance", "Creates", "it", "if", "it", "doesn", "t", "already", "exist", "test_time", ":", "Time", "to", "maintain", "open", "the", "application", "when", "testing", ".", "It", "s", "given", "in", "seconds" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L65-L94
[ "def", "qapplication", "(", "translate", "=", "True", ",", "test_time", "=", "3", ")", ":", "if", "running_in_mac_app", "(", ")", ":", "SpyderApplication", "=", "MacApplication", "else", ":", "SpyderApplication", "=", "QApplication", "app", "=", "SpyderApplicati...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
file_uri
Select the right file uri scheme according to the operating system
spyder/utils/qthelpers.py
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): """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: ...
[ "Select", "the", "right", "file", "uri", "scheme", "according", "to", "the", "operating", "system" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L97-L107
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
install_translator
Install Qt translator to the QApplication instance
spyder/utils/qthelpers.py
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): """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...
[ "Install", "Qt", "translator", "to", "the", "QApplication", "instance" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L111-L120
[ "def", "install_translator", "(", "qapp", ")", ":", "global", "QT_TRANSLATOR", "if", "QT_TRANSLATOR", "is", "None", ":", "qt_translator", "=", "QTranslator", "(", ")", "if", "qt_translator", ".", "load", "(", "\"qt_\"", "+", "QLocale", ".", "system", "(", ")...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
keybinding
Return keybinding
spyder/utils/qthelpers.py
def keybinding(attr): """Return keybinding""" ks = getattr(QKeySequence, attr) return from_qvariant(QKeySequence.keyBindings(ks)[0], str)
def keybinding(attr): """Return keybinding""" ks = getattr(QKeySequence, attr) return from_qvariant(QKeySequence.keyBindings(ks)[0], str)
[ "Return", "keybinding" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L123-L126
[ "def", "keybinding", "(", "attr", ")", ":", "ks", "=", "getattr", "(", "QKeySequence", ",", "attr", ")", "return", "from_qvariant", "(", "QKeySequence", ".", "keyBindings", "(", "ks", ")", "[", "0", "]", ",", "str", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
mimedata2url
Extract url list from MIME data extlist: for example ('.py', '.pyw')
spyder/utils/qthelpers.py
def mimedata2url(source, extlist=None): """ Extract url list from MIME data extlist: for example ('.py', '.pyw') """ pathlist = [] if source.hasUrls(): for url in source.urls(): path = _process_mime_path(to_text_string(url.toString()), extlist) if path is...
def mimedata2url(source, extlist=None): """ Extract url list from MIME data extlist: for example ('.py', '.pyw') """ pathlist = [] if source.hasUrls(): for url in source.urls(): path = _process_mime_path(to_text_string(url.toString()), extlist) if path is...
[ "Extract", "url", "list", "from", "MIME", "data", "extlist", ":", "for", "example", "(", ".", "py", ".", "pyw", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L146-L163
[ "def", "mimedata2url", "(", "source", ",", "extlist", "=", "None", ")", ":", "pathlist", "=", "[", "]", "if", "source", ".", "hasUrls", "(", ")", ":", "for", "url", "in", "source", ".", "urls", "(", ")", ":", "path", "=", "_process_mime_path", "(", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
keyevent2tuple
Convert QKeyEvent instance into a tuple
spyder/utils/qthelpers.py
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): """Convert QKeyEvent instance into a tuple""" return (event.type(), event.key(), event.modifiers(), event.text(), event.isAutoRepeat(), event.count())
[ "Convert", "QKeyEvent", "instance", "into", "a", "tuple" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L166-L169
[ "def", "keyevent2tuple", "(", "event", ")", ":", "return", "(", "event", ".", "type", "(", ")", ",", "event", ".", "key", "(", ")", ",", "event", ".", "modifiers", "(", ")", ",", "event", ".", "text", "(", ")", ",", "event", ".", "isAutoRepeat", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_toolbutton
Create a QToolButton
spyder/utils/qthelpers.py
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, text_beside_icon=False): """Create a QToolButton""" button = QToolButton(parent) if text is not None: button.setText(text) ...
[ "Create", "a", "QToolButton" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L190-L213
[ "def", "create_toolbutton", "(", "parent", ",", "text", "=", "None", ",", "shortcut", "=", "None", ",", "icon", "=", "None", ",", "tip", "=", "None", ",", "toggled", "=", "None", ",", "triggered", "=", "None", ",", "autoraise", "=", "True", ",", "tex...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
action2button
Create a QToolButton directly from a QAction object
spyder/utils/qthelpers.py
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): """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...
[ "Create", "a", "QToolButton", "directly", "from", "a", "QAction", "object" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L216-L225
[ "def", "action2button", "(", "action", ",", "autoraise", "=", "True", ",", "text_beside_icon", "=", "False", ",", "parent", "=", "None", ")", ":", "if", "parent", "is", "None", ":", "parent", "=", "action", ".", "parent", "(", ")", "button", "=", "QToo...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
toggle_actions
Enable/disable actions
spyder/utils/qthelpers.py
def toggle_actions(actions, enable): """Enable/disable actions""" if actions is not None: for action in actions: if action is not None: action.setEnabled(enable)
def toggle_actions(actions, enable): """Enable/disable actions""" if actions is not None: for action in actions: if action is not None: action.setEnabled(enable)
[ "Enable", "/", "disable", "actions" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L228-L233
[ "def", "toggle_actions", "(", "actions", ",", "enable", ")", ":", "if", "actions", "is", "not", "None", ":", "for", "action", "in", "actions", ":", "if", "action", "is", "not", "None", ":", "action", ".", "setEnabled", "(", "enable", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_action
Create a QAction
spyder/utils/qthelpers.py
def create_action(parent, text, shortcut=None, icon=None, tip=None, toggled=None, triggered=None, data=None, menurole=None, context=Qt.WindowShortcut): """Create a QAction""" action = SpyderAction(text, parent) if triggered is not None: action.triggered.conn...
def create_action(parent, text, shortcut=None, icon=None, tip=None, toggled=None, triggered=None, data=None, menurole=None, context=Qt.WindowShortcut): """Create a QAction""" action = SpyderAction(text, parent) if triggered is not None: action.triggered.conn...
[ "Create", "a", "QAction" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L236-L278
[ "def", "create_action", "(", "parent", ",", "text", ",", "shortcut", "=", "None", ",", "icon", "=", "None", ",", "tip", "=", "None", ",", "toggled", "=", "None", ",", "triggered", "=", "None", ",", "data", "=", "None", ",", "menurole", "=", "None", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
add_shortcut_to_tooltip
Add the shortcut associated with a given action to its tooltip
spyder/utils/qthelpers.py
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): """Add the shortcut associated with a given action to its tooltip""" action.setToolTip(action.toolTip() + ' (%s)' % get_shortcut(context=context, name=name))
[ "Add", "the", "shortcut", "associated", "with", "a", "given", "action", "to", "its", "tooltip" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L281-L284
[ "def", "add_shortcut_to_tooltip", "(", "action", ",", "context", ",", "name", ")", ":", "action", ".", "setToolTip", "(", "action", ".", "toolTip", "(", ")", "+", "' (%s)'", "%", "get_shortcut", "(", "context", "=", "context", ",", "name", "=", "name", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
add_actions
Add actions to a QMenu or a QToolBar.
spyder/utils/qthelpers.py
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): """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 = ...
[ "Add", "actions", "to", "a", "QMenu", "or", "a", "QToolBar", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L287-L322
[ "def", "add_actions", "(", "target", ",", "actions", ",", "insert_before", "=", "None", ")", ":", "previous_action", "=", "None", "target_actions", "=", "list", "(", "target", ".", "actions", "(", ")", ")", "if", "target_actions", ":", "previous_action", "="...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_bookmark_action
Create bookmark action
spyder/utils/qthelpers.py
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): """Create bookmark action""" @Slot() def open_url(): return programs.start_file(url) return create_action( parent, title, shortcut=shortcut, icon=icon, triggered=open_url)
[ "Create", "bookmark", "action" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L335-L343
[ "def", "create_bookmark_action", "(", "parent", ",", "url", ",", "title", ",", "icon", "=", "None", ",", "shortcut", "=", "None", ")", ":", "@", "Slot", "(", ")", "def", "open_url", "(", ")", ":", "return", "programs", ".", "start_file", "(", "url", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_module_bookmark_actions
Create bookmark actions depending on module installation: bookmarks = ((module_name, url, title), ...)
spyder/utils/qthelpers.py
def create_module_bookmark_actions(parent, bookmarks): """ Create bookmark actions depending on module installation: bookmarks = ((module_name, url, title), ...) """ actions = [] for key, url, title in bookmarks: # Create actions for scientific distros only if Spyder is installed ...
def create_module_bookmark_actions(parent, bookmarks): """ Create bookmark actions depending on module installation: bookmarks = ((module_name, url, title), ...) """ actions = [] for key, url, title in bookmarks: # Create actions for scientific distros only if Spyder is installed ...
[ "Create", "bookmark", "actions", "depending", "on", "module", "installation", ":", "bookmarks", "=", "((", "module_name", "url", "title", ")", "...", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L346-L362
[ "def", "create_module_bookmark_actions", "(", "parent", ",", "bookmarks", ")", ":", "actions", "=", "[", "]", "for", "key", ",", "url", ",", "title", "in", "bookmarks", ":", "# Create actions for scientific distros only if Spyder is installed\r", "# under them\r", "crea...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_program_action
Create action to run a program
spyder/utils/qthelpers.py
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): """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: ...
[ "Create", "action", "to", "run", "a", "program" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L365-L374
[ "def", "create_program_action", "(", "parent", ",", "text", ",", "name", ",", "icon", "=", "None", ",", "nt_name", "=", "None", ")", ":", "if", "is_text_string", "(", "icon", ")", ":", "icon", "=", "get_icon", "(", "icon", ")", "if", "os", ".", "name...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_python_script_action
Create action to run a GUI based Python script
spyder/utils/qthelpers.py
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=[]): """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, ...
[ "Create", "action", "to", "run", "a", "GUI", "based", "Python", "script" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L377-L384
[ "def", "create_python_script_action", "(", "parent", ",", "text", ",", "icon", ",", "package", ",", "module", ",", "args", "=", "[", "]", ")", ":", "if", "is_text_string", "(", "icon", ")", ":", "icon", "=", "get_icon", "(", "icon", ")", "if", "program...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_filetype_icon
Return file type icon
spyder/utils/qthelpers.py
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): """Return file type icon""" ext = osp.splitext(fname)[1] if ext.startswith('.'): ext = ext[1:] return get_icon( "%s.png" % ext, ima.icon('FileIcon') )
[ "Return", "file", "type", "icon" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L423-L428
[ "def", "get_filetype_icon", "(", "fname", ")", ":", "ext", "=", "osp", ".", "splitext", "(", "fname", ")", "[", "1", "]", "if", "ext", ".", "startswith", "(", "'.'", ")", ":", "ext", "=", "ext", "[", "1", ":", "]", "return", "get_icon", "(", "\"%...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
show_std_icons
Show all standard Icons
spyder/utils/qthelpers.py
def show_std_icons(): """ Show all standard Icons """ app = qapplication() dialog = ShowStdIcons(None) dialog.show() sys.exit(app.exec_())
def show_std_icons(): """ Show all standard Icons """ app = qapplication() dialog = ShowStdIcons(None) dialog.show() sys.exit(app.exec_())
[ "Show", "all", "standard", "Icons" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L501-L508
[ "def", "show_std_icons", "(", ")", ":", "app", "=", "qapplication", "(", ")", "dialog", "=", "ShowStdIcons", "(", "None", ")", "dialog", ".", "show", "(", ")", "sys", ".", "exit", "(", "app", ".", "exec_", "(", ")", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
calc_tools_spacing
Return a spacing (int) or None if we don't have the appropriate metrics to calculate the spacing. We're trying to adapt the spacing below the tools_layout spacing so that the main_widget has the same vertical position as the editor widgets (which have tabs above). The required spacing is ...
spyder/utils/qthelpers.py
def calc_tools_spacing(tools_layout): """ Return a spacing (int) or None if we don't have the appropriate metrics to calculate the spacing. We're trying to adapt the spacing below the tools_layout spacing so that the main_widget has the same vertical position as the editor widgets (which...
def calc_tools_spacing(tools_layout): """ Return a spacing (int) or None if we don't have the appropriate metrics to calculate the spacing. We're trying to adapt the spacing below the tools_layout spacing so that the main_widget has the same vertical position as the editor widgets (which...
[ "Return", "a", "spacing", "(", "int", ")", "or", "None", "if", "we", "don", "t", "have", "the", "appropriate", "metrics", "to", "calculate", "the", "spacing", ".", "We", "re", "trying", "to", "adapt", "the", "spacing", "below", "the", "tools_layout", "sp...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L511-L548
[ "def", "calc_tools_spacing", "(", "tools_layout", ")", ":", "metrics", "=", "{", "# (tabbar_height, offset)\r", "'nt.fusion'", ":", "(", "32", ",", "0", ")", ",", "'nt.windowsvista'", ":", "(", "21", ",", "3", ")", ",", "'nt.windowsxp'", ":", "(", "24", ",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
create_plugin_layout
Returns a layout for a set of controls above a main widget. This is a standard layout for many plugin panes (even though, it's currently more often applied not to the pane itself but with in the one widget contained in the pane. tools_layout: a layout containing the top toolbar main_widget: t...
spyder/utils/qthelpers.py
def create_plugin_layout(tools_layout, main_widget=None): """ Returns a layout for a set of controls above a main widget. This is a standard layout for many plugin panes (even though, it's currently more often applied not to the pane itself but with in the one widget contained in the pane. ...
def create_plugin_layout(tools_layout, main_widget=None): """ Returns a layout for a set of controls above a main widget. This is a standard layout for many plugin panes (even though, it's currently more often applied not to the pane itself but with in the one widget contained in the pane. ...
[ "Returns", "a", "layout", "for", "a", "set", "of", "controls", "above", "a", "main", "widget", ".", "This", "is", "a", "standard", "layout", "for", "many", "plugin", "panes", "(", "even", "though", "it", "s", "currently", "more", "often", "applied", "not...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L551-L571
[ "def", "create_plugin_layout", "(", "tools_layout", ",", "main_widget", "=", "None", ")", ":", "layout", "=", "QVBoxLayout", "(", ")", "layout", ".", "setContentsMargins", "(", "0", ",", "0", ",", "0", ",", "0", ")", "spacing", "=", "calc_tools_spacing", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
DialogManager.show
Generic method to show a non-modal dialog and keep reference to the Qt C++ object
spyder/utils/qthelpers.py
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): """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() ...
[ "Generic", "method", "to", "show", "a", "non", "-", "modal", "dialog", "and", "keep", "reference", "to", "the", "Qt", "C", "++", "object" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/qthelpers.py#L396-L411
[ "def", "show", "(", "self", ",", "dialog", ")", ":", "for", "dlg", "in", "list", "(", "self", ".", "dialogs", ".", "values", "(", ")", ")", ":", "if", "to_text_string", "(", "dlg", ".", "windowTitle", "(", ")", ")", "==", "to_text_string", "(", "di...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
add
Add Spyder dependency
spyder/dependencies.py
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): """Add Spyder dependency""" global DEPENDENCIES for dependency in DEPENDENCIES: if dependency.modname == modname: raise ValueError("Dependency has already been registered: %s"\ ...
[ "Add", "Spyder", "dependency" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L66-L75
[ "def", "add", "(", "modname", ",", "features", ",", "required_version", ",", "installed_version", "=", "None", ",", "optional", "=", "False", ")", ":", "global", "DEPENDENCIES", "for", "dependency", "in", "DEPENDENCIES", ":", "if", "dependency", ".", "modname"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
check
Check if required dependency is installed
spyder/dependencies.py
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): """Check if required dependency is installed""" for dependency in DEPENDENCIES: if dependency.modname == modname: return dependency.check() else: raise RuntimeError("Unkwown dependency %s" % modname)
[ "Check", "if", "required", "dependency", "is", "installed" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L78-L84
[ "def", "check", "(", "modname", ")", ":", "for", "dependency", "in", "DEPENDENCIES", ":", "if", "dependency", ".", "modname", "==", "modname", ":", "return", "dependency", ".", "check", "(", ")", "else", ":", "raise", "RuntimeError", "(", "\"Unkwown dependen...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
status
Return a status of dependencies
spyder/dependencies.py
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): """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...
[ "Return", "a", "status", "of", "dependencies" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L87-L101
[ "def", "status", "(", "deps", "=", "DEPENDENCIES", ",", "linesep", "=", "os", ".", "linesep", ")", ":", "maxwidth", "=", "0", "col1", "=", "[", "]", "col2", "=", "[", "]", "for", "dependency", "in", "deps", ":", "title1", "=", "dependency", ".", "m...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
missing_dependencies
Return the status of missing dependencies (if any)
spyder/dependencies.py
def missing_dependencies(): """Return the status of missing dependencies (if any)""" missing_deps = [] for dependency in DEPENDENCIES: if not dependency.check() and not dependency.optional: missing_deps.append(dependency) if missing_deps: return status(deps=missing_dep...
def missing_dependencies(): """Return the status of missing dependencies (if any)""" missing_deps = [] for dependency in DEPENDENCIES: if not dependency.check() and not dependency.optional: missing_deps.append(dependency) if missing_deps: return status(deps=missing_dep...
[ "Return", "the", "status", "of", "missing", "dependencies", "(", "if", "any", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L104-L113
[ "def", "missing_dependencies", "(", ")", ":", "missing_deps", "=", "[", "]", "for", "dependency", "in", "DEPENDENCIES", ":", "if", "not", "dependency", ".", "check", "(", ")", "and", "not", "dependency", ".", "optional", ":", "missing_deps", ".", "append", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
Dependency.check
Check if dependency is installed
spyder/dependencies.py
def check(self): """Check if dependency is installed""" return programs.is_module_installed(self.modname, self.required_version, self.installed_version)
def check(self): """Check if dependency is installed""" return programs.is_module_installed(self.modname, self.required_version, self.installed_version)
[ "Check", "if", "dependency", "is", "installed" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L42-L46
[ "def", "check", "(", "self", ")", ":", "return", "programs", ".", "is_module_installed", "(", "self", ".", "modname", ",", "self", ".", "required_version", ",", "self", ".", "installed_version", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
Dependency.get_installed_version
Return dependency status (string)
spyder/dependencies.py
def get_installed_version(self): """Return dependency status (string)""" if self.check(): return '%s (%s)' % (self.installed_version, self.OK) else: return '%s (%s)' % (self.installed_version, self.NOK)
def get_installed_version(self): """Return dependency status (string)""" if self.check(): return '%s (%s)' % (self.installed_version, self.OK) else: return '%s (%s)' % (self.installed_version, self.NOK)
[ "Return", "dependency", "status", "(", "string", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L48-L53
[ "def", "get_installed_version", "(", "self", ")", ":", "if", "self", ".", "check", "(", ")", ":", "return", "'%s (%s)'", "%", "(", "self", ".", "installed_version", ",", "self", ".", "OK", ")", "else", ":", "return", "'%s (%s)'", "%", "(", "self", ".",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_spyderplugins_mods
Import modules from plugins package and return the list
spyder/otherplugins.py
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): """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 = [], [] ...
[ "Import", "modules", "from", "plugins", "package", "and", "return", "the", "list" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L31-L43
[ "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", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
_get_spyderplugins
Scan the directory `plugin_path` for plugin packages and loads them.
spyder/otherplugins.py
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): """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. ...
[ "Scan", "the", "directory", "plugin_path", "for", "plugin", "packages", "and", "loads", "them", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L46-L69
[ "def", "_get_spyderplugins", "(", "plugin_path", ",", "is_io", ",", "modnames", ",", "modlist", ")", ":", "if", "not", "osp", ".", "isdir", "(", "plugin_path", ")", ":", "return", "for", "name", "in", "os", ".", "listdir", "(", "plugin_path", ")", ":", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
_import_plugin
Import the plugin `module_name` from `plugin_path`, add it to `modlist` and adds its name to `modnames`.
spyder/otherplugins.py
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): """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...
[ "Import", "the", "plugin", "module_name", "from", "plugin_path", "add", "it", "to", "modlist", "and", "adds", "its", "name", "to", "modnames", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L72-L98
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
_import_module_from_path
Imports `module_name` from `plugin_path`. Return None if no module is found.
spyder/otherplugins.py
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): """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...
[ "Imports", "module_name", "from", "plugin_path", ".", "Return", "None", "if", "no", "module", "is", "found", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/otherplugins.py#L101-L121
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_std_icon
Get standard platform icon Call 'show_std_icons()' for details
spyder/utils/icon_manager.py
def get_std_icon(name, size=None): """Get standard platform icon Call 'show_std_icons()' for details""" if not name.startswith('SP_'): name = 'SP_' + name icon = QWidget().style().standardIcon(getattr(QStyle, name)) if size is None: return icon else: return QIcon(icon.pix...
def get_std_icon(name, size=None): """Get standard platform icon Call 'show_std_icons()' for details""" if not name.startswith('SP_'): name = 'SP_' + name icon = QWidget().style().standardIcon(getattr(QStyle, name)) if size is None: return icon else: return QIcon(icon.pix...
[ "Get", "standard", "platform", "icon", "Call", "show_std_icons", "()", "for", "details" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/icon_manager.py#L346-L355
[ "def", "get_std_icon", "(", "name", ",", "size", "=", "None", ")", ":", "if", "not", "name", ".", "startswith", "(", "'SP_'", ")", ":", "name", "=", "'SP_'", "+", "name", "icon", "=", "QWidget", "(", ")", ".", "style", "(", ")", ".", "standardIcon"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_icon
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).
spyder/utils/icon_manager.py
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): """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...
[ "Return", "image", "inside", "a", "QIcon", "object", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/icon_manager.py#L358-L386
[ "def", "get_icon", "(", "name", ",", "default", "=", "None", ",", "resample", "=", "False", ")", ":", "icon_path", "=", "get_image_path", "(", "name", ",", "default", "=", "None", ")", "if", "icon_path", "is", "not", "None", ":", "icon", "=", "QIcon", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_icon_by_extension
Return the icon depending on the file extension
spyder/utils/icon_manager.py
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): """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 =...
[ "Return", "the", "icon", "depending", "on", "the", "file", "extension" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/icon_manager.py#L409-L459
[ "def", "get_icon_by_extension", "(", "fname", ",", "scale_factor", ")", ":", "application_icons", "=", "{", "}", "application_icons", ".", "update", "(", "BIN_FILES", ")", "application_icons", ".", "update", "(", "DOCUMENT_FILES", ")", "if", "osp", ".", "isdir",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
AutosaveErrorDialog.accept
Update `show_errors` and hide dialog box. Overrides method of `QDialogBox`.
spyder/plugins/editor/widgets/autosaveerror.py
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): """ Update `show_errors` and hide dialog box. Overrides method of `QDialogBox`. """ AutosaveErrorDialog.show_errors = not self.dismiss_box.isChecked() return QDialog.accept(self)
[ "Update", "show_errors", "and", "hide", "dialog", "box", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/autosaveerror.py#L78-L85
[ "def", "accept", "(", "self", ")", ":", "AutosaveErrorDialog", ".", "show_errors", "=", "not", "self", ".", "dismiss_box", ".", "isChecked", "(", ")", "return", "QDialog", ".", "accept", "(", "self", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
OneColumnTree.setup_common_actions
Setup context menu common actions
spyder/widgets/onecolumntree.py
def setup_common_actions(self): """Setup context menu common actions""" self.collapse_all_action = create_action(self, text=_('Collapse all'), icon=ima.icon('collapse'), triggered=self.col...
def setup_common_actions(self): """Setup context menu common actions""" self.collapse_all_action = create_action(self, text=_('Collapse all'), icon=ima.icon('collapse'), triggered=self.col...
[ "Setup", "context", "menu", "common", "actions" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/onecolumntree.py#L49-L74
[ "def", "setup_common_actions", "(", "self", ")", ":", "self", ".", "collapse_all_action", "=", "create_action", "(", "self", ",", "text", "=", "_", "(", "'Collapse all'", ")", ",", "icon", "=", "ima", ".", "icon", "(", "'collapse'", ")", ",", "triggered", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0