Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def sort_file_tabs_alphabetically(self): while self.sorted() is False: for i in range(0, self.tabs.tabBar().count()): if(self.tabs.tabBar().tabText(i) > self.tabs.tabBar().tabText(i + 1)): ...
[ "Sort open tabs alphabetically." ]
Please provide a description of the function:def sorted(self): for i in range(0, self.tabs.tabBar().count() - 1): if (self.tabs.tabBar().tabText(i) > self.tabs.tabBar().tabText(i + 1)): return False return True
[ "Utility function for sort_file_tabs_alphabetically()." ]
Please provide a description of the function:def add_last_closed_file(self, fname): if fname in self.last_closed_files: self.last_closed_files.remove(fname) self.last_closed_files.insert(0, fname) if len(self.last_closed_files) > 10: self.last_closed_files....
[ "Add to last closed file list." ]
Please provide a description of the function:def save_if_changed(self, cancelable=False, index=None): if index is None: indexes = list(range(self.get_stack_count())) else: indexes = [index] buttons = QMessageBox.Yes | QMessageBox.No if cancelable: ...
[ "Ask user to save file if modified.\r\n\r\n Args:\r\n cancelable: Show Cancel button.\r\n index: File to check for modification.\r\n\r\n Returns:\r\n False when save() fails or is cancelled.\r\n True when save() is successful, there are no modifications,\r\n...
Please provide a description of the function:def _write_to_file(self, fileinfo, filename): txt = to_text_string(fileinfo.editor.get_text_with_eol()) fileinfo.encoding = encoding.write(txt, filename, fileinfo.encoding)
[ "Low-level function for writing text of editor to file.\r\n\r\n Args:\r\n fileinfo: FileInfo object associated to editor to be saved\r\n filename: str with filename to save to\r\n\r\n This is a low-level function that only saves the text to file in the\r\n correct encoding...
Please provide a description of the function:def save(self, index=None, force=False): if index is None: # Save the currently edited file if not self.get_stack_count(): return index = self.get_stack_index() finfo = self.data[index] ...
[ "Write text of editor to a file.\r\n\r\n Args:\r\n index: self.data index to save. If None, defaults to\r\n currentIndex().\r\n force: Force save regardless of file state.\r\n\r\n Returns:\r\n True upon successful save or when file doesn't need to be sa...
Please provide a description of the function:def file_saved_in_other_editorstack(self, original_filename, filename): index = self.has_filename(original_filename) if index is None: return finfo = self.data[index] finfo.newly_created = False finfo.filena...
[ "\r\n File was just saved in another editorstack, let's synchronize!\r\n This avoids file being automatically reloaded.\r\n\r\n The original filename is passed instead of an index in case the tabs\r\n on the editor stacks were moved and are now in a different order - see\r\n issue...
Please provide a description of the function:def select_savename(self, original_filename): if self.edit_filetypes is None: self.edit_filetypes = get_edit_filetypes() if self.edit_filters is None: self.edit_filters = get_edit_filters() # Don't use filters ...
[ "Select a name to save a file.\r\n\r\n Args:\r\n original_filename: Used in the dialog to display the current file\r\n path and name.\r\n\r\n Returns:\r\n Normalized path for the selected file name or None if no name was\r\n selected.\r\n " ]
Please provide a description of the function:def save_as(self, index=None): if index is None: # Save the currently edited file index = self.get_stack_index() finfo = self.data[index] # The next line is necessary to avoid checking if the file exists ...
[ "Save file as...\r\n\r\n Args:\r\n index: self.data index for the file to save.\r\n\r\n Returns:\r\n False if no file name was selected or if save() was unsuccessful.\r\n True is save() was successful.\r\n\r\n Gets the new file name from select_savename(). If n...
Please provide a description of the function:def save_copy_as(self, index=None): if index is None: # Save the currently edited file index = self.get_stack_index() finfo = self.data[index] original_filename = finfo.filename filename = self.select_sa...
[ "Save copy of file as...\r\n\r\n Args:\r\n index: self.data index for the file to save.\r\n\r\n Returns:\r\n False if no file name was selected or if save() was unsuccessful.\r\n True is save() was successful.\r\n\r\n Gets the new file name from select_savename(...
Please provide a description of the function:def save_all(self): for index in range(self.get_stack_count()): if self.data[index].editor.document().isModified(): self.save(index)
[ "Save all opened files.\r\n\r\n Iterate through self.data and call save() on any modified files.\r\n " ]
Please provide a description of the function:def analyze_script(self, index=None): if self.is_analysis_done: return if index is None: index = self.get_stack_index() if self.data: finfo = self.data[index] if self.todolist_enabled: ...
[ "Analyze current script with todos" ]
Please provide a description of the function:def set_todo_results(self, filename, todo_results): index = self.has_filename(filename) if index is None: return self.data[index].set_todo_results(todo_results)
[ "Synchronize todo results between editorstacks" ]
Please provide a description of the function:def current_changed(self, index): # count = self.get_stack_count() # for btn in (self.filelist_btn, self.previous_btn, self.next_btn): # btn.setEnabled(count > 1) editor = self.get_current_editor() if editor.lsp_ready...
[ "Stack index has changed" ]
Please provide a description of the function:def tab_navigation_mru(self, forward=True): self.tabs_switcher = TabSwitcherWidget(self, self.stack_history, self.tabs) self.tabs_switcher.show() self.tabs_switcher.select_row(1 if forward e...
[ "\r\n Tab navigation with \"most recently used\" behaviour.\r\n\r\n It's fired when pressing 'go to previous file' or 'go to next file'\r\n shortcuts.\r\n\r\n forward:\r\n True: move to next file\r\n False: move to previous file\r\n " ]
Please provide a description of the function:def focus_changed(self): fwidget = QApplication.focusWidget() for finfo in self.data: if fwidget is finfo.editor: self.refresh() self.editor_focus_changed.emit()
[ "Editor focus has changed" ]
Please provide a description of the function:def _refresh_outlineexplorer(self, index=None, update=True, clear=False): oe = self.outlineexplorer if oe is None: return if index is None: index = self.get_stack_index() if self.data: finfo...
[ "Refresh outline explorer panel" ]
Please provide a description of the function:def _sync_outlineexplorer_file_order(self): if self.outlineexplorer is not None: self.outlineexplorer.treewidget.set_editor_ids_order( [finfo.editor.get_document_id() for finfo in self.data])
[ "\r\n Order the root file items of the outline explorer as in the tabbar\r\n of the current EditorStack.\r\n " ]
Please provide a description of the function:def __refresh_statusbar(self, index): finfo = self.data[index] self.encoding_changed.emit(finfo.encoding) # Refresh cursor position status: line, index = finfo.editor.get_cursor_line_column() self.sig_editor_cursor_posit...
[ "Refreshing statusbar widgets" ]
Please provide a description of the function:def __check_file_status(self, index): if self.__file_status_flag: # Avoid infinite loop: when the QMessageBox.question pops, it # gets focus and then give it back to the CodeEditor instance, # triggering a refresh cyc...
[ "Check if file has been changed in any way outside Spyder:\r\n 1. removed, moved or renamed outside Spyder\r\n 2. modified outside Spyder" ]
Please provide a description of the function:def refresh(self, index=None): if index is None: index = self.get_stack_index() # Set current editor if self.get_stack_count(): index = self.get_stack_index() finfo = self.data[index] ed...
[ "Refresh tabwidget" ]
Please provide a description of the function:def modification_changed(self, state=None, index=None, editor_id=None): if editor_id is not None: for index, _finfo in enumerate(self.data): if id(_finfo.editor) == editor_id: break # This must be...
[ "\r\n Current editor's modification state has changed\r\n --> change tab title depending on new modification state\r\n --> enable/disable save/save all actions\r\n " ]
Please provide a description of the function:def reload(self, index): finfo = self.data[index] txt, finfo.encoding = encoding.read(finfo.filename) finfo.lastmodified = QFileInfo(finfo.filename).lastModified() position = finfo.editor.get_position('cursor') finfo.edi...
[ "Reload file from disk" ]
Please provide a description of the function:def revert(self): index = self.get_stack_index() finfo = self.data[index] filename = finfo.filename if finfo.editor.document().isModified(): self.msgbox = QMessageBox( QMessageBox.Warning, ...
[ "Revert file from disk" ]
Please provide a description of the function:def create_new_editor(self, fname, enc, txt, set_current, new=False, cloned_from=None, add_where='end'): editor = codeeditor.CodeEditor(self) editor.go_to_definition.connect( lambda fname, line, column: self...
[ "\r\n Create a new editor instance\r\n Returns finfo object (instead of editor as in previous releases)\r\n " ]
Please provide a description of the function:def send_to_help(self, name, signature, force=False): if not force and not self.help_enabled: return if self.help is not None \ and (force or self.help.dockwidget.isVisible()): signature = to_text_string(signat...
[ "qstr1: obj_text, qstr2: argpspec, qstr3: note, qstr4: doc_text" ]
Please provide a description of the function:def new(self, filename, encoding, text, default_content=False, empty=False): finfo = self.create_new_editor(filename, encoding, text, set_current=False, new=True) finfo.editor.set_cursor_positio...
[ "\r\n Create new filename with *encoding* and *text*\r\n " ]
Please provide a description of the function:def load(self, filename, set_current=True, add_where='end'): filename = osp.abspath(to_text_string(filename)) self.starting_long_process.emit(_("Loading %s...") % filename) text, enc = encoding.read(filename) finfo = self.create_...
[ "\r\n Load filename, create an editor instance and return it\r\n *Warning* This is loading file, creating editor but not executing\r\n the source code analysis -- the analysis must be done by the editor\r\n plugin (in case multiple editorstack instances are handled)\r\n " ]
Please provide a description of the function:def set_os_eol_chars(self, index=None, osname=None): if osname is None: osname = os.name if index is None: index = self.get_stack_index() finfo = self.data[index] eol_chars = sourcecode.get_eol_chars_fro...
[ "Sets the EOL character(s) based on the operating system.\r\n\r\n If `osname` is None, then the default line endings for the current\r\n operating system (`os.name` value) will be used.\r\n\r\n `osname` can be one of:\r\n ('posix', 'nt', 'java')\r\n " ]
Please provide a description of the function:def remove_trailing_spaces(self, index=None): if index is None: index = self.get_stack_index() finfo = self.data[index] finfo.editor.remove_trailing_spaces()
[ "Remove trailing spaces" ]
Please provide a description of the function:def fix_indentation(self, index=None): if index is None: index = self.get_stack_index() finfo = self.data[index] finfo.editor.fix_indentation()
[ "Replace tab characters by spaces" ]
Please provide a description of the function:def run_selection(self): text = self.get_current_editor().get_selection_as_executable_code() if text: self.exec_in_extconsole.emit(text.rstrip(), self.focus_to_editor) return editor = self.get_current_editor() ...
[ "\r\n Run selected text or current line in console.\r\n\r\n If some text is selected, then execute that text in console.\r\n\r\n If no text is selected, then execute current line, unless current line\r\n is empty. Then, advance cursor to next line. If cursor is on last line\r\n an...
Please provide a description of the function:def run_cell(self): text, line = self.get_current_editor().get_cell_as_executable_code() self._run_cell_text(text, line)
[ "Run current cell." ]
Please provide a description of the function:def advance_cell(self, reverse=False): if not reverse: move_func = self.get_current_editor().go_to_next_cell else: move_func = self.get_current_editor().go_to_previous_cell if self.focus_to_editor: ...
[ "Advance to the next cell.\r\n\r\n reverse = True --> go to previous cell.\r\n " ]
Please provide a description of the function:def re_run_last_cell(self): text, line = (self.get_current_editor() .get_last_cell_as_executable_code()) self._run_cell_text(text, line)
[ "Run the previous cell again." ]
Please provide a description of the function:def _run_cell_text(self, text, line): finfo = self.get_current_finfo() editor = self.get_current_editor() oe_data = editor.highlighter.get_outlineexplorer_data() try: cell_name = oe_data.get(line-1).def_name ...
[ "Run cell code in the console.\r\n\r\n Cell code is run in the console by copying it to the console if\r\n `self.run_cell_copy` is ``True`` otherwise by using the `run_cell`\r\n function.\r\n\r\n Parameters\r\n ----------\r\n text : str\r\n The code in the cell a...
Please provide a description of the function:def dragEnterEvent(self, event): source = event.mimeData() # The second check is necessary on Windows, where source.hasUrls() # can return True but source.urls() is [] # The third check is needed since a file could be dropped fro...
[ "Reimplement Qt method\r\n Inform Qt about the types of data that the widget accepts" ]
Please provide a description of the function:def dropEvent(self, event): source = event.mimeData() # The second check is necessary when mimedata2url(source) # returns None. # Fixes issue 7742 if source.hasUrls() and mimedata2url(source): files = mimeda...
[ "Reimplement Qt method\r\n Unpack dropped data and handle it" ]
Please provide a description of the function:def split(self, orientation=Qt.Vertical): self.setOrientation(orientation) self.editorstack.set_orientation(orientation) editorsplitter = EditorSplitter(self.parent(), self.plugin, self.menu_actions, ...
[ "Create and attach a new EditorSplitter to the current EditorSplitter.\r\n\r\n The new EditorSplitter widget will contain an EditorStack that\r\n is a clone of the current EditorStack.\r\n\r\n A single EditorSplitter instance can be split multiple times, but the\r\n orientation will be t...
Please provide a description of the function:def iter_editorstacks(self): editorstacks = [(self.widget(0), self.orientation())] if self.count() > 1: editorsplitter = self.widget(1) editorstacks += editorsplitter.iter_editorstacks() return editorstacks
[ "Return the editor stacks for this splitter and every first child.\r\n\r\n Note: If a splitter contains more than one splitter as a direct\r\n child, only the first child's editor stack is included.\r\n\r\n Returns:\r\n List of tuples containing (EditorStack instance, orientati...
Please provide a description of the function:def get_layout_settings(self): splitsettings = [] for editorstack, orientation in self.iter_editorstacks(): clines = [] cfname = '' # XXX - this overrides value from the loop to always be False? ...
[ "Return the layout state for this splitter and its children.\r\n\r\n Record the current state, including file names and current line\r\n numbers, of the splitter panels.\r\n\r\n Returns:\r\n A dictionary containing keys {hexstate, sizes, splitsettings}.\r\n hexstate: S...
Please provide a description of the function:def set_layout_settings(self, settings, dont_goto=None): splitsettings = settings.get('splitsettings') if splitsettings is None: return splitter = self editor = None for index, (is_vertical, cfname, clines) ...
[ "Restore layout state for the splitter panels.\r\n\r\n Apply the settings to restore a saved layout within the editor. If\r\n the splitsettings key doesn't exist, then return without restoring\r\n any settings.\r\n\r\n The current EditorSplitter (self) calls split() for each element\r\n...
Please provide a description of the function:def add_toolbars_to_menu(self, menu_title, actions): # Six is the position of the view menu in menus list # that you can find in plugins/editor.py setup_other_windows. view_menu = self.menus[6] if actions == self.toolbars and vie...
[ "Add toolbars to a menu." ]
Please provide a description of the function:def load_toolbars(self): toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[]) if toolbars_names: dic = {} for toolbar in self.toolbars: dic[toolbar.objectName()] = toolbar ...
[ "Loads the last visible toolbars from the .ini file." ]
Please provide a description of the function:def resizeEvent(self, event): if not self.isMaximized() and not self.isFullScreen(): self.window_size = self.size() QMainWindow.resizeEvent(self, event)
[ "Reimplement Qt method" ]
Please provide a description of the function:def get_layout_settings(self): splitsettings = self.editorwidget.editorsplitter.get_layout_settings() return dict(size=(self.window_size.width(), self.window_size.height()), pos=(self.pos().x(), self.pos().y()), ...
[ "Return layout state" ]
Please provide a description of the function:def set_layout_settings(self, settings): size = settings.get('size') if size is not None: self.resize( QSize(*size) ) self.window_size = self.size() pos = settings.get('pos') if pos is not None: ...
[ "Restore layout state" ]
Please provide a description of the function:def file_saved_in_editorstack(self, editorstack_id_str, original_filename, filename): for editorstack in self.editorstacks: if str(id(editorstack)) != editorstack_id_str: editorstack.file_sav...
[ "A file was saved in editorstack, this notifies others" ]
Please provide a description of the function:def file_renamed_in_data_in_editorstack(self, editorstack_id_str, original_filename, filename): for editorstack in self.editorstacks: if str(id(editorstack)) != editorstack_id_str: ...
[ "A file was renamed in data in editorstack, this notifies others" ]
Please provide a description of the function:def findinfiles_callback(self): widget = QApplication.focusWidget() if not self.ismaximized: self.dockwidget.setVisible(True) self.dockwidget.raise_() text = '' try: if widget.has_selected_t...
[ "Find in files callback" ]
Please provide a description of the function:def register_plugin(self): self.main.add_dockwidget(self) self.findinfiles.result_browser.sig_edit_goto.connect( self.main.editor.load) self.findinfiles.find_options.redirect_stdio...
[ "Register plugin in Spyder's main window" ]
Please provide a description of the function:def closing_plugin(self, cancelable=False): self.findinfiles.closing_widget() # stop search thread and clean-up options = self.findinfiles.find_options.get_options(to_save=True) if options is not None: (search_text, text_re,...
[ "Perform actions before parent main window is closed" ]
Please provide a description of the function:def _draw_fold_region_background(self, block, painter): r = FoldScope(block) th = TextHelper(self.editor) start, end = r.get_range(ignore_blank_lines=True) if start > 0: top = th.line_pos_from_number(start) else: ...
[ "\n Draw the fold region when the mouse is over and non collapsed\n indicator.\n\n :param top: Top position\n :param block: Current block.\n :param painter: QPainter\n " ]
Please provide a description of the function:def _draw_rect(self, rect, painter): c = self.editor.sideareas_color grad = QLinearGradient(rect.topLeft(), rect.topRight()) if sys.platform == 'darwin': grad.setColorAt(0, c.lighter(100)) ...
[ "\n Draw the background rectangle using the current style primitive color.\n\n :param rect: The fold zone rect to draw\n\n :param painter: The widget's painter.\n " ]
Please provide a description of the function:def _draw_fold_indicator(self, top, mouse_over, collapsed, painter): rect = QRect(0, top, self.sizeHint().width(), self.sizeHint().height()) if self._native_icons: opt = QStyleOptionViewItem() opt....
[ "\n Draw the fold indicator/trigger (arrow).\n\n :param top: Top position\n :param mouse_over: Whether the mouse is over the indicator\n :param collapsed: Whether the trigger is collapsed or not.\n :param painter: QPainter\n " ]
Please provide a description of the function:def find_parent_scope(block): original = block if not TextBlockHelper.is_fold_trigger(block): # search level of next non blank line while block.text().strip() == '' and block.isValid(): block = block.next() ...
[ "Find parent scope, if the block is not a fold trigger." ]
Please provide a description of the function:def _clear_scope_decos(self): for deco in self._scope_decos: self.editor.decorations.remove(deco) self._scope_decos[:] = []
[ "Clear scope decorations (on the editor)" ]
Please provide a description of the function:def _get_scope_highlight_color(self): color = self.editor.sideareas_color if color.lightness() < 128: color = drift_color(color, 130) else: color = drift_color(color, 105) return color
[ "\n Gets the base scope highlight color (derivated from the editor\n background)\n\n For lighter themes will be a darker color, \n and for darker ones will be a lighter color\n " ]
Please provide a description of the function:def _decorate_block(self, start, end): color = self._get_scope_highlight_color() draw_order = DRAW_ORDERS.get('codefolding') d = TextDecoration(self.editor.document(), start_line=start, end_line=end+1, draw_order=dr...
[ "\n Create a decoration and add it to the editor.\n\n Args:\n start (int) start line of the decoration\n end (int) end line of the decoration\n " ]
Please provide a description of the function:def _highlight_block(self, block): scope = FoldScope(block) if (self._current_scope is None or self._current_scope.get_range() != scope.get_range()): self._current_scope = scope self._clear_scope_decos() ...
[ "\n Highlights the current fold scope.\n\n :param block: Block that starts the current fold scope.\n " ]
Please provide a description of the function:def mouseMoveEvent(self, event): super(FoldingPanel, self).mouseMoveEvent(event) th = TextHelper(self.editor) line = th.line_nbr_from_position(event.pos().y()) if line >= 0: block = FoldScope.find_parent_scope( ...
[ "\n Detect mouser over indicator and highlight the current scope in the\n editor (up and down decoration arround the foldable text when the mouse\n is over an indicator).\n\n :param event: event\n " ]
Please provide a description of the function:def mousePressEvent(self, event): if self._mouse_over_line is not None: block = self.editor.document().findBlockByNumber( self._mouse_over_line) self.toggle_fold_trigger(block)
[ "Folds/unfolds the pressed indicator if any." ]
Please provide a description of the function:def _show_previous_blank_lines(block): # set previous blank lines visibles pblock = block.previous() while (pblock.text().strip() == '' and pblock.blockNumber() >= 0): pblock.setVisible(True) pblock = pb...
[ "\n Show the block previous blank lines\n " ]
Please provide a description of the function:def refresh_decorations(self, force=False): cursor = self.editor.textCursor() if (self._prev_cursor is None or force or self._prev_cursor.blockNumber() != cursor.blockNumber()): for deco in self._block_decos: ...
[ "\n Refresh decorations colors. This function is called by the syntax\n highlighter when the style changed so that we may update our\n decorations colors according to the new style.\n " ]
Please provide a description of the function:def _refresh_editor_and_scrollbars(self): TextHelper(self.editor).mark_whole_doc_dirty() self.editor.repaint() s = self.editor.size() s.setWidth(s.width() + 1) self.editor.resizeEvent(QResizeEvent(self.editor.size(), s))
[ "\n Refrehes editor content and scollbars.\n\n We generate a fake resize event to refresh scroll bar.\n\n We have the same problem as described here:\n http://www.qtcentre.org/threads/44803 and we apply the same solution\n (don't worry, there is no visual effect, the editor does n...
Please provide a description of the function:def collapse_all(self): self._clear_block_deco() block = self.editor.document().firstBlock() last = self.editor.document().lastBlock() while block.isValid(): lvl = TextBlockHelper.get_fold_lvl(block) trigger = ...
[ "\n Collapses all triggers and makes all blocks with fold level > 0\n invisible.\n " ]
Please provide a description of the function:def _clear_block_deco(self): for deco in self._block_decos: self.editor.decorations.remove(deco) self._block_decos[:] = []
[ "Clear the folded block decorations." ]
Please provide a description of the function:def expand_all(self): block = self.editor.document().firstBlock() while block.isValid(): TextBlockHelper.set_collapsed(block, False) block.setVisible(True) block = block.next() self._clear_block_deco() ...
[ "Expands all fold triggers." ]
Please provide a description of the function:def _on_action_toggle(self): block = FoldScope.find_parent_scope(self.editor.textCursor().block()) self.toggle_fold_trigger(block)
[ "Toggle the current fold trigger." ]
Please provide a description of the function:def _highlight_caret_scope(self): cursor = self.editor.textCursor() block_nbr = cursor.blockNumber() if self._block_nbr != block_nbr: block = FoldScope.find_parent_scope( self.editor.textCursor().block()) ...
[ "\n Highlight the scope of the current caret position.\n\n This get called only if :attr:`\n spyder.widgets.panels.FoldingPanel.highlight_care_scope` is True.\n " ]
Please provide a description of the function:def set_menu_actions(self, menu_actions): if self.menu_actions is not None: add_actions(self.menu, self.menu_actions)
[ "Add options to corner menu." ]
Please provide a description of the function:def refresh(self): if self.tabwidget.count(): editor = self.tabwidget.currentWidget() else: editor = None self.find_widget.set_editor(editor)
[ "Refresh tabwidget." ]
Please provide a description of the function:def move_tab(self, index_from, index_to): filename = self.filenames.pop(index_from) editor = self.editors.pop(index_from) self.filenames.insert(index_to, filename) self.editors.insert(index_to, editor)
[ "\n Move tab.\n\n (tabs themselves have already been moved by the history.tabwidget)\n " ]
Please provide a description of the function:def add_history(self, filename, color_scheme, font, wrap): filename = encoding.to_unicode_from_fs(filename) if filename in self.filenames: return editor = codeeditor.CodeEditor(self) if osp.splitext(filename)[1] == '.py': ...
[ "\n Add new history tab.\n\n Args:\n filename (str): file to be loaded in a new tab.\n " ]
Please provide a description of the function:def append_to_history(self, filename, command, go_to_eof): if not is_text_string(filename): # filename is a QString filename = to_text_string(filename.toUtf8(), 'utf-8') command = to_text_string(command) index = self.filenames.ind...
[ "\n Append an entry to history filename.\n\n Args:\n filename (str): file to be updated in a new tab.\n command (str): line to be added.\n go_to_eof (bool): scroll to the end of file.\n " ]
Please provide a description of the function:def request(req=None, method=None, requires_response=True): if req is None: return functools.partial(request, method=method, requires_response=requires_response) @functools.wraps(req) def wrapper(self, *args, **kwarg...
[ "Call function req and then emit its results to the LSP server." ]
Please provide a description of the function:def class_register(cls): cls.handler_registry = {} for method_name in dir(cls): method = getattr(cls, method_name) if hasattr(method, '_handle'): cls.handler_registry.update({method._handle: method_name}) return cls
[ "Class decorator that allows to map LSP method names to class methods." ]
Please provide a description of the function:def update_font(self): font = self.get_plugin_font() for client in self.clients: client.set_font(font)
[ "Update font from Preferences" ]
Please provide a description of the function:def apply_plugin_settings(self, options): font_n = 'plugin_font' font_o = self.get_plugin_font() help_n = 'connect_to_oi' help_o = CONF.get('help', 'connect/ipython_console') color_scheme_n = 'color_scheme_name' ...
[ "Apply configuration file's plugin settings" ]
Please provide a description of the function:def toggle_view(self, checked): if checked: self.dockwidget.show() self.dockwidget.raise_() # Start a client in case there are none shown if not self.clients: if self.main.is_setting_up: ...
[ "Toggle view" ]
Please provide a description of the function:def closing_plugin(self, cancelable=False): self.mainwindow_close = True for client in self.clients: client.shutdown() client.remove_stderr_file() client.dialog_manager.close_all() client.close()...
[ "Perform actions before parent main window is closed" ]
Please provide a description of the function:def refresh_plugin(self): client = None if self.tabwidget.count(): client = self.tabwidget.currentWidget() # Decide what to show for each client if client.info_page != client.blank_page: # ...
[ "Refresh tabwidget" ]
Please provide a description of the function:def get_plugin_actions(self): create_client_action = create_action( self, _("New console (default settings)"), icon=ima.icon('ipython_console'), ...
[ "Return a list of actions related to plugin." ]
Please provide a description of the function:def register_plugin(self): self.main.add_dockwidget(self) self.focus_changed.connect(self.main.plugin_focus_changed) self.edit_goto.connect(self.main.editor.load) self.edit_goto[str, int, str, bool].connect( ...
[ "Register plugin in Spyder's main window" ]
Please provide a description of the function:def get_focus_client(self): widget = QApplication.focusWidget() for client in self.get_clients(): if widget is client or widget is client.get_control(): return client
[ "Return current client with focus, if any" ]
Please provide a description of the function:def run_script(self, filename, wdir, args, debug, post_mortem, current_client, clear_variables): norm = lambda text: remove_backslashes(to_text_string(text)) # Run Cython files in a dedicated console is_cython = osp....
[ "Run script in current or dedicated client" ]
Please provide a description of the function:def run_cell(self, code, cell_name, filename, run_cell_copy): def norm(text): return remove_backslashes(to_text_string(text)) self.run_cell_filename = filename # Select client to execute code on it client = sel...
[ "Run cell in current or dedicated client.", "{}" ]
Please provide a description of the function:def set_current_client_working_directory(self, directory): shellwidget = self.get_current_shellwidget() if shellwidget is not None: shellwidget.set_cwd(directory)
[ "Set current client working directory." ]
Please provide a description of the function:def set_working_directory(self, dirname): if dirname: self.main.workingdirectory.chdir(dirname, refresh_explorer=True, refresh_console=False)
[ "Set current working directory.\r\n In the workingdirectory and explorer plugins.\r\n " ]
Please provide a description of the function:def execute_code(self, lines, current_client=True, clear_variables=False): sw = self.get_current_shellwidget() if sw is not None: if sw._reading: pass else: if not current_client: ...
[ "Execute code instructions." ]
Please provide a description of the function:def create_new_client(self, give_focus=True, filename='', is_cython=False, is_pylab=False, is_sympy=False, given_name=None): self.master_clients += 1 client_id = dict(int_id=to_text_string(self.master_clients), ...
[ "Create a new client" ]
Please provide a description of the function:def create_client_for_kernel(self): connect_output = KernelConnectionDialog.get_connection_parameters(self) (connection_file, hostname, sshkey, password, ok) = connect_output if not ok: return else: self...
[ "Create a client connected to an existing kernel" ]
Please provide a description of the function:def connect_client_to_kernel(self, client, is_cython=False, is_pylab=False, is_sympy=False): connection_file = client.connection_file stderr_handle = None if self.test_no_stderr else client.stderr_handle ...
[ "Connect a client to its kernel" ]
Please provide a description of the function:def edit_file(self, filename, line): if encoding.is_text_file(filename): # The default line number sent by ipykernel is always the last # one, but we prefer to use the first. self.edit_goto.emit(filename, 1, '')
[ "Handle %edit magic petitions." ]
Please provide a description of the function:def config_options(self): # ---- Jupyter config ---- try: full_cfg = load_pyconfig_files(['jupyter_qtconsole_config.py'], jupyter_config_dir()) # From the full config we only ...
[ "\r\n Generate a Trailets Config instance for shell widgets using our\r\n config system\r\n\r\n This lets us create each widget with its own config\r\n " ]
Please provide a description of the function:def interpreter_versions(self): if CONF.get('main_interpreter', 'default'): from IPython.core import release versions = dict( python_version = sys.version.split("\n")[0].strip(), ipython_version =...
[ "Python and IPython versions used by clients" ]
Please provide a description of the function:def additional_options(self, is_pylab=False, is_sympy=False): options = dict( pylab=self.get_option('pylab'), autoload_pylab=self.get_option('pylab/autoload'), sympy=self.get_option('symbolic_math'), show...
[ "\r\n Additional options for shell widgets that are not defined\r\n in JupyterWidget config options\r\n " ]
Please provide a description of the function:def register_client(self, client, give_focus=True): client.configure_shellwidget(give_focus=give_focus) # Local vars shellwidget = client.shellwidget control = shellwidget._control page_control = shellwidget._page_cont...
[ "Register new client" ]
Please provide a description of the function:def close_client(self, index=None, client=None, force=False): if not self.tabwidget.count(): return if client is not None: index = self.tabwidget.indexOf(client) # if index is not found in tabwidget it's beca...
[ "Close client tab from index or widget (or close current tab)" ]
Please provide a description of the function:def get_client_index_from_id(self, client_id): for index, client in enumerate(self.clients): if id(client) == client_id: return index
[ "Return client index from id" ]