summaryrefslogtreecommitdiff
path: root/astroid/node_classes.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix a crash caused by a lookup of a monkey-patched method (#803)2.4Claudiu Popa2020-06-161-2/+1
| | | Close PyCQA/pylint#3686
* Fix the new violations of super-without-argumentsClaudiu Popa2020-05-121-31/+27
|
* `FunctionDef.is_generator` properly handles `yield` nodes in `While` testsClaudiu Popa2020-05-121-0/+5
| | | | Close PyCQA/pylint#3519
* Add missing copyright annotations for the past releasesClaudiu Popa2020-04-271-4/+8
|
* Add posonlyargs_annotations to Arguments.get_children()Claudiu Popa2020-03-281-0/+6
|
* Add posonlyargs_annotations to Arguments.as_string()Claudiu Popa2020-03-281-1/+7
|
* Call super() for EvaluatedObjectClaudiu Popa2020-03-101-3/+5
|
* Add a new EvaluatedObject containerClaudiu Popa2020-03-101-0/+34
| | | | | | | | | This container is used to store values that have already been evaluated. For instance, 79d5a3a783cf0b5a729e4e467508e955a0cca55f added support for inferring `tuple()` call arguments, but as a result, the `elts` of a `Tuple` can be objects not *references*. As a result, `Tuple.elts` can contain class objects rather than references (names) to class object. The `EvaluatedObject` helps with that, as we still have to call `.infer()` (albeit a no-op) to grab the inferred value of an element.
* ``NodeNG.bool_value()`` gained an optional ``context`` parameterClaudiu Popa2020-03-051-5/+5
| | | | | | | | | We need to pass an inference context downstream when inferring the boolean value of a node in order to prevent recursion errors and double inference. This fix prevents a recursion error with dask library. Close PyCQA/pylint#2985
* Fix unbound local error caused by 061aaebea2be2d21831ef687cc4ba4a25d953c65Claudiu Popa2020-01-121-1/+1
|
* Can access positional only and keyword only argument type commentsAshley Whetter2020-01-111-0/+32
|
* ``nodes.Const.itered`` returns a list of ``Const`` nodes, not stringsClaudiu Popa2019-12-151-3/+3
| | | | | | | Because ``Const.itered`` was not returning proper nodes, pylint was failing when trying to infer objects created from those nodes. Close PyCQA/pylint#3306
* Allow inferring positional only arguments on Python 3.8Claudiu Popa2019-11-141-6/+8
|
* All type comments have as parent the corresponding `astroid` nodeClaudiu Popa2019-10-091-1/+3
| | | | | | | Until now they had as parent the builtin `ast` node which meant we were operating with primitive objects instead of our own. Close PyCQA/pylint#3174
* Remove NodeNG.nearest method (#692)kavins142019-09-101-27/+0
| | | | | | The NodeNG.nearest method was not working properly as outlined in #691 and seem to not be in use at all across astroid and pylint. Close #691
* Update method docstring (#690)kavins142019-09-081-6/+6
|
* Relax the spreading of defaults to both positional only and positional or ↵Claudiu Popa2019-07-101-10/+4
| | | | keywords arguments
* Disable legit errors for too many parametersClaudiu Popa2019-07-091-0/+3
|
* Add support for finding positional only arguments using the Arguments APIsClaudiu Popa2019-07-091-10/+15
|
* Introduce a new argument to `Arguments` for storing the positional only ↵Claudiu Popa2019-07-091-0/+13
| | | | | | | | | annotations The annotations were stored until now in `.annotations` and `kwonlyargs_annotations`, but given the addition of `posonlyargs`, we need to store the positional only annotations somewhere else as well. This new attribute should simplify the handling of annotations for both positional only and positional or keyword parameters.
* Add support for positional only arguments in astroid for python 3.8Claudiu Popa2019-07-091-1/+32
|
* Annotated AST follows PEP8 coding style when converted to string.Łukasz Rogalski2019-06-221-2/+4
|
* Add inference support to NamedExpr nodesClaudiu Popa2019-06-021-0/+4
|
* Add support for Python 3.8's `NamedExpr` nodes, which is part of assignment ↵Claudiu Popa2019-06-011-0/+25
| | | | | | expressions. Close #674
* Mark Ellipsis as a constant for Python 3.8Claudiu Popa2019-06-011-2/+5
|
* Can access per argument type comments (#667)Ashley Whetter2019-05-141-0/+16
| | | Close #665
* Improved builtin inference for ``tuple``, ``set``, ``frozenset``, ``list`` ↵Claudiu Popa2019-03-281-4/+11
| | | | | | | | | | | and ``dict`` We were properly inferring these callables *only* if they had consts as values, but that is not the case most of the time. Instead we try to infer the values that their arguments can be and use them instead of assuming Const nodes all the time. Close PyCQA/pylint#2841
* Use a list to hold the statements to be filtered per node instead of keeping ↵Claudiu Popa2019-03-041-6/+8
| | | | them in a dict
* The last except handler wins when inferring variables bound in an except ↵Claudiu Popa2019-03-031-2/+14
| | | | | | handler. Close PyCQA/pylint#2777
* Avoid statement deletion in the _filter_stmts method of the LookupMixin ↵hippo912019-01-231-2/+10
| | | | | | | | | | | | | | class for PartialFunction In the case where the node is a PartialFunction and its name is the same as the current statement's name, avoid the statement deletion. The problem was that a call to a function that has been previously called vit a functools.partial was wrongly inferred. The bug comes from the _filter_stmts method of the LookupMixin class. The deletion of the current statement should not be made in the case where the node is an instance of the PartialFunction class and if the node's name is the same as the statement's name. This change also extracts PartialFunction from brain_functools into astroid.objects so that we remove a circular import problem. Close PyCQA/pylint#2588
* Add a method to the manager to retrieve the builtins moduleClaudiu Popa2019-01-191-1/+1
|
* Refactoring chained comparison (#636)hippo912019-01-131-2/+1
| | | | Reformat a chained comparison so that no more 'chained-comparison' warning is emitted from node_classe.py
* Cache the result of get_assign_nodesClaudiu Popa2018-10-101-4/+4
| | | | | | | | The result is usually static, but we're hitting this function quite a lot for big projects such as pandas. This change is a matter of compromising between the amount of memory astroid needs for analysis (e.g. storing the results in memory) vs the wasted CPU time in calling the same function over and over.
* Let formatting be handled by blackClaudiu Popa2018-10-021-1/+2
|
* Initial formatting of astroidClaudiu Popa2018-10-021-280/+418
|
* Make sure that assign nodes can find ``yield`` statements in their valuesClaudiu Popa2018-08-101-0/+3
| | | | Close PyCQA/pylint#2400
* Cut obsolete "explicit StopIteration" commentsNick Drozd2018-07-301-4/+0
| | | | The explicit StopIterations were themselves were cut in ceeee097.
* Spelling fixesVille Skyttä2018-07-241-3/+3
|
* Update the copyright noticesastroid-2.0Claudiu Popa2018-07-151-3/+18
|
* Don't allow max_inferable to be set by an environment variable.Claudiu Popa2018-07-061-1/+1
| | | | | | | | This would introduce a new method of configuring astroid & pylint, while the usual approach we used so far was to set a flag in the MANAGER itself it we'd need to customize some behaviour (extension_package_whitelist and friends). Also renamed the flag to `max_inferable_values` to be more suggestive on what it does.
* Limit inference to a maximum of 100 results at a time to preventBryce Guinta2018-07-061-1/+3
| | | | | | | | | | spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close #579 Close PyCQA/pylint#2251
* Fix inference for nested callsBryce Guinta2018-07-051-0/+2
| | | | | | | | | Add context_lookup to the context class as extra_context. Deliver the correct context with the correct boundnode for function argument nodes. Close #177
* Move operator precedence methods into NodeNGbrendanator2018-07-051-1/+58
|
* Improve as_string output of operators, elif, with, return & docsbrendanator2018-07-051-1/+1
| | | | | | | | | | | | | The precedence and associativity rules of operators are respected and parens are only wrapped around child nodes when needed A single If node inside the else block is output as `elif` Unneccesary parens in with statements are removed Unneccesary parens in tuple returns are removed Doc strings in classes and functions no longer get additional indenting
* Add missing TryExcept multi-line block field (#571)Nick Drozd2018-06-281-1/+1
| | | | This was overlooked in the initial implementation of _multi_line_block_fields.
* Fix useless-object-inheritance lint error (#573)Nick Drozd2018-06-281-2/+2
| | | See https://github.com/PyCQA/pylint/pull/2209
* Prevent Const copy resulting in recursionBryce Guinta2018-06-231-0/+11
| | | | | | | | | | | | Calling object.__new__ on a Const node would result in infinite recursion Fix infinite recursion by explicitly raising AttributeError if __getattr__ is called for value See https://nedbatchelder.com/blog/201010/surprising_getattr_recursion.html for more details Close #565
* Stop astroid from getting stuck in an infinite loopBryce Guinta2018-06-191-0/+15
| | | | | | | | Stop issue where decorators with the same name as the decorated function would cause an infinite loop This infinite recursion was caused by an oversight in name lookup which prefferred methods even if they weren't defined yet Close #375
* Simplify chained comparisonClaudiu Popa2018-06-181-1/+1
|
* Fix lintingClaudiu Popa2018-06-141-6/+6
|