| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
with this
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
| |
3 With node.
|
|
|
|
| |
corresponding to the stdlib Compare node.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Close #300
|
| |
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
nodes anymore.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
more amenable to changes.
|
| |
|
|
|