Thu, 17 Dec 2020 14:20:51 +0100
Updated some source docu strings and added TODO markers.
--- a/eric6/DebugClients/Python/MultiprocessingExtension.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/DebugClients/Python/MultiprocessingExtension.py Thu Dec 17 14:20:51 2020 +0100 @@ -16,8 +16,6 @@ _originalBootstrap = None -# TODO: add support for start method 'forkserver' -# TODO: add support for start method 'spawn' def patchMultiprocessing(module, debugClient): """ Function to patch the multiprocessing module. @@ -37,6 +35,8 @@ _originalProcess = module.Process _originalBootstrap = _originalProcess._bootstrap + # TODO: implement a process tracer + # i.e. report which processes are started class ProcessWrapper(_originalProcess): """ Wrapper class for multiprocessing.Process.
--- a/eric6/Debugger/BreakPointModel.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/Debugger/BreakPointModel.py Thu Dec 17 14:20:51 2020 +0100 @@ -23,7 +23,8 @@ """ Constructor - @param parent reference to the parent widget (QObject) + @param parent reference to the parent widget + @type QObject """ super(BreakPointModel, self).__init__(parent) @@ -49,8 +50,10 @@ """ Public method to get the current column count. - @param parent reference to parent index (QModelIndex) (Unused) - @return column count (integer) + @param parent reference to parent index (Unused) + @type QModelIndex + @return column count + @rtype int """ return len(self.header) @@ -58,8 +61,10 @@ """ Public method to get the current row count. - @param parent reference to parent index (QModelIndex) - @return row count (integer) + @param parent reference to parent index + @type QModelIndex + @return row count + @rtype int """ # we do not have a tree, parent should always be invalid if parent is None or not parent.isValid(): @@ -71,9 +76,12 @@ """ Public method to get the requested data. - @param index index of the requested data (QModelIndex) - @param role role of the requested data (Qt.ItemDataRole) + @param index index of the requested data + @type QModelIndex + @param role role of the requested data + @type Qt.ItemDataRole @return the requested data + @rtype any """ if not index.isValid(): return None @@ -100,10 +108,14 @@ """ Public method to change data in the model. - @param index index of the changed data (QModelIndex) + @param index index of the changed data + @type QModelIndex @param value value of the changed data - @param role role of the changed data (Qt.ItemDataRole) - @return flag indicating success (boolean) + @type any + @param role role of the changed data + @type Qt.ItemDataRole + @return flag indicating success + @rtype bool """ if (not index.isValid() or index.column() >= len(self.header) or @@ -119,8 +131,10 @@ """ Public method to get item flags. - @param index index of the requested flags (QModelIndex) - @return item flags for the given index (Qt.ItemFlags) + @param index index of the requested flags + @type QModelIndex + @return item flags for the given index + @rtype Qt.ItemFlags """ if not index.isValid(): return Qt.ItemIsEnabled @@ -131,10 +145,14 @@ """ Public method to get header data. - @param section section number of the requested header data (integer) - @param orientation orientation of the header (Qt.Orientation) - @param role role of the requested data (Qt.ItemDataRole) + @param section section number of the requested header data + @type int + @param orientation orientation of the header + @type Qt.Orientation + @param role role of the requested data + @type Qt.ItemDataRole @return header data + @rtype str """ if orientation == Qt.Horizontal and role == Qt.DisplayRole: if section >= len(self.header): @@ -148,10 +166,14 @@ """ Public method to create an index. - @param row row number for the index (integer) - @param column column number for the index (integer) - @param parent index of the parent item (QModelIndex) - @return requested index (QModelIndex) + @param row row number for the index + @type int + @param column column number for the index + @type int + @param parent index of the parent item + @type QModelIndex + @return requested index + @rtype QModelIndex """ if ((parent and parent.isValid()) or row < 0 or row >= len(self.breakpoints) or @@ -164,8 +186,10 @@ """ Public method to get the parent index. - @param index index of item to get parent (QModelIndex) - @return index of parent (QModelIndex) + @param index index of item to get parent + @type QModelIndex + @return index of parent + @rtype QModelIndex """ return QModelIndex() @@ -173,8 +197,10 @@ """ Public method to check for the presence of child items. - @param parent index of parent item (QModelIndex) - @return flag indicating the presence of child items (boolean) + @param parent index of parent item + @type QModelIndex + @return flag indicating the presence of child items + @rtype bool """ if parent is None or not parent.isValid(): return len(self.breakpoints) > 0 @@ -187,11 +213,13 @@ """ Public method to add a new breakpoint to the list. - @param fn filename of the breakpoint (string) - @param line line number of the breakpoint (integer) + @param fn filename of the breakpoint + @type str + @param line line number of the breakpoint + @type int @param properties properties of the breakpoint - (tuple of condition (string), temporary flag (bool), - enabled flag (bool), ignore count (integer)) + (tuple of condition, temporary flag, enabled flag, ignore count) + @type tuple of (str, bool, bool, int) """ bp = [fn, line] + list(properties) cnt = len(self.breakpoints) @@ -203,12 +231,15 @@ """ Public method to set the values of a breakpoint given by index. - @param index index of the breakpoint (QModelIndex) - @param fn filename of the breakpoint (string) - @param line line number of the breakpoint (integer) + @param index index of the breakpoint + @type QModelIndex + @param fn filename of the breakpoint + @type str + @param line line number of the breakpoint + @type int @param properties properties of the breakpoint - (tuple of condition (string), temporary flag (bool), - enabled flag (bool), ignore count (integer)) + (tuple of condition, temporary flag, enabled flag, ignore count) + @type tuple of (str, bool, bool, int) """ if index.isValid(): row = index.row() @@ -223,8 +254,10 @@ """ Public method to set the enabled state of a breakpoint given by index. - @param index index of the breakpoint (QModelIndex) - @param enabled flag giving the enabled state (boolean) + @param index index of the breakpoint + @type QModelIndex + @param enabled flag giving the enabled state + @type bool """ if index.isValid(): row = index.row() @@ -238,7 +271,8 @@ """ Public method to set the values of a breakpoint given by index. - @param index index of the breakpoint (QModelIndex) + @param index index of the breakpoint + @type QModelIndex """ if index.isValid(): row = index.row() @@ -250,7 +284,8 @@ """ Public method to delete a list of breakpoints given by their indexes. - @param idxList list of breakpoint indexes (list of QModelIndex) + @param idxList list of breakpoint indexes + @type list of QModelIndex """ rows = [] for index in idxList: @@ -276,9 +311,11 @@ """ Public method to get the values of a breakpoint given by index. - @param index index of the breakpoint (QModelIndex) - @return breakpoint (list of seven values (filename, line number, + @param index index of the breakpoint + @type QModelIndex + @return breakpoint (list of six values (filename, line number, condition, temporary flag, enabled flag, ignore count)) + @rtype list of (str, int, str, bool, bool, int) """ if index.isValid(): return self.breakpoints[index.row()][:] # return a copy @@ -290,9 +327,12 @@ Public method to get the index of a breakpoint given by filename and line number. - @param fn filename of the breakpoint (string) - @param lineno line number of the breakpoint (integer) - @return index (QModelIndex) + @param fn filename of the breakpoint + @type str + @param lineno line number of the breakpoint + @type int + @return index + @rtype QModelIndex """ for row in range(len(self.breakpoints)): bp = self.breakpoints[row] @@ -305,8 +345,10 @@ """ Public method to test, if a breakpoint given by its index is temporary. - @param index index of the breakpoint to test (QModelIndex) - @return flag indicating a temporary breakpoint (boolean) + @param index index of the breakpoint to test + @type QModelIndex + @return flag indicating a temporary breakpoint + @rtype bool """ if index.isValid(): return self.breakpoints[index.row()][3]
--- a/eric6/Debugger/BreakPointViewer.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/Debugger/BreakPointViewer.py Thu Dec 17 14:20:51 2020 +0100 @@ -67,7 +67,8 @@ """ Public slot to set the breakpoint model. - @param model reference to the breakpoint model (BreakPointModel) + @param model reference to the breakpoint model + @type BreakPointModel """ self.__model = model @@ -111,8 +112,10 @@ """ Private slot to convert an index to a source index. - @param index index to be converted (QModelIndex) - @return mapped index (QModelIndex) + @param index index to be converted + @type QModelIndex + @return mapped index + @rtype QModelIndex """ return self.sortingModel.mapToSource(index) @@ -120,8 +123,10 @@ """ Private slot to convert a source index to an index. - @param sindex source index to be converted (QModelIndex) - @return mapped index (QModelIndex) + @param sindex source index to be converted + @type QModelIndex + @return mapped index + @rtype QModelIndex """ return self.sortingModel.mapFromSource(sindex) @@ -129,8 +134,10 @@ """ Private slot to select a complete row. - @param index index determining the row to be selected (QModelIndex) - @param selected flag indicating the action (bool) + @param index index determining the row to be selected + @type QModelIndex + @param selected flag indicating the action + @type bool """ if not index.isValid(): return @@ -205,7 +212,8 @@ """ Private slot to show the context menu. - @param coord the position of the mouse pointer (QPoint) + @param coord the position of the mouse pointer + @type QPoint """ cnt = self.__getSelectedItemsCount() if cnt <= 1: @@ -259,7 +267,8 @@ """ Private slot to handle the double clicked signal. - @param index index of the entry that was double clicked (QModelIndex) + @param index index of the entry that was double clicked + @type QModelIndex """ if index.isValid(): self.__editBreakpoint(index) @@ -276,7 +285,8 @@ """ Private slot to edit a breakpoint. - @param index index of breakpoint to be edited (QModelIndex) + @param index index of breakpoint to be edited + @type QModelIndex """ sindex = self.__toSourceIndex(index) if sindex.isValid(): @@ -308,8 +318,10 @@ """ Private method to set the enabled status of a breakpoint. - @param index index of breakpoint to be enabled/disabled (QModelIndex) - @param enabled flag indicating the enabled status to be set (boolean) + @param index index of breakpoint to be enabled/disabled + @type QModelIndex + @param enabled flag indicating the enabled status to be set + @type bool """ sindex = self.__toSourceIndex(index) if sindex.isValid(): @@ -421,8 +433,10 @@ """ Public slot to handle the clientLine signal. - @param fn filename of the breakpoint (string) - @param lineno line number of the breakpoint (integer) + @param fn filename of the breakpoint + @type str + @param lineno line number of the breakpoint + @type int """ sindex = self.__model.getBreakPointIndex(fn, lineno) if sindex.isValid(): @@ -456,7 +470,8 @@ """ Private method to get the count of items selected. - @return count of items selected (integer) + @return count of items selected + @rtype int """ count = len(self.selectedIndexes()) // (self.__model.columnCount() - 1) # column count is 1 greater than selectable
--- a/eric6/Debugger/DebugViewer.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/Debugger/DebugViewer.py Thu Dec 17 14:20:51 2020 +0100 @@ -55,8 +55,10 @@ """ Constructor - @param debugServer reference to the debug server object (DebugServer) - @param parent parent widget (QWidget) + @param debugServer reference to the debug server object + @type DebugServer + @param parent parent widget + @type QWidget """ super(DebugViewer, self).__init__(parent) @@ -322,7 +324,8 @@ """ Public method to set a reference to the Debug UI. - @param debugUI reference to the DebugUI object (DebugUI) + @param debugUI reference to the DebugUI object + @type DebugUI """ self.debugUI = debugUI self.callStackViewer.setDebugger(debugUI) @@ -336,7 +339,7 @@ def handleResetUI(self): """ - Public method to reset the SBVviewer. + Public method to reset the viewer. """ self.globalsViewer.handleResetUI() self.localsViewer.handleResetUI() @@ -355,7 +358,8 @@ """ Public method to initialize the call stack viewer. - @param projectMode flag indicating to enable the project mode (boolean) + @param projectMode flag indicating to enable the project mode + @type bool """ self.callStackViewer.clear() self.callStackViewer.setProjectMode(projectMode) @@ -364,7 +368,8 @@ """ Public method to get the state of the call trace function. - @return flag indicating the state of the call trace function (boolean) + @return flag indicating the state of the call trace function + @rtype bool """ return self.callTraceViewer.isCallTraceEnabled() @@ -381,7 +386,8 @@ In project mode the call trace info is shown with project relative path names. - @param enabled flag indicating to enable the project mode (boolean) + @param enabled flag indicating to enable the project mode + @type bool """ self.callTraceViewer.setProjectMode(enabled) @@ -390,7 +396,9 @@ Public method to show the variables in the respective window. @param vlist list of variables to display + @type list @param showGlobals flag indicating global/local state + @type bool """ if showGlobals: self.globalsViewer.showVariables(vlist, self.framenr) @@ -402,7 +410,9 @@ Public method to show the variables in the respective window. @param vlist list of variables to display + @type list @param showGlobals flag indicating global/local state + @type bool """ if showGlobals: self.globalsViewer.showVariable(vlist) @@ -414,6 +424,7 @@ Public method to make a variables tab visible. @param showGlobals flag indicating global/local state + @type bool """ if showGlobals: self.__tabWidget.setCurrentWidget(self.glvWidget) @@ -546,7 +557,8 @@ """ Private slot to handle the selection of a new stack frame number. - @param frmnr frame number (0 is the current frame) (int) + @param frmnr frame number (0 is the current frame) + @type int """ if frmnr >= 0: self.framenr = frmnr @@ -598,7 +610,8 @@ """ Public method to get a reference to the current widget. - @return reference to the current widget (QWidget) + @return reference to the current widget + @rtype QWidget """ return self.__tabWidget.currentWidget() @@ -606,7 +619,8 @@ """ Public slot to set the current page based on the given widget. - @param widget reference to the widget (QWidget) + @param widget reference to the widget + @type QWidget """ self.__tabWidget.setCurrentWidget(widget) @@ -678,9 +692,10 @@ """ Private slot to handle the selection of a thread in the thread list. - @param current reference to the new current item (QTreeWidgetItem) + @param current reference to the new current item + @type QTreeWidgetItem @param previous reference to the previous current item - (QTreeWidgetItem) + @type QTreeWidgetItem """ if current is not None and self.__doThreadListUpdate: tid = current.data(0, self.ThreadIdRole) @@ -691,7 +706,8 @@ Private slot to handle the selection of a call stack entry of the call stack viewer. - @param frameNo frame number (index) of the selected entry (integer) + @param frameNo frame number (index) of the selected entry + @type int """ if frameNo >= 0: self.stackComboBox.setCurrentIndex(frameNo)
--- a/eric6/Debugger/DebuggerInterfaceNone.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/Debugger/DebuggerInterfaceNone.py Thu Dec 17 14:20:51 2020 +0100 @@ -23,8 +23,10 @@ """ Constructor - @param debugServer reference to the debug server (DebugServer) - @param passive flag indicating passive connection mode (boolean) + @param debugServer reference to the debug server + @type DebugServer + @param passive flag indicating passive connection mode + @type bool """ super(DebuggerInterfaceNone, self).__init__() @@ -84,7 +86,8 @@ """ Public method to retrieve the debug clients capabilities. - @return debug client capabilities (integer) + @return debug client capabilities + @rtype int """ return self.clientCapabilities @@ -92,8 +95,10 @@ """ Public slot to handle a new connection. - @param sock reference to the socket object (QTcpSocket) - @return flag indicating success (boolean) + @param sock reference to the socket object + @type QTcpSocket + @return flag indicating success + @rtype bool """ return False @@ -110,8 +115,8 @@ """ Public method to cleanly shut down. - It closes our socket and shuts down - the debug client. (Needed on Win OS) + It closes our socket and shuts down the debug client. + (Needed on Win OS) """ self.qsock = None self.queue = [] @@ -120,7 +125,8 @@ """ Public method to test, if a debug client has connected. - @return flag indicating the connection status (boolean) + @return flag indicating the connection status + @rtype bool """ return self.qsock is not None @@ -128,7 +134,8 @@ """ Public method to set the environment for a program to debug, run, ... - @param env environment settings (dictionary) + @param env environment settings + @type dict """ return
--- a/eric6/Debugger/DebuggerInterfacePython.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/Debugger/DebuggerInterfacePython.py Thu Dec 17 14:20:51 2020 +0100 @@ -554,7 +554,6 @@ self.debugServer.masterClientConnected() self.debugServer.initializeClient(debuggerId) - # TODO: show info about new client # perform auto-continue except for master if ( @@ -586,7 +585,12 @@ if not self.__connections: # no active connections anymore - self.debugServer.signalLastClientExited() + try: + self.debugServer.signalLastClientExited() + except RuntimeError: + # debug server object might have been deleted already + # ignore this + pass self.__autoContinued.clear() def getDebuggerIds(self): @@ -666,7 +670,8 @@ """ Public method to set the environment for a program to debug, run, ... - @param env environment settings (dictionary) + @param env environment settings + @type dict """ if self.__master: self.__sendJsonCommand("RequestEnvironment", {"environment": env},
--- a/eric6/Debugger/StartDialog.py Thu Dec 17 13:54:47 2020 +0100 +++ b/eric6/Debugger/StartDialog.py Thu Dec 17 14:20:51 2020 +0100 @@ -162,9 +162,9 @@ """ Public method to retrieve the data entered into this dialog. - @return a tuple of interpreter (string), argv (string), workdir - (string), environment (string), exceptions flag (boolean), - clear interpreter flag (boolean) and run in console flag (boolean) + @return a tuple of interpreter, argv, workdir, environment, + exceptions flag, clear interpreter flag and run in console flag + @rtype tuple of (str, str, str, str, bool, bool, bool) """ cmdLine = self.ui.cmdlineCombo.currentText() workdir = self.ui.workdirPicker.currentText(toNative=False) @@ -205,7 +205,8 @@ Public method to retrieve the coverage related data entered into this dialog. - @return flag indicating erasure of coverage info (boolean) + @return flag indicating erasure of coverage info + @rtype bool """ if self.dialogType == 2: return self.ui.eraseCheckBox.isChecked() @@ -217,7 +218,8 @@ Public method to retrieve the profiling related data entered into this dialog. - @return flag indicating erasure of profiling info (boolean) + @return flag indicating erasure of profiling info + @rtype bool """ if self.dialogType == 3: return self.ui.eraseCheckBox.isChecked() @@ -344,7 +346,8 @@ """ Private slot called by a button of the button box clicked. - @param button button that was clicked (QAbstractButton) + @param button button that was clicked + @type QAbstractButton """ if button == self.clearButton: self.__clearHistories()