eric6/DebugClients/Python/BreakpointWatch.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8043
0acf98cd089a
parent 8243
cc717c2ae956
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
6 """ 6 """
7 Module implementing the breakpoint and watch class. 7 Module implementing the breakpoint and watch class.
8 """ 8 """
9 9
10 import os 10 import os
11 import contextlib
11 12
12 13
13 class Breakpoint: 14 class Breakpoint:
14 """ 15 """
15 Breakpoint class. 16 Breakpoint class.
58 59
59 def deleteMe(self): 60 def deleteMe(self):
60 """ 61 """
61 Public method to clear this breakpoint. 62 Public method to clear this breakpoint.
62 """ 63 """
63 try: 64 with contextlib.suppress(KeyError):
64 del Breakpoint.breaks[(self.file, self.line)] 65 del Breakpoint.breaks[(self.file, self.line)]
65 Breakpoint.breakInFile[self.file].remove(self.line) 66 Breakpoint.breakInFile[self.file].remove(self.line)
66 if not Breakpoint.breakInFile[self.file]: 67 if not Breakpoint.breakInFile[self.file]:
67 del Breakpoint.breakInFile[self.file] 68 del Breakpoint.breakInFile[self.file]
68 except KeyError:
69 pass
70 69
71 def enable(self): 70 def enable(self):
72 """ 71 """
73 Public method to enable this breakpoint. 72 Public method to enable this breakpoint.
74 """ 73 """
224 223
225 def deleteMe(self): 224 def deleteMe(self):
226 """ 225 """
227 Public method to clear this watch expression. 226 Public method to clear this watch expression.
228 """ 227 """
229 try: 228 with contextlib.suppress(ValueError):
230 del Watch.watches[self] 229 del Watch.watches[self]
231 except ValueError:
232 pass
233 230
234 def enable(self): 231 def enable(self):
235 """ 232 """
236 Public method to enable this watch. 233 Public method to enable this watch.
237 """ 234 """
249 Static method to clear a watch expression. 246 Static method to clear a watch expression.
250 247
251 @param cond expression of the watch expression to be cleared 248 @param cond expression of the watch expression to be cleared
252 @type str 249 @type str
253 """ 250 """
254 try: 251 with contextlib.suppress(ValueError):
255 Watch.watches.remove(Watch.get_watch(cond)) 252 Watch.watches.remove(Watch.get_watch(cond))
256 except ValueError:
257 pass
258 253
259 @staticmethod 254 @staticmethod
260 def clear_all_watches(): 255 def clear_all_watches():
261 """ 256 """
262 Static method to clear all watch expressions. 257 Static method to clear all watch expressions.

eric ide

mercurial