--- a/src/eric7/Debugger/DebugServer.py Sun Dec 03 14:54:00 2023 +0100 +++ b/src/eric7/Debugger/DebugServer.py Mon Jan 01 11:10:45 2024 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2007 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> +# Copyright (c) 2007 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> # """ @@ -426,7 +426,7 @@ @return list of supported languages @rtype list of str """ - languages = list(self.__debuggerInterfaceRegistry.keys()) + languages = list(self.__debuggerInterfaceRegistry) with contextlib.suppress(ValueError): languages.remove("None") @@ -973,16 +973,22 @@ Public method to set the environment for a program to debug, run, ... @param env environment settings - @type str + @type str or dict + @exception TypeError taised to indicate an unsupported parameter type """ - envlist = shlex.split(env) - envdict = {} - for el in envlist: - if "=" in el: - key, value = el.split("=", 1) - envdict[key] = value - else: - envdict[el] = "" + if not isinstance(env, (dict, str)): + raise TypeError("'env' must be of type str or list of str") + elif isinstance(env, str): + envlist = shlex.split(env) + envdict = {} + for el in envlist: + if "=" in el: + key, value = el.split("=", 1) + envdict[key] = value + else: + envdict[el] = "" + else: + envdict = env self.debuggerInterface.remoteEnvironment(envdict) def remoteLoad( @@ -1009,14 +1015,14 @@ @param venvName name of the virtual environment to be used @type str - @param fn the filename to debug + @param fn filename to debug @type str - @param argv the command line arguments to pass to the program - @type str - @param wd the working directory for the program + @param argv list of command line arguments to pass to the program + @type list of str + @param wd working directory for the program @type str @param env environment parameter settings - @type str + @type str or dict @param autoClearShell flag indicating, that the interpreter window should be cleared @type bool @@ -1120,14 +1126,14 @@ @param venvName name of the virtual environment to be used @type str - @param fn the filename to debug + @param fn filename to debug @type str - @param argv the command line arguments to pass to the program - @type str - @param wd the working directory for the program + @param argv list of command line arguments to pass to the program + @type list str + @param wd working directory for the program @type str @param env environment parameter settings - @type str + @type str or dict @param autoClearShell flag indicating, that the interpreter window should be cleared @type bool @@ -1199,14 +1205,14 @@ @param venvName name of the virtual environment to be used @type str - @param fn the filename to debug + @param fn filename to debug @type str - @param argv the command line arguments to pass to the program - @type str - @param wd the working directory for the program + @param argv list of command line arguments to pass to the program + @type list of str + @param wd working directory for the program @type str @param env environment parameter settings - @type str + @type str or dict @param autoClearShell flag indicating, that the interpreter window should be cleared @type bool @@ -1281,14 +1287,14 @@ @param venvName name of the virtual environment to be used @type str - @param fn the filename to debug + @param fn filename to debug @type str - @param argv the command line arguments to pass to the program - @type str - @param wd the working directory for the program + @param argv list of command line arguments to pass to the program + @type list of str + @param wd working directory for the program @type str @param env environment parameter settings - @type str + @type str or dict @param autoClearShell flag indicating, that the interpreter window should be cleared @type bool @@ -1350,7 +1356,7 @@ @param debuggerId ID of the debugger backend @type str - @param stmt the Python statement to execute. + @param stmt Python statement to execute. @type str """ self.debuggerInterface.remoteStatement(debuggerId, stmt.rstrip()) @@ -1398,6 +1404,7 @@ @param debuggerId ID of the debugger backend @type str @param special flag indicating a special continue operation + @type bool """ self.debuggerInterface.remoteContinue(debuggerId, special) @@ -1408,7 +1415,7 @@ @param debuggerId ID of the debugger backend @type str - @param line the new line, where execution should be continued to + @param line new line, where execution should be continued to @type int """ self.debuggerInterface.remoteContinueUntil(debuggerId, line) @@ -1419,7 +1426,7 @@ @param debuggerId ID of the debugger backend @type str - @param line the new line, where execution should be continued + @param line new line, where execution should be continued @type int """ self.debuggerInterface.remoteMoveIP(debuggerId, line) @@ -1434,7 +1441,7 @@ @type str @param fn filename the breakpoint belongs to @type str - @param line linenumber of the breakpoint + @param line line number of the breakpoint @type int @param setBreakpoint flag indicating setting or resetting a breakpoint @type bool @@ -1455,7 +1462,7 @@ @type str @param fn filename the breakpoint belongs to @type str - @param line linenumber of the breakpoint + @param line line number of the breakpoint @type int @param enable flag indicating enabling or disabling a breakpoint @type bool @@ -1470,7 +1477,7 @@ @type str @param fn filename the breakpoint belongs to @type str - @param line linenumber of the breakpoint + @param line line number of the breakpoint @type int @param count number of occurrences to ignore @type int @@ -1528,7 +1535,7 @@ @param debuggerId ID of the debugger backend @type str - @param inputString the raw input + @param inputString raw input @type str """ self.debuggerInterface.remoteRawInput(debuggerId, inputString) @@ -1569,7 +1576,7 @@ @param debuggerId ID of the debugger backend @type str - @param scope the scope of the variables (0 = local, 1 = global) + @param scope scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out @type list of str @@ -1588,7 +1595,7 @@ @param debuggerId ID of the debugger backend @type str - @param scope the scope of the variables (0 = local, 1 = global) + @param scope scope of the variables (0 = local, 1 = global) @type int @param filterList list of variable types to filter out @type list of str @@ -1621,7 +1628,7 @@ @param debuggerId ID of the debugger backend @type str - @param scope the scope of the variables (0 = local, 1 = global) + @param scope scope of the variables (0 = local, 1 = global) @type int @param filterStr regexp string for variable names to filter out @type str @@ -1658,7 +1665,7 @@ @param debuggerId ID of the debugger backend @type str - @param text the text to be completed + @param text text to be completed @type str """ self.debuggerInterface.remoteCompletion(debuggerId, text)