rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.groupsFolder.manage_delFolder(groupId) | self.groupsFolder.manage_delObjects([groupId,]) | def delete_group_folder(self, groupId): # Create the group folder self.groupsFolder.manage_delFolder(groupId) assert not(hasattr(self.groupsFolder, groupId)) return group |
return group | def delete_group_folder(self, groupId): # Create the group folder self.groupsFolder.manage_delFolder(groupId) assert not(hasattr(self.groupsFolder, groupId)) return group | |
def del_user_group(self, group): memberGroup = '%s_member' % group.id | def delete_user_group(self, groupId): memberGroup = '%s_member' % groupId | def del_user_group(self, group): memberGroup = '%s_member' % group.id self.site_root.acl_users.userFolderDelGroups([memberGroup]) |
listManager.manage_delFolder(listManager.aq_explicit, groupId) | listManager.manage_delObjects([groupId,]) | def delete_list(self, groupId): listManager = self.site_root.ListManager listManager.manage_delFolder(listManager.aq_explicit, groupId) |
s.br_x = 300. s.br_y = 300. | def run(self): s = sane.open(self.selectedScanner) | |
event.modifiers() & QtCore.Qt.ControlModifier and \ | self._control_down(event.modifiers()) and \ | def event(self, event): """ Reimplemented to override shortcuts, if necessary. """ if self.override_shortcuts and \ event.type() == QtCore.QEvent.ShortcutOverride and \ event.modifiers() & QtCore.Qt.ControlModifier and \ event.key() in self._ctrl_down_remap: event.accept() return True else: return QtGui.QPlainTextEdit.... |
ctrl_down = event.modifiers() & QtCore.Qt.ControlModifier | ctrl_down = self._control_down(event.modifiers()) | def keyPressEvent(self, event): """ Reimplemented to create a console-like interface. """ intercepted = False cursor = self.textCursor() position = cursor.position() key = event.key() ctrl_down = event.modifiers() & QtCore.Qt.ControlModifier alt_down = event.modifiers() & QtCore.Qt.AltModifier shift_down = event.modifi... |
text = str(QtGui.QApplication.clipboard().text(mode)) | text = str(QtGui.QApplication.clipboard().text(mode)).rstrip() | def paste(self, mode=QtGui.QClipboard.Clipboard): """ Paste the contents of the clipboard into the input region. |
def paste(self): | def paste(self, mode=QtGui.QClipboard.Clipboard): | def paste(self): """ Paste the contents of the clipboard into the input region. """ if self._control.textInteractionFlags() & QtCore.Qt.TextEditable: try: text = str(QtGui.QApplication.clipboard().text()) except UnicodeEncodeError: pass else: self._insert_plain_text_into_buffer(dedent(text)) |
text = str(QtGui.QApplication.clipboard().text()) | text = str(QtGui.QApplication.clipboard().text(mode)) | def paste(self): """ Paste the contents of the clipboard into the input region. """ if self._control.textInteractionFlags() & QtCore.Qt.TextEditable: try: text = str(QtGui.QApplication.clipboard().text()) except UnicodeEncodeError: pass else: self._insert_plain_text_into_buffer(dedent(text)) |
control.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) | control.viewport().installEventFilter(self) | def _create_control(self): """ Creates and connects the underlying text widget. """ if self.kind == 'plain': control = ConsolePlainTextEdit() elif self.kind == 'rich': control = ConsoleTextEdit() control.setAcceptRichText(False) control.installEventFilter(self) control.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) ... |
layout = QtGui.QVBoxLayout(self) layout.setMargin(0) | def __init__(self, kind='plain', parent=None): """ Create a ConsoleWidget. Parameters ---------- kind : str, optional [default 'plain'] The type of text widget to use. Valid values are 'plain', which specifies a QPlainTextEdit, and 'rich', which specifies a QTextEdit. | |
if obj == self._control: etype = event.type() | etype = event.type() if etype == QtCore.QEvent.KeyPress and \ self._control_key_down(event.modifiers()) and \ event.key() in self._ctrl_down_remap: new_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, self._ctrl_down_remap[event.key()], QtCore.Qt.NoModifier) QtGui.qApp.sendEvent(obj, new_event) return True elif etyp... | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widget. """ if obj == self._control: etype = event.type() |
elif etype == QtCore.QEvent.ShortcutOverride: if sys.platform != 'darwin' and \ self._control_key_down(event.modifiers()) and \ event.key() in self._shortcuts: event.accept() return False | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widget. """ if obj == self._control: etype = event.type() | |
layout = QtGui.QVBoxLayout(self) layout.setMargin(0) | def _create_control(self, kind): """ Creates and sets the underlying text widget. """ layout = QtGui.QVBoxLayout(self) layout.setMargin(0) if kind == 'plain': control = QtGui.QPlainTextEdit() elif kind == 'rich': control = QtGui.QTextEdit() control.setAcceptRichText(False) else: raise ValueError("Kind %s unknown." % re... | |
layout.addWidget(control) | def _create_control(self, kind): """ Creates and sets the underlying text widget. """ layout = QtGui.QVBoxLayout(self) layout.setMargin(0) if kind == 'plain': control = QtGui.QPlainTextEdit() elif kind == 'rich': control = QtGui.QTextEdit() control.setAcceptRichText(False) else: raise ValueError("Kind %s unknown." % re... | |
control.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) | def _create_control(self, kind): """ Creates and sets the underlying text widget. """ layout = QtGui.QVBoxLayout(self) layout.setMargin(0) if kind == 'plain': control = QtGui.QPlainTextEdit() elif kind == 'rich': control = QtGui.QTextEdit() control.setAcceptRichText(False) else: raise ValueError("Kind %s unknown." % re... | |
key = event.key() ctrl_down = self._control_key_down(event.modifiers()) if ctrl_down and key in self._ctrl_down_remap: new_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, self._ctrl_down_remap[key], QtCore.Qt.NoModifier) QtGui.qApp.sendEvent(self._control, new_event) return True | def _event_filter_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ key = event.key() ctrl_down = self._control_key_down(event.modifiers()) # If the key is remapped, return immediately. if ctrl_down and key in self._ctrl_down_remap: new_event = QtGui.QK... | |
font_metrics = QtGui.QFontMetrics(self.font) displaywidth = max(5, (self.width() / font_metrics.width(' ')) - 1) | width = self._control.viewport().width() char_width = QtGui.QFontMetrics(self.font).width(' ') displaywidth = max(5, width / char_width) | def _format_as_columns(self, items, separator=' '): """ Transform a list of strings into a single string with columns. |
self._set_top_cursor(self._get_prompt_cursor()) | prompt_cursor = self._get_prompt_cursor() if self._get_cursor().blockNumber() < prompt_cursor.blockNumber(): self._set_cursor(prompt_cursor) self._set_top_cursor(prompt_cursor) | def prompt_to_top(self): """ Moves the prompt to the top of the viewport. """ if not self._executing: self._set_top_cursor(self._get_prompt_cursor()) |
if self.paging != 'none' and re.match("(?:[^\n]*\n){%i}" % minlines, text): | if self.paging != 'none' and \ re.match("(?:[^\n]*\n){%i}" % minlines, text): | def _page(self, text, html=False): """ Displays text using the pager if it exceeds the height of the viewport. |
if diff < 0: | if diff < 0 and document.blockCount() == document.maximumBlockCount(): | def _adjust_scrollbars(self): """ Expands the vertical scrollbar beyond the range set by Qt. """ # This code is adapted from _q_adjustScrollbars in qplaintextedit.cpp # and qtextedit.cpp. document = self._control.document() scrollbar = self._control.verticalScrollBar() viewport_height = self._control.viewport().height(... |
_input_splitter_class = IPythonInputSplitter | def __init__(self, block, length, number): self.block = block self.length = length self.number = number | |
high = max(0, document.lineCount() - 1) | maximum = max(0, document.lineCount() - 1) | def _adjust_scrollbars(self): """ Expands the vertical scrollbar beyond the range set by Qt. """ # This code is adapted from _q_adjustScrollbars in qplaintextedit.cpp # and qtextedit.cpp. document = self._control.document() scrollbar = self._control.verticalScrollBar() viewport_height = self._control.viewport().height(... |
high = document.size().height() | maximum = document.size().height() | def _adjust_scrollbars(self): """ Expands the vertical scrollbar beyond the range set by Qt. """ # This code is adapted from _q_adjustScrollbars in qplaintextedit.cpp # and qtextedit.cpp. document = self._control.document() scrollbar = self._control.verticalScrollBar() viewport_height = self._control.viewport().height(... |
scrollbar.setRange(0, high) | diff = maximum - scrollbar.maximum() scrollbar.setRange(0, maximum) | def _adjust_scrollbars(self): """ Expands the vertical scrollbar beyond the range set by Qt. """ # This code is adapted from _q_adjustScrollbars in qplaintextedit.cpp # and qtextedit.cpp. document = self._control.document() scrollbar = self._control.verticalScrollBar() viewport_height = self._control.viewport().height(... |
len_prompt = len(self._continuation_prompt) | line, col = cursor.blockNumber(), cursor.columnNumber() | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
cursor.columnNumber() == len_prompt and \ position != self._prompt_pos: | col == len(self._continuation_prompt) and \ line > self._get_prompt_cursor().blockNumber(): | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
if not self._reading and cursor.atBlockEnd() and not \ cursor.hasSelection(): | if not self._reading and self._in_buffer(position) and \ cursor.atBlockEnd() and not cursor.hasSelection(): | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
self.setLineWrapMode(QtGui.QPlainTextEdit.WidgetWidth) self.setMaximumBlockCount(500) self.setUndoRedoEnabled(False) | def __init__(self, parent=None): QtGui.QPlainTextEdit.__init__(self, parent) | |
if ctrl_down: | if event.matches(QtGui.QKeySequence.Paste): self.paste() intercepted = True elif ctrl_down: | def keyPressEvent(self, event): """ Reimplemented to create a console-like interface. """ intercepted = False cursor = self.textCursor() position = cursor.position() key = event.key() ctrl_down = event.modifiers() & QtCore.Qt.ControlModifier alt_down = event.modifiers() & QtCore.Qt.AltModifier shift_down = event.modifi... |
self._executing = True | def keyPressEvent(self, event): """ Reimplemented to create a console-like interface. """ intercepted = False cursor = self.textCursor() position = cursor.position() key = event.key() ctrl_down = event.modifiers() & QtCore.Qt.ControlModifier alt_down = event.modifiers() & QtCore.Qt.AltModifier shift_down = event.modifi... | |
self.setReadOnly(False) | def _prompt_started(self): """ Called immediately after a new prompt is displayed. """ self.moveCursor(QtGui.QTextCursor.End) self.centerCursor() self.setReadOnly(False) self._executing = False self._prompt_started_hook() | |
QtGui.QListWidget.hideEvent(self, event) | QtGui.QLabel.hideEvent(self, event) | def hideEvent(self, event): """ Reimplemented to disconnect the cursor movement handler. """ QtGui.QListWidget.hideEvent(self, event) self.parent().cursorPositionChanged.disconnect(self._update_tip) |
QtGui.QListWidget.showEvent(self, event) | QtGui.QLabel.showEvent(self, event) | def showEvent(self, event): """ Reimplemented to connect the cursor movement handler. """ QtGui.QListWidget.showEvent(self, event) self.parent().cursorPositionChanged.connect(self._update_tip) |
if (etype == QtCore.QEvent.KeyPress and event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return, QtCore.Qt.Key_Escape)): self.hide() | if etype == QtCore.QEvent.KeyPress: key = event.key() if key in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return): self.hide() elif key == QtCore.Qt.Key_Escape: self.hide() return True | def eventFilter(self, obj, event): """ Reimplemented to hide on certain key presses and on parent focus changes. """ if obj == self.parent(): etype = event.type() if (etype == QtCore.QEvent.KeyPress and event.key() in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return, QtCore.Qt.Key_Escape)): self.hide() elif etype == QtCore.Q... |
width = font_metrics.maxWidth() * 81 + margin | width = font_metrics.width(' ') * 81 + margin | def sizeHint(self): """ Reimplemented to suggest a size that is 80 characters wide and 25 lines high. """ font_metrics = QtGui.QFontMetrics(self.font) margin = (self._control.frameWidth() + self._control.document().documentMargin()) * 2 style = self.style() splitwidth = style.pixelMetric(QtGui.QStyle.PM_SplitterWidth) |
char_width = QtGui.QFontMetrics(self.font).maxWidth() | char_width = QtGui.QFontMetrics(self.font).width(' ') | def _format_as_columns(self, items, separator=' '): """ Transform a list of strings into a single string with columns. |
self._control.moveCursor(QtGui.QTextCursor.PreviousBlock) self._control.moveCursor(QtGui.QTextCursor.EndOfBlock) | self._control.moveCursor(QtGui.QTextCursor.PreviousBlock, mode=anchormode) self._control.moveCursor(QtGui.QTextCursor.EndOfBlock, mode=anchormode) | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
cursor.movePosition(QtGui.QTextCursor.Right) | cursor.movePosition(QtGui.QTextCursor.Right, mode=anchormode) | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
n=len(self._continuation_prompt)) | n=len(self._continuation_prompt), mode=anchormode) | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
self._context_menu = self._create_context_menu() | def __init__(self, kind='plain', parent=None): """ Create a ConsoleWidget. Parameters ---------- kind : str, optional [default 'plain'] The type of text widget to use. Valid values are 'plain', which specifies a QPlainTextEdit, and 'rich', which specifies an QTextEdit. | |
if etype == QtCore.QEvent.ContextMenu: self._context_menu.exec_(event.globalPos()) return True | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widget. """ if obj == self._control: etype = event.type() | |
elif etype == QtCore.QEvent.DragMove: | if etype == QtCore.QEvent.DragMove: | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widget. """ if obj == self._control: etype = event.type() |
def _create_context_menu(self): """ Creates a context menu for the underlying text widget. """ menu = QtGui.QMenu(self) clipboard = QtGui.QApplication.clipboard() copy_action = QtGui.QAction('Copy', self) copy_action.triggered.connect(self.copy) self.copy_available.connect(copy_action.setEnabled) menu.addAction(copy_a... | def _create_context_menu(self): """ Creates a context menu for the underlying text widget. """ menu = QtGui.QMenu(self) clipboard = QtGui.QApplication.clipboard() | |
replaced_event = None | def _event_filter_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False replaced_event = None cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_dow... | |
key = event.key() ctrl_down = self._control_key_down(event.modifiers()) | def _event_filter_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False replaced_event = None cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_dow... | |
if key in self._ctrl_down_remap: ctrl_down = False key = self._ctrl_down_remap[key] replaced_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, key, QtCore.Qt.NoModifier) elif key == QtCore.Qt.Key_K: | if key == QtCore.Qt.Key_K: | def _event_filter_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False replaced_event = None cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_dow... |
if self._completion_widget.isVisible(): self._completion_widget.keyPressEvent(event) intercepted = event.isAccepted() | def _event_filter_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False replaced_event = None cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_dow... | |
if not intercepted and replaced_event: QtGui.qApp.sendEvent(self._control, replaced_event) | def _event_filter_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False replaced_event = None cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_dow... | |
custom_edit_requested = QtCore.pyqtSignal(object, int) | custom_edit_requested = QtCore.pyqtSignal(object, object) | def __init__(self, block, length, number): self.block = block self.length = length self.number = number |
self._highlighter.highlighting_on = True if self._get_prompt_cursor().blockNumber() != \ self._get_end_cursor().blockNumber(): self.appendPlainText(' ' * self._input_splitter.indent_spaces) | if not self._reading: self._highlighter.highlighting_on = True if self._get_prompt_cursor().blockNumber() != \ self._get_end_cursor().blockNumber(): self.appendPlainText(' ' * self._input_splitter.indent_spaces) | def _prompt_started_hook(self): """ Called immediately after a new prompt is displayed. """ self._highlighter.highlighting_on = True |
self._highlighter.highlighting_on = False | if not self._reading: self._highlighter.highlighting_on = False | def _prompt_finished_hook(self): """ Called immediately after a prompt is finished, i.e. when some input will be processed and a new prompt displayed. """ self._highlighter.highlighting_on = False |
if block.isValid(): | if block.isValid() and not block.text().isEmpty(): | def _show_interpreter_prompt_for_reply(self, msg): """ Reimplemented for IPython-style prompts. """ # Update the old prompt number if necessary. content = msg['content'] previous_prompt_number = content['prompt_number'] if self._previous_prompt_obj and \ self._previous_prompt_obj.number != previous_prompt_number: block... |
intercept = True | intercepted = True | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
self.parent().cursorPositionChanged.disconnect(self._update_current) | try: self.parent().cursorPositionChanged.disconnect(self._update_current) except TypeError: pass | def hideEvent(self, event): """ Reimplemented to disconnect the cursor movement handler. """ QtGui.QListWidget.hideEvent(self, event) self.parent().cursorPositionChanged.disconnect(self._update_current) |
if not existing: | if existing: | def __init__(self, app, frontend, existing=False, may_close=True): """ Create a MainWindow for the specified FrontendWidget. The app is passed as an argument to allow for different closing behavior depending on whether we are the Kernel's parent. If existing is True, then this Console does not own the Kernel. If may... |
kernel_manager.start_kernel(ipython=False) | kwargs['ipython']=False | def main(): """ Entry point for application. """ # Parse command line arguments. parser = ArgumentParser() kgroup = parser.add_argument_group('kernel options') kgroup.add_argument('-e', '--existing', action='store_true', help='connect to an existing kernel') kgroup.add_argument('--ip', type=str, default=LOCALHOST, help... |
kernel_manager.start_kernel(pylab=args.pylab) else: kernel_manager.start_kernel() | kwargs['pylab']=args.pylab kernel_manager.start_kernel(**kwargs) | def main(): """ Entry point for application. """ # Parse command line arguments. parser = ArgumentParser() kgroup = parser.add_argument_group('kernel options') kgroup.add_argument('-e', '--existing', action='store_true', help='connect to an existing kernel') kgroup.add_argument('--ip', type=str, default=LOCALHOST, help... |
str(self._control.toHtml().toUtf8()))) | html)) | def export_html(self, parent = None, inline = False): """ Export the contents of the ConsoleWidget as HTML. |
if self._reading: intercepted = False elif not self._tab_pressed(): | if self._tab_pressed(): intercepted = not self._in_buffer() else: | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... |
else: intercepted = not self._in_buffer() | def _event_filter_console_keypress(self, event): """ Filter key events for the underlying text widget to create a console-like interface. """ intercepted = False cursor = self._control.textCursor() position = cursor.position() key = event.key() ctrl_down = self._control_key_down(event.modifiers()) alt_down = event.modi... | |
elif obj == self._control: if etype == QtCore.QEvent.DragMove: return True elif etype == QtCore.QEvent.KeyPress: | elif etype == QtCore.QEvent.KeyPress: if obj == self._control: | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widget. """ # Re-map keys for all filtered widgets. etype = event.type() if etype == QtCore.QEvent.KeyPress and \ self._control_key_down(event.modifiers()) and \ event.key() in self._ctrl_down_remap: new_event ... |
elif obj == self._page_control: if etype == QtCore.QEvent.KeyPress: | elif obj == self._page_control: | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widget. """ # Re-map keys for all filtered widgets. etype = event.type() if etype == QtCore.QEvent.KeyPress and \ self._control_key_down(event.modifiers()) and \ event.key() in self._ctrl_down_remap: new_event ... |
control = QtGui.QPlainTextEdit() | control = ConsolePlainTextEdit() | def _create_control(self, kind): """ Creates and connects the underlying text widget. """ if kind == 'plain': control = QtGui.QPlainTextEdit() elif kind == 'rich': control = QtGui.QTextEdit() control.setAcceptRichText(False) else: raise ValueError("Kind %s unknown." % repr(kind)) control.installEventFilter(self) contro... |
control = QtGui.QTextEdit() | control = ConsoleTextEdit() | def _create_control(self, kind): """ Creates and connects the underlying text widget. """ if kind == 'plain': control = QtGui.QPlainTextEdit() elif kind == 'rich': control = QtGui.QTextEdit() control.setAcceptRichText(False) else: raise ValueError("Kind %s unknown." % repr(kind)) control.installEventFilter(self) contro... |
control = QtGui.QPlainTextEdit() | control = ConsolePlainTextEdit() | def _create_page_control(self): """ Creates and connects the underlying paging widget. """ control = QtGui.QPlainTextEdit() control.installEventFilter(self) control.setReadOnly(True) control.setUndoRedoEnabled(False) control.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) return control |
self._append_plain_text(msg['content']['data']) | text = msg['content']['data'].expandtabs(8) self._append_plain_text(text) | def _handle_stream(self, msg): """ Handle stdout, stderr, and stdin. """ if not self._hidden and self._is_from_this_session(msg): self._append_plain_text(msg['content']['data']) self._control.moveCursor(QtGui.QTextCursor.End) |
elif etype == QtCore.QEvent.Resize: QtCore.QTimer.singleShot(0, self._adjust_scrollbars) | elif etype == QtCore.QEvent.Resize and not self._filter_resize: self._filter_resize = True QtGui.qApp.sendEvent(obj, event) self._adjust_scrollbars() self._filter_resize = False return True | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widgets. """ etype = event.type() if etype == QtCore.QEvent.KeyPress: |
self._control.setTextCursor(cursor) | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widgets. """ etype = event.type() if etype == QtCore.QEvent.KeyPress: | |
self._insert_plain_text_into_buffer(text) | self._insert_plain_text_into_buffer(cursor, text) | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widgets. """ etype = event.type() if etype == QtCore.QEvent.KeyPress: |
lines = string.splitlines(True) if lines: self._append_plain_text(lines[0]) for i in xrange(1, len(lines)): if self._continuation_prompt_html is None: self._append_plain_text(self._continuation_prompt) else: self._append_html(self._continuation_prompt_html) self._append_plain_text(lines[i]) | self._insert_plain_text_into_buffer(self._get_prompt_cursor(), string) | def _set_input_buffer(self, string): """ Replaces the text in the input buffer with 'string'. """ # For now, it is an error to modify the input buffer during execution. if self._executing: raise RuntimeError("Cannot change input buffer during execution.") |
self._insert_plain_text_into_buffer(dedent(text)) | self._insert_plain_text_into_buffer(cursor, dedent(text)) | def paste(self, mode=QtGui.QClipboard.Clipboard): """ Paste the contents of the clipboard into the input region. |
def _insert_plain_text_into_buffer(self, text): """ Inserts text into the input buffer at the current cursor position, ensuring that continuation prompts are inserted as necessary. | def _insert_plain_text_into_buffer(self, cursor, text): """ Inserts text into the input buffer using the specified cursor (which must be in the input buffer), ensuring that continuation prompts are inserted as necessary. | def _insert_plain_text_into_buffer(self, text): """ Inserts text into the input buffer at the current cursor position, ensuring that continuation prompts are inserted as necessary. """ lines = unicode(text).splitlines(True) if lines: self._keep_cursor_in_buffer() cursor = self._control.textCursor() cursor.beginEditBloc... |
self._keep_cursor_in_buffer() cursor = self._control.textCursor() | def _insert_plain_text_into_buffer(self, text): """ Inserts text into the input buffer at the current cursor position, ensuring that continuation prompts are inserted as necessary. """ lines = unicode(text).splitlines(True) if lines: self._keep_cursor_in_buffer() cursor = self._control.textCursor() cursor.beginEditBloc... | |
self._control.setTextCursor(cursor) | def _insert_plain_text_into_buffer(self, text): """ Inserts text into the input buffer at the current cursor position, ensuring that continuation prompts are inserted as necessary. """ lines = unicode(text).splitlines(True) if lines: self._keep_cursor_in_buffer() cursor = self._control.textCursor() cursor.beginEditBloc... | |
def resizeEvent(self, event): """ Adjust the scrollbars manually after a resize event. """ super(ConsoleWidget, self).resizeEvent(event) self._adjust_scrollbars() | def eventFilter(self, obj, event): """ Reimplemented to ensure a console-like behavior in the underlying text widgets. """ etype = event.type() if etype == QtCore.QEvent.KeyPress: | |
while (time<final_time): | while time < final_time: | def Maxwell2D(d, Hx, Hy, Ez, final_time): """Integrate TM-mode Maxwell's until final_time starting with initial conditions Hx, Hy, Ez. """ l = d.ldis time = 0 # Runge-Kutta residual storage resHx = np.zeros_like(Hx) resHy = np.zeros_like(Hx) resEz = np.zeros_like(Hx) # compute time step size rLGL = JacobiGQ(0,0, l.N... |
print lift_dev.strides | def prepare_dev_data(self): ldis = self.ldis | |
tagSet = univ.Integer.tagSet.tagImplicitly( | tagSet = univ.OctetString.tagSet.tagImplicitly( | def prettyOut(self, value): return ipAddressPrettyOut(value) |
continue | break | def loadModules(self, *modNames): # Build a list of available modules if not modNames: modNames = {} for mibSource in self.__mibSources: for modName in mibSource.listdir(): modNames[modName] = None modNames = modNames.keys() if not modNames: raise error.SmiError( 'No MIB module to load at %s' % (self,) ) for modName i... |
if not cbFun(sendRequestHandle, None, | if not cbFun(sendRequestHandle, errorIndication, | def _handleResponse( self, snmpEngine, transportDomain, transportAddress, messageProcessingModel, securityModel, securityName, securityLevel, contextEngineId, contextName, pduVersion, PDU, timeout, retryCount, pMod, rspPDU, sendRequestHandle, (cbFun, cbCtx) ): varBindTable = pMod.apiBulkPDU.getVarBindTable(PDU, rspPDU) |
debug.logger & debug.flagDsp and debug.logger('sendPdu: new sendPduHandle %s' % sendPduHandle) | debug.logger & debug.flagDsp and debug.logger('sendPdu: new sendPduHandle %s, context %s' % (sendPduHandle, expectResponse)) | def sendPdu( self, snmpEngine, transportDomain, transportAddress, messageProcessingModel, securityModel, securityName, securityLevel, contextEngineId, contextName, pduVersion, PDU, expectResponse ): """PDU dispatcher -- prepare and serialize a request or notification""" # 4.1.1.2 mpHandler = snmpEngine.messageProcessin... |
if contextName is not None: | if contextName is None: | def addV1System(snmpEngine, securityName, communityName, contextEngineId=None, contextName=None, transportTag=None): snmpCommunityEntry, tblIdx, snmpEngineID = __cookV1SystemInfo( snmpEngine, securityName ) if contextEngineId is None: contextEngineId = snmpEngineID.syntax if contextName is not None: contextName = comm... |
readSubTree=(), writeSubTree=(), notifySubTree=()): | readSubTree=(), writeSubTree=(), notifySubTree=(), contextName=''): | def addVacmUser(snmpEngine, securityModel, securityName, securityLevel, readSubTree=(), writeSubTree=(), notifySubTree=()): ( groupName, securityLevel, readView, writeView, notifyView ) = __cookVacmUserInfo( snmpEngine, securityModel, securityName, securityLevel, ) addVacmGroup( snmpEngine, groupName, securityModel, se... |
snmpEngine, groupName, '', securityModel, securityLevel, 1, | snmpEngine, groupName, contextName, securityModel, securityLevel, 1, | def addVacmUser(snmpEngine, securityModel, securityName, securityLevel, readSubTree=(), writeSubTree=(), notifySubTree=()): ( groupName, securityLevel, readView, writeView, notifyView ) = __cookVacmUserInfo( snmpEngine, securityModel, securityName, securityLevel, ) addVacmGroup( snmpEngine, groupName, securityModel, se... |
nonRepeaters = int(self.getNonRepeaters(reqPDU)) N = min(nonRepeaters, len(self.getVarBindList(reqPDU))) R = max(len(self.getVarBindList(reqPDU))-N, 0) if R == 0: M = 0 else: M = int(min(self.getMaxRepetitions(reqPDU), (len(apiPDU.getVarBindList(rspPDU))-N))/R) varBindList = apiPDU.getVarBindList(rspPDU) varBindRows = ... | nonRepeaters = self.getNonRepeaters(reqPDU) maxRepetitions = self.getMaxRepetitions(reqPDU) reqVarBinds = self.getVarBinds(reqPDU) N = min(int(nonRepeaters), len(reqVarBinds)) M = int(maxRepetitions) R = max(len(reqVarBinds)-N, 0) rspVarBinds = self.getVarBinds(rspPDU) varBindTable = [] if R: for i in range(0, len... | def getVarBindTable(self, reqPDU, rspPDU): nonRepeaters = int(self.getNonRepeaters(reqPDU)) N = min(nonRepeaters, len(self.getVarBindList(reqPDU))) R = max(len(self.getVarBindList(reqPDU))-N, 0) if R == 0: M = 0 else: M = int(min(self.getMaxRepetitions(reqPDU), (len(apiPDU.getVarBindList(rspPDU))-N))/R) varBindList = a... |
val = None if len(varBindRow) < colIdx+N+1: varBindRow.append((oid, val)) else: varBindRow[colIdx] = (oid, val) | varBindRow[idx] = (oid, None) | def getVarBindTable(self, reqPDU, rspPDU): nonRepeaters = int(self.getNonRepeaters(reqPDU)) N = min(nonRepeaters, len(self.getVarBindList(reqPDU))) R = max(len(self.getVarBindList(reqPDU))-N, 0) if R == 0: M = 0 else: M = int(min(self.getMaxRepetitions(reqPDU), (len(apiPDU.getVarBindList(rspPDU))-N))/R) varBindList = a... |
del self.__timeline[engineIdKey] debug.logger & debug.flagSM and debug.logger('__expireEnginesInfo: expiring %s' % (engineIdKey,)) | if self.__timeline.has_key(engineIdKey): del self.__timeline[engineIdKey] debug.logger & debug.flagSM and debug.logger('__expireEnginesInfo: expiring %s' % (engineIdKey,)) | def __expireTimelineInfo(self): if self.__timelineExpQueue.has_key(self.__expirationTimer): for engineIdKey in self.__timelineExpQueue[self.__expirationTimer]: del self.__timeline[engineIdKey] debug.logger & debug.flagSM and debug.logger('__expireEnginesInfo: expiring %s' % (engineIdKey,)) del self.__timelineExpQueue[s... |
maxSizeResponseScopedPDU = maxMessageSize - 512 if maxSizeResponseScopedPDU < 0: | try: maxSizeResponseScopedPDU = maxMessageSize - len(securityParameters) - 48 except PyAsn1Error: | def processIncomingMsg( self, snmpEngine, messageProcessingModel, maxMessageSize, securityParameters, securityModel, securityLevel, wholeMsg, msg # XXX ): # 3.2.1 try: securityParameters, rest = decoder.decode( securityParameters, asn1Spec=self._securityParametersSpec ) except PyAsn1Error: snmpInASNParseErrs, = snmpEn... |
if tag in string.split(str(mibNode.syntax), ' '): | if tag in string.split(str(mibNode.syntax)): | def getTargetNames(snmpEngine, tag): mibInstrumController = snmpEngine.msgAndPduDsp.mibInstrumController # Transport endpoint ( snmpTargetAddrEntry, snmpTargetAddrTagList ) = mibInstrumController.mibBuilder.importSymbols( 'SNMP-TARGET-MIB', 'snmpTargetAddrEntry', 'snmpTargetAddrTagList' ) targetNames = [] nextName = s... |
'PySNMP example command responder at %s' % __file__ | 'PySNMP example command responder' | def __call__(self, protoVer): return api.protoModules[protoVer].OctetString( 'PySNMP example command responder at %s' % __file__ ) |
'provides': [ 'pysnmp' ], | def howto_install_setuptools(): print """Error: You need setuptools Python package! | |
'requires': [ 'pyasn1', 'pycrypto' ], 'provides': [ 'pysnmp' ] | 'requires': [ 'pyasn1', 'pycrypto' ] | def howto_install_setuptools(): print """Error: You need setuptools Python package! |
errorIndication = 'dataMispatch' | errorIndication = 'dataMismatch' | def prepareDataElements( self, snmpEngine, transportDomain, transportAddress, wholeMsg ): # 7.2.2 try: msg, restOfwholeMsg = decoder.decode( wholeMsg, asn1Spec=self._snmpMsgSpec ) except PyAsn1Error: snmpInASNParseErrs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInASNPa... |
errorIndication = 'engineIDMispatch' | errorIndication = 'engineIDMismatch' | def prepareDataElements( self, snmpEngine, transportDomain, transportAddress, wholeMsg ): # 7.2.2 try: msg, restOfwholeMsg = decoder.decode( wholeMsg, asn1Spec=self._snmpMsgSpec ) except PyAsn1Error: snmpInASNParseErrs, = snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.importSymbols('__SNMPv2-MIB', 'snmpInASNPa... |
appReturn['errorStatus'] = errorStatus appReturn['errorIndex'] = errorIndex appReturn['varBindTable'] = varBindTable | if errorStatus == 2: appReturn['errorStatus'] = errorStatus.clone(0) appReturn['errorIndex'] = errorIndex.clone(0) else: appReturn['errorStatus'] = errorStatus appReturn['errorIndex'] = errorIndex appReturn['varBindTable'] = varBindTotalTable | def __cbFun( sendRequestHandle, errorIndication, errorStatus, errorIndex, varBindTable, (varBindHead, varBindTotalTable, appReturn) ): if errorIndication or errorStatus: appReturn['errorIndication'] = errorIndication appReturn['errorStatus'] = errorStatus appReturn['errorIndex'] = errorIndex appReturn['varBindTable'] =... |
self.writeCleanup(name, val, idx, (acFun, acCtx)) | self.writeUndo(name, val, idx, (acFun, acCtx)) | def createUndo(self, name, val, idx, (acFun, acCtx)): if val is not None: self.writeCleanup(name, val, idx, (acFun, acCtx)) |
self._vars[name].createUndo(name, val, idx, (acFun, acCtx)) | try: self._vars[name] == 0 except PyAsn1Error: del self._vars[name] else: self._vars[name].createUndo(name, val, idx, (acFun, acCtx)) | def createUndo(self, name, val, idx, (acFun, acCtx)): # Set back previous column instance, drop the new one if self.__createdInstances.has_key(name): self._vars[name] = self.__createdInstances[name] del self.__createdInstances[name] # Remove new instance on rollback if self._vars[name] is None: del self._vars[name] els... |
self.__timerCbFuns = [] self.__timeToGo = 0 | self.__timerCallables = [] | def __init__(self): self.__transports = {} self.__jobs = {} self.__recvCbFun = None self.__timerCbFuns = [] self.__timeToGo = 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.