summaryrefslogtreecommitdiff
path: root/astroid/tree/scoped_nodes.py
Commit message (Collapse)AuthorAgeFilesLines
* Mark __init_subclass__ as classmethod (#388)2.0.experimental2.0Łukasz Rogalski2017-01-301-0/+3
|
* Let NotSupportedError be propagated.Claudiu Popa2017-01-261-6/+1
|
* Implement __getitem__ inference for classes (using the metaclass)David Euresti2017-01-221-0/+25
| | | | | | Essentially implement the getitem method in ClassDef which returns the correct value. Fixes #348
* Make ClassDefs support keyword arguments. (#384)Derek Gustafson2017-01-221-2/+5
|
* Skip the current class when deducing its mro. Close #361.Claudiu Popa2016-11-211-0/+2
|
* Add `returns` into the proper order in FunctionDef._astroid_fieldsClaudiu Popa2016-07-271-1/+1
| | | | | The order is important, since it determines the last child, which in turn determines the last line number of a scoped node.
* Even more granular copyrights (thanks to copyrite)Claudiu Popa2016-07-221-2/+5
|
* Keep a consistent copyright notice across the board.Claudiu Popa2016-07-191-0/+2
|
* Give priority to local special attributes for classes and modulesClaudiu Popa2016-06-051-4/+23
| | | | | | For instance, a module can decide to redefine its __file__ attribute. Previously, this was defaulting to the file name itself, without taking in account local redefinitions.
* Convert all files to new license headerCeridwen2016-05-171-17/+3
|
* Build a dummy module object for namespace directories and add a test for ↵Claudiu Popa2016-05-091-0/+2
| | | | multiple directories contributing to the same namespace.
* Don't crash when a decorated method has the same name as the decorator, ↵Claudiu Popa2016-04-301-1/+9
| | | | which is a builtin object (a property)
* Calling lambda methods (defined at class level) can be understood.Claudiu Popa2016-04-261-1/+6
|
* decoratornames() does not leak InferenceError anymore.Claudiu Popa2016-03-111-2/+5
|
* Try to compute descriptors only for objects with the source code available.Claudiu Popa2016-03-011-5/+12
|
* Unbound methods don't occur anymore on Python 3Claudiu Popa2016-02-251-3/+8
| | | | | | | Instead, we're inferring FunctionDefs where an unbound access to a method was found. Close #257
* Introduce a special attributes modelClaudiu Popa2016-02-231-62/+17
| | | | | | | | Through this model, astroid starts knowing special attributes of certain Python objects, such as functions, classes, super objects and so on. This was previously possible before, but now the lookup and the attributes themselves are separated into a new module, objectmodel.py, which describes, in a more comprehensive way, the data model of each object.
* Add a __repr__ for CallSite. Close #209Claudiu Popa2016-02-191-0/+8
|
* imported_names() got replaced by public_names()Claudiu Popa2016-02-181-51/+3
| | | | | | | | | | | | | Our understanding of wildcard imports through __all__ was half baked to say at least, since we couldn't account for modifications of the list, which results in tons of false positives. Instead, we replaced it with public_names(), a method which returns all the names that are publicly available in a module, that is that don't start with an underscore, even though this means that there is a possibility for other names to be leaked out even though they are not present in the __all__ variable. Close #322
* Changed the way how parameters are being builtClaudiu Popa2016-02-131-13/+17
| | | | | | | | | | | | | | | 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
* Use keys and values as separate arguments for nodes.DictClaudiu Popa2016-01-041-2/+5
| | | | | | | | 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.
* 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-031-46/+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-021-3/+2
| | | | | | 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
* 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.
* 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.
* 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
|
* 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-171-13/+21
| | | | | | | | | | | | | | | | | * 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.
* Remove debugging statementCeridwen2015-11-161-1/+0
|
* Merge modular-locals into 2.0Ceridwen2015-11-161-112/+365
|
* Merge structured exceptions into 2.0Claudiu Popa2015-11-131-102/+145
|
* Rename Uninferable and instantiate_class, fix broken tests, improveCeridwen2015-11-061-31/+31
| | | | | | | | | | | 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-1/+1
| | | | nodes anymore.
* Add Function.called_with, which returns a CallSite with the given arguments.Claudiu Popa2015-11-041-0/+219
| | | | | The returned CallSite object can be used to pair arguments with function's parameters.
* Merge runtime namespace with interpreter namespace.Claudiu Popa2015-11-011-5/+5
|
* Move the implementation of scopes into interpreter.scopes, which makes it ↵Claudiu Popa2015-11-011-6/+0
| | | | more amenable to changes.