eric6/DebugClients/Python/BreakpointWatch.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8043
0acf98cd089a
parent 8243
cc717c2ae956
--- a/eric6/DebugClients/Python/BreakpointWatch.py	Fri Apr 02 11:59:41 2021 +0200
+++ b/eric6/DebugClients/Python/BreakpointWatch.py	Sat May 01 14:27:20 2021 +0200
@@ -8,6 +8,7 @@
 """
 
 import os
+import contextlib
 
 
 class Breakpoint:
@@ -60,13 +61,11 @@
         """
         Public method to clear this breakpoint.
         """
-        try:
+        with contextlib.suppress(KeyError):
             del Breakpoint.breaks[(self.file, self.line)]
             Breakpoint.breakInFile[self.file].remove(self.line)
             if not Breakpoint.breakInFile[self.file]:
                 del Breakpoint.breakInFile[self.file]
-        except KeyError:
-            pass
 
     def enable(self):
         """
@@ -226,10 +225,8 @@
         """
         Public method to clear this watch expression.
         """
-        try:
+        with contextlib.suppress(ValueError):
             del Watch.watches[self]
-        except ValueError:
-            pass
 
     def enable(self):
         """
@@ -251,10 +248,8 @@
         @param cond expression of the watch expression to be cleared
         @type str
         """
-        try:
+        with contextlib.suppress(ValueError):
             Watch.watches.remove(Watch.get_watch(cond))
-        except ValueError:
-            pass
 
     @staticmethod
     def clear_all_watches():

eric ide

mercurial