eric6/UI/UserInterface.py

changeset 8240
93b8a353c4bf
parent 8235
78e6d29eb773
child 8243
cc717c2ae956
--- a/eric6/UI/UserInterface.py	Wed Apr 14 19:38:19 2021 +0200
+++ b/eric6/UI/UserInterface.py	Wed Apr 14 19:59:16 2021 +0200
@@ -15,6 +15,7 @@
 import datetime
 import getpass
 import functools
+import contextlib
 
 from PyQt5.QtCore import (
     pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate,
@@ -3961,13 +3962,11 @@
             It must be one of "ui" or "wizards".
         """
         for act in actions:
-            try:
+            with contextlib.suppress(ValueError):
                 if actionType == 'ui':
                     self.actions.remove(act)
                 elif actionType == 'wizards':
                     self.wizardsActions.remove(act)
-            except ValueError:
-                pass
         
     def getActions(self, actionType):
         """
@@ -6672,11 +6671,8 @@
             fn = os.path.join(Utilities.getConfigDir(),
                               f"eric6_crash_session{ext}")
             if os.path.exists(fn):
-                try:
+                with contextlib.suppress(OSError):
                     os.remove(fn)
-                except OSError:
-                    # ignore it silently
-                    pass
     
     def __writeCrashSession(self):
         """

eric ide

mercurial