summaryrefslogtreecommitdiff
path: root/ChangeLog
Commit message (Collapse)AuthorAgeFilesLines
* Add a new *inference object* called SuperClaudiu Popa2015-05-281-0/+10
| | | | | | | | | | | | This patch also adds support for understanding super calls. astroid understands the zero-argument form of super, specific to Python 3, where the interpreter fills itself the arguments of the call. Also, we are understanding the 2-argument form of super, both for bounded lookups (super(X, instance)) as well as for unbounded lookups (super(X, Y)), having as well support for validating that the object-or-type is a subtype of the first argument. The unbounded form of super (one argument) is not understood, since it's useless in practice and should be removed from Python's specification. Closes issue #89.
* Specify that inference objects can be found in the AST tree, but only after ↵Claudiu Popa2015-05-191-1/+1
| | | | inference.
* Add a new type of nodes, called *inference objects*.Claudiu Popa2015-05-191-0/+9
| | | | | | | | | | | Inference objects are similar with AST nodes, but they can be obtained only after inference, so they can't be found inside the AST tree. Their purpose is to handle at astroid level some operations which can't be handled when using brain transforms. For instance, the first object added is FrozenSet, which can be manipulated at astroid's level (inferred, itered etc). Code such as this 'frozenset((1,2))' will not return an Instance of frozenset, without having access to its content, but a new objects.FrozenSet, which can be used just as a nodes.Set.
* Add support for understanding context managers created with ↵Claudiu Popa2015-05-091-1/+0
| | | | contextlib.contextmanager.
* Add basic support for understanding context managers.Claudiu Popa2015-05-091-0/+7
| | | | | | | Currently, there's no way to understand whatever __enter__ returns in a context manager and what it is binded using the ``as`` keyword. With these changes, we can understand ``bar`` in ``with foo() as bar``, which will be the result of __enter__. There's no support for contextlib.contextmanager yet.
* Class.has_dynamic_getattr doesn't return True for special methods which ↵Claudiu Popa2015-05-071-0/+7
| | | | | | | | | | aren't implemented in pure Python. Since most likely the methods were coming from a live object, this implies that all of them will have __getattr__ and __getattribute__ present and it is wrong to consider that those methods were actually implemented (the descriptors will be there, not necessarily implying that the function is user implemented).
* Classes aren't marked as interfaces anymore, in the `type` attribute.Claudiu Popa2015-05-051-0/+2
|
* Add two new exceptions for handling MRO error cases.Claudiu Popa2015-05-031-0/+7
| | | | | | | DuplicateBasesError is emitted when duplicate bases are found in a class, InconsistentMroError is raised when the method resolution is determined to be inconsistent. They share a common class, MroError, which is a subclass of ResolveError, meaning that this change is backwards compatible.
* Ensure that generated enum values have the correct base classesenum-fixesPhilip Lorenz2015-05-011-0/+3
| | | | | | | | | | | | | | Enum values should share the same base classes as their defining class. If this is not the case it may lead to wrong inference results when an enum member is used - e.g. for the following snippet: class X(enum.IntEnum): one = 1 print([1, 2][X.one]) pylint will detect a "invalid-sequence-index" error as the __index__ method of X.one is not detected.
* Expose a implicit_metaclass() method in Class.Claudiu Popa2015-04-251-1/+4
| | | | | This will return a builtins.type instance for newstyle classes, otherwise it will return None.
* Class.local_attr and Class.local_attr_ancestors uses internally a mro ↵Claudiu Popa2015-04-181-0/+12
| | | | | | | | | | | | | lookup, using .mro() method, if they can. That means for newstyle classes, when trying to lookup a member using one of these functions, the first one according to the mro will be returned. This reflects nicely the reality, but it can have as a drawback the fact that it is a behaviour change (the previous behaviour was incorrect though). Also, having bases which can return multiple values when inferred will not work with the new approach, because .mro() only retrieves the first value inferred from a base.
* Don't hard fail when calling .mro() on a class which has combined both ↵Claudiu Popa2015-04-181-0/+7
| | | | | | | newstyle and old style classes. The class in question is actually newstyle (and the __mro__ can be retrieved using Python). .mro() fallbacks to using .ancestors() in that case.
* Support multiple types of known properties in _wrap_attr.Claudiu Popa2015-04-171-1/+2
|
* UnboundMethod.getattr calls the getattr of its _proxied object.Claudiu Popa2015-04-171-0/+7
| | | | | | It previously crashed, since it called super(...).getattr(..) and the first ancestor in its mro was bases.Proxy and bases.Proxy doesn't implement the .getattr method. Closes issue #91.
* Improve the inference of Getattr nodes when dealing with abstract properties ↵Claudiu Popa2015-04-171-0/+9
| | | | | | | | | | from the abc module. In astroid.bases.Instance._wrap_attr we had a detection code for properties, which basically inferred whatever a property returned, passing the results up the stack, to the igetattr() method. It handled only the builtin property but the new patch also handles abc.abstractproperty.
* .slots() will return an empty list for classes with empty slots.Claudiu Popa2015-04-141-0/+6
| | | | | | Previously it returned None, which is the same value for classes without slots at all. This was changed in order to better reflect what's actually happening.
* Understand partially the 3-argument form of `type`.Claudiu Popa2015-04-131-0/+4
| | | | | | | The only change is that astroid understands members passed in as dictionaries as the third argument. This improves the understanding of classes generated on-the-fly, using the type function.
* Add brain tips for multiprocessing post Python 3.4+.Claudiu Popa2015-04-021-1/+5
| | | | | | | In Python 3.4+, the module level functions are retrieved with getattr from a context object, leading to many no-member errors in Pylint. This patch ensures us that we can retrieve those attributes, no matter what.
* Set the current function as parent for the Generator object inferred from ↵Claudiu Popa2015-04-011-0/+4
| | | | `infer_call_result`.
* Backed out changeset 53b22c3f6ed9Claudiu Popa2015-04-011-4/+0
|
* Set the current function as parent for the Generator object inferred from ↵Claudiu Popa2015-04-011-0/+4
| | | | `infer_call_result`.
* Add some fixes which enhances the Jython support.Claudiu Popa2015-03-301-0/+6
| | | | | | | The fix mostly includes updates to modutils, which is modified in order to properly lookup paths from live objects, which ends in $py.class, not pyc as for Python 2, Closes issue #83.
* Add brain tips for multiprocessing.Manager and ↵Claudiu Popa2015-03-281-0/+3
| | | | multiprocessing.managers.SyncManager.
* Catch SyntaxError in astroid.builder.AstroidBuilder._data_build and reraise ↵Claudiu Popa2015-03-171-0/+7
| | | | it as AstroidBuildingException.
* Prepare 1.3.6 release.astroid-1.3.6Claudiu Popa2015-03-141-1/+2
|
* Add a new option to AstroidManager for controlling the AST peephole optimizerClaudiu Popa2015-03-141-0/+6
| | | | | | | The new option, 'optimize_ast', controls if peephole optimizer should be enabled or not. This prevents a regression, where the visit_binop method wasn't called anymore with astroid 1.3.5, due to the differences in the resulting AST. Closes issue #82.
* Class.slots raises NotImplementedError for old style classes.Claudiu Popa2015-03-141-0/+5
| | | | Closes issue #67.
* Prepare 1.3.5.astroid-1.3.5Claudiu Popa2015-03-111-1/+2
|
* Implement the assigned_stmts operation for Starred nodes.Claudiu Popa2015-02-211-1/+5
| | | | | | | This was omitted when support for Python 3 was added in astroid. It currently works only for Starred nodes in assignments and only for the most common of cases, such as `a, *b = (1, 2, 3)`. Closes issue #36.
* Improve the scope_lookup method for Classes.Claudiu Popa2015-02-091-0/+10
| | | | | | | | | | | This patch improves the scope lookup for Classes, regarding qualified objects, with an attribute name exactly as one provided in the class itself. For example, a class containing an attribute 'first', which was also an import and which had, as a base, a qualified name or a Gettattr node, in the form 'module.first', then Pylint would have inferred the `first` name as the function from the Class, not the import. Closes Pylint issue #466.
* Fix a crash which occurred when a class was the ancestorClaudiu Popa2015-01-291-0/+3
| | | | | | of itself. Closes issue #78.
* Obtain the methods for the nose brain tip through anClaudiu Popa2015-01-271-0/+4
| | | | | | unittest.TestCase instance. Closes Pylint issue #457.
* Add the ability to optimize small ast subtrees.Claudiu Popa2015-01-181-0/+7
| | | | | | | | The first use of the AST peephole optimizer is the optimization of multiple BinOp nodes. This removes recursivity in the rebuilder when dealing with a lot of small strings joined by the addition operator. which are now precomputed to the final string. Closes issue #59.
* Prepare a new micro release.astroid-1.3.4Claudiu Popa2015-01-171-1/+2
|
* Get the first element from the method list when obtaining nose.tools.trivial ↵Claudiu Popa2015-01-161-0/+4
| | | | | | functions. Closes Pylint issue #448.
* Prepare the release.astroid-1.3.3Claudiu Popa2015-01-161-1/+1
|
* Add inference tips for nose.tools.Claudiu Popa2015-01-111-0/+2
|
* .slots() can contain unicode strings on Python 2.Claudiu Popa2015-01-031-0/+2
|
* Improve the detection for functions decorated with decoratorsClaudiu Popa2014-12-291-0/+3
| | | | which returns static or class methods.
* Add brain tips for six.moves. Closes issue #63.Claudiu Popa2014-12-181-0/+2
|
* Add a new method to Class nodes, 'mro'.Claudiu Popa2014-12-151-0/+3
| | | | With this method, the method resolution order of a class can be retrieved.
* Rework the file_stream API.Claudiu Popa2014-12-151-5/+9
| | | | | | | | | | | | Restore file_stream to a propery, but deprecate it in favour of the newly added method Module.stream. By using a method instead of a property, it will be easier to properly close the file right after it is used, which will ensure that no file descriptors are leaked. Until now, due to the fact that a module was cached, it was not possible to close the file_stream anywhere. file_stream will start emitting PendingDeprecationWarnings in astroid 1.4, DeprecationWarnings in astroid 1.5 and it will be finally removed in astroid 1.6.
* Changed the API for Class.slots.Claudiu Popa2014-12-051-0/+5
| | | | | | | | | It returns None when the class doesn't define any slots. Previously, for both the cases where the class didn't have slots defined and when it had an empty list of slots, Class.slots returned an empty list, which is ambiguous.
* Add brain definition for most string and unicode methodsSylvain Th?nault2014-12-041-0/+3
|
* Add inference tips for dict calls.Claudiu Popa2014-12-031-1/+1
| | | | | This patch properly infers dict constructor calls, as in dict(), dict(kwarg=value), dict(<iterable>), dict(<mapping>) and dict(<iterable> or <mapping>, **kwarg) syntax.
* Add inference tips for 'tuple', 'set' and 'list' builtins.Claudiu Popa2014-11-281-0/+2
| | | | | | | | This patch adds some inference tips for the mentioned builtins, making calls such as 'list([4, 5, 6])` be inferred the same as `[4, 5, 6]`. Previosly, inferring those objects resulted in an Instance of the given builtin, without having access to their elements. This is useful, for instance, when trying to infer slots defined with set, list of tuple calls (instead of their syntactic equivalents).
* Restore the file_stream API.Claudiu Popa2014-11-251-0/+8
| | | | | | | | | | Module.file_stream is again a property, but each opened file is cached. Module node gains a new API, 'close', which should be called for closing all the gathered file streams. This is consistent with how the API worked pre-astroid 1.3 (meaning that no seek is required).
* Prepare the 1.3.2 release.astroid-1.3.2Torsten Marek2014-11-221-1/+2
|
* Update the changelog.Torsten Marek2014-11-221-3/+9
|
* Fix a crash with invalid subscript index.Claudiu Popa2014-11-221-0/+2
| | | | | Don't try to infer 'self.config = {0: self.config[0]}' and similar subscript constructions.