eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityContext.py

changeset 8221
0572a215bd2f
parent 8207
d359172d11be
child 8228
772103b14c18
diff -r 006ee31b4835 -r 0572a215bd2f eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityContext.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityContext.py	Sun Apr 11 12:38:16 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityContext.py	Sun Apr 11 16:53:48 2021 +0200
@@ -309,10 +309,7 @@
             if not isinstance(argumentValues, list):
                 # if passed a single value, or a tuple, convert to a list
                 argumentValues = [argumentValues]
-            for val in argumentValues:
-                if argValue == val:
-                    return True
-            return False
+            return any(argValue == val for val in argumentValues)
         else:
             # argument name not found, return None to allow testing for this
             # eventuality
@@ -402,9 +399,7 @@
         @return flag indicating the given module was found
         @rtype bool
         """
-        if 'imports' in self.__context:
-            for imp in self.__context['imports']:
-                if module in imp:
-                    return True
-        
-        return False
+        try:
+            return any(module in imp for imp in self.__context['imports'])
+        except KeyError:
+            return False

eric ide

mercurial