8239:59a9a658618c | 8240:93b8a353c4bf |
---|---|
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. |
224 | 225 |
225 def deleteMe(self): | 226 def deleteMe(self): |
226 """ | 227 """ |
227 Public method to clear this watch expression. | 228 Public method to clear this watch expression. |
228 """ | 229 """ |
229 try: | 230 with contextlib.suppress(ValueError): |
230 del Watch.watches[self] | 231 del Watch.watches[self] |
231 except ValueError: | |
232 pass | |
233 | 232 |
234 def enable(self): | 233 def enable(self): |
235 """ | 234 """ |
236 Public method to enable this watch. | 235 Public method to enable this watch. |
237 """ | 236 """ |
249 Static method to clear a watch expression. | 248 Static method to clear a watch expression. |
250 | 249 |
251 @param cond expression of the watch expression to be cleared | 250 @param cond expression of the watch expression to be cleared |
252 @type str | 251 @type str |
253 """ | 252 """ |
254 try: | 253 with contextlib.suppress(ValueError): |
255 Watch.watches.remove(Watch.get_watch(cond)) | 254 Watch.watches.remove(Watch.get_watch(cond)) |
256 except ValueError: | |
257 pass | |
258 | 255 |
259 @staticmethod | 256 @staticmethod |
260 def clear_all_watches(): | 257 def clear_all_watches(): |
261 """ | 258 """ |
262 Static method to clear all watch expressions. | 259 Static method to clear all watch expressions. |