partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
ClientWidget.kernel_restarted_message
Show kernel restarted/died messages.
spyder/plugins/ipythonconsole/widgets/client.py
def kernel_restarted_message(self, msg): """Show kernel restarted/died messages.""" if not self.is_error_shown: # If there are kernel creation errors, jupyter_client will # try to restart the kernel and qtconsole prints a # message about it. # So we ...
def kernel_restarted_message(self, msg): """Show kernel restarted/died messages.""" if not self.is_error_shown: # If there are kernel creation errors, jupyter_client will # try to restart the kernel and qtconsole prints a # message about it. # So we ...
[ "Show", "kernel", "restarted", "/", "died", "messages", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L558-L575
[ "def", "kernel_restarted_message", "(", "self", ",", "msg", ")", ":", "if", "not", "self", ".", "is_error_shown", ":", "# If there are kernel creation errors, jupyter_client will\r", "# try to restart the kernel and qtconsole prints a\r", "# message about it.\r", "# So we read the ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget.reset_namespace
Resets the namespace by removing all names defined by the user
spyder/plugins/ipythonconsole/widgets/client.py
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): """Resets the namespace by removing all names defined by the user""" self.shellwidget.reset_namespace(warning=self.reset_warning, message=True)
[ "Resets", "the", "namespace", "by", "removing", "all", "names", "defined", "by", "the", "user" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L593-L596
[ "def", "reset_namespace", "(", "self", ")", ":", "self", ".", "shellwidget", ".", "reset_namespace", "(", "warning", "=", "self", ".", "reset_warning", ",", "message", "=", "True", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget.show_syspath
Show sys.path contents.
spyder/plugins/ipythonconsole/widgets/client.py
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): """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...
[ "Show", "sys", ".", "path", "contents", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L602-L610
[ "def", "show_syspath", "(", "self", ",", "syspath", ")", ":", "if", "syspath", "is", "not", "None", ":", "editor", "=", "CollectionsEditor", "(", "self", ")", "editor", ".", "setup", "(", "syspath", ",", "title", "=", "\"sys.path contents\"", ",", "readonl...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget.show_env
Show environment variables.
spyder/plugins/ipythonconsole/widgets/client.py
def show_env(self, env): """Show environment variables.""" self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
def show_env(self, env): """Show environment variables.""" self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
[ "Show", "environment", "variables", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L613-L615
[ "def", "show_env", "(", "self", ",", "env", ")", ":", "self", ".", "dialog_manager", ".", "show", "(", "RemoteEnvDialog", "(", "env", ",", "parent", "=", "self", ")", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget.show_time
Text to show in time_label.
spyder/plugins/ipythonconsole/widgets/client.py
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): """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() ...
[ "Text", "to", "show", "in", "time_label", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L623-L644
[ "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 ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget.set_elapsed_time_visible
Slot to show/hide elapsed time label.
spyder/plugins/ipythonconsole/widgets/client.py
def set_elapsed_time_visible(self, state): """Slot to show/hide elapsed time label.""" self.show_elapsed_time = state if self.time_label is not None: self.time_label.setVisible(state)
def set_elapsed_time_visible(self, state): """Slot to show/hide elapsed time label.""" self.show_elapsed_time = state if self.time_label is not None: self.time_label.setVisible(state)
[ "Slot", "to", "show", "/", "hide", "elapsed", "time", "label", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L651-L655
[ "def", "set_elapsed_time_visible", "(", "self", ",", "state", ")", ":", "self", ".", "show_elapsed_time", "=", "state", "if", "self", ".", "time_label", "is", "not", "None", ":", "self", ".", "time_label", ".", "setVisible", "(", "state", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget.set_info_page
Set current info_page.
spyder/plugins/ipythonconsole/widgets/client.py
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): """Set current info_page.""" if self.info_page is not None: self.infowidget.setHtml( self.info_page, QUrl.fromLocalFile(self.css_path) )
[ "Set", "current", "info_page", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L657-L663
[ "def", "set_info_page", "(", "self", ")", ":", "if", "self", ".", "info_page", "is", "not", "None", ":", "self", ".", "infowidget", ".", "setHtml", "(", "self", ".", "info_page", ",", "QUrl", ".", "fromLocalFile", "(", "self", ".", "css_path", ")", ")"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget._create_loading_page
Create html page to show while the kernel is starting
spyder/plugins/ipythonconsole/widgets/client.py
def _create_loading_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(LOADING) loading_img = get_image_path('loading_sprites.png') if os.name == 'nt': loading_img = loading_img.replace('\\', '/') message = _("Con...
def _create_loading_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(LOADING) loading_img = get_image_path('loading_sprites.png') if os.name == 'nt': loading_img = loading_img.replace('\\', '/') message = _("Con...
[ "Create", "html", "page", "to", "show", "while", "the", "kernel", "is", "starting" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L666-L676
[ "def", "_create_loading_page", "(", "self", ")", ":", "loading_template", "=", "Template", "(", "LOADING", ")", "loading_img", "=", "get_image_path", "(", "'loading_sprites.png'", ")", "if", "os", ".", "name", "==", "'nt'", ":", "loading_img", "=", "loading_img"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget._create_blank_page
Create html page to show while the kernel is starting
spyder/plugins/ipythonconsole/widgets/client.py
def _create_blank_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(BLANK) page = loading_template.substitute(css_path=self.css_path) return page
def _create_blank_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(BLANK) page = loading_template.substitute(css_path=self.css_path) return page
[ "Create", "html", "page", "to", "show", "while", "the", "kernel", "is", "starting" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L678-L682
[ "def", "_create_blank_page", "(", "self", ")", ":", "loading_template", "=", "Template", "(", "BLANK", ")", "page", "=", "loading_template", ".", "substitute", "(", "css_path", "=", "self", ".", "css_path", ")", "return", "page" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget._show_loading_page
Show animation while the kernel is loading.
spyder/plugins/ipythonconsole/widgets/client.py
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): """Show animation while the kernel is loading.""" self.shellwidget.hide() self.infowidget.show() self.info_page = self.loading_page self.set_info_page()
[ "Show", "animation", "while", "the", "kernel", "is", "loading", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L684-L689
[ "def", "_show_loading_page", "(", "self", ")", ":", "self", ".", "shellwidget", ".", "hide", "(", ")", "self", ".", "infowidget", ".", "show", "(", ")", "self", ".", "info_page", "=", "self", ".", "loading_page", "self", ".", "set_info_page", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget._hide_loading_page
Hide animation shown while the kernel is loading.
spyder/plugins/ipythonconsole/widgets/client.py
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): """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)
[ "Hide", "animation", "shown", "while", "the", "kernel", "is", "loading", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L691-L697
[ "def", "_hide_loading_page", "(", "self", ")", ":", "self", ".", "infowidget", ".", "hide", "(", ")", "self", ".", "shellwidget", ".", "show", "(", ")", "self", ".", "info_page", "=", "self", ".", "blank_page", "self", ".", "set_info_page", "(", ")", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget._read_stderr
Read the stderr file of the kernel.
spyder/plugins/ipythonconsole/widgets/client.py
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): """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...
[ "Read", "the", "stderr", "file", "of", "the", "kernel", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L699-L721
[ "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", "("...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ClientWidget._show_mpl_backend_errors
Show possible errors when setting the selected Matplotlib backend.
spyder/plugins/ipythonconsole/widgets/client.py
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): """ 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....
[ "Show", "possible", "errors", "when", "setting", "the", "selected", "Matplotlib", "backend", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L723-L731
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin._calculate_position
Calculate a global point position `QPoint(x, y)`, for a given line, local cursor position, or local point.
spyder/widgets/mixins.py
def _calculate_position(self, at_line=None, at_position=None, at_point=None): """ Calculate a global point position `QPoint(x, y)`, for a given line, local cursor position, or local point. """ # Check that no option or only one option is given: ...
def _calculate_position(self, at_line=None, at_position=None, at_point=None): """ Calculate a global point position `QPoint(x, y)`, for a given line, local cursor position, or local point. """ # Check that no option or only one option is given: ...
[ "Calculate", "a", "global", "point", "position", "QPoint", "(", "x", "y", ")", "for", "a", "given", "line", "local", "cursor", "position", "or", "local", "point", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L74-L114
[ "def", "_calculate_position", "(", "self", ",", "at_line", "=", "None", ",", "at_position", "=", "None", ",", "at_point", "=", "None", ")", ":", "# Check that no option or only one option is given:\r", "if", "[", "at_line", ",", "at_position", ",", "at_point", "]"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin._update_stylesheet
Update the background stylesheet to make it lighter.
spyder/widgets/mixins.py
def _update_stylesheet(self, widget): """Update the background stylesheet to make it lighter.""" if is_dark_interface(): css = qdarkstyle.load_stylesheet_from_environment() widget.setStyleSheet(css) palette = widget.palette() background = palette.col...
def _update_stylesheet(self, widget): """Update the background stylesheet to make it lighter.""" if is_dark_interface(): css = qdarkstyle.load_stylesheet_from_environment() widget.setStyleSheet(css) palette = widget.palette() background = palette.col...
[ "Update", "the", "background", "stylesheet", "to", "make", "it", "lighter", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L116-L131
[ "def", "_update_stylesheet", "(", "self", ",", "widget", ")", ":", "if", "is_dark_interface", "(", ")", ":", "css", "=", "qdarkstyle", ".", "load_stylesheet_from_environment", "(", ")", "widget", ".", "setStyleSheet", "(", "css", ")", "palette", "=", "widget",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin._format_text
Create HTML template for calltips and tooltips. This will display title and text as separate sections and add `...` if `ellide` is True and the text is too long.
spyder/widgets/mixins.py
def _format_text(self, title, text, color, ellide=False): """ Create HTML template for calltips and tooltips. This will display title and text as separate sections and add `...` if `ellide` is True and the text is too long. """ template = ''' <div sty...
def _format_text(self, title, text, color, ellide=False): """ Create HTML template for calltips and tooltips. This will display title and text as separate sections and add `...` if `ellide` is True and the text is too long. """ template = ''' <div sty...
[ "Create", "HTML", "template", "for", "calltips", "and", "tooltips", ".", "This", "will", "display", "title", "and", "text", "as", "separate", "sections", "and", "add", "...", "if", "ellide", "is", "True", "and", "the", "text", "is", "too", "long", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L133-L183
[ "def", "_format_text", "(", "self", ",", "title", ",", "text", ",", "color", ",", "ellide", "=", "False", ")", ":", "template", "=", "'''\r\n <div style=\\'font-family: \"{font_family}\";\r\n font-size: {title_size}pt;\r\n ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin._format_signature
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.
spyder/widgets/mixins.py
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): """ Create HTML template for signature. This template will include indent after the method name, a highlight ...
[ "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", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L185-L288
[ "def", "_format_signature", "(", "self", ",", "signature", ",", "doc", "=", "''", ",", "parameter", "=", "''", ",", "parameter_doc", "=", "''", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "is_python", "=", "False", ")", ":", "active_parameter_template", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.show_calltip
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.
spyder/widgets/mixins.py
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): """ Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature informat...
[ "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", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L290-L315
[ "def", "show_calltip", "(", "self", ",", "signature", ",", "doc", "=", "''", ",", "parameter", "=", "''", ",", "parameter_doc", "=", "''", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "is_python", "=", "False", ")", ":", "# Find position of calltip\r", "p...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.show_tooltip
Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections.
spyder/widgets/mixins.py
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): """ Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections. """ if text is not None and ...
[ "Show", "tooltip", ".", "Tooltips", "will", "disappear", "if", "mouse", "hovers", "them", ".", "They", "are", "meant", "for", "quick", "inspections", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L317-L340
[ "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...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.set_eol_chars
Set widget end-of-line (EOL) characters from text (analyzes text)
spyder/widgets/mixins.py
def set_eol_chars(self, text): """Set widget end-of-line (EOL) characters from text (analyzes text)""" if not is_text_string(text): # testing for QString (PyQt API#1) text = to_text_string(text) eol_chars = sourcecode.get_eol_chars(text) is_document_modified = eol_chars ...
def set_eol_chars(self, text): """Set widget end-of-line (EOL) characters from text (analyzes text)""" if not is_text_string(text): # testing for QString (PyQt API#1) text = to_text_string(text) eol_chars = sourcecode.get_eol_chars(text) is_document_modified = eol_chars ...
[ "Set", "widget", "end", "-", "of", "-", "line", "(", "EOL", ")", "characters", "from", "text", "(", "analyzes", "text", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L343-L353
[ "def", "set_eol_chars", "(", "self", ",", "text", ")", ":", "if", "not", "is_text_string", "(", "text", ")", ":", "# testing for QString (PyQt API#1)\r", "text", "=", "to_text_string", "(", "text", ")", "eol_chars", "=", "sourcecode", ".", "get_eol_chars", "(", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_text_with_eol
Same as 'toPlainText', replace '\n' by correct end-of-line characters
spyder/widgets/mixins.py
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): """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('\...
[ "Same", "as", "toPlainText", "replace", "\\", "n", "by", "correct", "end", "-", "of", "-", "line", "characters" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L362-L371
[ "def", "get_text_with_eol", "(", "self", ")", ":", "utext", "=", "to_text_string", "(", "self", ".", "toPlainText", "(", ")", ")", "lines", "=", "utext", ".", "splitlines", "(", ")", "linesep", "=", "self", ".", "get_line_separator", "(", ")", "txt", "="...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_position
Get offset in character for the given subject from the start of text edit area
spyder/widgets/mixins.py
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): """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) ...
[ "Get", "offset", "in", "character", "for", "the", "given", "subject", "from", "the", "start", "of", "text", "edit", "area" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L375-L392
[ "def", "get_position", "(", "self", ",", "subject", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "if", "subject", "==", "'cursor'", ":", "pass", "elif", "subject", "==", "'sol'", ":", "cursor", ".", "movePosition", "(", "QTextCursor", "....
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.set_cursor_position
Set cursor position
spyder/widgets/mixins.py
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): """Set cursor position""" position = self.get_position(position) cursor = self.textCursor() cursor.setPosition(position) self.setTextCursor(cursor) self.ensureCursorVisible()
[ "Set", "cursor", "position" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L410-L416
[ "def", "set_cursor_position", "(", "self", ",", "position", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "setPosition", "(", "position", ")", "self", ".", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.move_cursor
Move cursor to left or right (unit: characters)
spyder/widgets/mixins.py
def move_cursor(self, chars=0): """Move cursor to left or right (unit: characters)""" direction = QTextCursor.Right if chars > 0 else QTextCursor.Left for _i in range(abs(chars)): self.moveCursor(direction, QTextCursor.MoveAnchor)
def move_cursor(self, chars=0): """Move cursor to left or right (unit: characters)""" direction = QTextCursor.Right if chars > 0 else QTextCursor.Left for _i in range(abs(chars)): self.moveCursor(direction, QTextCursor.MoveAnchor)
[ "Move", "cursor", "to", "left", "or", "right", "(", "unit", ":", "characters", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L418-L422
[ "def", "move_cursor", "(", "self", ",", "chars", "=", "0", ")", ":", "direction", "=", "QTextCursor", ".", "Right", "if", "chars", ">", "0", "else", "QTextCursor", ".", "Left", "for", "_i", "in", "range", "(", "abs", "(", "chars", ")", ")", ":", "s...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.is_cursor_on_first_line
Return True if cursor is on the first line
spyder/widgets/mixins.py
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): """Return True if cursor is on the first line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) return cursor.atStart()
[ "Return", "True", "if", "cursor", "is", "on", "the", "first", "line" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L424-L428
[ "def", "is_cursor_on_first_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "StartOfBlock", ")", "return", "cursor", ".", "atStart", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.is_cursor_on_last_line
Return True if cursor is on the last line
spyder/widgets/mixins.py
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): """Return True if cursor is on the last line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.EndOfBlock) return cursor.atEnd()
[ "Return", "True", "if", "cursor", "is", "on", "the", "last", "line" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L430-L434
[ "def", "is_cursor_on_last_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "EndOfBlock", ")", "return", "cursor", ".", "atEnd", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.is_cursor_before
Return True if cursor is before *position*
spyder/widgets/mixins.py
def is_cursor_before(self, position, char_offset=0): """Return True if cursor is before *position*""" position = self.get_position(position) + char_offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.set...
def is_cursor_before(self, position, char_offset=0): """Return True if cursor is before *position*""" position = self.get_position(position) + char_offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.set...
[ "Return", "True", "if", "cursor", "is", "before", "*", "position", "*" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L440-L447
[ "def", "is_cursor_before", "(", "self", ",", "position", ",", "char_offset", "=", "0", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "+", "char_offset", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "m...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.move_cursor_to_next
Move cursor to next *what* ('word' or 'character') toward *direction* ('left' or 'right')
spyder/widgets/mixins.py
def move_cursor_to_next(self, what='word', direction='left'): """ Move cursor to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.MoveAnchor)
def move_cursor_to_next(self, what='word', direction='left'): """ Move cursor to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.MoveAnchor)
[ "Move", "cursor", "to", "next", "*", "what", "*", "(", "word", "or", "character", ")", "toward", "*", "direction", "*", "(", "left", "or", "right", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L467-L472
[ "def", "move_cursor_to_next", "(", "self", ",", "what", "=", "'word'", ",", "direction", "=", "'left'", ")", ":", "self", ".", "__move_cursor_anchor", "(", "what", ",", "direction", ",", "QTextCursor", ".", "MoveAnchor", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.clear_selection
Clear current selection
spyder/widgets/mixins.py
def clear_selection(self): """Clear current selection""" cursor = self.textCursor() cursor.clearSelection() self.setTextCursor(cursor)
def clear_selection(self): """Clear current selection""" cursor = self.textCursor() cursor.clearSelection() self.setTextCursor(cursor)
[ "Clear", "current", "selection" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L476-L480
[ "def", "clear_selection", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "clearSelection", "(", ")", "self", ".", "setTextCursor", "(", "cursor", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.extend_selection_to_next
Extend selection to next *what* ('word' or 'character') toward *direction* ('left' or 'right')
spyder/widgets/mixins.py
def extend_selection_to_next(self, what='word', direction='left'): """ Extend selection to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.KeepAnchor)
def extend_selection_to_next(self, what='word', direction='left'): """ Extend selection to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.KeepAnchor)
[ "Extend", "selection", "to", "next", "*", "what", "*", "(", "word", "or", "character", ")", "toward", "*", "direction", "*", "(", "left", "or", "right", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L482-L487
[ "def", "extend_selection_to_next", "(", "self", ",", "what", "=", "'word'", ",", "direction", "=", "'left'", ")", ":", "self", ".", "__move_cursor_anchor", "(", "what", ",", "direction", ",", "QTextCursor", ".", "KeepAnchor", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_text_line
Return text line at line number *line_nb*
spyder/widgets/mixins.py
def get_text_line(self, line_nb): """Return text line at line number *line_nb*""" # Taking into account the case when a file ends in an empty line, # since splitlines doesn't return that line as the last element # TODO: Make this function more efficient try: ret...
def get_text_line(self, line_nb): """Return text line at line number *line_nb*""" # Taking into account the case when a file ends in an empty line, # since splitlines doesn't return that line as the last element # TODO: Make this function more efficient try: ret...
[ "Return", "text", "line", "at", "line", "number", "*", "line_nb", "*" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L499-L507
[ "def", "get_text_line", "(", "self", ",", "line_nb", ")", ":", "# Taking into account the case when a file ends in an empty line,\r", "# since splitlines doesn't return that line as the last element\r", "# TODO: Make this function more efficient\r", "try", ":", "return", "to_text_string"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_text
Return text between *position_from* and *position_to* Positions may be positions or 'sol', 'eol', 'sof', 'eof' or 'cursor'
spyder/widgets/mixins.py
def get_text(self, position_from, position_to): """ Return text between *position_from* and *position_to* Positions may be positions or 'sol', 'eol', 'sof', 'eof' or 'cursor' """ cursor = self.__select_text(position_from, position_to) text = to_text_string(cursor.se...
def get_text(self, position_from, position_to): """ Return text between *position_from* and *position_to* Positions may be positions or 'sol', 'eol', 'sof', 'eof' or 'cursor' """ cursor = self.__select_text(position_from, position_to) text = to_text_string(cursor.se...
[ "Return", "text", "between", "*", "position_from", "*", "and", "*", "position_to", "*", "Positions", "may", "be", "positions", "or", "sol", "eol", "sof", "eof", "or", "cursor" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L509-L522
[ "def", "get_text", "(", "self", ",", "position_from", ",", "position_to", ")", ":", "cursor", "=", "self", ".", "__select_text", "(", "position_from", ",", "position_to", ")", "text", "=", "to_text_string", "(", "cursor", ".", "selectedText", "(", ")", ")", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_character
Return character at *position* with the given offset.
spyder/widgets/mixins.py
def get_character(self, position, offset=0): """Return character at *position* with the given offset.""" position = self.get_position(position) + offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.setPo...
def get_character(self, position, offset=0): """Return character at *position* with the given offset.""" position = self.get_position(position) + offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.setPo...
[ "Return", "character", "at", "*", "position", "*", "with", "the", "given", "offset", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L524-L535
[ "def", "get_character", "(", "self", ",", "position", ",", "offset", "=", "0", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "+", "offset", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_current_word_and_position
Return current word, i.e. word at cursor position, and the start position
spyder/widgets/mixins.py
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): """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 ...
[ "Return", "current", "word", "i", ".", "e", ".", "word", "at", "cursor", "position", "and", "the", "start", "position" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L551-L596
[ "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", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_current_word
Return current word, i.e. word at cursor position
spyder/widgets/mixins.py
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): """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]
[ "Return", "current", "word", "i", ".", "e", ".", "word", "at", "cursor", "position" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L598-L602
[ "def", "get_current_word", "(", "self", ",", "completion", "=", "False", ")", ":", "ret", "=", "self", ".", "get_current_word_and_position", "(", "completion", ")", "if", "ret", "is", "not", "None", ":", "return", "ret", "[", "0", "]" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_current_line
Return current line's text
spyder/widgets/mixins.py
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): """Return current line's text""" cursor = self.textCursor() cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText())
[ "Return", "current", "line", "s", "text" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L604-L608
[ "def", "get_current_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "BlockUnderCursor", ")", "return", "to_text_string", "(", "cursor", ".", "selectedText", "(", ")", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_line_at
Return line at *coordinates* (QPoint)
spyder/widgets/mixins.py
def get_line_at(self, coordinates): """Return line at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText()).replace(u'\u2029', '')
def get_line_at(self, coordinates): """Return line at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText()).replace(u'\u2029', '')
[ "Return", "line", "at", "*", "coordinates", "*", "(", "QPoint", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L619-L623
[ "def", "get_line_at", "(", "self", ",", "coordinates", ")", ":", "cursor", "=", "self", ".", "cursorForPosition", "(", "coordinates", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "BlockUnderCursor", ")", "return", "to_text_string", "(", "cursor", "."...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_word_at
Return word at *coordinates* (QPoint)
spyder/widgets/mixins.py
def get_word_at(self, coordinates): """Return word at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.WordUnderCursor) return to_text_string(cursor.selectedText())
def get_word_at(self, coordinates): """Return word at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.WordUnderCursor) return to_text_string(cursor.selectedText())
[ "Return", "word", "at", "*", "coordinates", "*", "(", "QPoint", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L625-L629
[ "def", "get_word_at", "(", "self", ",", "coordinates", ")", ":", "cursor", "=", "self", ".", "cursorForPosition", "(", "coordinates", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "WordUnderCursor", ")", "return", "to_text_string", "(", "cursor", ".",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_block_indentation
Return line indentation (character number)
spyder/widgets/mixins.py
def get_block_indentation(self, block_nb): """Return line indentation (character number)""" text = to_text_string(self.document().findBlockByNumber(block_nb).text()) text = text.replace("\t", " "*self.tab_stop_width_spaces) return len(text)-len(text.lstrip())
def get_block_indentation(self, block_nb): """Return line indentation (character number)""" text = to_text_string(self.document().findBlockByNumber(block_nb).text()) text = text.replace("\t", " "*self.tab_stop_width_spaces) return len(text)-len(text.lstrip())
[ "Return", "line", "indentation", "(", "character", "number", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L631-L635
[ "def", "get_block_indentation", "(", "self", ",", "block_nb", ")", ":", "text", "=", "to_text_string", "(", "self", ".", "document", "(", ")", ".", "findBlockByNumber", "(", "block_nb", ")", ".", "text", "(", ")", ")", "text", "=", "text", ".", "replace"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_selection_bounds
Return selection bounds (block numbers)
spyder/widgets/mixins.py
def get_selection_bounds(self): """Return selection bounds (block numbers)""" cursor = self.textCursor() start, end = cursor.selectionStart(), cursor.selectionEnd() block_start = self.document().findBlock(start) block_end = self.document().findBlock(end) return sort...
def get_selection_bounds(self): """Return selection bounds (block numbers)""" cursor = self.textCursor() start, end = cursor.selectionStart(), cursor.selectionEnd() block_start = self.document().findBlock(start) block_end = self.document().findBlock(end) return sort...
[ "Return", "selection", "bounds", "(", "block", "numbers", ")" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L637-L643
[ "def", "get_selection_bounds", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "start", ",", "end", "=", "cursor", ".", "selectionStart", "(", ")", ",", "cursor", ".", "selectionEnd", "(", ")", "block_start", "=", "self", ".", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_selected_text
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
spyder/widgets/mixins.py
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 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...
[ "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" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L651-L659
[ "def", "get_selected_text", "(", "self", ")", ":", "return", "to_text_string", "(", "self", ".", "textCursor", "(", ")", ".", "selectedText", "(", ")", ")", ".", "replace", "(", "u\"\\u2029\"", ",", "self", ".", "get_line_separator", "(", ")", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.replace
Replace selected text by *text* If *pattern* is not None, replacing selected text using regular expression text substitution
spyder/widgets/mixins.py
def replace(self, text, pattern=None): """Replace selected text by *text* If *pattern* is not None, replacing selected text using regular expression text substitution""" cursor = self.textCursor() cursor.beginEditBlock() if pattern is not None: seltxt =...
def replace(self, text, pattern=None): """Replace selected text by *text* If *pattern* is not None, replacing selected text using regular expression text substitution""" cursor = self.textCursor() cursor.beginEditBlock() if pattern is not None: seltxt =...
[ "Replace", "selected", "text", "by", "*", "text", "*", "If", "*", "pattern", "*", "is", "not", "None", "replacing", "selected", "text", "using", "regular", "expression", "text", "substitution" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L665-L678
[ "def", "replace", "(", "self", ",", "text", ",", "pattern", "=", "None", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "beginEditBlock", "(", ")", "if", "pattern", "is", "not", "None", ":", "seltxt", "=", "to_text_string"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.find_multiline_pattern
Reimplement QTextDocument's find method Add support for *multiline* regular expressions
spyder/widgets/mixins.py
def find_multiline_pattern(self, regexp, cursor, findflag): """Reimplement QTextDocument's find method Add support for *multiline* regular expressions""" pattern = to_text_string(regexp.pattern()) text = to_text_string(self.toPlainText()) try: regobj = re.comp...
def find_multiline_pattern(self, regexp, cursor, findflag): """Reimplement QTextDocument's find method Add support for *multiline* regular expressions""" pattern = to_text_string(regexp.pattern()) text = to_text_string(self.toPlainText()) try: regobj = re.comp...
[ "Reimplement", "QTextDocument", "s", "find", "method", "Add", "support", "for", "*", "multiline", "*", "regular", "expressions" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L682-L710
[ "def", "find_multiline_pattern", "(", "self", ",", "regexp", ",", "cursor", ",", "findflag", ")", ":", "pattern", "=", "to_text_string", "(", "regexp", ".", "pattern", "(", ")", ")", "text", "=", "to_text_string", "(", "self", ".", "toPlainText", "(", ")",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.find_text
Find text
spyder/widgets/mixins.py
def find_text(self, text, changed=True, forward=True, case=False, words=False, regexp=False): """Find text""" cursor = self.textCursor() findflag = QTextDocument.FindFlag() if not forward: findflag = findflag | QTextDocument.FindBackward i...
def find_text(self, text, changed=True, forward=True, case=False, words=False, regexp=False): """Find text""" cursor = self.textCursor() findflag = QTextDocument.FindFlag() if not forward: findflag = findflag | QTextDocument.FindBackward i...
[ "Find", "text" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L712-L767
[ "def", "find_text", "(", "self", ",", "text", ",", "changed", "=", "True", ",", "forward", "=", "True", ",", "case", "=", "False", ",", "words", "=", "False", ",", "regexp", "=", "False", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_number_matches
Get the number of matches for the searched text.
spyder/widgets/mixins.py
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): """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...
[ "Get", "the", "number", "of", "matches", "for", "the", "searched", "text", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L773-L798
[ "def", "get_number_matches", "(", "self", ",", "pattern", ",", "source_text", "=", "''", ",", "case", "=", "False", ",", "regexp", "=", "False", ")", ":", "pattern", "=", "to_text_string", "(", "pattern", ")", "if", "not", "pattern", ":", "return", "0", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseEditMixin.get_match_number
Get number of the match for the searched text.
spyder/widgets/mixins.py
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): """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, ...
[ "Get", "number", "of", "the", "match", "for", "the", "searched", "text", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L800-L807
[ "def", "get_match_number", "(", "self", ",", "pattern", ",", "case", "=", "False", ",", "regexp", "=", "False", ")", ":", "position", "=", "self", ".", "textCursor", "(", ")", ".", "position", "(", ")", "source_text", "=", "self", ".", "get_text", "(",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TracebackLinksMixin.mouseReleaseEvent
Go to error
spyder/widgets/mixins.py
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): """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...
[ "Go", "to", "error" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L862-L868
[ "def", "mouseReleaseEvent", "(", "self", ",", "event", ")", ":", "self", ".", "QT_CLASS", ".", "mouseReleaseEvent", "(", "self", ",", "event", ")", "text", "=", "self", ".", "get_line_at", "(", "event", ".", "pos", "(", ")", ")", "if", "get_error_match",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TracebackLinksMixin.mouseMoveEvent
Show Pointing Hand Cursor on error messages
spyder/widgets/mixins.py
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): """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.__...
[ "Show", "Pointing", "Hand", "Cursor", "on", "error", "messages" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L870-L882
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "text", "=", "self", ".", "get_line_at", "(", "event", ".", "pos", "(", ")", ")", "if", "get_error_match", "(", "text", ")", ":", "if", "not", "self", ".", "__cursor_changed", ":", "QApplica...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
TracebackLinksMixin.leaveEvent
If cursor has not been restored yet, do it now
spyder/widgets/mixins.py
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 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)
[ "If", "cursor", "has", "not", "been", "restored", "yet", "do", "it", "now" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L884-L889
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "__cursor_changed", ":", "QApplication", ".", "restoreOverrideCursor", "(", ")", "self", ".", "__cursor_changed", "=", "False", "self", ".", "QT_CLASS", ".", "leaveEvent", "(", "sel...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
GetHelpMixin.show_object_info
Show signature calltip and/or docstring in the Help plugin
spyder/widgets/mixins.py
def show_object_info(self, text, call=False, force=False): """Show signature calltip and/or docstring in the Help plugin""" text = to_text_string(text) # Show docstring help_enabled = self.help_enabled or force if force and self.help is not None: self.help.doc...
def show_object_info(self, text, call=False, force=False): """Show signature calltip and/or docstring in the Help plugin""" text = to_text_string(text) # Show docstring help_enabled = self.help_enabled or force if force and self.help is not None: self.help.doc...
[ "Show", "signature", "calltip", "and", "/", "or", "docstring", "in", "the", "Help", "plugin" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L917-L967
[ "def", "show_object_info", "(", "self", ",", "text", ",", "call", "=", "False", ",", "force", "=", "False", ")", ":", "text", "=", "to_text_string", "(", "text", ")", "# Show docstring\r", "help_enabled", "=", "self", ".", "help_enabled", "or", "force", "i...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
SaveHistoryMixin.create_history_filename
Create history_filename with INITHISTORY if it doesn't exist.
spyder/widgets/mixins.py
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): """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...
[ "Create", "history_filename", "with", "INITHISTORY", "if", "it", "doesn", "t", "exist", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L988-L994
[ "def", "create_history_filename", "(", "self", ")", ":", "if", "self", ".", "history_filename", "and", "not", "osp", ".", "isfile", "(", "self", ".", "history_filename", ")", ":", "try", ":", "encoding", ".", "writelines", "(", "self", ".", "INITHISTORY", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
SaveHistoryMixin.add_to_history
Add command to history
spyder/widgets/mixins.py
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): """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...
[ "Add", "command", "to", "history" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L996-L1021
[ "def", "add_to_history", "(", "self", ",", "command", ")", ":", "command", "=", "to_text_string", "(", "command", ")", "if", "command", "in", "[", "''", ",", "'\\n'", "]", "or", "command", ".", "startswith", "(", "'Traceback'", ")", ":", "return", "if", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BrowseHistoryMixin.browse_history
Browse history
spyder/widgets/mixins.py
def browse_history(self, backward): """Browse history""" if self.is_cursor_before('eol') and self.hist_wholeline: self.hist_wholeline = False tocursor = self.get_current_line_to_cursor() text, self.histidx = self.find_in_history(tocursor, self.histidx, ...
def browse_history(self, backward): """Browse history""" if self.is_cursor_before('eol') and self.hist_wholeline: self.hist_wholeline = False tocursor = self.get_current_line_to_cursor() text, self.histidx = self.find_in_history(tocursor, self.histidx, ...
[ "Browse", "history" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L1035-L1052
[ "def", "browse_history", "(", "self", ",", "backward", ")", ":", "if", "self", ".", "is_cursor_before", "(", "'eol'", ")", "and", "self", ".", "hist_wholeline", ":", "self", ".", "hist_wholeline", "=", "False", "tocursor", "=", "self", ".", "get_current_line...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BrowseHistoryMixin.find_in_history
Find text 'tocursor' in history, from index 'start_idx
spyder/widgets/mixins.py
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): """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...
[ "Find", "text", "tocursor", "in", "history", "from", "index", "start_idx" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L1054-L1076
[ "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"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutTranslator.keyevent_to_keyseq
Return a QKeySequence representation of the provided QKeyEvent.
spyder/preferences/shortcuts.py
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): """Return a QKeySequence representation of the provided QKeyEvent.""" self.keyPressEvent(event) event.accept() return self.keySequence()
[ "Return", "a", "QKeySequence", "representation", "of", "the", "provided", "QKeyEvent", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L74-L78
[ "def", "keyevent_to_keyseq", "(", "self", ",", "event", ")", ":", "self", ".", "keyPressEvent", "(", "event", ")", "event", ".", "accept", "(", ")", "return", "self", ".", "keySequence", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutLineEdit.setText
Qt method extension.
spyder/preferences/shortcuts.py
def setText(self, sequence): """Qt method extension.""" self.setToolTip(sequence) super(ShortcutLineEdit, self).setText(sequence)
def setText(self, sequence): """Qt method extension.""" self.setToolTip(sequence) super(ShortcutLineEdit, self).setText(sequence)
[ "Qt", "method", "extension", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L115-L118
[ "def", "setText", "(", "self", ",", "sequence", ")", ":", "self", ".", "setToolTip", "(", "sequence", ")", "super", "(", "ShortcutLineEdit", ",", "self", ")", ".", "setText", "(", "sequence", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutFinder.set_text
Set the filter text.
spyder/preferences/shortcuts.py
def set_text(self, text): """Set the filter text.""" text = text.strip() new_text = self.text() + text self.setText(new_text)
def set_text(self, text): """Set the filter text.""" text = text.strip() new_text = self.text() + text self.setText(new_text)
[ "Set", "the", "filter", "text", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L136-L140
[ "def", "set_text", "(", "self", ",", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "new_text", "=", "self", ".", "text", "(", ")", "+", "text", "self", ".", "setText", "(", "new_text", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutFinder.keyPressEvent
Qt Override.
spyder/preferences/shortcuts.py
def keyPressEvent(self, event): """Qt Override.""" key = event.key() if key in [Qt.Key_Up]: self._parent.previous_row() elif key in [Qt.Key_Down]: self._parent.next_row() elif key in [Qt.Key_Enter, Qt.Key_Return]: self._parent.show_edit...
def keyPressEvent(self, event): """Qt Override.""" key = event.key() if key in [Qt.Key_Up]: self._parent.previous_row() elif key in [Qt.Key_Down]: self._parent.next_row() elif key in [Qt.Key_Enter, Qt.Key_Return]: self._parent.show_edit...
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L142-L152
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "key", "=", "event", ".", "key", "(", ")", "if", "key", "in", "[", "Qt", ".", "Key_Up", "]", ":", "self", ".", "_parent", ".", "previous_row", "(", ")", "elif", "key", "in", "[", "Qt", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.setup
Setup the ShortcutEditor with the provided arguments.
spyder/preferences/shortcuts.py
def setup(self): """Setup the ShortcutEditor with the provided arguments.""" # Widgets icon_info = HelperToolButton() icon_info.setIcon(get_std_icon('MessageBoxInformation')) layout_icon_info = QVBoxLayout() layout_icon_info.setContentsMargins(0, 0, 0, 0) l...
def setup(self): """Setup the ShortcutEditor with the provided arguments.""" # Widgets icon_info = HelperToolButton() icon_info.setIcon(get_std_icon('MessageBoxInformation')) layout_icon_info = QVBoxLayout() layout_icon_info.setContentsMargins(0, 0, 0, 0) l...
[ "Setup", "the", "ShortcutEditor", "with", "the", "provided", "arguments", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L181-L295
[ "def", "setup", "(", "self", ")", ":", "# Widgets\r", "icon_info", "=", "HelperToolButton", "(", ")", "icon_info", ".", "setIcon", "(", "get_std_icon", "(", "'MessageBoxInformation'", ")", ")", "layout_icon_info", "=", "QVBoxLayout", "(", ")", "layout_icon_info", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.event
Qt method override.
spyder/preferences/shortcuts.py
def event(self, event): """Qt method override.""" if event.type() in (QEvent.Shortcut, QEvent.ShortcutOverride): return True else: return super(ShortcutEditor, self).event(event)
def event(self, event): """Qt method override.""" if event.type() in (QEvent.Shortcut, QEvent.ShortcutOverride): return True else: return super(ShortcutEditor, self).event(event)
[ "Qt", "method", "override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L315-L320
[ "def", "event", "(", "self", ",", "event", ")", ":", "if", "event", ".", "type", "(", ")", "in", "(", "QEvent", ".", "Shortcut", ",", "QEvent", ".", "ShortcutOverride", ")", ":", "return", "True", "else", ":", "return", "super", "(", "ShortcutEditor", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.keyPressEvent
Qt method override.
spyder/preferences/shortcuts.py
def keyPressEvent(self, event): """Qt method override.""" event_key = event.key() if not event_key or event_key == Qt.Key_unknown: return if len(self._qsequences) == 4: # QKeySequence accepts a maximum of 4 different sequences. return i...
def keyPressEvent(self, event): """Qt method override.""" event_key = event.key() if not event_key or event_key == Qt.Key_unknown: return if len(self._qsequences) == 4: # QKeySequence accepts a maximum of 4 different sequences. return i...
[ "Qt", "method", "override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L322-L339
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "event_key", "=", "event", ".", "key", "(", ")", "if", "not", "event_key", "or", "event_key", "==", "Qt", ".", "Key_unknown", ":", "return", "if", "len", "(", "self", ".", "_qsequences", ")",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.check_conflicts
Check shortcuts for conflicts.
spyder/preferences/shortcuts.py
def check_conflicts(self): """Check shortcuts for conflicts.""" conflicts = [] if len(self._qsequences) == 0: return conflicts new_qsequence = self.new_qsequence for shortcut in self.shortcuts: shortcut_qsequence = QKeySequence.fromString(str(shor...
def check_conflicts(self): """Check shortcuts for conflicts.""" conflicts = [] if len(self._qsequences) == 0: return conflicts new_qsequence = self.new_qsequence for shortcut in self.shortcuts: shortcut_qsequence = QKeySequence.fromString(str(shor...
[ "Check", "shortcuts", "for", "conflicts", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L341-L358
[ "def", "check_conflicts", "(", "self", ")", ":", "conflicts", "=", "[", "]", "if", "len", "(", "self", ".", "_qsequences", ")", "==", "0", ":", "return", "conflicts", "new_qsequence", "=", "self", ".", "new_qsequence", "for", "shortcut", "in", "self", "....
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.check_singlekey
Check if the first sub-sequence of the new key sequence is valid.
spyder/preferences/shortcuts.py
def check_singlekey(self): """Check if the first sub-sequence of the new key sequence is valid.""" if len(self._qsequences) == 0: return True else: keystr = self._qsequences[0] valid_single_keys = (EDITOR_SINGLE_KEYS if ...
def check_singlekey(self): """Check if the first sub-sequence of the new key sequence is valid.""" if len(self._qsequences) == 0: return True else: keystr = self._qsequences[0] valid_single_keys = (EDITOR_SINGLE_KEYS if ...
[ "Check", "if", "the", "first", "sub", "-", "sequence", "of", "the", "new", "key", "sequence", "is", "valid", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L372-L390
[ "def", "check_singlekey", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_qsequences", ")", "==", "0", ":", "return", "True", "else", ":", "keystr", "=", "self", ".", "_qsequences", "[", "0", "]", "valid_single_keys", "=", "(", "EDITOR_SINGLE_KEY...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.update_warning
Update the warning label, buttons state and sequence text.
spyder/preferences/shortcuts.py
def update_warning(self): """Update the warning label, buttons state and sequence text.""" new_qsequence = self.new_qsequence new_sequence = self.new_sequence self.text_new_sequence.setText( new_qsequence.toString(QKeySequence.NativeText)) conflicts = self.che...
def update_warning(self): """Update the warning label, buttons state and sequence text.""" new_qsequence = self.new_qsequence new_sequence = self.new_sequence self.text_new_sequence.setText( new_qsequence.toString(QKeySequence.NativeText)) conflicts = self.che...
[ "Update", "the", "warning", "label", "buttons", "state", "and", "sequence", "text", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L392-L446
[ "def", "update_warning", "(", "self", ")", ":", "new_qsequence", "=", "self", ".", "new_qsequence", "new_sequence", "=", "self", ".", "new_sequence", "self", ".", "text_new_sequence", ".", "setText", "(", "new_qsequence", ".", "toString", "(", "QKeySequence", "....
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.set_sequence_from_str
This is a convenience method to set the new QKeySequence of the shortcut editor from a string.
spyder/preferences/shortcuts.py
def set_sequence_from_str(self, sequence): """ This is a convenience method to set the new QKeySequence of the shortcut editor from a string. """ self._qsequences = [QKeySequence(s) for s in sequence.split(', ')] self.update_warning()
def set_sequence_from_str(self, sequence): """ This is a convenience method to set the new QKeySequence of the shortcut editor from a string. """ self._qsequences = [QKeySequence(s) for s in sequence.split(', ')] self.update_warning()
[ "This", "is", "a", "convenience", "method", "to", "set", "the", "new", "QKeySequence", "of", "the", "shortcut", "editor", "from", "a", "string", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L448-L454
[ "def", "set_sequence_from_str", "(", "self", ",", "sequence", ")", ":", "self", ".", "_qsequences", "=", "[", "QKeySequence", "(", "s", ")", "for", "s", "in", "sequence", ".", "split", "(", "', '", ")", "]", "self", ".", "update_warning", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.set_sequence_to_default
Set the new sequence to the default value defined in the config.
spyder/preferences/shortcuts.py
def set_sequence_to_default(self): """Set the new sequence to the default value defined in the config.""" sequence = CONF.get_default( 'shortcuts', "{}/{}".format(self.context, self.name)) self._qsequences = sequence.split(', ') self.update_warning()
def set_sequence_to_default(self): """Set the new sequence to the default value defined in the config.""" sequence = CONF.get_default( 'shortcuts', "{}/{}".format(self.context, self.name)) self._qsequences = sequence.split(', ') self.update_warning()
[ "Set", "the", "new", "sequence", "to", "the", "default", "value", "defined", "in", "the", "config", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L456-L461
[ "def", "set_sequence_to_default", "(", "self", ")", ":", "sequence", "=", "CONF", ".", "get_default", "(", "'shortcuts'", ",", "\"{}/{}\"", ".", "format", "(", "self", ".", "context", ",", "self", ".", "name", ")", ")", "self", ".", "_qsequences", "=", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutEditor.accept_override
Unbind all conflicted shortcuts, and accept the new one
spyder/preferences/shortcuts.py
def accept_override(self): """Unbind all conflicted shortcuts, and accept the new one""" conflicts = self.check_conflicts() if conflicts: for shortcut in conflicts: shortcut.key = '' self.accept()
def accept_override(self): """Unbind all conflicted shortcuts, and accept the new one""" conflicts = self.check_conflicts() if conflicts: for shortcut in conflicts: shortcut.key = '' self.accept()
[ "Unbind", "all", "conflicted", "shortcuts", "and", "accept", "the", "new", "one" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L478-L484
[ "def", "accept_override", "(", "self", ")", ":", "conflicts", "=", "self", ".", "check_conflicts", "(", ")", "if", "conflicts", ":", "for", "shortcut", "in", "conflicts", ":", "shortcut", ".", "key", "=", "''", "self", ".", "accept", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsModel.current_index
Get the currently selected index in the parent table view.
spyder/preferences/shortcuts.py
def current_index(self): """Get the currently selected index in the parent table view.""" i = self._parent.proxy_model.mapToSource(self._parent.currentIndex()) return i
def current_index(self): """Get the currently selected index in the parent table view.""" i = self._parent.proxy_model.mapToSource(self._parent.currentIndex()) return i
[ "Get", "the", "currently", "selected", "index", "in", "the", "parent", "table", "view", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L537-L540
[ "def", "current_index", "(", "self", ")", ":", "i", "=", "self", ".", "_parent", ".", "proxy_model", ".", "mapToSource", "(", "self", ".", "_parent", ".", "currentIndex", "(", ")", ")", "return", "i" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsModel.sortByName
Qt Override.
spyder/preferences/shortcuts.py
def sortByName(self): """Qt Override.""" self.shortcuts = sorted(self.shortcuts, key=lambda x: x.context+'/'+x.name) self.reset()
def sortByName(self): """Qt Override.""" self.shortcuts = sorted(self.shortcuts, key=lambda x: x.context+'/'+x.name) self.reset()
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L542-L546
[ "def", "sortByName", "(", "self", ")", ":", "self", ".", "shortcuts", "=", "sorted", "(", "self", ".", "shortcuts", ",", "key", "=", "lambda", "x", ":", "x", ".", "context", "+", "'/'", "+", "x", ".", "name", ")", "self", ".", "reset", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsModel.data
Qt Override.
spyder/preferences/shortcuts.py
def data(self, index, role=Qt.DisplayRole): """Qt Override.""" row = index.row() if not index.isValid() or not (0 <= row < len(self.shortcuts)): return to_qvariant() shortcut = self.shortcuts[row] key = shortcut.key column = index.column() ...
def data(self, index, role=Qt.DisplayRole): """Qt Override.""" row = index.row() if not index.isValid() or not (0 <= row < len(self.shortcuts)): return to_qvariant() shortcut = self.shortcuts[row] key = shortcut.key column = index.column() ...
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L554-L588
[ "def", "data", "(", "self", ",", "index", ",", "role", "=", "Qt", ".", "DisplayRole", ")", ":", "row", "=", "index", ".", "row", "(", ")", "if", "not", "index", ".", "isValid", "(", ")", "or", "not", "(", "0", "<=", "row", "<", "len", "(", "s...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsModel.headerData
Qt Override.
spyder/preferences/shortcuts.py
def headerData(self, section, orientation, role=Qt.DisplayRole): """Qt Override.""" if role == Qt.TextAlignmentRole: if orientation == Qt.Horizontal: return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter)) return to_qvariant(int(Qt.AlignRight | Qt.AlignVCe...
def headerData(self, section, orientation, role=Qt.DisplayRole): """Qt Override.""" if role == Qt.TextAlignmentRole: if orientation == Qt.Horizontal: return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter)) return to_qvariant(int(Qt.AlignRight | Qt.AlignVCe...
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L590-L607
[ "def", "headerData", "(", "self", ",", "section", ",", "orientation", ",", "role", "=", "Qt", ".", "DisplayRole", ")", ":", "if", "role", "==", "Qt", ".", "TextAlignmentRole", ":", "if", "orientation", "==", "Qt", ".", "Horizontal", ":", "return", "to_qv...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsModel.setData
Qt Override.
spyder/preferences/shortcuts.py
def setData(self, index, value, role=Qt.EditRole): """Qt Override.""" if index.isValid() and 0 <= index.row() < len(self.shortcuts): shortcut = self.shortcuts[index.row()] column = index.column() text = from_qvariant(value, str) if column == SEQUENCE...
def setData(self, index, value, role=Qt.EditRole): """Qt Override.""" if index.isValid() and 0 <= index.row() < len(self.shortcuts): shortcut = self.shortcuts[index.row()] column = index.column() text = from_qvariant(value, str) if column == SEQUENCE...
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L617-L627
[ "def", "setData", "(", "self", ",", "index", ",", "value", ",", "role", "=", "Qt", ".", "EditRole", ")", ":", "if", "index", ".", "isValid", "(", ")", "and", "0", "<=", "index", ".", "row", "(", ")", "<", "len", "(", "self", ".", "shortcuts", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsModel.update_search_letters
Update search letters with text input in search box.
spyder/preferences/shortcuts.py
def update_search_letters(self, text): """Update search letters with text input in search box.""" self.letters = text names = [shortcut.name for shortcut in self.shortcuts] results = get_search_scores(text, names, template='<b>{0}</b>') self.normal_text, self.rich_text, self...
def update_search_letters(self, text): """Update search letters with text input in search box.""" self.letters = text names = [shortcut.name for shortcut in self.shortcuts] results = get_search_scores(text, names, template='<b>{0}</b>') self.normal_text, self.rich_text, self...
[ "Update", "search", "letters", "with", "text", "input", "in", "search", "box", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L629-L635
[ "def", "update_search_letters", "(", "self", ",", "text", ")", ":", "self", ".", "letters", "=", "text", "names", "=", "[", "shortcut", ".", "name", "for", "shortcut", "in", "self", ".", "shortcuts", "]", "results", "=", "get_search_scores", "(", "text", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
CustomSortFilterProxy.set_filter
Set regular expression for filter.
spyder/preferences/shortcuts.py
def set_filter(self, text): """Set regular expression for filter.""" self.pattern = get_search_regex(text) if self.pattern: self._parent.setSortingEnabled(False) else: self._parent.setSortingEnabled(True) self.invalidateFilter()
def set_filter(self, text): """Set regular expression for filter.""" self.pattern = get_search_regex(text) if self.pattern: self._parent.setSortingEnabled(False) else: self._parent.setSortingEnabled(True) self.invalidateFilter()
[ "Set", "regular", "expression", "for", "filter", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L659-L666
[ "def", "set_filter", "(", "self", ",", "text", ")", ":", "self", ".", "pattern", "=", "get_search_regex", "(", "text", ")", "if", "self", ".", "pattern", ":", "self", ".", "_parent", ".", "setSortingEnabled", "(", "False", ")", "else", ":", "self", "."...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
CustomSortFilterProxy.filterAcceptsRow
Qt override. Reimplemented from base class to allow the use of custom filtering.
spyder/preferences/shortcuts.py
def filterAcceptsRow(self, row_num, parent): """Qt override. Reimplemented from base class to allow the use of custom filtering. """ model = self.sourceModel() name = model.row(row_num).name r = re.search(self.pattern, name) if r is None: r...
def filterAcceptsRow(self, row_num, parent): """Qt override. Reimplemented from base class to allow the use of custom filtering. """ model = self.sourceModel() name = model.row(row_num).name r = re.search(self.pattern, name) if r is None: r...
[ "Qt", "override", ".", "Reimplemented", "from", "base", "class", "to", "allow", "the", "use", "of", "custom", "filtering", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L668-L680
[ "def", "filterAcceptsRow", "(", "self", ",", "row_num", ",", "parent", ")", ":", "model", "=", "self", ".", "sourceModel", "(", ")", "name", "=", "model", ".", "row", "(", "row_num", ")", ".", "name", "r", "=", "re", ".", "search", "(", "self", "."...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.focusOutEvent
Qt Override.
spyder/preferences/shortcuts.py
def focusOutEvent(self, e): """Qt Override.""" self.source_model.update_active_row() super(ShortcutsTable, self).focusOutEvent(e)
def focusOutEvent(self, e): """Qt Override.""" self.source_model.update_active_row() super(ShortcutsTable, self).focusOutEvent(e)
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L714-L717
[ "def", "focusOutEvent", "(", "self", ",", "e", ")", ":", "self", ".", "source_model", ".", "update_active_row", "(", ")", "super", "(", "ShortcutsTable", ",", "self", ")", ".", "focusOutEvent", "(", "e", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.focusInEvent
Qt Override.
spyder/preferences/shortcuts.py
def focusInEvent(self, e): """Qt Override.""" super(ShortcutsTable, self).focusInEvent(e) self.selectRow(self.currentIndex().row())
def focusInEvent(self, e): """Qt Override.""" super(ShortcutsTable, self).focusInEvent(e) self.selectRow(self.currentIndex().row())
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L719-L722
[ "def", "focusInEvent", "(", "self", ",", "e", ")", ":", "super", "(", "ShortcutsTable", ",", "self", ")", ".", "focusInEvent", "(", "e", ")", "self", ".", "selectRow", "(", "self", ".", "currentIndex", "(", ")", ".", "row", "(", ")", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.adjust_cells
Adjust column size based on contents.
spyder/preferences/shortcuts.py
def adjust_cells(self): """Adjust column size based on contents.""" self.resizeColumnsToContents() fm = self.horizontalHeader().fontMetrics() names = [fm.width(s.name + ' '*9) for s in self.source_model.shortcuts] self.setColumnWidth(NAME, max(names)) self.horizonta...
def adjust_cells(self): """Adjust column size based on contents.""" self.resizeColumnsToContents() fm = self.horizontalHeader().fontMetrics() names = [fm.width(s.name + ' '*9) for s in self.source_model.shortcuts] self.setColumnWidth(NAME, max(names)) self.horizonta...
[ "Adjust", "column", "size", "based", "on", "contents", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L729-L735
[ "def", "adjust_cells", "(", "self", ")", ":", "self", ".", "resizeColumnsToContents", "(", ")", "fm", "=", "self", ".", "horizontalHeader", "(", ")", ".", "fontMetrics", "(", ")", "names", "=", "[", "fm", ".", "width", "(", "s", ".", "name", "+", "' ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.load_shortcuts
Load shortcuts and assign to table model.
spyder/preferences/shortcuts.py
def load_shortcuts(self): """Load shortcuts and assign to table model.""" shortcuts = [] for context, name, keystr in iter_shortcuts(): shortcut = Shortcut(context, name, keystr) shortcuts.append(shortcut) shortcuts = sorted(shortcuts, key=lambda x: x.contex...
def load_shortcuts(self): """Load shortcuts and assign to table model.""" shortcuts = [] for context, name, keystr in iter_shortcuts(): shortcut = Shortcut(context, name, keystr) shortcuts.append(shortcut) shortcuts = sorted(shortcuts, key=lambda x: x.contex...
[ "Load", "shortcuts", "and", "assign", "to", "table", "model", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L737-L752
[ "def", "load_shortcuts", "(", "self", ")", ":", "shortcuts", "=", "[", "]", "for", "context", ",", "name", ",", "keystr", "in", "iter_shortcuts", "(", ")", ":", "shortcut", "=", "Shortcut", "(", "context", ",", "name", ",", "keystr", ")", "shortcuts", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.check_shortcuts
Check shortcuts for conflicts.
spyder/preferences/shortcuts.py
def check_shortcuts(self): """Check shortcuts for conflicts.""" conflicts = [] for index, sh1 in enumerate(self.source_model.shortcuts): if index == len(self.source_model.shortcuts)-1: break if str(sh1.key) == '': continue ...
def check_shortcuts(self): """Check shortcuts for conflicts.""" conflicts = [] for index, sh1 in enumerate(self.source_model.shortcuts): if index == len(self.source_model.shortcuts)-1: break if str(sh1.key) == '': continue ...
[ "Check", "shortcuts", "for", "conflicts", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L754-L775
[ "def", "check_shortcuts", "(", "self", ")", ":", "conflicts", "=", "[", "]", "for", "index", ",", "sh1", "in", "enumerate", "(", "self", ".", "source_model", ".", "shortcuts", ")", ":", "if", "index", "==", "len", "(", "self", ".", "source_model", ".",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.save_shortcuts
Save shortcuts from table model.
spyder/preferences/shortcuts.py
def save_shortcuts(self): """Save shortcuts from table model.""" self.check_shortcuts() for shortcut in self.source_model.shortcuts: shortcut.save()
def save_shortcuts(self): """Save shortcuts from table model.""" self.check_shortcuts() for shortcut in self.source_model.shortcuts: shortcut.save()
[ "Save", "shortcuts", "from", "table", "model", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L777-L781
[ "def", "save_shortcuts", "(", "self", ")", ":", "self", ".", "check_shortcuts", "(", ")", "for", "shortcut", "in", "self", ".", "source_model", ".", "shortcuts", ":", "shortcut", ".", "save", "(", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.show_editor
Create, setup and display the shortcut editor dialog.
spyder/preferences/shortcuts.py
def show_editor(self): """Create, setup and display the shortcut editor dialog.""" index = self.proxy_model.mapToSource(self.currentIndex()) row, column = index.row(), index.column() shortcuts = self.source_model.shortcuts context = shortcuts[row].context name = sho...
def show_editor(self): """Create, setup and display the shortcut editor dialog.""" index = self.proxy_model.mapToSource(self.currentIndex()) row, column = index.row(), index.column() shortcuts = self.source_model.shortcuts context = shortcuts[row].context name = sho...
[ "Create", "setup", "and", "display", "the", "shortcut", "editor", "dialog", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L783-L798
[ "def", "show_editor", "(", "self", ")", ":", "index", "=", "self", ".", "proxy_model", ".", "mapToSource", "(", "self", ".", "currentIndex", "(", ")", ")", "row", ",", "column", "=", "index", ".", "row", "(", ")", ",", "index", ".", "column", "(", ...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.set_regex
Update the regex text for the shortcut finder.
spyder/preferences/shortcuts.py
def set_regex(self, regex=None, reset=False): """Update the regex text for the shortcut finder.""" if reset: text = '' else: text = self.finder.text().replace(' ', '').lower() self.proxy_model.set_filter(text) self.source_model.update_search_lette...
def set_regex(self, regex=None, reset=False): """Update the regex text for the shortcut finder.""" if reset: text = '' else: text = self.finder.text().replace(' ', '').lower() self.proxy_model.set_filter(text) self.source_model.update_search_lette...
[ "Update", "the", "regex", "text", "for", "the", "shortcut", "finder", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L800-L813
[ "def", "set_regex", "(", "self", ",", "regex", "=", "None", ",", "reset", "=", "False", ")", ":", "if", "reset", ":", "text", "=", "''", "else", ":", "text", "=", "self", ".", "finder", ".", "text", "(", ")", ".", "replace", "(", "' '", ",", "'...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.next_row
Move to next row from currently selected row.
spyder/preferences/shortcuts.py
def next_row(self): """Move to next row from currently selected row.""" row = self.currentIndex().row() rows = self.proxy_model.rowCount() if row + 1 == rows: row = -1 self.selectRow(row + 1)
def next_row(self): """Move to next row from currently selected row.""" row = self.currentIndex().row() rows = self.proxy_model.rowCount() if row + 1 == rows: row = -1 self.selectRow(row + 1)
[ "Move", "to", "next", "row", "from", "currently", "selected", "row", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L815-L821
[ "def", "next_row", "(", "self", ")", ":", "row", "=", "self", ".", "currentIndex", "(", ")", ".", "row", "(", ")", "rows", "=", "self", ".", "proxy_model", ".", "rowCount", "(", ")", "if", "row", "+", "1", "==", "rows", ":", "row", "=", "-", "1...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.previous_row
Move to previous row from currently selected row.
spyder/preferences/shortcuts.py
def previous_row(self): """Move to previous row from currently selected row.""" row = self.currentIndex().row() rows = self.proxy_model.rowCount() if row == 0: row = rows self.selectRow(row - 1)
def previous_row(self): """Move to previous row from currently selected row.""" row = self.currentIndex().row() rows = self.proxy_model.rowCount() if row == 0: row = rows self.selectRow(row - 1)
[ "Move", "to", "previous", "row", "from", "currently", "selected", "row", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L823-L829
[ "def", "previous_row", "(", "self", ")", ":", "row", "=", "self", ".", "currentIndex", "(", ")", ".", "row", "(", ")", "rows", "=", "self", ".", "proxy_model", ".", "rowCount", "(", ")", "if", "row", "==", "0", ":", "row", "=", "rows", "self", "....
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsTable.keyPressEvent
Qt Override.
spyder/preferences/shortcuts.py
def keyPressEvent(self, event): """Qt Override.""" key = event.key() if key in [Qt.Key_Enter, Qt.Key_Return]: self.show_editor() elif key in [Qt.Key_Tab]: self.finder.setFocus() elif key in [Qt.Key_Backtab]: self.parent().reset_btn.setF...
def keyPressEvent(self, event): """Qt Override.""" key = event.key() if key in [Qt.Key_Enter, Qt.Key_Return]: self.show_editor() elif key in [Qt.Key_Tab]: self.finder.setFocus() elif key in [Qt.Key_Backtab]: self.parent().reset_btn.setF...
[ "Qt", "Override", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L831-L849
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "key", "=", "event", ".", "key", "(", ")", "if", "key", "in", "[", "Qt", ".", "Key_Enter", ",", "Qt", ".", "Key_Return", "]", ":", "self", ".", "show_editor", "(", ")", "elif", "key", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
ShortcutsConfigPage.reset_to_default
Reset to default values of the shortcuts making a confirmation.
spyder/preferences/shortcuts.py
def reset_to_default(self): """Reset to default values of the shortcuts making a confirmation.""" reset = QMessageBox.warning(self, _("Shortcuts reset"), _("Do you want to reset " "to default values?"), ...
def reset_to_default(self): """Reset to default values of the shortcuts making a confirmation.""" reset = QMessageBox.warning(self, _("Shortcuts reset"), _("Do you want to reset " "to default values?"), ...
[ "Reset", "to", "default", "values", "of", "the", "shortcuts", "making", "a", "confirmation", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L895-L907
[ "def", "reset_to_default", "(", "self", ")", ":", "reset", "=", "QMessageBox", ".", "warning", "(", "self", ",", "_", "(", "\"Shortcuts reset\"", ")", ",", "_", "(", "\"Do you want to reset \"", "\"to default values?\"", ")", ",", "QMessageBox", ".", "Yes", "|...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_color_scheme
Get a color scheme from config using its name
spyder/utils/syntaxhighlighters.py
def get_color_scheme(name): """Get a color scheme from config using its name""" name = name.lower() scheme = {} for key in COLOR_SCHEME_KEYS: try: scheme[key] = CONF.get('appearance', name+'/'+key) except: scheme[key] = CONF.get('appearance', 'spyder/'+key...
def get_color_scheme(name): """Get a color scheme from config using its name""" name = name.lower() scheme = {} for key in COLOR_SCHEME_KEYS: try: scheme[key] = CONF.get('appearance', name+'/'+key) except: scheme[key] = CONF.get('appearance', 'spyder/'+key...
[ "Get", "a", "color", "scheme", "from", "config", "using", "its", "name" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L88-L97
[ "def", "get_color_scheme", "(", "name", ")", ":", "name", "=", "name", ".", "lower", "(", ")", "scheme", "=", "{", "}", "for", "key", "in", "COLOR_SCHEME_KEYS", ":", "try", ":", "scheme", "[", "key", "]", "=", "CONF", ".", "get", "(", "'appearance'",...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_python_patterns
Strongly inspired from idlelib.ColorDelegator.make_pat
spyder/utils/syntaxhighlighters.py
def make_python_patterns(additional_keywords=[], additional_builtins=[]): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwlist = keyword.kwlist + additional_keywords builtinlist = [str(name) for name in dir(builtins) if not name.startswith('_')] + additional_builtins r...
def make_python_patterns(additional_keywords=[], additional_builtins=[]): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwlist = keyword.kwlist + additional_keywords builtinlist = [str(name) for name in dir(builtins) if not name.startswith('_')] + additional_builtins r...
[ "Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L329-L389
[ "def", "make_python_patterns", "(", "additional_keywords", "=", "[", "]", ",", "additional_builtins", "=", "[", "]", ")", ":", "kwlist", "=", "keyword", ".", "kwlist", "+", "additional_keywords", "builtinlist", "=", "[", "str", "(", "name", ")", "for", "name...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
get_code_cell_name
Returns a code cell name from a code cell comment.
spyder/utils/syntaxhighlighters.py
def get_code_cell_name(text): """Returns a code cell name from a code cell comment.""" name = text.strip().lstrip("#% ") if name.startswith("<codecell>"): name = name[10:].lstrip() elif name.startswith("In["): name = name[2:] if name.endswith("]:"): name = nam...
def get_code_cell_name(text): """Returns a code cell name from a code cell comment.""" name = text.strip().lstrip("#% ") if name.startswith("<codecell>"): name = name[10:].lstrip() elif name.startswith("In["): name = name[2:] if name.endswith("]:"): name = nam...
[ "Returns", "a", "code", "cell", "name", "from", "a", "code", "cell", "comment", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L392-L402
[ "def", "get_code_cell_name", "(", "text", ")", ":", "name", "=", "text", ".", "strip", "(", ")", ".", "lstrip", "(", "\"#% \"", ")", "if", "name", ".", "startswith", "(", "\"<codecell>\"", ")", ":", "name", "=", "name", "[", "10", ":", "]", ".", "l...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_generic_c_patterns
Strongly inspired from idlelib.ColorDelegator.make_pat
spyder/utils/syntaxhighlighters.py
def make_generic_c_patterns(keywords, builtins, instance=None, define=None, comment=None): "Strongly inspired from idlelib.ColorDelegator.make_pat" kw = r"\b" + any("keyword", keywords.split()) + r"\b" builtin = r"\b" + any("builtin", builtins.split()+C_TYPES.split()) + r"\b"...
def make_generic_c_patterns(keywords, builtins, instance=None, define=None, comment=None): "Strongly inspired from idlelib.ColorDelegator.make_pat" kw = r"\b" + any("keyword", keywords.split()) + r"\b" builtin = r"\b" + any("builtin", builtins.split()+C_TYPES.split()) + r"\b"...
[ "Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L607-L629
[ "def", "make_generic_c_patterns", "(", "keywords", ",", "builtins", ",", "instance", "=", "None", ",", "define", "=", "None", ",", "comment", "=", "None", ")", ":", "kw", "=", "r\"\\b\"", "+", "any", "(", "\"keyword\"", ",", "keywords", ".", "split", "("...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_fortran_patterns
Strongly inspired from idlelib.ColorDelegator.make_pat
spyder/utils/syntaxhighlighters.py
def make_fortran_patterns(): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwstr = 'access action advance allocatable allocate apostrophe assign assignment associate asynchronous backspace bind blank blockdata call case character class close common complex contains continue cycle data deallocate de...
def make_fortran_patterns(): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwstr = 'access action advance allocatable allocate apostrophe assign assignment associate asynchronous backspace bind blank blockdata call case character class close common complex contains continue cycle data deallocate de...
[ "Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L705-L721
[ "def", "make_fortran_patterns", "(", ")", ":", "kwstr", "=", "'access action advance allocatable allocate apostrophe assign assignment associate asynchronous backspace bind blank blockdata call case character class close common complex contains continue cycle data deallocate decimal delim default dime...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_nsis_patterns
Strongly inspired from idlelib.ColorDelegator.make_pat
spyder/utils/syntaxhighlighters.py
def make_nsis_patterns(): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwstr1 = 'Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateD...
def make_nsis_patterns(): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwstr1 = 'Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateD...
[ "Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L829-L840
[ "def", "make_nsis_patterns", "(", ")", ":", "kwstr1", "=", "'Abort AddBrandingImage AddSize AllowRootDirInstall AllowSkipFiles AutoCloseWindow BGFont BGGradient BrandingText BringToFront Call CallInstDLL Caption ClearErrors CompletedText ComponentText CopyFiles CRCCheck CreateDirectory CreateFont Crea...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_gettext_patterns
Strongly inspired from idlelib.ColorDelegator.make_pat
spyder/utils/syntaxhighlighters.py
def make_gettext_patterns(): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwstr = 'msgid msgstr' kw = r"\b" + any("keyword", kwstr.split()) + r"\b" fuzzy = any("builtin", [r"#,[^\n]*"]) links = any("normal", [r"#:[^\n]*"]) comment = any("comment", [r"#[^\n]*"]) number = an...
def make_gettext_patterns(): "Strongly inspired from idlelib.ColorDelegator.make_pat" kwstr = 'msgid msgstr' kw = r"\b" + any("keyword", kwstr.split()) + r"\b" fuzzy = any("builtin", [r"#,[^\n]*"]) links = any("normal", [r"#:[^\n]*"]) comment = any("comment", [r"#[^\n]*"]) number = an...
[ "Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L852-L867
[ "def", "make_gettext_patterns", "(", ")", ":", "kwstr", "=", "'msgid msgstr'", "kw", "=", "r\"\\b\"", "+", "any", "(", "\"keyword\"", ",", "kwstr", ".", "split", "(", ")", ")", "+", "r\"\\b\"", "fuzzy", "=", "any", "(", "\"builtin\"", ",", "[", "r\"#,[^\...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_yaml_patterns
Strongly inspired from sublime highlighter
spyder/utils/syntaxhighlighters.py
def make_yaml_patterns(): "Strongly inspired from sublime highlighter " kw = any("keyword", [r":|>|-|\||\[|\]|[A-Za-z][\w\s\-\_ ]+(?=:)"]) links = any("normal", [r"#:[^\n]*"]) comment = any("comment", [r"#[^\n]*"]) number = any("number", [r"\b[+-]?[0-9]+[lL]?\b", ...
def make_yaml_patterns(): "Strongly inspired from sublime highlighter " kw = any("keyword", [r":|>|-|\||\[|\]|[A-Za-z][\w\s\-\_ ]+(?=:)"]) links = any("normal", [r"#:[^\n]*"]) comment = any("comment", [r"#[^\n]*"]) number = any("number", [r"\b[+-]?[0-9]+[lL]?\b", ...
[ "Strongly", "inspired", "from", "sublime", "highlighter" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L878-L891
[ "def", "make_yaml_patterns", "(", ")", ":", "kw", "=", "any", "(", "\"keyword\"", ",", "[", "r\":|>|-|\\||\\[|\\]|[A-Za-z][\\w\\s\\-\\_ ]+(?=:)\"", "]", ")", "links", "=", "any", "(", "\"normal\"", ",", "[", "r\"#:[^\\n]*\"", "]", ")", "comment", "=", "any", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
make_html_patterns
Strongly inspired from idlelib.ColorDelegator.make_pat
spyder/utils/syntaxhighlighters.py
def make_html_patterns(): """Strongly inspired from idlelib.ColorDelegator.make_pat """ tags = any("builtin", [r"<", r"[\?/]?>", r"(?<=<).*?(?=[ >])"]) keywords = any("keyword", [r" [\w:-]*?(?==)"]) string = any("string", [r'".*?"']) comment = any("comment", [r"<!--.*?-->"]) multiline_comm...
def make_html_patterns(): """Strongly inspired from idlelib.ColorDelegator.make_pat """ tags = any("builtin", [r"<", r"[\?/]?>", r"(?<=<).*?(?=[ >])"]) keywords = any("keyword", [r" [\w:-]*?(?==)"]) string = any("string", [r'".*?"']) comment = any("comment", [r"<!--.*?-->"]) multiline_comm...
[ "Strongly", "inspired", "from", "idlelib", ".", "ColorDelegator", ".", "make_pat" ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L962-L971
[ "def", "make_html_patterns", "(", ")", ":", "tags", "=", "any", "(", "\"builtin\"", ",", "[", "r\"<\"", ",", "r\"[\\?/]?>\"", ",", "r\"(?<=<).*?(?=[ >])\"", "]", ")", "keywords", "=", "any", "(", "\"keyword\"", ",", "[", "r\" [\\w:-]*?(?==)\"", "]", ")", "st...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
guess_pygments_highlighter
Factory to generate syntax highlighter for the given filename. If a syntax highlighter is not available for a particular file, this function will attempt to generate one based on the lexers in Pygments. If Pygments is not available or does not have an appropriate lexer, TextSH will be returned in...
spyder/utils/syntaxhighlighters.py
def guess_pygments_highlighter(filename): """Factory to generate syntax highlighter for the given filename. If a syntax highlighter is not available for a particular file, this function will attempt to generate one based on the lexers in Pygments. If Pygments is not available or does not have an ...
def guess_pygments_highlighter(filename): """Factory to generate syntax highlighter for the given filename. If a syntax highlighter is not available for a particular file, this function will attempt to generate one based on the lexers in Pygments. If Pygments is not available or does not have an ...
[ "Factory", "to", "generate", "syntax", "highlighter", "for", "the", "given", "filename", ".", "If", "a", "syntax", "highlighter", "is", "not", "available", "for", "a", "particular", "file", "this", "function", "will", "attempt", "to", "generate", "one", "based...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1233-L1259
[ "def", "guess_pygments_highlighter", "(", "filename", ")", ":", "try", ":", "from", "pygments", ".", "lexers", "import", "get_lexer_for_filename", ",", "get_lexer_by_name", "except", "Exception", ":", "return", "TextSH", "root", ",", "ext", "=", "os", ".", "path...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseSH.highlightBlock
Highlights a block of text. Please do not override, this method. Instead you should implement :func:`spyder.utils.syntaxhighplighters.SyntaxHighlighter.highlight_block`. :param text: text to highlight.
spyder/utils/syntaxhighlighters.py
def highlightBlock(self, text): """ Highlights a block of text. Please do not override, this method. Instead you should implement :func:`spyder.utils.syntaxhighplighters.SyntaxHighlighter.highlight_block`. :param text: text to highlight. """ self.highligh...
def highlightBlock(self, text): """ Highlights a block of text. Please do not override, this method. Instead you should implement :func:`spyder.utils.syntaxhighplighters.SyntaxHighlighter.highlight_block`. :param text: text to highlight. """ self.highligh...
[ "Highlights", "a", "block", "of", "text", ".", "Please", "do", "not", "override", "this", "method", ".", "Instead", "you", "should", "implement", ":", "func", ":", "spyder", ".", "utils", ".", "syntaxhighplighters", ".", "SyntaxHighlighter", ".", "highlight_bl...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L219-L236
[ "def", "highlightBlock", "(", "self", ",", "text", ")", ":", "self", ".", "highlight_block", "(", "text", ")", "# Process blocks for fold detection\r", "current_block", "=", "self", ".", "currentBlock", "(", ")", "previous_block", "=", "self", ".", "_find_prev_non...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
BaseSH.highlight_spaces
Make blank space less apparent by setting the foreground alpha. This only has an effect when 'Show blank space' is turned on. Derived classes could call this function at the end of highlightBlock().
spyder/utils/syntaxhighlighters.py
def highlight_spaces(self, text, offset=0): """ Make blank space less apparent by setting the foreground alpha. This only has an effect when 'Show blank space' is turned on. Derived classes could call this function at the end of highlightBlock(). """ flags_...
def highlight_spaces(self, text, offset=0): """ Make blank space less apparent by setting the foreground alpha. This only has an effect when 'Show blank space' is turned on. Derived classes could call this function at the end of highlightBlock(). """ flags_...
[ "Make", "blank", "space", "less", "apparent", "by", "setting", "the", "foreground", "alpha", ".", "This", "only", "has", "an", "effect", "when", "Show", "blank", "space", "is", "turned", "on", ".", "Derived", "classes", "could", "call", "this", "function", ...
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L247-L275
[ "def", "highlight_spaces", "(", "self", ",", "text", ",", "offset", "=", "0", ")", ":", "flags_text", "=", "self", ".", "document", "(", ")", ".", "defaultTextOption", "(", ")", ".", "flags", "(", ")", "show_blanks", "=", "flags_text", "&", "QTextOption"...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
train
PythonSH.highlight_block
Implement specific highlight for Python.
spyder/utils/syntaxhighlighters.py
def highlight_block(self, text): """Implement specific highlight for Python.""" text = to_text_string(text) prev_state = tbh.get_state(self.currentBlock().previous()) if prev_state == self.INSIDE_DQ3STRING: offset = -4 text = r'""" '+text elif prev_...
def highlight_block(self, text): """Implement specific highlight for Python.""" text = to_text_string(text) prev_state = tbh.get_state(self.currentBlock().previous()) if prev_state == self.INSIDE_DQ3STRING: offset = -4 text = r'""" '+text elif prev_...
[ "Implement", "specific", "highlight", "for", "Python", "." ]
spyder-ide/spyder
python
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L426-L557
[ "def", "highlight_block", "(", "self", ",", "text", ")", ":", "text", "=", "to_text_string", "(", "text", ")", "prev_state", "=", "tbh", ".", "get_state", "(", "self", ".", "currentBlock", "(", ")", ".", "previous", "(", ")", ")", "if", "prev_state", "...
f76836ce1b924bcc4efd3f74f2960d26a4e528e0