diff -r 411df92e881f -r 3b34efa2857c src/eric7/DebugClients/Python/DebugClientBase.py --- a/src/eric7/DebugClients/Python/DebugClientBase.py Sun Dec 03 14:54:00 2023 +0100 +++ b/src/eric7/DebugClients/Python/DebugClientBase.py Mon Jan 01 11:10:45 2024 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2002 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> +# Copyright (c) 2002 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> # """ @@ -81,7 +81,8 @@ """ Replacement for the standard os.close(fd). - @param fd open file descriptor to be closed (integer) + @param fd open file descriptor to be closed + @type int """ if DebugClientInstance is None: DebugClientOrigClose(fd) @@ -101,7 +102,8 @@ """ Replacement for the standard sys.setrecursionlimit(limit). - @param limit recursion limit (integer) + @param limit recursion limit + @type int """ rl = max(limit, 64) setRecursionLimit(rl) @@ -207,7 +209,8 @@ """ Public method to return the current coding. - @return codec name (string) + @return codec name + @rtype str """ return self.__coding @@ -215,7 +218,8 @@ """ Private method to set the coding used by a python file. - @param filename name of the file to inspect (string) + @param filename name of the file to inspect + @type str """ if self.noencoding: self.__coding = sys.getdefaultencoding() @@ -263,7 +267,8 @@ Public method to close the session with the debugger and optionally terminate. - @param terminate flag indicating to terminate (boolean) + @param terminate flag indicating to terminate + @type bool """ with contextlib.suppress(Exception): # secok self.set_quit() @@ -293,6 +298,7 @@ @param mode kind of code to be generated (exec or eval) @type str @return compiled code object (None in case of errors) + @rtype Code """ with codecs.open(filename, encoding=self.__coding) as fp: statement = fp.read() @@ -310,6 +316,7 @@ @param mode kind of code to be generated (exec or eval) @type str @return compiled code object (None in case of errors) + @rtype Code """ try: code = compile(statement + "\n", filename, mode) @@ -341,7 +348,7 @@ @param jsonStr string containing the command received from the IDE @type str """ - ## printerr(jsonStr) ## debug # __IGNORE_WARNING_M891__ + ## printerr(jsonStr) ## debug # noqa: M891 try: commandDict = json.loads(jsonStr.strip()) @@ -892,7 +899,7 @@ @param filename name of the file the bp belongs to @type str - @param lineno linenumber of the bp + @param lineno line number of the bp @type int """ self.sendJsonCommand( @@ -1029,7 +1036,8 @@ """ Private method to determine the clients capabilities. - @return client capabilities (integer) + @return client capabilities + @rtype int """ if importlib.util.find_spec("PyProfile") is None: return self.clientCapabilities & ~DebugClientCapabilities.HasProfiler @@ -1041,6 +1049,7 @@ Public method called when there is data ready to be read. @param stream file like object that has data to be read + @type file like @return flag indicating an error condition @rtype bool """ @@ -1066,6 +1075,7 @@ Public method called when we are ready to write data. @param stream file like object that has data to be written + @type file like """ stream.write_p("") stream.flush() @@ -1088,7 +1098,8 @@ Public method implementing our event loop. @param disablePolling flag indicating to enter an event loop with - polling disabled (boolean) + polling disabled + @type bool """ self.eventExit = False self.pollingDisabled = disablePolling @@ -1220,9 +1231,12 @@ """ Private method called to report an uncaught exception. - @param exctype the type of the exception - @param excval data about the exception + @param exctype class of the exception + @type type + @param excval exception instance + @type Exception @param exctb traceback for the exception + @type traceback """ self.mainThread.user_exception((exctype, excval, exctb), True) @@ -1295,8 +1309,10 @@ sys.path is used as a set of possible prefixes. The name stays relative if a file could not be found. - @param fn filename (string) - @return the converted filename (string) + @param fn filename + @type str + @return the converted filename + @rtype str """ if os.path.isabs(fn): return fn @@ -1333,7 +1349,8 @@ """ Public method to return the main script we are currently running. - @return flag indicating a running debug session (boolean) + @return flag indicating a running debug session + @rtype bool """ return self.running @@ -1675,8 +1692,10 @@ Private slot to convert a filter string to a list of filter objects. @param scope 1 to generate filter for global variables, 0 for local - variables (int) + variables + @type int @param filterString string of filter patterns separated by ';' + @type str """ patternFilterObjects = None filterString = filterString.strip() @@ -1703,7 +1722,8 @@ """ Private slot to handle the request for a commandline completion list. - @param text the text to be completed (string) + @param text the text to be completed + @type str """ completerDelims = " \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?" @@ -1742,9 +1762,12 @@ """ Private method to create a completions list. - @param text text to complete (string) + @param text text to complete + @type str @param completer completer method - @param completions set where to add new completions strings (set) + @type function + @param completions set where to add new completions strings + @type set """ state = 0 try: @@ -1966,10 +1989,14 @@ """ Public method used to start the remote debugger and call a function. - @param scriptname name of the script to be debugged (string) + @param scriptname name of the script to be debugged + @type str @param func function to be called + @type function @param *args arguments being passed to func + @type list @return result of the function call + @rtype Any """ self.startDebugger(scriptname, enableTrace=False) res = self.mainThread.runcall(func, *args) @@ -1980,8 +2007,10 @@ """ Private method to resolve a hostname to an IP address. - @param host hostname of the debug server (string) - @return IP address (string) + @param host hostname of the debug server + @type str + @return IP address + @rtype str """ try: host, version = host.split("@@") @@ -2168,7 +2197,8 @@ It prevents the debugger connections from being closed. - @param fd file descriptor to be closed (integer) + @param fd file descriptor to be closed + @type int """ if fd in [ self.readstream.fileno(), @@ -2184,8 +2214,10 @@ Private slot to calculate a path list including the PYTHONPATH environment variable. - @param firstEntry entry to be put first in sys.path (string) - @return path list for use as sys.path (list of strings) + @param firstEntry entry to be put first in sys.path + @type str + @return path list for use as sys.path + @rtype list of str """ sysPath = [ path