summaryrefslogtreecommitdiff
path: root/astroid/tree/node_classes.py
Commit message (Collapse)AuthorAgeFilesLines
* Clean up spacing, typos, and add .hypothesis to .gitignoreCeridwen2016-04-071-0/+1
|
* Replace None with Empty in the ASTs and refactor the zipper tests to work ↵Ceridwen2016-03-021-123/+125
| | | | with this
* Changed the way how parameters are being builtClaudiu Popa2016-02-131-79/+78
| | | | | | | | | | | | | | | 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
* Don't set the fromlineno of parents or children for nodes without it setClaudiu Popa2016-01-251-2/+5
| | | | | | | | | | | | | If a node had a .fromlineno as None, then a function would be invoked which retrieved the first line number of the children or the parents which wasn't none. This is wrong, because it's not a guarantee that all nodes should have it set, especially those coming from raw_building, where it can be close to impossible to determine the line number of an object coming from an extension module. The functionality was removed and certain guards were added in a couple of places in order to protect operations against None. Close #310 and #195
* Put mixins before NodeNG for WithItemCeridwen2016-01-091-1/+1
|
* Rename asspath to assign_ppathCeridwen2016-01-091-4/+4
|
* Refactor With nodes to have subnodes, WithItems, corresponding to the stdlib ↵Ceridwen2016-01-091-10/+16
| | | | 3 With node.
* Refactor Compare nodes to have two sequences, ops and comparators, ↵Ceridwen2016-01-081-9/+12
| | | | corresponding to the stdlib Compare node.
* Use keys and values as separate arguments for nodes.DictClaudiu Popa2016-01-041-10/+16
| | | | | | | | Dict was a bit different that the corresponding class from the builtin ast module with respect to how it was initialized. Instead of accepting a list of pairs, the initializer accepts two arguments, one for keys, the other for values. For backward compatibility, the class gained a new .items property.
* Add .builtins() method to the manager, for retrieving the builtins module. ↵Claudiu Popa2016-01-041-7/+7
| | | | Close #300
* Remove the old aliases for ass_type / file_bytes / file and nodes.Claudiu Popa2016-01-031-15/+0
|
* Move mixins into tree.base.Claudiu Popa2016-01-021-20/+19
| | | | | | The mixins are better off in tree.base, rather than having their own module. They are also used only by the AST nodes. Close #292
* Remove do_import_module and real_name from ImportFrom and Import nodes.Claudiu Popa2016-01-021-2/+8
| | | | | | | | | | | | | | do_import_module was broken for Import, since it was relying on a missing attribute `modname`. do_import_module in fact required all the time for a name parameter to be passed as an argument. The inherent problem is that Import doesn't have an underlying module name, but more of them, in the .names attribute. Thus requiring for do_import_module to pick one name from .names or to return multiple modules was deemed inappropiate and the method became a function which always requires the import name to be given. do_import_module and real_name are now functions in interpreter.util. Closes #293
* Some nodes got a new attribute, 'ctx', which tells in which context the said ↵Claudiu Popa2015-12-081-0/+25
| | | | | | | | | | | | | | | | | | | node was used. The possible values for the contexts are `Load` ('a'), `Del` ('del a'), `Store` ('a = 4') and the nodes that got the new attribute are Starred, Subscript, List and Tuple. The builtin ast module provides contexts for Name and Attribute as well, but we took a different approach in the past, by having different nodes for each type of context. For instance, Name used in a Del context is a DelName, while Name used in a Store context is AssignName. Since this is ingrained in astroid since quite some time, it makes no sense to change them as well, even though it's a loss of consistency. The patch introduces a new dependency to enum34 on older Python versions, which is used for building the three possible enum values for the contexts. Closes issue #267.
* Fixed bugs introduced by merging modular-locals into 2.0.Ceridwen2015-11-171-1/+4
| | | | | | | | | | | | | | | | | * Add comment and memoization to the lazy instance in raw_building. * Work around obscure pylib/apipkg issue. * Add a skip to numpy test that's not terminating on Python 2. * Fix module special attributes. * Make errors for old-style classes in mro() TypeErrors, not NotImplementedErrors. * Add special nodes to treeabc. * Add {posargs} to tox.ini to enable passing -v to unittest.
* Add missing _proxied methods.Claudiu Popa2015-11-171-0/+15
|
* Merge modular-locals into 2.0Ceridwen2015-11-161-53/+75
|
* Merge structured exceptions into 2.0Claudiu Popa2015-11-131-7/+6
|
* Rename Uninferable and instantiate_class, fix broken tests, improveCeridwen2015-11-061-1/+1
| | | | | | | | | | | testing. * Rename YES to Uninferable * Rename instanciate_class to instantiate_class. * Use six in test_namedtuple_advanced_inference. * Fix test_file_from_module failure on PyPy. * Add enum34 to unittest_brain. * Add unittest_brain dependencies tox.ini.
* Move LookupMixin into mixins, since we can it doesn't need to depend on Name ↵Claudiu Popa2015-11-071-151/+3
| | | | nodes anymore.
* Separate class instances and builtin instances into two conceptsClaudiu Popa2015-11-071-6/+10
| | | | | | | | | | | | | One problem with handling both concepts with a single class leads to type-testing using type identity rather than using isinstance, since builtin instances uses the same base class as class instances (even though this is fairly fuzzy). With two classes instead, we can easily distinguish between these cases. The commit includes two new virtual base classes, Instance and BuiltinInstance and separates the Instance class into BaseInstance and Instance, also changing in some places the use of type-identity testing with isinstance testing. Closes issue #214.
* The inference functions are implemented as dispatch-functions on virtual ↵Claudiu Popa2015-11-051-8/+42
| | | | | | | base classes, instead of monkey-patching nodes This has the nice side effect that circular the dependency between inference.py and node_classes is finally removed.
* Remove the circular dependency between protocols.py and node_classes.pyClaudiu Popa2015-11-041-12/+39
| | | | | | | | | | | | | | | | This is accomplished with two types of modifications: * implementing dispatch functions on virtual base classes, which removes entirely the need of monkey-patching of node classes's methods. * since some of the functions in protocols.py needed to create new nodes, we injected the node_classes module into the dispatched function when calling it, which is a nice use case of dependency injection. This commit also includes new exceptions, which might be raised whenever trying to access a capability, with a dispatch function, on a node which does not support it.
* Move unpack_infer and are_exclusive into the interpreter namespace.Claudiu Popa2015-11-021-82/+4
|
* Merge runtime namespace with interpreter namespace.Claudiu Popa2015-11-011-4/+4
|
* Move the implementation of scopes into interpreter.scopes, which makes it ↵Claudiu Popa2015-11-011-4/+0
| | | | more amenable to changes.
* Move singledispatch import into a common place, where it can be used by astroid.Claudiu Popa2015-11-011-4/+0
|
* Move node_classes and scoped_nodes into the tree namespace.Claudiu Popa2015-11-011-0/+1440