src/eric7/DebugClients/Python/DebugClientBase.py

branch
eric7
changeset 11148
15e30f0c76a8
parent 11090
f5f5f5803935
equal deleted inserted replaced
11147:dee6e106b4d3 11148:15e30f0c76a8
142 142
143 Type2Indicators = { 143 Type2Indicators = {
144 # Python types 144 # Python types
145 "list": "[]", 145 "list": "[]",
146 "tuple": "()", 146 "tuple": "()",
147 "dict": "{:}", # __IGNORE_WARNING_M613__ 147 "dict": "{:}", # __IGNORE_WARNING_M-613__
148 "set": "{}", # __IGNORE_WARNING_M613__ 148 "set": "{}", # __IGNORE_WARNING_M-613__
149 "frozenset": "{}", # __IGNORE_WARNING_M613__ 149 "frozenset": "{}", # __IGNORE_WARNING_M-613__
150 "numpy.ndarray": "[ndarray]", # __IGNORE_WARNING_M613__ 150 "numpy.ndarray": "[ndarray]", # __IGNORE_WARNING_M-613__
151 "collections.abc.ItemsView": "[]", 151 "collections.abc.ItemsView": "[]",
152 "collections.abc.KeysView": "[]", 152 "collections.abc.KeysView": "[]",
153 "collections.abc.ValuesView": "[]", 153 "collections.abc.ValuesView": "[]",
154 } 154 }
155 155
348 Public method to handle a command serialized as a JSON string. 348 Public method to handle a command serialized as a JSON string.
349 349
350 @param jsonStr string containing the command received from the IDE 350 @param jsonStr string containing the command received from the IDE
351 @type str 351 @type str
352 """ 352 """
353 ## printerr(jsonStr) ## debug # noqa: M891 353 ## printerr(jsonStr) ## debug # noqa: M-891
354 354
355 try: 355 try:
356 commandDict = json.loads(jsonStr.strip()) 356 commandDict = json.loads(jsonStr.strip())
357 except (TypeError, ValueError) as err: 357 except (TypeError, ValueError) as err:
358 printerr("Error handling command: " + jsonStr) 358 printerr("Error handling command: " + jsonStr)
548 self.mainThread.run( 548 self.mainThread.run(
549 code, self.debugMod.__dict__, debug=False, closeSession=False 549 code, self.debugMod.__dict__, debug=False, closeSession=False
550 ) 550 )
551 551
552 elif method == "RequestCoverage": 552 elif method == "RequestCoverage":
553 from coverage import Coverage # __IGNORE_WARNING_I10__ 553 from coverage import Coverage # __IGNORE_WARNING_I-10__
554 554
555 self.disassembly = None 555 self.disassembly = None
556 sys.argv = [] 556 sys.argv = []
557 if params["argv"] and params["argv"][0].startswith("--plugin="): 557 if params["argv"] and params["argv"][0].startswith("--plugin="):
558 # we are coverage testing an eric IDE plug-in 558 # we are coverage testing an eric IDE plug-in
594 self.cover.stop() 594 self.cover.stop()
595 self.cover.save() 595 self.cover.save()
596 596
597 elif method == "RequestProfile": 597 elif method == "RequestProfile":
598 sys.setprofile(None) 598 sys.setprofile(None)
599 import PyProfile # __IGNORE_WARNING_I10__ 599 import PyProfile # __IGNORE_WARNING_I-10__
600 600
601 self.disassembly = None 601 self.disassembly = None
602 sys.argv = [] 602 sys.argv = []
603 if params["argv"] and params["argv"][0].startswith("--plugin="): 603 if params["argv"] and params["argv"][0].startswith("--plugin="):
604 # we are profiling an eric IDE plug-in 604 # we are profiling an eric IDE plug-in
1809 enableTrace=True, 1809 enableTrace=True,
1810 reportAllExceptions=False, 1810 reportAllExceptions=False,
1811 tracePython=False, 1811 tracePython=False,
1812 redirect=True, 1812 redirect=True,
1813 passive=True, 1813 passive=True,
1814 multiprocessSupport=False, # noqa: U100 1814 multiprocessSupport=False, # noqa: U-100
1815 ): 1815 ):
1816 """ 1816 """
1817 Public method used to start the remote debugger. 1817 Public method used to start the remote debugger.
1818 1818
1819 @param filename the program to be debugged 1819 @param filename the program to be debugged
2111 break 2111 break
2112 else: # unknown option 2112 else: # unknown option
2113 del args[0] 2113 del args[0]
2114 if not args: 2114 if not args:
2115 print("No program given. Aborting!") 2115 print("No program given. Aborting!")
2116 # __IGNORE_WARNING_M801__ 2116 # __IGNORE_WARNING_M-801__
2117 elif "-m" in args: 2117 elif "-m" in args:
2118 print("Running module as a script is not supported. Aborting!") 2118 print("Running module as a script is not supported. Aborting!")
2119 # __IGNORE_WARNING_M801__ 2119 # __IGNORE_WARNING_M-801__
2120 else: 2120 else:
2121 # Store options in case a new Python process is created 2121 # Store options in case a new Python process is created
2122 self.startOptions = ( 2122 self.startOptions = (
2123 wd, 2123 wd,
2124 host, 2124 host,
2182 # IPv6 address or IPv4 address 2182 # IPv6 address or IPv4 address
2183 remoteAddress = ipOrHost 2183 remoteAddress = ipOrHost
2184 else: 2184 else:
2185 remoteAddress = self.__resolveHost(ipOrHost) 2185 remoteAddress = self.__resolveHost(ipOrHost)
2186 if remoteAddress is None: 2186 if remoteAddress is None:
2187 print(f"Remote host '{ipOrHost}' could not be resolved.") # noqa: M801 2187 print(f"Remote host '{ipOrHost}' could not be resolved.") # noqa: M-801
2188 sys.exit(1) 2188 sys.exit(1)
2189 2189
2190 sys.argv = [""] 2190 sys.argv = [""]
2191 if "" not in sys.path: 2191 if "" not in sys.path:
2192 sys.path.insert(0, "") 2192 sys.path.insert(0, "")
2206 self.__coding = self.defaultCoding 2206 self.__coding = self.defaultCoding
2207 patchNewProcessFunctions(self.multiprocessSupport, self) 2207 patchNewProcessFunctions(self.multiprocessSupport, self)
2208 self.connectDebugger(port, remoteAddress, redirect) 2208 self.connectDebugger(port, remoteAddress, redirect)
2209 self.__interact() 2209 self.__interact()
2210 else: 2210 else:
2211 print("No network port given. Aborting...") # noqa: M801 2211 print("No network port given. Aborting...") # noqa: M-801
2212 sys.exit(2) 2212 sys.exit(2)
2213 2213
2214 def close(self, fd): 2214 def close(self, fd):
2215 """ 2215 """
2216 Public method implementing a close method as a replacement for 2216 Public method implementing a close method as a replacement for

eric ide

mercurial