summaryrefslogtreecommitdiff
path: root/astroid/inference.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Even more granular copyrights (thanks to copyrite)Claudiu Popa2016-07-221-2/+5
|
* Keep a consistent copyright notice across the board.Claudiu Popa2016-07-191-0/+2
|
* Now is_subtype / is_supertype raises an internal exception when a type ↵Claudiu Popa2016-06-031-9/+21
| | | | | | | | 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.
* Fix typosJakub Wilk2016-06-021-2/+2
|
* Convert all files to new license headerCeridwen2016-05-161-17/+3
|
* Improve inference with regard redefinition of values in subclassesClaudiu Popa2016-04-261-0/+11
| | | | | | | | 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
* Set the parent to the BinOp node when inferring nodes created during binary ↵Claudiu Popa2016-02-161-34/+32
| | | | | | | 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.
* Cleanup pylint's warnings over astroid codebaseClaudiu Popa2015-12-141-6/+5
| | | | | | | | | | 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.
* AstroidBuildingException is now AstroidBuildingError.Claudiu Popa2015-12-061-2/+2
| | | | The first name will exist until astroid 2.0.
* Add two new exceptions, AstroidImportError and AstroidSyntaxError.Claudiu Popa2015-12-061-6/+18
| | | | | | | | 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.
* Merge upstream changesCeridwen2015-11-061-1/+1
|\
| * Rename Uninferable and instantiate_class, fix broken tests, improveCeridwen2015-11-061-38/+38
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Rename Uninferable and instatiate_classCeridwen2015-11-061-38/+38
| |
* | Add structured exceptions to decorators and remaining functions.Ceridwen2015-11-061-7/+21
| | | | | | | | | | | | | | | | | | | | * 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.
* | This bookmark adds structured exceptions to astroid.Ceridwen2015-11-021-26/+39
|/ | | | | | | | | | | | | | | | | | | 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.
* Merged in dmand/astroid/binop-inference-fix (pull request #92)Claudiu Popa2015-10-231-7/+7
|\ | | | | | | Fix binary operator inference issue from pylint's #646
| * Fix binary operation inference crash by using cloned contextsDmitry Pribysh2015-10-211-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add support for indexing containers with instances which provides an ↵Claudiu Popa2015-10-221-0/+4
| | | | | | | | | | | | | | | | __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.
* | Create a call context when inferring unary operands on instances.Claudiu Popa2015-10-221-0/+3
|/
* Remove doctype and future imports which aren't useful.Claudiu Popa2015-10-111-2/+0
|
* Move decorators from bases to decorators module.Claudiu Popa2015-10-111-19/+20
|
* Don't wrap instance's arguments into a Const, instead let the original index ↵Claudiu Popa2015-10-031-19/+16
| | | | | | | | 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.
* Fix a crash which occurred when inferring unary operands which yielded ↵Claudiu Popa2015-10-031-0/+2
| | | | objects which weren't callable.
* Fix pylint errors.Claudiu Popa2015-09-261-2/+0
|
* Merged in ceridwenv/astroid (pull request #88)Claudiu Popa2015-09-261-4/+4
|\ | | | | | | Use six.reraise to avoid losing tracebacks for simple cases
| * Add helper function for reraising exceptionsCeridwen2015-09-211-13/+4
| |
| * Use six.reraise to avoid losing tracebacks for simple casesCeridwen2015-09-211-4/+13
| |
* | Fix a crash when inferring subscripts which returned the same object all the ↵Claudiu Popa2015-09-251-3/+6
|/ | | | time.
* Improve the understanding of argumentsClaudiu Popa2015-09-091-0/+1
| | | | | | | | 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.
* First pass of the Python 3.5 support.Claudiu Popa2015-09-071-3/+1
|
* Disable the no-value-for-parameter message for now, since it's a false ↵Claudiu Popa2015-08-261-0/+2
| | | | positive that needs to be fixed later on in Pylint.
* Last merge (hopefully) and all bugs fixed but oneCeridwen2015-08-211-17/+71
|\
| * Understand slices of tuples, lists, strings and instances with support for ↵Claudiu Popa2015-08-211-17/+71
| | | | | | | | | | | | slices. Closes issue #137.
* | Add tests for aliasesCeridwen2015-08-211-2/+4
| |
* | More fixes for bugs introduced during mergeCeridwen2015-08-181-13/+15
| |
* | Fix most obvious errors intorduced by the latest mergeCeridwen2015-08-141-4/+4
| |
* | Merge main into defaultCeridwen2015-08-141-210/+129
|\ \ | |/
| * Big cleanup across the entire projectClaudiu Popa2015-08-121-70/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Remove unused import.Claudiu Popa2015-08-121-1/+1
| |
| * Move InferenceContext and CallContext into astroid.contextClaudiu Popa2015-08-121-101/+16
| | | | | | | | | | | | | | 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.
| * Move YES to astroid.util.Claudiu Popa2015-08-091-40/+41
| | | | | | | | | | | | | | 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*.
| * Remove trailing whitespace.Claudiu Popa2015-08-081-1/+1
| |
| * Add CallFunc.keywords, instead of putting together args and kwargs in ↵Claudiu Popa2015-08-081-22/+20
| | | | | | | | | | | | | | | | | | 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.
| * Move the choosing of the predicate at the beginning of the function.Claudiu Popa2015-08-041-6/+5
| |
* | Fix bugs introduced by merge and formattingCeridwen2015-07-111-1/+1
| |
* | Merged changes from logilab/astroidCeridwen2015-07-101-2/+3
|\ \ | |/
| * Infer the unary method retrieved from classes.Claudiu Popa2015-07-031-2/+3
| |
* | Node constructors almost finished except for two bugsCeridwen2015-07-081-28/+28
|/
* Add support for inferring methods masquerading as others for the binop ↵Claudiu Popa2015-07-021-1/+2
| | | | protocols.
* Remove trailing whitespace.Claudiu Popa2015-07-011-1/+1
|