summaryrefslogtreecommitdiff
path: root/astroid/inference.py
Commit message (Collapse)AuthorAgeFilesLines
* Make sure that Attribute.infer has a protection against StopIterationsClaudiu Popa2019-01-191-3/+5
|
* Remove StopIteration handling which should not leak at all from inferenceClaudiu Popa2019-01-181-9/+1
|
* Move infer_name_module() in pylint and remove it from hereClaudiu Popa2019-01-131-9/+0
|
* Revert path copying in InferenceContext()Claudiu Popa2018-12-301-3/+0
| | | | | | | | While copying the path solves some inference issues, it also leads to horrenduous performance hits on large libraries such as pandas. We still want to have the path copying, but we need a better understanding on why that is needed, as well as a change on how we operate with the inference contexts.
* Multiple "value" or "slice" values on subscript inference.Daniel Martin2018-10-151-46/+43
| | | | Fixes astroid bug #614.
* Replace a nested for loop with a product() callClaudiu Popa2018-10-111-15/+8
|
* Use yield fromClaudiu Popa2018-10-101-2/+1
|
* Remove unneeded commentClaudiu Popa2018-10-101-3/+0
|
* Replace a nested for loop with itertools.productClaudiu Popa2018-10-101-15/+16
|
* Replace checks against None and Uninferable to boolean checksClaudiu Popa2018-10-101-3/+3
| | | | Uninferable acts as None so that should be enough.
* Simplify the creation of extra_context for _infer_callClaudiu Popa2018-10-101-3/+2
|
* Use copy_context where it makes senseClaudiu Popa2018-10-101-6/+5
|
* Initial formatting of astroidClaudiu Popa2018-10-021-94/+143
|
* Pass parameters by keyword name when inferring sequences.Claudiu Popa2018-09-281-1/+2
| | | | Close PyCQA/pylint#2526
* infer_call_result can raise InferenceError so make sure to handle that for ↵Claudiu Popa2018-07-311-1/+0
| | | | | | | | | | | the call sites where it is used infer_call_result started recently to raise InferenceError for objects for which it could not find any returns. Previously it was silently raising a StopIteration, which was especially leaking when calling builtin methods. Since it is after all an inference method, it is expected that it could raise an InferenceError rather than returning nothing. Close PyCQA/pylint#2350
* Cut obsolete "explicit StopIteration" commentsNick Drozd2018-07-301-10/+0
| | | | The explicit StopIterations were themselves were cut in ceeee097.
* Spelling fixesVille Skyttä2018-07-241-2/+2
|
* Fix lint errorBryce Guinta2018-07-241-0/+1
| | | | pylint doesn't understand decorators
* Wrap the inference functions with raise_if_nothing_inferred where we didn't ↵Claudiu Popa2018-07-241-1/+16
| | | | | | | have any guards against them This is especially important in a Python 3.7 worlds where we need to handle StopIteration that can be triggered by next() over empty generators.
* Rename method for making it clearerClaudiu Popa2018-07-241-15/+15
|
* Update the copyright noticesastroid-2.0Claudiu Popa2018-07-151-2/+14
|
* Fix inference for nested callsBryce Guinta2018-07-051-3/+3
| | | | | | | | | Add context_lookup to the context class as extra_context. Deliver the correct context with the correct boundnode for function argument nodes. Close #177
* Refactor assinging boundnode to contextBryce Guinta2018-07-041-7/+4
| | | | | Code in multiple places had the same pattern for infering call results.
* Make sure that context_lookup is always definedClaudiu Popa2018-06-131-1/+6
|
* Remove useless TODOs that are either issues in the issue tracker or things ↵Claudiu Popa2018-06-121-7/+2
| | | | which we'll never get to fix/change
* Convert to yield fromNick Drozd2018-06-081-17/+9
| | | | | | | I tried this to see if it would improve performance. It didn't, but it does look nicer, so we might as well keep it. See also 5fd5aa81483e709cb5c464c7d4bb37c8c39f2afa
* Don't propagate Uninferable objects when inferring BinOpsClaudiu Popa2018-06-051-0/+2
| | | | Close PyCQA/pylint#2059
* Remove reraise() in favour of using raise..fromClaudiu Popa2018-05-311-14/+27
|
* Fix lint errorsAshley Whetter2018-05-051-6/+6
|
* Fix StopIteration raising for python3.7 (#534)HoverHell2018-04-241-8/+14
| | | | | | Because we don't support Python 2 any longer in the master branch, we can return values from generators to signal that we want to throw a StopIteration, without actually raising the StopIteration itself.
* Set context boundnode for binary operation to correct inferenceBryce Guinta2018-03-301-0/+2
|
* Add context_lookup to infer_call_result for function argumentsBryce Guinta2018-03-301-1/+20
| | | | | | | | This allows inference of function arguments to be different than the inference of the function body Currently this is only used for object.__new__(cls) calls but can be expanded later
* Fix duplicate values in inferred dictionary node from dictionary unpackingBryce Guinta2018-03-021-2/+26
|
* Fix augassign recursion errorBryce Guinta2018-02-181-5/+0
| | | | | | | | | | | | | | | The augmented assign rhs context path was deleted most likely due to a recently fixed inference bug where InferenceContext path attributes were shared between objects. Recursive functions on the right hand side of the augmented assign would forget that they were already called, causing an eventual RecursionError in astroid inference Now that the InferenceContext clone() method properly copies the inference path between Contexts, it's fine to remove this hack. Fixes #437, Fixes #447, Fixes #313, Fixes PyCQA/pylint#1642, Fixes PyCQA/pylint#1805, Fixes PyCQA/pylint#1854, Fixes PyCQA/pylint#1452
* Fix lint warningsClaudiu Popa2017-10-121-0/+1
|
* Skip Uninferable inferred objects when inferring a DictClaudiu Popa2017-08-121-1/+1
| | | | Close PyCQA/pylint#1619
* Catch _NonDeducibleTypeHierarchy in inference._infer_augassign (#443)Michał Masłowski2017-07-081-4/+2
| | | | Similarly to _infer_binop, we have to handle exceptions raised by helpers.is_subtype and helpers.is_supertype in _infer_augassign.
* TypoClaudiu Popa2017-03-121-1/+1
|
* Move the iteration inside the try branch, which makes the quickstart redundantClaudiu Popa2017-03-121-20/+3
|
* Quickstart _infer_binary_operation to raise errors that occur during startup.Calen Pennington2017-03-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | Since https://github.com/PyCQA/astroid/commit/3e27213914271309a4716662b09fda91fca9efa1, is_subtype and is_supertype raise exceptions when they can't find a relationship between types. This is caught by the callers of _infer_binary_operation. However, the error is only thrown after the generator return by _infer_binary_operation is started. Prior to this patch, the generator is only started inside the else clause of: try: results = _infer_binary_operation(lhs, rhs, self, context, _get_binop_flow) except exceptions._NonDeducibleTypeHierarchy: yield util.Uninferable else: for result in results: yield result To address this, the quickstart decorator pulls the first value from the generator when it's called, and then buffers that first result until it is needed by the later iteration.
* Move the catching of AttributeInferenceError where .getitem() is called, in ↵Claudiu Popa2017-03-011-0/+1
| | | | infer_subscript
* Raise InferenceError in Class.getitem. Close #395Claudiu Popa2017-03-011-1/+1
|
* Infer starred expressions in tuple, list, set and dict literals (#396)Łukasz Rogalski2017-02-141-4/+69
|
* Fix the discrepancies between master and 2.0 codeClaudiu Popa2016-12-301-7/+3
|
* Add support for binary operations between classes.Claudiu Popa2016-12-301-1/+6
|
* Add a new mechanism for retrieving the special methods.Claudiu Popa2016-12-301-1/+8
|
* Add support for inferring unary binary op for classesClaudiu Popa2016-12-301-1/+1
|
* Let the type error propagate as an AstroidTypeError.Claudiu Popa2016-12-031-1/+3
|
* getitem() method accepts nodes now, instead of Python objects.Claudiu Popa2016-11-211-43/+9
|
* Fix some pylint errors over the code base.Claudiu Popa2016-08-241-1/+1
|