id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
31,300
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
SearchInComboBox.__redirect_stdio_emit
def __redirect_stdio_emit(self, value): """ Searches through the parent tree to see if it is possible to emit the redirect_stdio signal. This logic allows to test the SearchInComboBox select_directory method outside of the FindInFiles plugin. """ parent = s...
python
def __redirect_stdio_emit(self, value): """ Searches through the parent tree to see if it is possible to emit the redirect_stdio signal. This logic allows to test the SearchInComboBox select_directory method outside of the FindInFiles plugin. """ parent = s...
[ "def", "__redirect_stdio_emit", "(", "self", ",", "value", ")", ":", "parent", "=", "self", ".", "parent", "(", ")", "while", "parent", "is", "not", "None", ":", "try", ":", "parent", ".", "redirect_stdio", ".", "emit", "(", "value", ")", "except", "At...
Searches through the parent tree to see if it is possible to emit the redirect_stdio signal. This logic allows to test the SearchInComboBox select_directory method outside of the FindInFiles plugin.
[ "Searches", "through", "the", "parent", "tree", "to", "see", "if", "it", "is", "possible", "to", "emit", "the", "redirect_stdio", "signal", ".", "This", "logic", "allows", "to", "test", "the", "SearchInComboBox", "select_directory", "method", "outside", "of", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L384-L398
31,301
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
FindOptions.keyPressEvent
def keyPressEvent(self, event): """Reimplemented to handle key events""" ctrl = event.modifiers() & Qt.ControlModifier shift = event.modifiers() & Qt.ShiftModifier if event.key() in (Qt.Key_Enter, Qt.Key_Return): self.find.emit() elif event.key() == Qt.Key_F and...
python
def keyPressEvent(self, event): """Reimplemented to handle key events""" ctrl = event.modifiers() & Qt.ControlModifier shift = event.modifiers() & Qt.ShiftModifier if event.key() in (Qt.Key_Enter, Qt.Key_Return): self.find.emit() elif event.key() == Qt.Key_F and...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "ctrl", "=", "event", ".", "modifiers", "(", ")", "&", "Qt", ".", "ControlModifier", "shift", "=", "event", ".", "modifiers", "(", ")", "&", "Qt", ".", "ShiftModifier", "if", "event", ".", ...
Reimplemented to handle key events
[ "Reimplemented", "to", "handle", "key", "events" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L636-L646
31,302
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
ResultsBrowser.set_sorting
def set_sorting(self, flag): """Enable result sorting after search is complete.""" self.sorting['status'] = flag self.header().setSectionsClickable(flag == ON)
python
def set_sorting(self, flag): """Enable result sorting after search is complete.""" self.sorting['status'] = flag self.header().setSectionsClickable(flag == ON)
[ "def", "set_sorting", "(", "self", ",", "flag", ")", ":", "self", ".", "sorting", "[", "'status'", "]", "=", "flag", "self", ".", "header", "(", ")", ".", "setSectionsClickable", "(", "flag", "==", "ON", ")" ]
Enable result sorting after search is complete.
[ "Enable", "result", "sorting", "after", "search", "is", "complete", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L778-L781
31,303
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
ResultsBrowser.append_result
def append_result(self, results, num_matches): """Real-time update of search results""" filename, lineno, colno, match_end, line = results if filename not in self.files: file_item = FileMatchItem(self, filename, self.sorting, self.text_col...
python
def append_result(self, results, num_matches): """Real-time update of search results""" filename, lineno, colno, match_end, line = results if filename not in self.files: file_item = FileMatchItem(self, filename, self.sorting, self.text_col...
[ "def", "append_result", "(", "self", ",", "results", ",", "num_matches", ")", ":", "filename", ",", "lineno", ",", "colno", ",", "match_end", ",", "line", "=", "results", "if", "filename", "not", "in", "self", ".", "files", ":", "file_item", "=", "FileMa...
Real-time update of search results
[ "Real", "-", "time", "update", "of", "search", "results" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L876-L904
31,304
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
FileProgressBar.showEvent
def showEvent(self, event): """Override show event to start waiting spinner.""" QWidget.showEvent(self, event) self.spinner.start()
python
def showEvent(self, event): """Override show event to start waiting spinner.""" QWidget.showEvent(self, event) self.spinner.start()
[ "def", "showEvent", "(", "self", ",", "event", ")", ":", "QWidget", ".", "showEvent", "(", "self", ",", "event", ")", "self", ".", "spinner", ".", "start", "(", ")" ]
Override show event to start waiting spinner.
[ "Override", "show", "event", "to", "start", "waiting", "spinner", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L934-L937
31,305
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
FileProgressBar.hideEvent
def hideEvent(self, event): """Override hide event to stop waiting spinner.""" QWidget.hideEvent(self, event) self.spinner.stop()
python
def hideEvent(self, event): """Override hide event to stop waiting spinner.""" QWidget.hideEvent(self, event) self.spinner.stop()
[ "def", "hideEvent", "(", "self", ",", "event", ")", ":", "QWidget", ".", "hideEvent", "(", "self", ",", "event", ")", "self", ".", "spinner", ".", "stop", "(", ")" ]
Override hide event to stop waiting spinner.
[ "Override", "hide", "event", "to", "stop", "waiting", "spinner", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L939-L942
31,306
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
FindInFilesWidget.stop_and_reset_thread
def stop_and_reset_thread(self, ignore_results=False): """Stop current search thread and clean-up""" if self.search_thread is not None: if self.search_thread.isRunning(): if ignore_results: self.search_thread.sig_finished.disconnect( ...
python
def stop_and_reset_thread(self, ignore_results=False): """Stop current search thread and clean-up""" if self.search_thread is not None: if self.search_thread.isRunning(): if ignore_results: self.search_thread.sig_finished.disconnect( ...
[ "def", "stop_and_reset_thread", "(", "self", ",", "ignore_results", "=", "False", ")", ":", "if", "self", ".", "search_thread", "is", "not", "None", ":", "if", "self", ".", "search_thread", ".", "isRunning", "(", ")", ":", "if", "ignore_results", ":", "sel...
Stop current search thread and clean-up
[ "Stop", "current", "search", "thread", "and", "clean", "-", "up" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L1029-L1039
31,307
spyder-ide/spyder
spyder/plugins/findinfiles/widgets.py
FindInFilesWidget.search_complete
def search_complete(self, completed): """Current search thread has finished""" self.result_browser.set_sorting(ON) self.find_options.ok_button.setEnabled(True) self.find_options.stop_button.setEnabled(False) self.status_bar.hide() self.result_browser.expandAll() ...
python
def search_complete(self, completed): """Current search thread has finished""" self.result_browser.set_sorting(ON) self.find_options.ok_button.setEnabled(True) self.find_options.stop_button.setEnabled(False) self.status_bar.hide() self.result_browser.expandAll() ...
[ "def", "search_complete", "(", "self", ",", "completed", ")", ":", "self", ".", "result_browser", ".", "set_sorting", "(", "ON", ")", "self", ".", "find_options", ".", "ok_button", ".", "setEnabled", "(", "True", ")", "self", ".", "find_options", ".", "sto...
Current search thread has finished
[ "Current", "search", "thread", "has", "finished" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/findinfiles/widgets.py#L1045-L1059
31,308
spyder-ide/spyder
spyder/widgets/github/backend.py
GithubBackend._get_credentials_from_settings
def _get_credentials_from_settings(self): """Get the stored credentials if any.""" remember_me = CONF.get('main', 'report_error/remember_me') remember_token = CONF.get('main', 'report_error/remember_token') username = CONF.get('main', 'report_error/username', '') if not remember_...
python
def _get_credentials_from_settings(self): """Get the stored credentials if any.""" remember_me = CONF.get('main', 'report_error/remember_me') remember_token = CONF.get('main', 'report_error/remember_token') username = CONF.get('main', 'report_error/username', '') if not remember_...
[ "def", "_get_credentials_from_settings", "(", "self", ")", ":", "remember_me", "=", "CONF", ".", "get", "(", "'main'", ",", "'report_error/remember_me'", ")", "remember_token", "=", "CONF", ".", "get", "(", "'main'", ",", "'report_error/remember_token'", ")", "use...
Get the stored credentials if any.
[ "Get", "the", "stored", "credentials", "if", "any", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L177-L185
31,309
spyder-ide/spyder
spyder/widgets/github/backend.py
GithubBackend._store_credentials
def _store_credentials(self, username, password, remember=False): """Store credentials for future use.""" if username and password and remember: CONF.set('main', 'report_error/username', username) try: keyring.set_password('github', username, password) ...
python
def _store_credentials(self, username, password, remember=False): """Store credentials for future use.""" if username and password and remember: CONF.set('main', 'report_error/username', username) try: keyring.set_password('github', username, password) ...
[ "def", "_store_credentials", "(", "self", ",", "username", ",", "password", ",", "remember", "=", "False", ")", ":", "if", "username", "and", "password", "and", "remember", ":", "CONF", ".", "set", "(", "'main'", ",", "'report_error/username'", ",", "usernam...
Store credentials for future use.
[ "Store", "credentials", "for", "future", "use", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L187-L203
31,310
spyder-ide/spyder
spyder/widgets/github/backend.py
GithubBackend._store_token
def _store_token(self, token, remember=False): """Store token for future use.""" if token and remember: try: keyring.set_password('github', 'token', token) except Exception: if self._show_msgbox: QMessageBox.warning(self.parent_...
python
def _store_token(self, token, remember=False): """Store token for future use.""" if token and remember: try: keyring.set_password('github', 'token', token) except Exception: if self._show_msgbox: QMessageBox.warning(self.parent_...
[ "def", "_store_token", "(", "self", ",", "token", ",", "remember", "=", "False", ")", ":", "if", "token", "and", "remember", ":", "try", ":", "keyring", ".", "set_password", "(", "'github'", ",", "'token'", ",", "token", ")", "except", "Exception", ":", ...
Store token for future use.
[ "Store", "token", "for", "future", "use", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L205-L220
31,311
spyder-ide/spyder
spyder/widgets/github/backend.py
GithubBackend.get_user_credentials
def get_user_credentials(self): """Get user credentials with the login dialog.""" password = None token = None (username, remember_me, remember_token) = self._get_credentials_from_settings() valid_py_os = not (PY2 and sys.platform.startswith('linux')) if username...
python
def get_user_credentials(self): """Get user credentials with the login dialog.""" password = None token = None (username, remember_me, remember_token) = self._get_credentials_from_settings() valid_py_os = not (PY2 and sys.platform.startswith('linux')) if username...
[ "def", "get_user_credentials", "(", "self", ")", ":", "password", "=", "None", "token", "=", "None", "(", "username", ",", "remember_me", ",", "remember_token", ")", "=", "self", ".", "_get_credentials_from_settings", "(", ")", "valid_py_os", "=", "not", "(", ...
Get user credentials with the login dialog.
[ "Get", "user", "credentials", "with", "the", "login", "dialog", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/github/backend.py#L223-L280
31,312
spyder-ide/spyder
spyder/widgets/calltip.py
ToolTipWidget.leaveEvent
def leaveEvent(self, event): """Override Qt method to hide the tooltip on leave.""" super(ToolTipWidget, self).leaveEvent(event) self.hide()
python
def leaveEvent(self, event): """Override Qt method to hide the tooltip on leave.""" super(ToolTipWidget, self).leaveEvent(event) self.hide()
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "super", "(", "ToolTipWidget", ",", "self", ")", ".", "leaveEvent", "(", "event", ")", "self", ".", "hide", "(", ")" ]
Override Qt method to hide the tooltip on leave.
[ "Override", "Qt", "method", "to", "hide", "the", "tooltip", "on", "leave", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L105-L108
31,313
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget.eventFilter
def eventFilter(self, obj, event): """ Reimplemented to hide on certain key presses and on text edit focus changes. """ if obj == self._text_edit: etype = event.type() if etype == QEvent.KeyPress: key = event.key() cursor = sel...
python
def eventFilter(self, obj, event): """ Reimplemented to hide on certain key presses and on text edit focus changes. """ if obj == self._text_edit: etype = event.type() if etype == QEvent.KeyPress: key = event.key() cursor = sel...
[ "def", "eventFilter", "(", "self", ",", "obj", ",", "event", ")", ":", "if", "obj", "==", "self", ".", "_text_edit", ":", "etype", "=", "event", ".", "type", "(", ")", "if", "etype", "==", "QEvent", ".", "KeyPress", ":", "key", "=", "event", ".", ...
Reimplemented to hide on certain key presses and on text edit focus changes.
[ "Reimplemented", "to", "hide", "on", "certain", "key", "presses", "and", "on", "text", "edit", "focus", "changes", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L144-L176
31,314
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget.timerEvent
def timerEvent(self, event): """ Reimplemented to hide the widget when the hide timer fires. """ if event.timerId() == self._hide_timer.timerId(): self._hide_timer.stop() self.hide()
python
def timerEvent(self, event): """ Reimplemented to hide the widget when the hide timer fires. """ if event.timerId() == self._hide_timer.timerId(): self._hide_timer.stop() self.hide()
[ "def", "timerEvent", "(", "self", ",", "event", ")", ":", "if", "event", ".", "timerId", "(", ")", "==", "self", ".", "_hide_timer", ".", "timerId", "(", ")", ":", "self", ".", "_hide_timer", ".", "stop", "(", ")", "self", ".", "hide", "(", ")" ]
Reimplemented to hide the widget when the hide timer fires.
[ "Reimplemented", "to", "hide", "the", "widget", "when", "the", "hide", "timer", "fires", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L178-L183
31,315
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget.enterEvent
def enterEvent(self, event): """ Reimplemented to cancel the hide timer. """ super(CallTipWidget, self).enterEvent(event) if self.as_tooltip: self.hide() if (self._hide_timer.isActive() and self.app.topLevelAt(QCursor.pos()) == self): self._hide...
python
def enterEvent(self, event): """ Reimplemented to cancel the hide timer. """ super(CallTipWidget, self).enterEvent(event) if self.as_tooltip: self.hide() if (self._hide_timer.isActive() and self.app.topLevelAt(QCursor.pos()) == self): self._hide...
[ "def", "enterEvent", "(", "self", ",", "event", ")", ":", "super", "(", "CallTipWidget", ",", "self", ")", ".", "enterEvent", "(", "event", ")", "if", "self", ".", "as_tooltip", ":", "self", ".", "hide", "(", ")", "if", "(", "self", ".", "_hide_timer...
Reimplemented to cancel the hide timer.
[ "Reimplemented", "to", "cancel", "the", "hide", "timer", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L189-L198
31,316
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget.hideEvent
def hideEvent(self, event): """ Reimplemented to disconnect signal handlers and event filter. """ super(CallTipWidget, self).hideEvent(event) self._text_edit.cursorPositionChanged.disconnect( self._cursor_position_changed) self._text_edit.removeEventFilter(self)
python
def hideEvent(self, event): """ Reimplemented to disconnect signal handlers and event filter. """ super(CallTipWidget, self).hideEvent(event) self._text_edit.cursorPositionChanged.disconnect( self._cursor_position_changed) self._text_edit.removeEventFilter(self)
[ "def", "hideEvent", "(", "self", ",", "event", ")", ":", "super", "(", "CallTipWidget", ",", "self", ")", ".", "hideEvent", "(", "event", ")", "self", ".", "_text_edit", ".", "cursorPositionChanged", ".", "disconnect", "(", "self", ".", "_cursor_position_cha...
Reimplemented to disconnect signal handlers and event filter.
[ "Reimplemented", "to", "disconnect", "signal", "handlers", "and", "event", "filter", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L200-L206
31,317
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget.leaveEvent
def leaveEvent(self, event): """ Reimplemented to start the hide timer. """ super(CallTipWidget, self).leaveEvent(event) self._leave_event_hide()
python
def leaveEvent(self, event): """ Reimplemented to start the hide timer. """ super(CallTipWidget, self).leaveEvent(event) self._leave_event_hide()
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "super", "(", "CallTipWidget", ",", "self", ")", ".", "leaveEvent", "(", "event", ")", "self", ".", "_leave_event_hide", "(", ")" ]
Reimplemented to start the hide timer.
[ "Reimplemented", "to", "start", "the", "hide", "timer", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L208-L212
31,318
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget.showEvent
def showEvent(self, event): """ Reimplemented to connect signal handlers and event filter. """ super(CallTipWidget, self).showEvent(event) self._text_edit.cursorPositionChanged.connect( self._cursor_position_changed) self._text_edit.installEventFilter(self)
python
def showEvent(self, event): """ Reimplemented to connect signal handlers and event filter. """ super(CallTipWidget, self).showEvent(event) self._text_edit.cursorPositionChanged.connect( self._cursor_position_changed) self._text_edit.installEventFilter(self)
[ "def", "showEvent", "(", "self", ",", "event", ")", ":", "super", "(", "CallTipWidget", ",", "self", ")", ".", "showEvent", "(", "event", ")", "self", ".", "_text_edit", ".", "cursorPositionChanged", ".", "connect", "(", "self", ".", "_cursor_position_change...
Reimplemented to connect signal handlers and event filter.
[ "Reimplemented", "to", "connect", "signal", "handlers", "and", "event", "filter", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L234-L240
31,319
spyder-ide/spyder
spyder/widgets/calltip.py
CallTipWidget._cursor_position_changed
def _cursor_position_changed(self): """ Updates the tip based on user cursor movement. """ cursor = self._text_edit.textCursor() position = cursor.position() document = self._text_edit.document() char = to_text_string(document.characterAt(position - 1)) if positio...
python
def _cursor_position_changed(self): """ Updates the tip based on user cursor movement. """ cursor = self._text_edit.textCursor() position = cursor.position() document = self._text_edit.document() char = to_text_string(document.characterAt(position - 1)) if positio...
[ "def", "_cursor_position_changed", "(", "self", ")", ":", "cursor", "=", "self", ".", "_text_edit", ".", "textCursor", "(", ")", "position", "=", "cursor", ".", "position", "(", ")", "document", "=", "self", ".", "_text_edit", ".", "document", "(", ")", ...
Updates the tip based on user cursor movement.
[ "Updates", "the", "tip", "based", "on", "user", "cursor", "movement", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/calltip.py#L394-L406
31,320
spyder-ide/spyder
spyder/utils/sourcecode.py
has_mixed_eol_chars
def has_mixed_eol_chars(text): """Detect if text has mixed EOL characters""" eol_chars = get_eol_chars(text) if eol_chars is None: return False correct_text = eol_chars.join((text+eol_chars).splitlines()) return repr(correct_text) != repr(text)
python
def has_mixed_eol_chars(text): """Detect if text has mixed EOL characters""" eol_chars = get_eol_chars(text) if eol_chars is None: return False correct_text = eol_chars.join((text+eol_chars).splitlines()) return repr(correct_text) != repr(text)
[ "def", "has_mixed_eol_chars", "(", "text", ")", ":", "eol_chars", "=", "get_eol_chars", "(", "text", ")", "if", "eol_chars", "is", "None", ":", "return", "False", "correct_text", "=", "eol_chars", ".", "join", "(", "(", "text", "+", "eol_chars", ")", ".", ...
Detect if text has mixed EOL characters
[ "Detect", "if", "text", "has", "mixed", "EOL", "characters" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L44-L50
31,321
spyder-ide/spyder
spyder/utils/sourcecode.py
normalize_eols
def normalize_eols(text, eol='\n'): """Use the same eol's in text""" for eol_char, _ in EOL_CHARS: if eol_char != eol: text = text.replace(eol_char, eol) return text
python
def normalize_eols(text, eol='\n'): """Use the same eol's in text""" for eol_char, _ in EOL_CHARS: if eol_char != eol: text = text.replace(eol_char, eol) return text
[ "def", "normalize_eols", "(", "text", ",", "eol", "=", "'\\n'", ")", ":", "for", "eol_char", ",", "_", "in", "EOL_CHARS", ":", "if", "eol_char", "!=", "eol", ":", "text", "=", "text", ".", "replace", "(", "eol_char", ",", "eol", ")", "return", "text"...
Use the same eol's in text
[ "Use", "the", "same", "eol", "s", "in", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L53-L58
31,322
spyder-ide/spyder
spyder/utils/sourcecode.py
is_builtin
def is_builtin(text): """Test if passed string is the name of a Python builtin object""" from spyder.py3compat import builtins return text in [str(name) for name in dir(builtins) if not name.startswith('_')]
python
def is_builtin(text): """Test if passed string is the name of a Python builtin object""" from spyder.py3compat import builtins return text in [str(name) for name in dir(builtins) if not name.startswith('_')]
[ "def", "is_builtin", "(", "text", ")", ":", "from", "spyder", ".", "py3compat", "import", "builtins", "return", "text", "in", "[", "str", "(", "name", ")", "for", "name", "in", "dir", "(", "builtins", ")", "if", "not", "name", ".", "startswith", "(", ...
Test if passed string is the name of a Python builtin object
[ "Test", "if", "passed", "string", "is", "the", "name", "of", "a", "Python", "builtin", "object" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L66-L70
31,323
spyder-ide/spyder
spyder/utils/sourcecode.py
split_source
def split_source(source_code): '''Split source code into lines ''' eol_chars = get_eol_chars(source_code) if eol_chars: return source_code.split(eol_chars) else: return [source_code]
python
def split_source(source_code): '''Split source code into lines ''' eol_chars = get_eol_chars(source_code) if eol_chars: return source_code.split(eol_chars) else: return [source_code]
[ "def", "split_source", "(", "source_code", ")", ":", "eol_chars", "=", "get_eol_chars", "(", "source_code", ")", "if", "eol_chars", ":", "return", "source_code", ".", "split", "(", "eol_chars", ")", "else", ":", "return", "[", "source_code", "]" ]
Split source code into lines
[ "Split", "source", "code", "into", "lines" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L100-L107
31,324
spyder-ide/spyder
spyder/utils/sourcecode.py
get_identifiers
def get_identifiers(source_code): '''Split source code into python identifier-like tokens''' tokens = set(re.split(r"[^0-9a-zA-Z_.]", source_code)) valid = re.compile(r'[a-zA-Z_]') return [token for token in tokens if re.match(valid, token)]
python
def get_identifiers(source_code): '''Split source code into python identifier-like tokens''' tokens = set(re.split(r"[^0-9a-zA-Z_.]", source_code)) valid = re.compile(r'[a-zA-Z_]') return [token for token in tokens if re.match(valid, token)]
[ "def", "get_identifiers", "(", "source_code", ")", ":", "tokens", "=", "set", "(", "re", ".", "split", "(", "r\"[^0-9a-zA-Z_.]\"", ",", "source_code", ")", ")", "valid", "=", "re", ".", "compile", "(", "r'[a-zA-Z_]'", ")", "return", "[", "token", "for", ...
Split source code into python identifier-like tokens
[ "Split", "source", "code", "into", "python", "identifier", "-", "like", "tokens" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L110-L114
31,325
spyder-ide/spyder
spyder/utils/sourcecode.py
disambiguate_fname
def disambiguate_fname(files_path_list, filename): """Get tab title without ambiguation.""" fname = os.path.basename(filename) same_name_files = get_same_name_files(files_path_list, fname) if len(same_name_files) > 1: compare_path = shortest_path(same_name_files) if compare_path ==...
python
def disambiguate_fname(files_path_list, filename): """Get tab title without ambiguation.""" fname = os.path.basename(filename) same_name_files = get_same_name_files(files_path_list, fname) if len(same_name_files) > 1: compare_path = shortest_path(same_name_files) if compare_path ==...
[ "def", "disambiguate_fname", "(", "files_path_list", ",", "filename", ")", ":", "fname", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", "same_name_files", "=", "get_same_name_files", "(", "files_path_list", ",", "fname", ")", "if", "len", "(", ...
Get tab title without ambiguation.
[ "Get", "tab", "title", "without", "ambiguation", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L173-L195
31,326
spyder-ide/spyder
spyder/utils/sourcecode.py
get_same_name_files
def get_same_name_files(files_path_list, filename): """Get a list of the path components of the files with the same name.""" same_name_files = [] for fname in files_path_list: if filename == os.path.basename(fname): same_name_files.append(path_components(fname)) return same_nam...
python
def get_same_name_files(files_path_list, filename): """Get a list of the path components of the files with the same name.""" same_name_files = [] for fname in files_path_list: if filename == os.path.basename(fname): same_name_files.append(path_components(fname)) return same_nam...
[ "def", "get_same_name_files", "(", "files_path_list", ",", "filename", ")", ":", "same_name_files", "=", "[", "]", "for", "fname", "in", "files_path_list", ":", "if", "filename", "==", "os", ".", "path", ".", "basename", "(", "fname", ")", ":", "same_name_fi...
Get a list of the path components of the files with the same name.
[ "Get", "a", "list", "of", "the", "path", "components", "of", "the", "files", "with", "the", "same", "name", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/sourcecode.py#L197-L203
31,327
spyder-ide/spyder
spyder/plugins/editor/utils/decoration.py
TextDecorationsManager.add
def add(self, decorations): """ Add text decorations on a CodeEditor instance. Don't add duplicated decorations, and order decorations according draw_order and the size of the selection. Args: decorations (sourcecode.api.TextDecoration) (could be a list) Ret...
python
def add(self, decorations): """ Add text decorations on a CodeEditor instance. Don't add duplicated decorations, and order decorations according draw_order and the size of the selection. Args: decorations (sourcecode.api.TextDecoration) (could be a list) Ret...
[ "def", "add", "(", "self", ",", "decorations", ")", ":", "added", "=", "0", "if", "isinstance", "(", "decorations", ",", "list", ")", ":", "not_repeated", "=", "set", "(", "decorations", ")", "-", "set", "(", "self", ".", "_decorations", ")", "self", ...
Add text decorations on a CodeEditor instance. Don't add duplicated decorations, and order decorations according draw_order and the size of the selection. Args: decorations (sourcecode.api.TextDecoration) (could be a list) Returns: int: Amount of decorations add...
[ "Add", "text", "decorations", "on", "a", "CodeEditor", "instance", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/decoration.py#L35-L59
31,328
spyder-ide/spyder
spyder/plugins/editor/utils/decoration.py
TextDecorationsManager.update
def update(self): """Update editor extra selections with added decorations. NOTE: Update TextDecorations to use editor font, using a different font family and point size could cause unwanted behaviors. """ font = self.editor.font() for decoration in self._decorations: ...
python
def update(self): """Update editor extra selections with added decorations. NOTE: Update TextDecorations to use editor font, using a different font family and point size could cause unwanted behaviors. """ font = self.editor.font() for decoration in self._decorations: ...
[ "def", "update", "(", "self", ")", ":", "font", "=", "self", ".", "editor", ".", "font", "(", ")", "for", "decoration", "in", "self", ".", "_decorations", ":", "try", ":", "decoration", ".", "format", ".", "setFont", "(", "font", ",", "QTextCharFormat"...
Update editor extra selections with added decorations. NOTE: Update TextDecorations to use editor font, using a different font family and point size could cause unwanted behaviors.
[ "Update", "editor", "extra", "selections", "with", "added", "decorations", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/decoration.py#L86-L100
31,329
spyder-ide/spyder
spyder/plugins/editor/utils/decoration.py
TextDecorationsManager._order_decorations
def _order_decorations(self): """Order decorations according draw_order and size of selection. Highest draw_order will appear on top of the lowest values. If draw_order is equal,smaller selections are draw in top of bigger selections. """ def order_function(sel): ...
python
def _order_decorations(self): """Order decorations according draw_order and size of selection. Highest draw_order will appear on top of the lowest values. If draw_order is equal,smaller selections are draw in top of bigger selections. """ def order_function(sel): ...
[ "def", "_order_decorations", "(", "self", ")", ":", "def", "order_function", "(", "sel", ")", ":", "end", "=", "sel", ".", "cursor", ".", "selectionEnd", "(", ")", "start", "=", "sel", ".", "cursor", ".", "selectionStart", "(", ")", "return", "sel", "....
Order decorations according draw_order and size of selection. Highest draw_order will appear on top of the lowest values. If draw_order is equal,smaller selections are draw in top of bigger selections.
[ "Order", "decorations", "according", "draw_order", "and", "size", "of", "selection", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/utils/decoration.py#L108-L122
31,330
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/help.py
HelpWidget.get_signature
def get_signature(self, content): """Get signature from inspect reply content""" data = content.get('data', {}) text = data.get('text/plain', '') if text: text = ANSI_OR_SPECIAL_PATTERN.sub('', text) self._control.current_prompt_pos = self._prompt_pos ...
python
def get_signature(self, content): """Get signature from inspect reply content""" data = content.get('data', {}) text = data.get('text/plain', '') if text: text = ANSI_OR_SPECIAL_PATTERN.sub('', text) self._control.current_prompt_pos = self._prompt_pos ...
[ "def", "get_signature", "(", "self", ",", "content", ")", ":", "data", "=", "content", ".", "get", "(", "'data'", ",", "{", "}", ")", "text", "=", "data", ".", "get", "(", "'text/plain'", ",", "''", ")", "if", "text", ":", "text", "=", "ANSI_OR_SPE...
Get signature from inspect reply content
[ "Get", "signature", "from", "inspect", "reply", "content" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/help.py#L40-L69
31,331
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/help.py
HelpWidget._handle_inspect_reply
def _handle_inspect_reply(self, rep): """ Reimplement call tips to only show signatures, using the same style from our Editor and External Console too """ cursor = self._get_cursor() info = self._request_info.get('call_tip') if info and info.id == rep['parent_head...
python
def _handle_inspect_reply(self, rep): """ Reimplement call tips to only show signatures, using the same style from our Editor and External Console too """ cursor = self._get_cursor() info = self._request_info.get('call_tip') if info and info.id == rep['parent_head...
[ "def", "_handle_inspect_reply", "(", "self", ",", "rep", ")", ":", "cursor", "=", "self", ".", "_get_cursor", "(", ")", "info", "=", "self", ".", "_request_info", ".", "get", "(", "'call_tip'", ")", "if", "info", "and", "info", ".", "id", "==", "rep", ...
Reimplement call tips to only show signatures, using the same style from our Editor and External Console too
[ "Reimplement", "call", "tips", "to", "only", "show", "signatures", "using", "the", "same", "style", "from", "our", "Editor", "and", "External", "Console", "too" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/help.py#L119-L134
31,332
spyder-ide/spyder
spyder/utils/external/github.py
_encode_params
def _encode_params(kw): ''' Encode parameters. ''' args = [] for k, v in kw.items(): try: # Python 2 qv = v.encode('utf-8') if isinstance(v, unicode) else str(v) except: qv = v args.append('%s=%s' % (k, urlquote(qv))) return '&'.join(ar...
python
def _encode_params(kw): ''' Encode parameters. ''' args = [] for k, v in kw.items(): try: # Python 2 qv = v.encode('utf-8') if isinstance(v, unicode) else str(v) except: qv = v args.append('%s=%s' % (k, urlquote(qv))) return '&'.join(ar...
[ "def", "_encode_params", "(", "kw", ")", ":", "args", "=", "[", "]", "for", "k", ",", "v", "in", "kw", ".", "items", "(", ")", ":", "try", ":", "# Python 2", "qv", "=", "v", ".", "encode", "(", "'utf-8'", ")", "if", "isinstance", "(", "v", ",",...
Encode parameters.
[ "Encode", "parameters", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/github.py#L79-L91
31,333
spyder-ide/spyder
spyder/utils/external/github.py
_encode_json
def _encode_json(obj): ''' Encode object as json str. ''' def _dump_obj(obj): if isinstance(obj, dict): return obj d = dict() for k in dir(obj): if not k.startswith('_'): d[k] = getattr(obj, k) return d return json.dumps(obj, de...
python
def _encode_json(obj): ''' Encode object as json str. ''' def _dump_obj(obj): if isinstance(obj, dict): return obj d = dict() for k in dir(obj): if not k.startswith('_'): d[k] = getattr(obj, k) return d return json.dumps(obj, de...
[ "def", "_encode_json", "(", "obj", ")", ":", "def", "_dump_obj", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "return", "obj", "d", "=", "dict", "(", ")", "for", "k", "in", "dir", "(", "obj", ")", ":", "if", "not...
Encode object as json str.
[ "Encode", "object", "as", "json", "str", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/github.py#L93-L105
31,334
spyder-ide/spyder
spyder/utils/external/github.py
GitHub.authorize_url
def authorize_url(self, state=None): ''' Generate authorize_url. >>> GitHub(client_id='3ebf94c5776d565bcf75').authorize_url() 'https://github.com/login/oauth/authorize?client_id=3ebf94c5776d565bcf75' ''' if not self._client_id: raise ApiAuthError('No client i...
python
def authorize_url(self, state=None): ''' Generate authorize_url. >>> GitHub(client_id='3ebf94c5776d565bcf75').authorize_url() 'https://github.com/login/oauth/authorize?client_id=3ebf94c5776d565bcf75' ''' if not self._client_id: raise ApiAuthError('No client i...
[ "def", "authorize_url", "(", "self", ",", "state", "=", "None", ")", ":", "if", "not", "self", ".", "_client_id", ":", "raise", "ApiAuthError", "(", "'No client id.'", ")", "kw", "=", "dict", "(", "client_id", "=", "self", ".", "_client_id", ")", "if", ...
Generate authorize_url. >>> GitHub(client_id='3ebf94c5776d565bcf75').authorize_url() 'https://github.com/login/oauth/authorize?client_id=3ebf94c5776d565bcf75'
[ "Generate", "authorize_url", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/github.py#L184-L200
31,335
spyder-ide/spyder
spyder/plugins/editor/lsp/decorators.py
send_request
def send_request(req=None, method=None, requires_response=True): """Call function req and then send its results via ZMQ.""" if req is None: return functools.partial(send_request, method=method, requires_response=requires_response) @functools.wraps(req) def wrapp...
python
def send_request(req=None, method=None, requires_response=True): """Call function req and then send its results via ZMQ.""" if req is None: return functools.partial(send_request, method=method, requires_response=requires_response) @functools.wraps(req) def wrapp...
[ "def", "send_request", "(", "req", "=", "None", ",", "method", "=", "None", ",", "requires_response", "=", "True", ")", ":", "if", "req", "is", "None", ":", "return", "functools", ".", "partial", "(", "send_request", ",", "method", "=", "method", ",", ...
Call function req and then send its results via ZMQ.
[ "Call", "function", "req", "and", "then", "send", "its", "results", "via", "ZMQ", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/decorators.py#L12-L24
31,336
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
ReadOnlyCollectionsModel.get_value
def get_value(self, index): """Return current value""" if index.column() == 0: return self.keys[ index.row() ] elif index.column() == 1: return self.types[ index.row() ] elif index.column() == 2: return self.sizes[ index.row() ] else: ...
python
def get_value(self, index): """Return current value""" if index.column() == 0: return self.keys[ index.row() ] elif index.column() == 1: return self.types[ index.row() ] elif index.column() == 2: return self.sizes[ index.row() ] else: ...
[ "def", "get_value", "(", "self", ",", "index", ")", ":", "if", "index", ".", "column", "(", ")", "==", "0", ":", "return", "self", ".", "keys", "[", "index", ".", "row", "(", ")", "]", "elif", "index", ".", "column", "(", ")", "==", "1", ":", ...
Return current value
[ "Return", "current", "value" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L301-L310
31,337
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
ReadOnlyCollectionsModel.headerData
def headerData(self, section, orientation, role=Qt.DisplayRole): """Overriding method headerData""" if role != Qt.DisplayRole: return to_qvariant() i_column = int(section) if orientation == Qt.Horizontal: headers = (self.header0, _("Type"), _("Size"), _("Val...
python
def headerData(self, section, orientation, role=Qt.DisplayRole): """Overriding method headerData""" if role != Qt.DisplayRole: return to_qvariant() i_column = int(section) if orientation == Qt.Horizontal: headers = (self.header0, _("Type"), _("Size"), _("Val...
[ "def", "headerData", "(", "self", ",", "section", ",", "orientation", ",", "role", "=", "Qt", ".", "DisplayRole", ")", ":", "if", "role", "!=", "Qt", ".", "DisplayRole", ":", "return", "to_qvariant", "(", ")", "i_column", "=", "int", "(", "section", ")...
Overriding method headerData
[ "Overriding", "method", "headerData" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L357-L366
31,338
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
ReadOnlyCollectionsModel.flags
def flags(self, index): """Overriding method flags""" # This method was implemented in CollectionsModel only, but to enable # tuple exploration (even without editing), this method was moved here if not index.isValid(): return Qt.ItemIsEnabled return Qt.ItemFlags...
python
def flags(self, index): """Overriding method flags""" # This method was implemented in CollectionsModel only, but to enable # tuple exploration (even without editing), this method was moved here if not index.isValid(): return Qt.ItemIsEnabled return Qt.ItemFlags...
[ "def", "flags", "(", "self", ",", "index", ")", ":", "# This method was implemented in CollectionsModel only, but to enable\r", "# tuple exploration (even without editing), this method was moved here\r", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "Qt", "."...
Overriding method flags
[ "Overriding", "method", "flags" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L368-L375
31,339
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsDelegate.show_warning
def show_warning(self, index): """ Decide if showing a warning when the user is trying to view a big variable associated to a Tablemodel index This avoids getting the variables' value to know its size and type, using instead those already computed by the TableMode...
python
def show_warning(self, index): """ Decide if showing a warning when the user is trying to view a big variable associated to a Tablemodel index This avoids getting the variables' value to know its size and type, using instead those already computed by the TableMode...
[ "def", "show_warning", "(", "self", ",", "index", ")", ":", "try", ":", "val_size", "=", "index", ".", "model", "(", ")", ".", "sizes", "[", "index", ".", "row", "(", ")", "]", "val_type", "=", "index", ".", "model", "(", ")", ".", "types", "[", ...
Decide if showing a warning when the user is trying to view a big variable associated to a Tablemodel index This avoids getting the variables' value to know its size and type, using instead those already computed by the TableModel. The problem is when a variable ...
[ "Decide", "if", "showing", "a", "warning", "when", "the", "user", "is", "trying", "to", "view", "a", "big", "variable", "associated", "to", "a", "Tablemodel", "index", "This", "avoids", "getting", "the", "variables", "value", "to", "know", "its", "size", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L435-L456
31,340
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
BaseTableView.set_data
def set_data(self, data): """Set table data""" if data is not None: self.model.set_data(data, self.dictfilter) self.sortByColumn(0, Qt.AscendingOrder)
python
def set_data(self, data): """Set table data""" if data is not None: self.model.set_data(data, self.dictfilter) self.sortByColumn(0, Qt.AscendingOrder)
[ "def", "set_data", "(", "self", ",", "data", ")", ":", "if", "data", "is", "not", "None", ":", "self", ".", "model", ".", "set_data", "(", "data", ",", "self", ".", "dictfilter", ")", "self", ".", "sortByColumn", "(", "0", ",", "Qt", ".", "Ascendin...
Set table data
[ "Set", "table", "data" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L920-L924
31,341
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
BaseTableView.keyPressEvent
def keyPressEvent(self, event): """Reimplement Qt methods""" if event.key() == Qt.Key_Delete: self.remove_item() elif event.key() == Qt.Key_F2: self.rename_item() elif event == QKeySequence.Copy: self.copy() elif event == QKeySequence.P...
python
def keyPressEvent(self, event): """Reimplement Qt methods""" if event.key() == Qt.Key_Delete: self.remove_item() elif event.key() == Qt.Key_F2: self.rename_item() elif event == QKeySequence.Copy: self.copy() elif event == QKeySequence.P...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "if", "event", ".", "key", "(", ")", "==", "Qt", ".", "Key_Delete", ":", "self", ".", "remove_item", "(", ")", "elif", "event", ".", "key", "(", ")", "==", "Qt", ".", "Key_F2", ":", "se...
Reimplement Qt methods
[ "Reimplement", "Qt", "methods" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L953-L964
31,342
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
BaseTableView.dragEnterEvent
def dragEnterEvent(self, event): """Allow user to drag files""" if mimedata2url(event.mimeData()): event.accept() else: event.ignore()
python
def dragEnterEvent(self, event): """Allow user to drag files""" if mimedata2url(event.mimeData()): event.accept() else: event.ignore()
[ "def", "dragEnterEvent", "(", "self", ",", "event", ")", ":", "if", "mimedata2url", "(", "event", ".", "mimeData", "(", ")", ")", ":", "event", ".", "accept", "(", ")", "else", ":", "event", ".", "ignore", "(", ")" ]
Allow user to drag files
[ "Allow", "user", "to", "drag", "files" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L976-L981
31,343
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
BaseTableView.dragMoveEvent
def dragMoveEvent(self, event): """Allow user to move files""" if mimedata2url(event.mimeData()): event.setDropAction(Qt.CopyAction) event.accept() else: event.ignore()
python
def dragMoveEvent(self, event): """Allow user to move files""" if mimedata2url(event.mimeData()): event.setDropAction(Qt.CopyAction) event.accept() else: event.ignore()
[ "def", "dragMoveEvent", "(", "self", ",", "event", ")", ":", "if", "mimedata2url", "(", "event", ".", "mimeData", "(", ")", ")", ":", "event", ".", "setDropAction", "(", "Qt", ".", "CopyAction", ")", "event", ".", "accept", "(", ")", "else", ":", "ev...
Allow user to move files
[ "Allow", "user", "to", "move", "files" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L983-L989
31,344
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
BaseTableView.dropEvent
def dropEvent(self, event): """Allow user to drop supported files""" urls = mimedata2url(event.mimeData()) if urls: event.setDropAction(Qt.CopyAction) event.accept() self.sig_files_dropped.emit(urls) else: event.ignore()
python
def dropEvent(self, event): """Allow user to drop supported files""" urls = mimedata2url(event.mimeData()) if urls: event.setDropAction(Qt.CopyAction) event.accept() self.sig_files_dropped.emit(urls) else: event.ignore()
[ "def", "dropEvent", "(", "self", ",", "event", ")", ":", "urls", "=", "mimedata2url", "(", "event", ".", "mimeData", "(", ")", ")", "if", "urls", ":", "event", ".", "setDropAction", "(", "Qt", ".", "CopyAction", ")", "event", ".", "accept", "(", ")",...
Allow user to drop supported files
[ "Allow", "user", "to", "drop", "supported", "files" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L991-L999
31,345
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
BaseTableView.import_from_string
def import_from_string(self, text, title=None): """Import data from string""" data = self.model.get_data() # Check if data is a dict if not hasattr(data, "keys"): return editor = ImportWizard(self, text, title=title, contents_title...
python
def import_from_string(self, text, title=None): """Import data from string""" data = self.model.get_data() # Check if data is a dict if not hasattr(data, "keys"): return editor = ImportWizard(self, text, title=title, contents_title...
[ "def", "import_from_string", "(", "self", ",", "text", ",", "title", "=", "None", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "# Check if data is a dict\r", "if", "not", "hasattr", "(", "data", ",", "\"keys\"", ")", ":", "retu...
Import data from string
[ "Import", "data", "from", "string" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1227-L1239
31,346
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.is_list
def is_list(self, key): """Return True if variable is a list or a tuple""" data = self.model.get_data() return isinstance(data[key], (tuple, list))
python
def is_list(self, key): """Return True if variable is a list or a tuple""" data = self.model.get_data() return isinstance(data[key], (tuple, list))
[ "def", "is_list", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "isinstance", "(", "data", "[", "key", "]", ",", "(", "tuple", ",", "list", ")", ")" ]
Return True if variable is a list or a tuple
[ "Return", "True", "if", "variable", "is", "a", "list", "or", "a", "tuple" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1301-L1304
31,347
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.is_set
def is_set(self, key): """Return True if variable is a set""" data = self.model.get_data() return isinstance(data[key], set)
python
def is_set(self, key): """Return True if variable is a set""" data = self.model.get_data() return isinstance(data[key], set)
[ "def", "is_set", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "isinstance", "(", "data", "[", "key", "]", ",", "set", ")" ]
Return True if variable is a set
[ "Return", "True", "if", "variable", "is", "a", "set" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1306-L1309
31,348
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.get_len
def get_len(self, key): """Return sequence length""" data = self.model.get_data() return len(data[key])
python
def get_len(self, key): """Return sequence length""" data = self.model.get_data() return len(data[key])
[ "def", "get_len", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "len", "(", "data", "[", "key", "]", ")" ]
Return sequence length
[ "Return", "sequence", "length" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1311-L1314
31,349
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.is_array
def is_array(self, key): """Return True if variable is a numpy array""" data = self.model.get_data() return isinstance(data[key], (ndarray, MaskedArray))
python
def is_array(self, key): """Return True if variable is a numpy array""" data = self.model.get_data() return isinstance(data[key], (ndarray, MaskedArray))
[ "def", "is_array", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "isinstance", "(", "data", "[", "key", "]", ",", "(", "ndarray", ",", "MaskedArray", ")", ")" ]
Return True if variable is a numpy array
[ "Return", "True", "if", "variable", "is", "a", "numpy", "array" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1316-L1319
31,350
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.is_dict
def is_dict(self, key): """Return True if variable is a dictionary""" data = self.model.get_data() return isinstance(data[key], dict)
python
def is_dict(self, key): """Return True if variable is a dictionary""" data = self.model.get_data() return isinstance(data[key], dict)
[ "def", "is_dict", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "isinstance", "(", "data", "[", "key", "]", ",", "dict", ")" ]
Return True if variable is a dictionary
[ "Return", "True", "if", "variable", "is", "a", "dictionary" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1326-L1329
31,351
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.get_array_shape
def get_array_shape(self, key): """Return array's shape""" data = self.model.get_data() return data[key].shape
python
def get_array_shape(self, key): """Return array's shape""" data = self.model.get_data() return data[key].shape
[ "def", "get_array_shape", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "data", "[", "key", "]", ".", "shape" ]
Return array's shape
[ "Return", "array", "s", "shape" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1331-L1334
31,352
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditorTableView.get_array_ndim
def get_array_ndim(self, key): """Return array's ndim""" data = self.model.get_data() return data[key].ndim
python
def get_array_ndim(self, key): """Return array's ndim""" data = self.model.get_data() return data[key].ndim
[ "def", "get_array_ndim", "(", "self", ",", "key", ")", ":", "data", "=", "self", ".", "model", ".", "get_data", "(", ")", "return", "data", "[", "key", "]", ".", "ndim" ]
Return array's ndim
[ "Return", "array", "s", "ndim" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1336-L1339
31,353
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditor.setup
def setup(self, data, title='', readonly=False, width=650, remote=False, icon=None, parent=None): """Setup editor.""" if isinstance(data, (dict, set)): # dictionnary, set self.data_copy = data.copy() datalen = len(data) elif isinstance(dat...
python
def setup(self, data, title='', readonly=False, width=650, remote=False, icon=None, parent=None): """Setup editor.""" if isinstance(data, (dict, set)): # dictionnary, set self.data_copy = data.copy() datalen = len(data) elif isinstance(dat...
[ "def", "setup", "(", "self", ",", "data", ",", "title", "=", "''", ",", "readonly", "=", "False", ",", "width", "=", "650", ",", "remote", "=", "False", ",", "icon", "=", "None", ",", "parent", "=", "None", ")", ":", "if", "isinstance", "(", "dat...
Setup editor.
[ "Setup", "editor", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1427-L1497
31,354
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.kernel_id
def kernel_id(self): """Get kernel id""" if self.connection_file is not None: json_file = osp.basename(self.connection_file) return json_file.split('.json')[0]
python
def kernel_id(self): """Get kernel id""" if self.connection_file is not None: json_file = osp.basename(self.connection_file) return json_file.split('.json')[0]
[ "def", "kernel_id", "(", "self", ")", ":", "if", "self", ".", "connection_file", "is", "not", "None", ":", "json_file", "=", "osp", ".", "basename", "(", "self", ".", "connection_file", ")", "return", "json_file", ".", "split", "(", "'.json'", ")", "[", ...
Get kernel id
[ "Get", "kernel", "id" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L194-L198
31,355
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.stderr_file
def stderr_file(self): """Filename to save kernel stderr output.""" stderr_file = None if self.connection_file is not None: stderr_file = self.kernel_id + '.stderr' if self.stderr_dir is not None: stderr_file = osp.join(self.stderr_dir, stderr_file) ...
python
def stderr_file(self): """Filename to save kernel stderr output.""" stderr_file = None if self.connection_file is not None: stderr_file = self.kernel_id + '.stderr' if self.stderr_dir is not None: stderr_file = osp.join(self.stderr_dir, stderr_file) ...
[ "def", "stderr_file", "(", "self", ")", ":", "stderr_file", "=", "None", "if", "self", ".", "connection_file", "is", "not", "None", ":", "stderr_file", "=", "self", ".", "kernel_id", "+", "'.stderr'", "if", "self", ".", "stderr_dir", "is", "not", "None", ...
Filename to save kernel stderr output.
[ "Filename", "to", "save", "kernel", "stderr", "output", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L201-L213
31,356
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.stderr_handle
def stderr_handle(self): """Get handle to stderr_file.""" if self.stderr_file is not None: # Needed to prevent any error that could appear. # See issue 6267 try: handle = codecs.open(self.stderr_file, 'w', encoding='utf-8') except Ex...
python
def stderr_handle(self): """Get handle to stderr_file.""" if self.stderr_file is not None: # Needed to prevent any error that could appear. # See issue 6267 try: handle = codecs.open(self.stderr_file, 'w', encoding='utf-8') except Ex...
[ "def", "stderr_handle", "(", "self", ")", ":", "if", "self", ".", "stderr_file", "is", "not", "None", ":", "# Needed to prevent any error that could appear.\r", "# See issue 6267\r", "try", ":", "handle", "=", "codecs", ".", "open", "(", "self", ".", "stderr_file"...
Get handle to stderr_file.
[ "Get", "handle", "to", "stderr_file", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L216-L228
31,357
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.remove_stderr_file
def remove_stderr_file(self): """Remove stderr_file associated with the client.""" try: # Defer closing the stderr_handle until the client # is closed because jupyter_client needs it open # while it tries to restart the kernel self.stderr_handle.clos...
python
def remove_stderr_file(self): """Remove stderr_file associated with the client.""" try: # Defer closing the stderr_handle until the client # is closed because jupyter_client needs it open # while it tries to restart the kernel self.stderr_handle.clos...
[ "def", "remove_stderr_file", "(", "self", ")", ":", "try", ":", "# Defer closing the stderr_handle until the client\r", "# is closed because jupyter_client needs it open\r", "# while it tries to restart the kernel\r", "self", ".", "stderr_handle", ".", "close", "(", ")", "os", ...
Remove stderr_file associated with the client.
[ "Remove", "stderr_file", "associated", "with", "the", "client", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L230-L239
31,358
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.configure_shellwidget
def configure_shellwidget(self, give_focus=True): """Configure shellwidget after kernel is started""" if give_focus: self.get_control().setFocus() # Set exit callback self.shellwidget.set_exit_callback() # To save history self.shellwidget.executing....
python
def configure_shellwidget(self, give_focus=True): """Configure shellwidget after kernel is started""" if give_focus: self.get_control().setFocus() # Set exit callback self.shellwidget.set_exit_callback() # To save history self.shellwidget.executing....
[ "def", "configure_shellwidget", "(", "self", ",", "give_focus", "=", "True", ")", ":", "if", "give_focus", ":", "self", ".", "get_control", "(", ")", ".", "setFocus", "(", ")", "# Set exit callback\r", "self", ".", "shellwidget", ".", "set_exit_callback", "(",...
Configure shellwidget after kernel is started
[ "Configure", "shellwidget", "after", "kernel", "is", "started" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L241-L292
31,359
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.stop_button_click_handler
def stop_button_click_handler(self): """Method to handle what to do when the stop button is pressed""" self.stop_button.setDisabled(True) # Interrupt computations or stop debugging if not self.shellwidget._reading: self.interrupt_kernel() else: self...
python
def stop_button_click_handler(self): """Method to handle what to do when the stop button is pressed""" self.stop_button.setDisabled(True) # Interrupt computations or stop debugging if not self.shellwidget._reading: self.interrupt_kernel() else: self...
[ "def", "stop_button_click_handler", "(", "self", ")", ":", "self", ".", "stop_button", ".", "setDisabled", "(", "True", ")", "# Interrupt computations or stop debugging\r", "if", "not", "self", ".", "shellwidget", ".", "_reading", ":", "self", ".", "interrupt_kernel...
Method to handle what to do when the stop button is pressed
[ "Method", "to", "handle", "what", "to", "do", "when", "the", "stop", "button", "is", "pressed" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L305-L312
31,360
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_kernel_error
def show_kernel_error(self, error): """Show kernel initialization errors in infowidget.""" # Replace end of line chars with <br> eol = sourcecode.get_eol_chars(error) if eol: error = error.replace(eol, '<br>') # Don't break lines in hyphens # From htt...
python
def show_kernel_error(self, error): """Show kernel initialization errors in infowidget.""" # Replace end of line chars with <br> eol = sourcecode.get_eol_chars(error) if eol: error = error.replace(eol, '<br>') # Don't break lines in hyphens # From htt...
[ "def", "show_kernel_error", "(", "self", ",", "error", ")", ":", "# Replace end of line chars with <br>\r", "eol", "=", "sourcecode", ".", "get_eol_chars", "(", "error", ")", "if", "eol", ":", "error", "=", "error", ".", "replace", "(", "eol", ",", "'<br>'", ...
Show kernel initialization errors in infowidget.
[ "Show", "kernel", "initialization", "errors", "in", "infowidget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L314-L339
31,361
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_name
def get_name(self): """Return client name""" if self.given_name is None: # Name according to host if self.hostname is None: name = _("Console") else: name = self.hostname # Adding id to name client_id = ...
python
def get_name(self): """Return client name""" if self.given_name is None: # Name according to host if self.hostname is None: name = _("Console") else: name = self.hostname # Adding id to name client_id = ...
[ "def", "get_name", "(", "self", ")", ":", "if", "self", ".", "given_name", "is", "None", ":", "# Name according to host\r", "if", "self", ".", "hostname", "is", "None", ":", "name", "=", "_", "(", "\"Console\"", ")", "else", ":", "name", "=", "self", "...
Return client name
[ "Return", "client", "name" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L341-L357
31,362
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_options_menu
def get_options_menu(self): """Return options menu""" env_action = create_action( self, _("Show environment variables"), icon=ima.icon('environ'), triggered=self.shellwidget.get_env ...
python
def get_options_menu(self): """Return options menu""" env_action = create_action( self, _("Show environment variables"), icon=ima.icon('environ'), triggered=self.shellwidget.get_env ...
[ "def", "get_options_menu", "(", "self", ")", ":", "env_action", "=", "create_action", "(", "self", ",", "_", "(", "\"Show environment variables\"", ")", ",", "icon", "=", "ima", ".", "icon", "(", "'environ'", ")", ",", "triggered", "=", "self", ".", "shell...
Return options menu
[ "Return", "options", "menu" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L372-L399
31,363
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_toolbar_buttons
def get_toolbar_buttons(self): """Return toolbar buttons list.""" buttons = [] # Code to add the stop button if self.stop_button is None: self.stop_button = create_toolbutton( self, text=_("Stop"),...
python
def get_toolbar_buttons(self): """Return toolbar buttons list.""" buttons = [] # Code to add the stop button if self.stop_button is None: self.stop_button = create_toolbutton( self, text=_("Stop"),...
[ "def", "get_toolbar_buttons", "(", "self", ")", ":", "buttons", "=", "[", "]", "# Code to add the stop button\r", "if", "self", ".", "stop_button", "is", "None", ":", "self", ".", "stop_button", "=", "create_toolbutton", "(", "self", ",", "text", "=", "_", "...
Return toolbar buttons list.
[ "Return", "toolbar", "buttons", "list", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L401-L445
31,364
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.add_actions_to_context_menu
def add_actions_to_context_menu(self, menu): """Add actions to IPython widget context menu""" inspect_action = create_action(self, _("Inspect current object"), QKeySequence(get_shortcut('console', 'inspect curren...
python
def add_actions_to_context_menu(self, menu): """Add actions to IPython widget context menu""" inspect_action = create_action(self, _("Inspect current object"), QKeySequence(get_shortcut('console', 'inspect curren...
[ "def", "add_actions_to_context_menu", "(", "self", ",", "menu", ")", ":", "inspect_action", "=", "create_action", "(", "self", ",", "_", "(", "\"Inspect current object\"", ")", ",", "QKeySequence", "(", "get_shortcut", "(", "'console'", ",", "'inspect current object...
Add actions to IPython widget context menu
[ "Add", "actions", "to", "IPython", "widget", "context", "menu" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L447-L479
31,365
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_font
def set_font(self, font): """Set IPython widget's font""" self.shellwidget._control.setFont(font) self.shellwidget.font = font
python
def set_font(self, font): """Set IPython widget's font""" self.shellwidget._control.setFont(font) self.shellwidget.font = font
[ "def", "set_font", "(", "self", ",", "font", ")", ":", "self", ".", "shellwidget", ".", "_control", ".", "setFont", "(", "font", ")", "self", ".", "shellwidget", ".", "font", "=", "font" ]
Set IPython widget's font
[ "Set", "IPython", "widget", "s", "font" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L481-L484
31,366
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_color_scheme
def set_color_scheme(self, color_scheme, reset=True): """Set IPython color scheme.""" # Needed to handle not initialized kernel_client # See issue 6996 try: self.shellwidget.set_color_scheme(color_scheme, reset) except AttributeError: pass
python
def set_color_scheme(self, color_scheme, reset=True): """Set IPython color scheme.""" # Needed to handle not initialized kernel_client # See issue 6996 try: self.shellwidget.set_color_scheme(color_scheme, reset) except AttributeError: pass
[ "def", "set_color_scheme", "(", "self", ",", "color_scheme", ",", "reset", "=", "True", ")", ":", "# Needed to handle not initialized kernel_client\r", "# See issue 6996\r", "try", ":", "self", ".", "shellwidget", ".", "set_color_scheme", "(", "color_scheme", ",", "re...
Set IPython color scheme.
[ "Set", "IPython", "color", "scheme", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L486-L493
31,367
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.restart_kernel
def restart_kernel(self): """ Restart the associated kernel. Took this code from the qtconsole project Licensed under the BSD license """ sw = self.shellwidget if not running_under_pytest() and self.ask_before_restart: message = _('Are you ...
python
def restart_kernel(self): """ Restart the associated kernel. Took this code from the qtconsole project Licensed under the BSD license """ sw = self.shellwidget if not running_under_pytest() and self.ask_before_restart: message = _('Are you ...
[ "def", "restart_kernel", "(", "self", ")", ":", "sw", "=", "self", ".", "shellwidget", "if", "not", "running_under_pytest", "(", ")", "and", "self", ".", "ask_before_restart", ":", "message", "=", "_", "(", "'Are you sure you want to restart the kernel?'", ")", ...
Restart the associated kernel. Took this code from the qtconsole project Licensed under the BSD license
[ "Restart", "the", "associated", "kernel", ".", "Took", "this", "code", "from", "the", "qtconsole", "project", "Licensed", "under", "the", "BSD", "license" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L512-L555
31,368
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.reset_namespace
def reset_namespace(self): """Resets the namespace by removing all names defined by the user""" self.shellwidget.reset_namespace(warning=self.reset_warning, message=True)
python
def reset_namespace(self): """Resets the namespace by removing all names defined by the user""" self.shellwidget.reset_namespace(warning=self.reset_warning, message=True)
[ "def", "reset_namespace", "(", "self", ")", ":", "self", ".", "shellwidget", ".", "reset_namespace", "(", "warning", "=", "self", ".", "reset_warning", ",", "message", "=", "True", ")" ]
Resets the namespace by removing all names defined by the user
[ "Resets", "the", "namespace", "by", "removing", "all", "names", "defined", "by", "the", "user" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L593-L596
31,369
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_syspath
def show_syspath(self, syspath): """Show sys.path contents.""" if syspath is not None: editor = CollectionsEditor(self) editor.setup(syspath, title="sys.path contents", readonly=True, width=600, icon=ima.icon('syspath')) self.dialog_mana...
python
def show_syspath(self, syspath): """Show sys.path contents.""" if syspath is not None: editor = CollectionsEditor(self) editor.setup(syspath, title="sys.path contents", readonly=True, width=600, icon=ima.icon('syspath')) self.dialog_mana...
[ "def", "show_syspath", "(", "self", ",", "syspath", ")", ":", "if", "syspath", "is", "not", "None", ":", "editor", "=", "CollectionsEditor", "(", "self", ")", "editor", ".", "setup", "(", "syspath", ",", "title", "=", "\"sys.path contents\"", ",", "readonl...
Show sys.path contents.
[ "Show", "sys", ".", "path", "contents", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L602-L610
31,370
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_env
def show_env(self, env): """Show environment variables.""" self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
python
def show_env(self, env): """Show environment variables.""" self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
[ "def", "show_env", "(", "self", ",", "env", ")", ":", "self", ".", "dialog_manager", ".", "show", "(", "RemoteEnvDialog", "(", "env", ",", "parent", "=", "self", ")", ")" ]
Show environment variables.
[ "Show", "environment", "variables", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L613-L615
31,371
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_time
def show_time(self, end=False): """Text to show in time_label.""" if self.time_label is None: return elapsed_time = time.monotonic() - self.t0 # System time changed to past date, so reset start. if elapsed_time < 0: self.t0 = time.monotonic() ...
python
def show_time(self, end=False): """Text to show in time_label.""" if self.time_label is None: return elapsed_time = time.monotonic() - self.t0 # System time changed to past date, so reset start. if elapsed_time < 0: self.t0 = time.monotonic() ...
[ "def", "show_time", "(", "self", ",", "end", "=", "False", ")", ":", "if", "self", ".", "time_label", "is", "None", ":", "return", "elapsed_time", "=", "time", ".", "monotonic", "(", ")", "-", "self", ".", "t0", "# System time changed to past date, so reset ...
Text to show in time_label.
[ "Text", "to", "show", "in", "time_label", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L623-L644
31,372
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_info_page
def set_info_page(self): """Set current info_page.""" if self.info_page is not None: self.infowidget.setHtml( self.info_page, QUrl.fromLocalFile(self.css_path) )
python
def set_info_page(self): """Set current info_page.""" if self.info_page is not None: self.infowidget.setHtml( self.info_page, QUrl.fromLocalFile(self.css_path) )
[ "def", "set_info_page", "(", "self", ")", ":", "if", "self", ".", "info_page", "is", "not", "None", ":", "self", ".", "infowidget", ".", "setHtml", "(", "self", ".", "info_page", ",", "QUrl", ".", "fromLocalFile", "(", "self", ".", "css_path", ")", ")"...
Set current info_page.
[ "Set", "current", "info_page", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L657-L663
31,373
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._show_loading_page
def _show_loading_page(self): """Show animation while the kernel is loading.""" self.shellwidget.hide() self.infowidget.show() self.info_page = self.loading_page self.set_info_page()
python
def _show_loading_page(self): """Show animation while the kernel is loading.""" self.shellwidget.hide() self.infowidget.show() self.info_page = self.loading_page self.set_info_page()
[ "def", "_show_loading_page", "(", "self", ")", ":", "self", ".", "shellwidget", ".", "hide", "(", ")", "self", ".", "infowidget", ".", "show", "(", ")", "self", ".", "info_page", "=", "self", ".", "loading_page", "self", ".", "set_info_page", "(", ")" ]
Show animation while the kernel is loading.
[ "Show", "animation", "while", "the", "kernel", "is", "loading", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L684-L689
31,374
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._hide_loading_page
def _hide_loading_page(self): """Hide animation shown while the kernel is loading.""" self.infowidget.hide() self.shellwidget.show() self.info_page = self.blank_page self.set_info_page() self.shellwidget.sig_prompt_ready.disconnect(self._hide_loading_page)
python
def _hide_loading_page(self): """Hide animation shown while the kernel is loading.""" self.infowidget.hide() self.shellwidget.show() self.info_page = self.blank_page self.set_info_page() self.shellwidget.sig_prompt_ready.disconnect(self._hide_loading_page)
[ "def", "_hide_loading_page", "(", "self", ")", ":", "self", ".", "infowidget", ".", "hide", "(", ")", "self", ".", "shellwidget", ".", "show", "(", ")", "self", ".", "info_page", "=", "self", ".", "blank_page", "self", ".", "set_info_page", "(", ")", "...
Hide animation shown while the kernel is loading.
[ "Hide", "animation", "shown", "while", "the", "kernel", "is", "loading", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L691-L697
31,375
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._read_stderr
def _read_stderr(self): """Read the stderr file of the kernel.""" # We need to read stderr_file as bytes to be able to # detect its encoding with chardet f = open(self.stderr_file, 'rb') try: stderr_text = f.read() # This is needed to avoid show...
python
def _read_stderr(self): """Read the stderr file of the kernel.""" # We need to read stderr_file as bytes to be able to # detect its encoding with chardet f = open(self.stderr_file, 'rb') try: stderr_text = f.read() # This is needed to avoid show...
[ "def", "_read_stderr", "(", "self", ")", ":", "# We need to read stderr_file as bytes to be able to\r", "# detect its encoding with chardet\r", "f", "=", "open", "(", "self", ".", "stderr_file", ",", "'rb'", ")", "try", ":", "stderr_text", "=", "f", ".", "read", "("...
Read the stderr file of the kernel.
[ "Read", "the", "stderr", "file", "of", "the", "kernel", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L699-L721
31,376
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._show_mpl_backend_errors
def _show_mpl_backend_errors(self): """ Show possible errors when setting the selected Matplotlib backend. """ if not self.external_kernel: self.shellwidget.silent_execute( "get_ipython().kernel._show_mpl_backend_errors()") self.shellwidget....
python
def _show_mpl_backend_errors(self): """ Show possible errors when setting the selected Matplotlib backend. """ if not self.external_kernel: self.shellwidget.silent_execute( "get_ipython().kernel._show_mpl_backend_errors()") self.shellwidget....
[ "def", "_show_mpl_backend_errors", "(", "self", ")", ":", "if", "not", "self", ".", "external_kernel", ":", "self", ".", "shellwidget", ".", "silent_execute", "(", "\"get_ipython().kernel._show_mpl_backend_errors()\"", ")", "self", ".", "shellwidget", ".", "sig_prompt...
Show possible errors when setting the selected Matplotlib backend.
[ "Show", "possible", "errors", "when", "setting", "the", "selected", "Matplotlib", "backend", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L723-L731
31,377
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin._format_signature
def _format_signature(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Create HTML template for signature. This template will include indent after the method name, a highlight ...
python
def _format_signature(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Create HTML template for signature. This template will include indent after the method name, a highlight ...
[ "def", "_format_signature", "(", "self", ",", "signature", ",", "doc", "=", "''", ",", "parameter", "=", "''", ",", "parameter_doc", "=", "''", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "is_python", "=", "False", ")", ":", "active_parameter_template", ...
Create HTML template for signature. This template will include indent after the method name, a highlight color for the active parameter and highlights for special chars.
[ "Create", "HTML", "template", "for", "signature", ".", "This", "template", "will", "include", "indent", "after", "the", "method", "name", "a", "highlight", "color", "for", "the", "active", "parameter", "and", "highlights", "for", "special", "chars", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L185-L288
31,378
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.show_calltip
def show_calltip(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature informat...
python
def show_calltip(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature informat...
[ "def", "show_calltip", "(", "self", ",", "signature", ",", "doc", "=", "''", ",", "parameter", "=", "''", ",", "parameter_doc", "=", "''", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "is_python", "=", "False", ")", ":", "# Find position of calltip\r", "p...
Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature information on methods and functions.
[ "Show", "calltip", ".", "Calltips", "look", "like", "tooltips", "but", "will", "not", "disappear", "if", "mouse", "hovers", "them", ".", "They", "are", "useful", "for", "displaying", "signature", "information", "on", "methods", "and", "functions", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L290-L315
31,379
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.show_tooltip
def show_tooltip(self, title, text, color=_DEFAULT_TITLE_COLOR, at_line=None, at_position=None, at_point=None): """ Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections. """ if text is not None and ...
python
def show_tooltip(self, title, text, color=_DEFAULT_TITLE_COLOR, at_line=None, at_position=None, at_point=None): """ Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections. """ if text is not None and ...
[ "def", "show_tooltip", "(", "self", ",", "title", ",", "text", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "at_line", "=", "None", ",", "at_position", "=", "None", ",", "at_point", "=", "None", ")", ":", "if", "text", "is", "not", "None", "and", "l...
Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections.
[ "Show", "tooltip", ".", "Tooltips", "will", "disappear", "if", "mouse", "hovers", "them", ".", "They", "are", "meant", "for", "quick", "inspections", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L317-L340
31,380
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_text_with_eol
def get_text_with_eol(self): """Same as 'toPlainText', replace '\n' by correct end-of-line characters""" utext = to_text_string(self.toPlainText()) lines = utext.splitlines() linesep = self.get_line_separator() txt = linesep.join(lines) if utext.endswith('\...
python
def get_text_with_eol(self): """Same as 'toPlainText', replace '\n' by correct end-of-line characters""" utext = to_text_string(self.toPlainText()) lines = utext.splitlines() linesep = self.get_line_separator() txt = linesep.join(lines) if utext.endswith('\...
[ "def", "get_text_with_eol", "(", "self", ")", ":", "utext", "=", "to_text_string", "(", "self", ".", "toPlainText", "(", ")", ")", "lines", "=", "utext", ".", "splitlines", "(", ")", "linesep", "=", "self", ".", "get_line_separator", "(", ")", "txt", "="...
Same as 'toPlainText', replace '\n' by correct end-of-line characters
[ "Same", "as", "toPlainText", "replace", "\\", "n", "by", "correct", "end", "-", "of", "-", "line", "characters" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L362-L371
31,381
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_position
def get_position(self, subject): """Get offset in character for the given subject from the start of text edit area""" cursor = self.textCursor() if subject == 'cursor': pass elif subject == 'sol': cursor.movePosition(QTextCursor.StartOfBlock) ...
python
def get_position(self, subject): """Get offset in character for the given subject from the start of text edit area""" cursor = self.textCursor() if subject == 'cursor': pass elif subject == 'sol': cursor.movePosition(QTextCursor.StartOfBlock) ...
[ "def", "get_position", "(", "self", ",", "subject", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "if", "subject", "==", "'cursor'", ":", "pass", "elif", "subject", "==", "'sol'", ":", "cursor", ".", "movePosition", "(", "QTextCursor", "....
Get offset in character for the given subject from the start of text edit area
[ "Get", "offset", "in", "character", "for", "the", "given", "subject", "from", "the", "start", "of", "text", "edit", "area" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L375-L392
31,382
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.set_cursor_position
def set_cursor_position(self, position): """Set cursor position""" position = self.get_position(position) cursor = self.textCursor() cursor.setPosition(position) self.setTextCursor(cursor) self.ensureCursorVisible()
python
def set_cursor_position(self, position): """Set cursor position""" position = self.get_position(position) cursor = self.textCursor() cursor.setPosition(position) self.setTextCursor(cursor) self.ensureCursorVisible()
[ "def", "set_cursor_position", "(", "self", ",", "position", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "setPosition", "(", "position", ")", "self", ".", ...
Set cursor position
[ "Set", "cursor", "position" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L410-L416
31,383
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.is_cursor_on_first_line
def is_cursor_on_first_line(self): """Return True if cursor is on the first line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) return cursor.atStart()
python
def is_cursor_on_first_line(self): """Return True if cursor is on the first line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) return cursor.atStart()
[ "def", "is_cursor_on_first_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "StartOfBlock", ")", "return", "cursor", ".", "atStart", "(", ")" ]
Return True if cursor is on the first line
[ "Return", "True", "if", "cursor", "is", "on", "the", "first", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L424-L428
31,384
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.is_cursor_on_last_line
def is_cursor_on_last_line(self): """Return True if cursor is on the last line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.EndOfBlock) return cursor.atEnd()
python
def is_cursor_on_last_line(self): """Return True if cursor is on the last line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.EndOfBlock) return cursor.atEnd()
[ "def", "is_cursor_on_last_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "EndOfBlock", ")", "return", "cursor", ".", "atEnd", "(", ")" ]
Return True if cursor is on the last line
[ "Return", "True", "if", "cursor", "is", "on", "the", "last", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L430-L434
31,385
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.clear_selection
def clear_selection(self): """Clear current selection""" cursor = self.textCursor() cursor.clearSelection() self.setTextCursor(cursor)
python
def clear_selection(self): """Clear current selection""" cursor = self.textCursor() cursor.clearSelection() self.setTextCursor(cursor)
[ "def", "clear_selection", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "clearSelection", "(", ")", "self", ".", "setTextCursor", "(", "cursor", ")" ]
Clear current selection
[ "Clear", "current", "selection" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L476-L480
31,386
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_current_word_and_position
def get_current_word_and_position(self, completion=False): """Return current word, i.e. word at cursor position, and the start position""" cursor = self.textCursor() if cursor.hasSelection(): # Removes the selection and moves the cursor to the left side ...
python
def get_current_word_and_position(self, completion=False): """Return current word, i.e. word at cursor position, and the start position""" cursor = self.textCursor() if cursor.hasSelection(): # Removes the selection and moves the cursor to the left side ...
[ "def", "get_current_word_and_position", "(", "self", ",", "completion", "=", "False", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "if", "cursor", ".", "hasSelection", "(", ")", ":", "# Removes the selection and moves the cursor to the left side\r", ...
Return current word, i.e. word at cursor position, and the start position
[ "Return", "current", "word", "i", ".", "e", ".", "word", "at", "cursor", "position", "and", "the", "start", "position" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L551-L596
31,387
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_current_word
def get_current_word(self, completion=False): """Return current word, i.e. word at cursor position""" ret = self.get_current_word_and_position(completion) if ret is not None: return ret[0]
python
def get_current_word(self, completion=False): """Return current word, i.e. word at cursor position""" ret = self.get_current_word_and_position(completion) if ret is not None: return ret[0]
[ "def", "get_current_word", "(", "self", ",", "completion", "=", "False", ")", ":", "ret", "=", "self", ".", "get_current_word_and_position", "(", "completion", ")", "if", "ret", "is", "not", "None", ":", "return", "ret", "[", "0", "]" ]
Return current word, i.e. word at cursor position
[ "Return", "current", "word", "i", ".", "e", ".", "word", "at", "cursor", "position" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L598-L602
31,388
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_current_line
def get_current_line(self): """Return current line's text""" cursor = self.textCursor() cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText())
python
def get_current_line(self): """Return current line's text""" cursor = self.textCursor() cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText())
[ "def", "get_current_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "BlockUnderCursor", ")", "return", "to_text_string", "(", "cursor", ".", "selectedText", "(", ")", ")" ]
Return current line's text
[ "Return", "current", "line", "s", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L604-L608
31,389
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_selected_text
def get_selected_text(self): """ Return text selected by current text cursor, converted in unicode Replace the unicode line separator character \u2029 by the line separator characters returned by get_line_separator """ return to_text_string(self.textCursor().selec...
python
def get_selected_text(self): """ Return text selected by current text cursor, converted in unicode Replace the unicode line separator character \u2029 by the line separator characters returned by get_line_separator """ return to_text_string(self.textCursor().selec...
[ "def", "get_selected_text", "(", "self", ")", ":", "return", "to_text_string", "(", "self", ".", "textCursor", "(", ")", ".", "selectedText", "(", ")", ")", ".", "replace", "(", "u\"\\u2029\"", ",", "self", ".", "get_line_separator", "(", ")", ")" ]
Return text selected by current text cursor, converted in unicode Replace the unicode line separator character \u2029 by the line separator characters returned by get_line_separator
[ "Return", "text", "selected", "by", "current", "text", "cursor", "converted", "in", "unicode", "Replace", "the", "unicode", "line", "separator", "character", "\\", "u2029", "by", "the", "line", "separator", "characters", "returned", "by", "get_line_separator" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L651-L659
31,390
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_number_matches
def get_number_matches(self, pattern, source_text='', case=False, regexp=False): """Get the number of matches for the searched text.""" pattern = to_text_string(pattern) if not pattern: return 0 if not regexp: pattern = re.escap...
python
def get_number_matches(self, pattern, source_text='', case=False, regexp=False): """Get the number of matches for the searched text.""" pattern = to_text_string(pattern) if not pattern: return 0 if not regexp: pattern = re.escap...
[ "def", "get_number_matches", "(", "self", ",", "pattern", ",", "source_text", "=", "''", ",", "case", "=", "False", ",", "regexp", "=", "False", ")", ":", "pattern", "=", "to_text_string", "(", "pattern", ")", "if", "not", "pattern", ":", "return", "0", ...
Get the number of matches for the searched text.
[ "Get", "the", "number", "of", "matches", "for", "the", "searched", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L773-L798
31,391
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_match_number
def get_match_number(self, pattern, case=False, regexp=False): """Get number of the match for the searched text.""" position = self.textCursor().position() source_text = self.get_text(position_from='sof', position_to=position) match_number = self.get_number_matches(pattern, ...
python
def get_match_number(self, pattern, case=False, regexp=False): """Get number of the match for the searched text.""" position = self.textCursor().position() source_text = self.get_text(position_from='sof', position_to=position) match_number = self.get_number_matches(pattern, ...
[ "def", "get_match_number", "(", "self", ",", "pattern", ",", "case", "=", "False", ",", "regexp", "=", "False", ")", ":", "position", "=", "self", ".", "textCursor", "(", ")", ".", "position", "(", ")", "source_text", "=", "self", ".", "get_text", "(",...
Get number of the match for the searched text.
[ "Get", "number", "of", "the", "match", "for", "the", "searched", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L800-L807
31,392
spyder-ide/spyder
spyder/widgets/mixins.py
TracebackLinksMixin.mouseReleaseEvent
def mouseReleaseEvent(self, event): """Go to error""" self.QT_CLASS.mouseReleaseEvent(self, event) text = self.get_line_at(event.pos()) if get_error_match(text) and not self.has_selected_text(): if self.go_to_error is not None: self.go_to_error.emit(text...
python
def mouseReleaseEvent(self, event): """Go to error""" self.QT_CLASS.mouseReleaseEvent(self, event) text = self.get_line_at(event.pos()) if get_error_match(text) and not self.has_selected_text(): if self.go_to_error is not None: self.go_to_error.emit(text...
[ "def", "mouseReleaseEvent", "(", "self", ",", "event", ")", ":", "self", ".", "QT_CLASS", ".", "mouseReleaseEvent", "(", "self", ",", "event", ")", "text", "=", "self", ".", "get_line_at", "(", "event", ".", "pos", "(", ")", ")", "if", "get_error_match",...
Go to error
[ "Go", "to", "error" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L862-L868
31,393
spyder-ide/spyder
spyder/widgets/mixins.py
TracebackLinksMixin.mouseMoveEvent
def mouseMoveEvent(self, event): """Show Pointing Hand Cursor on error messages""" text = self.get_line_at(event.pos()) if get_error_match(text): if not self.__cursor_changed: QApplication.setOverrideCursor(QCursor(Qt.PointingHandCursor)) self.__...
python
def mouseMoveEvent(self, event): """Show Pointing Hand Cursor on error messages""" text = self.get_line_at(event.pos()) if get_error_match(text): if not self.__cursor_changed: QApplication.setOverrideCursor(QCursor(Qt.PointingHandCursor)) self.__...
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "text", "=", "self", ".", "get_line_at", "(", "event", ".", "pos", "(", ")", ")", "if", "get_error_match", "(", "text", ")", ":", "if", "not", "self", ".", "__cursor_changed", ":", "QApplica...
Show Pointing Hand Cursor on error messages
[ "Show", "Pointing", "Hand", "Cursor", "on", "error", "messages" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L870-L882
31,394
spyder-ide/spyder
spyder/widgets/mixins.py
TracebackLinksMixin.leaveEvent
def leaveEvent(self, event): """If cursor has not been restored yet, do it now""" if self.__cursor_changed: QApplication.restoreOverrideCursor() self.__cursor_changed = False self.QT_CLASS.leaveEvent(self, event)
python
def leaveEvent(self, event): """If cursor has not been restored yet, do it now""" if self.__cursor_changed: QApplication.restoreOverrideCursor() self.__cursor_changed = False self.QT_CLASS.leaveEvent(self, event)
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "__cursor_changed", ":", "QApplication", ".", "restoreOverrideCursor", "(", ")", "self", ".", "__cursor_changed", "=", "False", "self", ".", "QT_CLASS", ".", "leaveEvent", "(", "sel...
If cursor has not been restored yet, do it now
[ "If", "cursor", "has", "not", "been", "restored", "yet", "do", "it", "now" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L884-L889
31,395
spyder-ide/spyder
spyder/widgets/mixins.py
SaveHistoryMixin.create_history_filename
def create_history_filename(self): """Create history_filename with INITHISTORY if it doesn't exist.""" if self.history_filename and not osp.isfile(self.history_filename): try: encoding.writelines(self.INITHISTORY, self.history_filename) except EnvironmentErro...
python
def create_history_filename(self): """Create history_filename with INITHISTORY if it doesn't exist.""" if self.history_filename and not osp.isfile(self.history_filename): try: encoding.writelines(self.INITHISTORY, self.history_filename) except EnvironmentErro...
[ "def", "create_history_filename", "(", "self", ")", ":", "if", "self", ".", "history_filename", "and", "not", "osp", ".", "isfile", "(", "self", ".", "history_filename", ")", ":", "try", ":", "encoding", ".", "writelines", "(", "self", ".", "INITHISTORY", ...
Create history_filename with INITHISTORY if it doesn't exist.
[ "Create", "history_filename", "with", "INITHISTORY", "if", "it", "doesn", "t", "exist", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L988-L994
31,396
spyder-ide/spyder
spyder/widgets/mixins.py
SaveHistoryMixin.add_to_history
def add_to_history(self, command): """Add command to history""" command = to_text_string(command) if command in ['', '\n'] or command.startswith('Traceback'): return if command.endswith('\n'): command = command[:-1] self.histidx = None if l...
python
def add_to_history(self, command): """Add command to history""" command = to_text_string(command) if command in ['', '\n'] or command.startswith('Traceback'): return if command.endswith('\n'): command = command[:-1] self.histidx = None if l...
[ "def", "add_to_history", "(", "self", ",", "command", ")", ":", "command", "=", "to_text_string", "(", "command", ")", "if", "command", "in", "[", "''", ",", "'\\n'", "]", "or", "command", ".", "startswith", "(", "'Traceback'", ")", ":", "return", "if", ...
Add command to history
[ "Add", "command", "to", "history" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L996-L1021
31,397
spyder-ide/spyder
spyder/widgets/mixins.py
BrowseHistoryMixin.find_in_history
def find_in_history(self, tocursor, start_idx, backward): """Find text 'tocursor' in history, from index 'start_idx'""" if start_idx is None: start_idx = len(self.history) # Finding text in history step = -1 if backward else 1 idx = start_idx if len(toc...
python
def find_in_history(self, tocursor, start_idx, backward): """Find text 'tocursor' in history, from index 'start_idx'""" if start_idx is None: start_idx = len(self.history) # Finding text in history step = -1 if backward else 1 idx = start_idx if len(toc...
[ "def", "find_in_history", "(", "self", ",", "tocursor", ",", "start_idx", ",", "backward", ")", ":", "if", "start_idx", "is", "None", ":", "start_idx", "=", "len", "(", "self", ".", "history", ")", "# Finding text in history\r", "step", "=", "-", "1", "if"...
Find text 'tocursor' in history, from index 'start_idx
[ "Find", "text", "tocursor", "in", "history", "from", "index", "start_idx" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L1054-L1076
31,398
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutTranslator.keyevent_to_keyseq
def keyevent_to_keyseq(self, event): """Return a QKeySequence representation of the provided QKeyEvent.""" self.keyPressEvent(event) event.accept() return self.keySequence()
python
def keyevent_to_keyseq(self, event): """Return a QKeySequence representation of the provided QKeyEvent.""" self.keyPressEvent(event) event.accept() return self.keySequence()
[ "def", "keyevent_to_keyseq", "(", "self", ",", "event", ")", ":", "self", ".", "keyPressEvent", "(", "event", ")", "event", ".", "accept", "(", ")", "return", "self", ".", "keySequence", "(", ")" ]
Return a QKeySequence representation of the provided QKeyEvent.
[ "Return", "a", "QKeySequence", "representation", "of", "the", "provided", "QKeyEvent", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L74-L78
31,399
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutLineEdit.setText
def setText(self, sequence): """Qt method extension.""" self.setToolTip(sequence) super(ShortcutLineEdit, self).setText(sequence)
python
def setText(self, sequence): """Qt method extension.""" self.setToolTip(sequence) super(ShortcutLineEdit, self).setText(sequence)
[ "def", "setText", "(", "self", ",", "sequence", ")", ":", "self", ".", "setToolTip", "(", "sequence", ")", "super", "(", "ShortcutLineEdit", ",", "self", ")", ".", "setText", "(", "sequence", ")" ]
Qt method extension.
[ "Qt", "method", "extension", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L115-L118