summaryrefslogtreecommitdiff
path: root/scoped_nodes.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-07-13 22:29:00 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2014-07-13 22:29:00 +0300
commit4b80e44c09e81e611f630896eb38e376d09094a1 (patch)
treeac208798215be2757e8ed3dbe92d41a4085bd6ab /scoped_nodes.py
parent41aa1086a294c003fb50ef82d9bbbb4e1b17d113 (diff)
downloadastroid-git-4b80e44c09e81e611f630896eb38e376d09094a1.tar.gz
Expose function annotation to astroid. `Arguments` node exposes 'varargannotation', 'kwargannotation' and 'annotations' attributes, while `Function` node has the 'returns' attribute.
Diffstat (limited to 'scoped_nodes.py')
-rw-r--r--scoped_nodes.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scoped_nodes.py b/scoped_nodes.py
index 95d45a5d..f0708379 100644
--- a/scoped_nodes.py
+++ b/scoped_nodes.py
@@ -46,6 +46,7 @@ from astroid.bases import Statement
from astroid.manager import AstroidManager
ITER_METHODS = ('__iter__', '__getitem__')
+PY3K = sys.version_info >= (3, 0)
def remove_nodes(func, cls):
@@ -562,7 +563,11 @@ class Lambda(LocalsDictNodeNG, FilterStmtsMixin):
class Function(Statement, Lambda):
- _astroid_fields = ('decorators', 'args', 'body')
+ if PY3K:
+ _astroid_fields = ('decorators', 'args', 'body', 'returns')
+ returns = None
+ else:
+ _astroid_fields = ('decorators', 'args', 'body')
special_attributes = set(('__name__', '__doc__', '__dict__'))
is_function = True