| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
const_factory is buggy in master, as well as the entire raw_building
module, which means that at given points during rebuilding of ASTs
from live objects, nodes are constructed with Python objects as
elements, leading to various crashes with pylint and with astroid
during certain inference paths. This is fixed in 2.0 though, where
raw_building was completely rewritten, but bringing those changes
back into master will need some more work to be done. Until this
happens, we ignore the elements of sequences passed to const_factory,
since they are not useful in anyway (and the code that uses them
crashes anyway). This is just a temporary solution until we either
merge master with 2.0 or backport raw_building changes from 2.0
to master.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Major changes:
* AstroidError has an __init__ that accepts arbitrary keyword-only
arguments for adding information to exceptions, and a __str__ that
lazily uses exception attributes to generate a message. The first
positional argument to an exception is assigned to .message. The new
API should be fully backwards compatible in general.
* Some exceptions are combined or renamed; the old names are still
available.
* The OperationErrors used by pylint are now BadOperationMessages and
located in util.py.
* The AstroidBuildingException in _data_build stores the SyntaxError
in its .error attribute rather than args[0].
* Many places where exceptions are raised have new, hopefully more
useful error messages.
The only major issue remaining is how to propagate information into decorators.
|
| |
| |
| |
| |
| |
| |
| | |
This can happen for instance when the list contains objects which
weren't inferable in the first place. There were a bunch of places
affected by this bug: unpack_infer, the inference of list additions
and the handling of the namedtuple's fields.
|
|/
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
| |
We're doing this in order to reduce the dependency hell which
occurs when a module such as bases.py wants to use classes
defined in node_classes.
|
| |
|
|
|
|
| |
represent the ** operation.
|
|
|
|
|
|
|
|
|
| |
PEP 448
This is a different approach than what the builtin ast module does,
since it just uses None to represent this kind of operation,
which seems conceptually wrong, due to the fact the AST contains
non-AST nodes. Closes issue #206.
|
| |
|
|
|
|
|
|
| |
We did this because objects.Slice had more capabilities than
nodes.Slice, such as inferring the slice attributes (start, stop,
step) and it was used mostly for inferring the slice() builtin.
|
| |
|
| |
|
|
|
|
|
|
|
| |
They were added in order to have a minimum level of backward
compatibility, since they were removed from the class. This is also
an easy way to retrieve them, instead of looking explicitly for them
in args or keywords respectively.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch adds __str__` and `__repr__` methods to InferenceContext and
alters the `__str__, `__repr__, and repr_tree() methods for NodeNG.
The `__str__` methods print out formatted information about the object's
fields; NodeNG's `__str__` method is not recursive. InferenceContext's
__repr__` gives a compact representation of its fields. I slightly
shortened NodeNG's `__repr__` method by removing a field that's usually
empty. I rewrote repr_tree() to better format the information it
contains and to display *all* the fields for each AST node, with some
fields controlled by options to avoid spam. I also fixed
https://bitbucket.org/logilab/astroid/issues/185/as_string-gives-wrong-result-for-keyword .
|
| | |
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
| |
deprecated method should be warned upon.
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| | |
slices.
Closes issue #137.
|
| |
| |
| |
| | |
duplication. Closes issue #160.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The cleanup consisted in a couple of changes:
* import only modules, not objects, in order
to not clutter the module namespace and to not
leak accidentally objects which aren't public API
for the said modules.
* use two spaces between module level functions
* move some mixins from astroid.node_classes in
the proper order, starting at the left,
not being last in the MRO.
|
| |
| |
| |
| |
| |
| |
| | |
In order to reduce circular dependencies between components,
CallContext is moved into a new module, astroid.context.
At the same time, for increasing the cohesion inside astroid.bases,
InferenceContext was moved as well into astroid.context.
|
| |
| |
| |
| |
| |
| |
| | |
YES is needed by other components of astroid, components which aren't
necessarily related to astroid.bases. In order to reduce circular
interdependencies between components, YES is moved into a new module,
tailored for various *utilities*.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
CallFunc.args
This patch improves the similarity with the Python's AST. Until now,
CallFunc.args contained both the positional arguments and the keyword arguments,
which was misleading and always it was required to filter out keywords when working
with arguments.
|
| |
| |
| |
| |
| |
| |
| |
| | |
This also implements an easier @cache decorator and removes @classproperty as
it only was used in an insignificant test.
--HG--
branch : no-logilab-common
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Added aliases for inferred() and assign_type(), refactor some uses of
ternary if, remove some now-unused internal functions in rebuilder,
replaced the mutating docstring function with one that returns values
as well as side-effects, change back to lazy-object-proxy, and add keyword
args to the Module call in rebuilder.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I corrected the spelling of 'infered' to 'infered' and changed some to
make them more consistent with the built-in ast module and to read
better in English. I created aliases with proxy objects to maintain
backwards compatibility.
I also refactored the node classes so that they have __init__ and
postinit functions. The postinit function has to be called after the
creation of a parent with the instances of its children because the
node __init__ functions have to take a parent instance to maintain the
doubly-linked structure of the AST. This involved moving considerable
amounts of node-construction logic from rebuilder.py to
node_classes.py and scoped_nodes.py.
|
|/ |
|
| |
|
| |
|
| |
|
| |
|