Utilities/py3flakes/checker.py

branch
5_1_x
changeset 1536
7d766369823d
parent 1510
e75ecf2bd9dd
--- a/Utilities/py3flakes/checker.py	Sun Jan 08 20:07:13 2012 +0100
+++ b/Utilities/py3flakes/checker.py	Thu Jan 12 18:47:58 2012 +0100
@@ -2,10 +2,10 @@
 
 # Copyright (c) 2010 - 2012 Detlev Offenbach <detlev@die-offenbachs.de>
 #
-# Original (c) 2005-2008 Divmod, Inc.
+# Original (c) 2005-2010 Divmod, Inc.
 #
 # This module is based on pyflakes for Python2 but was heavily hacked to
-# work with Python3
+# work with Python3 and eric5
 
 import builtins
 import os.path
@@ -472,7 +472,7 @@
                 "Got impossible expression context: {0:r}".format(node.ctx,))
 
     def FUNCTIONDEF(self, node):
-        if getattr(node, "decorator_list", None) is not None:
+        if hasattr(node, "decorator_list"):
             for decorator in node.decorator_list:
                 self.handleNode(decorator, node)
         self.addBinding(node.lineno, FunctionDefinition(node.name, node))
@@ -529,9 +529,8 @@
         classes, and the body of its definition.  Additionally, add its name to
         the current scope.
         """
-        if getattr(node, "decorator_list", None) is not None:
-            for decorator in node.decorator_list:
-                self.handleNode(decorator, node)
+        for decorator in getattr(node, "decorator_list", []):
+            self.handleNode(decorator, node)
         for baseNode in node.bases:
             self.handleNode(baseNode, node)
         self.addBinding(node.lineno, Binding(node.name, node))

eric ide

mercurial