Utilities/py3flakes/checker.py

changeset 1534
e5b76a5eda84
parent 1509
c0b5e693b0eb
child 2088
73a2ca4ac409
--- a/Utilities/py3flakes/checker.py	Sun Jan 08 20:05:08 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
@@ -485,7 +485,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))
@@ -542,9 +542,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