| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
|
|
|
|
|
|
|
| |
hierarchy can't be determined
It used to return Uninferable, but no call site was actually taking care of this
potential return. It is better though to simply raise an exception and to let
the call sites to handle them in which way they want to.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The inference can handle the case where the attribute is accessed through a subclass
of a base class and the attribute is defined at the base class's level,
by taking in consideration a redefinition in the subclass.
This should fix https://github.com/PyCQA/pylint/issues/432
|
|
|
|
|
|
|
| |
operations
In order to do so, we had to change the signature of infer_binary_operation to receive
the binary operation instead of the operator itself.
|
|
|
|
|
|
|
|
|
|
| |
Some of the messages were disabled in pylintrc, since they're not
very useful for our case. Other parameters, such as the number of
arguments / statements / attributes etc were configured so that they
won't be too restrictive for our codebase, since making the code
to respect them right now requires too much development changes,
which is not justified by the end result.
Closes issue #284.
|
|
|
|
| |
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.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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.
|
|\
| |
| |
| | |
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).
--HG--
branch : binop-inference-fix
|
| |
| |
| |
| |
| |
| |
| |
| | |
__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.
|
| |
|