| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
multiple directories contributing to the same namespace.
|
|
|
|
|
|
| |
declaration forbids them.
Close issue #332
|
|
|
|
|
| |
They were previously tied because UnboundMethod had logic for type.__new__. Now this logic
was moved into a brain tip, simplifying the implementations of the methods.
|
|
|
|
| |
This reverts commit d37b81de4f1e64abc2f222c487785d816ab469ea.
|
| |
|
| |
|
|
|
|
| |
removed in 2.0.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Add handling to generate ClassInstance nodes for instance objects.
* Fix a number of special cases for building mock ASTs.
* Fix an infinite recursion on Python 2 by using the new
future_imports property to look up whether absolute_import is
active.
* Do some minor reorganization on how the builtins module is set up
and accessed from various places, mostly to make debugging easier.
This is in lieu of a more serious reorganization which needs to
happen.
* Remove Manager.infer_ast_from_something and Manager.ast_from_class
as superceded by the new functions in raw_building.
|
| |\ |
|
| |\ \ |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
assignments
|
| |\ \ \ |
|
| | | | | |
|
| | | | | |
|
|\ \ \ \ \
| | |_|_|/
| |/| | | |
|
| | |_|/
| |/| | |
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It was initially added in order to remove a recursion error in rebuilder, which
happened when a lot of strings were added together, leading to an
actual recursion error when executing the code. The peepholer was more
of a constant folding algorithm rather than a real peepholer. Since it's
purpose is limited and the original problem is not worth fixing in
astroid, but in the user code, this is removed.
Closes issue #210
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| | |
The runtime objects from astroid.bases and astroid.objects got
merged together into astroid.runtime.objects. bases._infer_stmts
was moved into a new namespace, interpreter, which should be
the starting point of a the new abstract interpretation component.
|
|/ |
|
|
|
|
|
|
| |
The entire original exception object needs to be passed to AstroidBuildingException
in builder.AstroidBuilder._file_build, since pylint uses this as an introspection method,
in order to find what error happened.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
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*.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Until now, the transforms were applied at the same time the tree was
being built. This was problematic if the transform functions were
using inference, since the inference was executed on a partially
constructed tree, which led to failures when post-building
information was needed (such as setting the _from_names
for the From imports).
Now there's a separate step for transforms, which are applied
using transform.TransformVisitor.
There's a couple of other related changes:
* astroid.parse and AstroidBuilder gained a new parameter
`apply_transforms`, which is a boolean flag, which will
control if the transforms are applied. We do this because
there are uses when the vanilla tree is wanted, without
any implicit modification.
* the transforms are also applied for builtin modules,
as a side effect of the fact that transform visiting
was moved in AstroidBuilder._post_build from
AstroidBuilder._data_build.
Closes issue #116.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| |
| | |
This API can be used to retrieve an astroid AST from a source code string,
similar to how ast.parse can be used to obtain a Python AST from a source string.
This is the test_utils.build_module promoted to a public API.
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
it as AstroidBuildingException.
|