summaryrefslogtreecommitdiff
path: root/astroid/tree
Commit message (Collapse)AuthorAgeFilesLines
* Add infer(), frame(), scope(), and statement() methods to the zipperzipperCeridwen2016-04-071-12/+76
|
* Clean up spacing, typos, and add .hypothesis to .gitignoreCeridwen2016-04-071-0/+1
|
* Make the field character limit for __str__ a global constantCeridwen2016-03-311-1/+5
|
* Clean up some comments and docstringsCeridwen2016-03-291-6/+6
|
* Improve zipper's backwards compatibility and fix bugsCeridwen2016-03-111-6/+22
|
* Add comments and docstrings to the zipper and the testsCeridwen2016-03-081-10/+119
|
* Add the remaining parts of the traversal API and tests for itCeridwen2016-03-082-107/+137
|
* Replace None with Empty in the ASTs and refactor the zipper tests to work ↵Ceridwen2016-03-025-187/+181
| | | | with this
* Revise zipper tests for speed and to be more accurate about what is being testedCeridwen2016-02-211-0/+20
|
* Merge testdata changes and Parameter nodes into zipper.Ceridwen2016-02-155-198/+222
|\
| * Changed the way how parameters are being builtClaudiu Popa2016-02-135-149/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-252-31/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * NodeNG.nearest was removed.Claudiu Popa2016-01-251-18/+0
| |
* | First version of Hypothesis tests for the zipper; unfinished, but works well ↵Ceridwen2016-02-151-21/+28
| | | | | | | | enough to find some bugs
* | Recreate zipper branch off 2.0Ceridwen2016-01-151-0/+272
|/
* Build AsyncWith nodes correctlyCeridwen2016-01-151-3/+3
|
* Fix typos for visit_withitem in as_string, forward visit_asyncwith correctly ↵Ceridwen2016-01-151-1/+1
| | | | in rebuilder
* Enforce strong updates per frames.Claudiu Popa2016-01-121-2/+1
| | | | | | | | | | | | When looking up a name in a scope, Scope.lookup will return only the values which will be reachable after execution, as seen in the following code: a = 1 a = 2 In this case it doesn't make sense to return two values, but only the last one.
* 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-093-34/+39
| | | | 3 With node.
* Refactor Compare nodes to have two sequences, ops and comparators, ↵Ceridwen2016-01-082-13/+17
| | | | corresponding to the stdlib Compare node.
* Use keys and values as separate arguments for nodes.DictClaudiu Popa2016-01-043-13/+26
| | | | | | | | 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
* Lambda is no longer at the top of the FunctionDef.Claudiu Popa2016-01-031-51/+59
| | | | | | This means that checks such as ``isinstance(node, Lambda)`` will not hold true anymore for Functions. Closes #291
* Remove the old aliases for ass_type / file_bytes / file and nodes.Claudiu Popa2016-01-033-73/+0
|
* file_stream is no more, using .stream() is the recommended way to obtain a ↵Claudiu Popa2016-01-021-15/+0
| | | | module stream.
* Move mixins into tree.base.Claudiu Popa2016-01-023-25/+239
| | | | | | 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
* Move qname() definition into a separate mixinClaudiu Popa2015-12-301-3/+13
| | | | | | | | The new mixin is used by ClassDef, Lambda, FunctionDef and Module, for defining a qname() method on them. This should fix a bug where the qname was defined on any subclass of LocalsDictNode, even though it wasn't possible to get a qualified name for the node in question. Closes #278.
* Move lookup specific bits into interpreter.lookupClaudiu Popa2015-12-291-280/+11
| | | | | | | | | | | This patch moves code which was targeted for implementing lookup support from scoped_nodes into interpreter.lookup, resulting in a more cohesive scoped_nodes module. The lookup functions were capable of using virtual base classes instead on relying on concrete classes offered by node_classes and scoped_nodes. The only minor complaint is that builtin_lookup still needs to depend on the manager, which is lazily loaded inside the function itself, at least until we'll get rid of this circular dependency.
* We're raising TypeError in 2.0 for old-style class operations, not ↵Claudiu Popa2015-12-291-1/+1
| | | | NotImplementedError.
* Trigger NotImplementedError with slots message before mro gets executed ↵Claudiu Popa2015-12-291-0/+4
| | | | (will fail for old style classes)
* The slots() method conflates all the slots from the ancestors into a list of ↵Claudiu Popa2015-12-291-10/+30
| | | | | | | | current and parent slots. We're doing this because this is the right semantics of slots, they get inherited, as long as each parent defines a __slots__ entry.
* Some nodes got a new attribute, 'ctx', which tells in which context the said ↵Claudiu Popa2015-12-082-232/+265
| | | | | | | | | | | | | | | | | | | 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.
* relative_to_absolute_name will now raise TooManyLevelsError when a relative ↵Claudiu Popa2015-12-061-0/+4
| | | | import is trying to access something beyond the top-level package.
* AstroidBuildingException is now AstroidBuildingError, the former being ↵Claudiu Popa2015-12-061-3/+3
| | | | removed in 2.0.
* Add two new exceptions, AstroidImportError and AstroidSyntaxError.Claudiu Popa2015-12-061-1/+1
| | | | | | | | They are subclasses of AstroidBuildingException and are raised when a module can't be imported from various reasons. Also do_import_module lets the errors to bubble up without converting them to InferenceError. This particular conversion happens only during the inference.
* assigned_stmts methods have the same signature from now on.Claudiu Popa2015-12-051-0/+1
| | | | | | | They used to have different signatures and each one made assumptions about what could be passed to other implementations, leading to various possible crashes when one or more arguments weren't given. Closes issue #277.
* Remove the visit method for AssignAttr in rebuilder, since AssignAttr does ↵Claudiu Popa2015-12-031-8/+0
| | | | not exist as a node in the builtin ast module.
* Clean up debug statements and fix trivial test failuresCeridwen2015-11-221-1/+1
|
* Clean up caching of and references to builtins mock ASTCeridwen2015-11-211-1/+1
|
* Fix the use of __all__ in wildcard_import_names for transformed modulesCeridwen2015-11-211-1/+6
|
* Add more legible docstring for repr_tree() that was lost in the merge, ↵Ceridwen2015-11-201-17/+17
| | | | print_tree() shortcut method
* Fix bugs introduced during modular-locals mergeCeridwen2015-11-191-1/+1
|
* Make classes, modules, and functions available under both intrinsic and ↵Ceridwen2015-11-181-2/+2
| | | | extrinsic names in mock ASTs
* Replace const_factory with Const call in CallSite.infer_argumentsCeridwen2015-11-181-1/+1
|
* Fix TypeErrors for old-style classes for __slots__ and MROsCeridwen2015-11-171-1/+1
|
* Fixed bugs introduced by merging modular-locals into 2.0.Ceridwen2015-11-173-14/+39
| | | | | | | | | | | | | | | | | * 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
|