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

changeset 8205
4a0f1f896341
parent 7923
91e843545d9a
child 8243
cc717c2ae956
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityUtils.py	Thu Apr 08 17:27:12 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/Security/SecurityUtils.py	Thu Apr 08 18:27:47 2021 +0200
@@ -156,10 +156,10 @@
     if isinstance(node, ast.Attribute):
         try:
             val = deepgetattr(node, 'value.id')
-            if val in aliases:
-                prefix = aliases[val]
-            else:
-                prefix = deepgetattr(node, 'value.id')
+            prefix = (
+                aliases[val] if val in aliases
+                else deepgetattr(node, 'value.id')
+            )
         except Exception:           # secok
             # We can't get the fully qualified name for an attr, just return
             # its base name.
@@ -195,9 +195,13 @@
     @return list containing the line number range
     @rtype list of int
     """
-    strip = {"body": None, "orelse": None,
-             "handlers": None, "finalbody": None}
-    for key in strip.keys():
+    strip = {
+        "body": None,
+        "orelse": None,
+        "handlers": None,
+        "finalbody": None
+    }
+    for key in strip:
         if hasattr(node, key):
             strip[key] = getattr(node, key)
             node.key = []
@@ -209,7 +213,7 @@
             lines_min = min(lines_min, n.lineno)
             lines_max = max(lines_max, n.lineno)
     
-    for key in strip.keys():
+    for key in strip:
         if strip[key] is not None:
             node.key = strip[key]
     

eric ide

mercurial