eric6/QScintilla/Lexers/LexerPerl.py

changeset 8243
cc717c2ae956
parent 7923
91e843545d9a
--- a/eric6/QScintilla/Lexers/LexerPerl.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/QScintilla/Lexers/LexerPerl.py	Thu Apr 15 18:11:24 2021 +0200
@@ -7,6 +7,8 @@
 Module implementing a Perl lexer with some additional methods.
 """
 
+import contextlib
+
 from PyQt5.Qsci import QsciLexerPerl
 
 from .Lexer import Lexer
@@ -38,15 +40,11 @@
         """
         self.setFoldComments(Preferences.getEditor("PerlFoldComment"))
         self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
-        try:
+        with contextlib.suppress(AttributeError):
             self.setFoldPackages(Preferences.getEditor("PerlFoldPackages"))
             self.setFoldPODBlocks(Preferences.getEditor("PerlFoldPODBlocks"))
-        except AttributeError:
-            pass
-        try:
+        with contextlib.suppress(AttributeError):
             self.setFoldAtElse(Preferences.getEditor("PerlFoldAtElse"))
-        except AttributeError:
-            pass
     
     def autoCompletionWordSeparators(self):
         """

eric ide

mercurial