| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
The first name will exist until astroid 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.
|
| |\ |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Use explicit StopIteration to pass information from generators to
raise_if_nothing_inferred and path_wrapper, rather than return or
implicit termination by reaching the end of the code block.
* Remove remove_nodes in favor of handling the cases in local_attr,
istance_attr, and getattr, to avoid the need for complicated
information passing when needing to raise an exception.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |\
| |
| |
| | |
Fix binary operator inference issue from pylint's #646
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Idea is that we shouldn't use the same context to infer left-hand side and
right-hand side of the binary operation because inferring lhs may leave
some metadata in context.path that is irrelevant (and can even break inference)
to inference of rhs.
So we make two clones of the original context and use them to infer left-hand
side and right-hand side independently. And then we use the original context to
infer the result of the operation applied to inferred values.
This patch fixes pylint's issue #646 and may be also related to other
similar astroid issues (#198, #199).
|
| | |
| |
| |
| |
| |
| |
| |
| | |
__index__ returning-int method.
This patch moves _class_as_index to helpers, where it becames class_instance_as_index.
Also, it instantiates its own call context, which makes certain idioms with lambdas
to work.
|
| |/ |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
object to be used.
This prevents a crash when the original index object is a slice object,
which was wrapped inadvertendly in a Const node, leading to a crash
later on if the said object was inferred. Closes issue #200.
|
| |
|
|
| |
objects which weren't callable.
|
| | |
|
| |\
| |
| |
| | |
Use six.reraise to avoid losing tracebacks for simple cases
|
| | | |
|
| | | |
|
| |/
|
|
| |
time.
|
| |
|
|
|
|
|
|
| |
This changeset introduces a better way to understand arguments
passed into call sites. The original logic was moved from
astroid.context.CallContext, which become only a container for
arguments and keyword arguments, to astroid.arguments.ArgumentInferator,
a new class for understanding arguments.
|
| | |
|
| |
|
|
| |
positive that needs to be fixed later on in Pylint.
|
| |\ |
|
| | | |
|
| | | |
|
| | | |
|
| | |\ |
|
| | | | |
|
| | |\ \ |
|
| | | | | |
|
| | |_|/
|/| |
| | |
| | |
| | |
| | | |
slices.
Closes issue #137.
|
| | | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |/ / |
|
| |/ |
|
| |
|
|
| |
protocols.
|
| | |
|
| |
|
|
| |
__getitem__. Closes issue #124.
|
| |
|
|
|
|
|
|
|
| |
augmented assignments.
The change is similar to what was added for UnaryOps: a new method
called *type_errors* for both AugAssign and BinOp, which can be used
to retrieve type errors occurred during inference. Also, a new
exception object was added, BinaryOperationError.
|
| | |
|
| |
|
|
|
|
| |
This patch completely changes the way how binary and augmented operations are
inferred, trying to be as compatible as possible with the semantics
from the language reference.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
It is used to deduce the value of a node when used in a boolean context, which is useful
for both inference, as well as for data flow analysis, where we are interested
in what branches will be followed when the program will be executed.
`bool_value` returns True, False or YES, if the node's boolean value can't
be deduced. The method is used when inferring the unary operand `not`.
Thus, `not something` will result in calling `something.bool_value` and
negating the result, if it is a boolean.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
operations.
In exceptions, one object was added for holding information about a possible
UnaryOp TypeError, object called `UnaryOperationError`. Even though the name
suggests it's an exception, it's actually not one. When inferring UnaryOps,
we use this special object to mark a possible TypeError,
object which can be interpreted by pylint in order to emit a new warning.
We are also exposing a new method for UnaryOps, called `type_errors`,
which returns a list of UnaryOperationsError.
|