From 6d2529632bae545ff7564501cac14316d5ea9204 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Mon, 1 Feb 2016 11:53:36 +0000 Subject: Changed the way how parameters are being built The old way consisted in having the parameter names, their defaults and their annotations separated in different components of the Arguments node. We introduced a new Param node, which holds the name of a parameter, its default value and its annotation. If any of the last two values are missing, then that slot will be filled with a new node kind, Empty, which is used for specifying the lack of something (None could have been used instead, but that means having non-AST nodes in the Arguments node). We're also having support for positional only arguments, for the moment only in raw_building. Close #215 --- astroid/tree/treeabc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'astroid/tree/treeabc.py') diff --git a/astroid/tree/treeabc.py b/astroid/tree/treeabc.py index 6ad96ba8..5c008255 100644 --- a/astroid/tree/treeabc.py +++ b/astroid/tree/treeabc.py @@ -67,6 +67,10 @@ class Name(NodeNG): """Class representing a Name node""" +class Parameter(NodeNG): + """Class representing a parameter node.""" + + class Arguments(NodeNG): """Class representing an Arguments node""" @@ -339,3 +343,12 @@ class ReservedName(NodeNG): class Unknown(NodeNG): pass + + +class Empty(NodeNG): + """Empty nodes represents the lack of something + + For instance, they can be used to represent missing annotations + or defaults for arguments or anything where None is a valid + value. + """ -- cgit v1.2.1