eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py

changeset 8243
cc717c2ae956
parent 8223
73ab31b11a81
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py	Thu Apr 15 18:11:24 2021 +0200
@@ -8,6 +8,7 @@
 """
 
 import re
+import contextlib
 
 from PyQt5.QtCore import QCoreApplication
 
@@ -561,9 +562,9 @@
         else:
             args = messageArgs
         
-        try:
+        with contextlib.suppress(KeyError):
             catalog = messageCatalogs[messageCategory]
-            try:
+            with contextlib.suppress(KeyError):
                 message = catalog[messageCode]
                 if args is None:
                     return message
@@ -572,10 +573,6 @@
                     return message(args)
                 else:
                     return message.format(*args)
-            except KeyError:
-                pass
-        except KeyError:
-            pass
     
     if example:
         return None

eric ide

mercurial