| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
Remove unused imports for astroid
|
| | |
|
| |
|
|
| |
Replace usage of a whitelist parameter in checkers.python3.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Since map() supports iterables, it should not issue
builtin-not-iterating for iterable arguments.
Signed-off-by: Tiago Honorato <tiagohonorato1@gmail.com>
|
| |
|
|
|
|
|
|
| |
Since zip() supports iterables, it should not be an issue
builtin-not-iterating for iterable arguments.
Signed-off-by: Tiago Honorato <tiagohonorato1@gmail.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| |
|
|
| |
As we do not maintain python 3.5 it permit to simplify some code
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Also move it from the Python 3 checker to the refactoring one, as it's a
better fit for it.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
using configuration:
```yaml
- repo: https://github.com/asottile/pyupgrade
rev: v2.1.0
hooks:
- id: pyupgrade
args: [--py3-plus, --keep-percent-format]
exclude: ^tests/(extensions/data/|functional/|input/|regrtest_data/)
```
|
| |
|
|
|
|
|
|
|
|
|
|
| |
While dict-keys-not-iterating does not generate false positives for the
'in' containment test, the check does generate false positives for the
inverse counterpart of the containment test, 'not in'. This patch
changes the check behavior to also consider the 'not in' operator as an
iterating context.
* Relates to #2186
Signed-off-by: Athos Ribeiro <athoscr@fedoraproject.org>
|
| |
|
| |
After all, if we don't use this, why should anybody else?
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoid costly inference in visit_call and visit_attribute
when the attribute name is one that cannot possibly trigger
a message.
This typically leads to a 30-50% speedup when running pylint
in python3 porting mode on most codebases.
Benchmark results on pylint's own code, on a 2018 macbook pro,
with python 3.6.8, using `hyperfine`.
pylint-2.4.2
```
Time (mean ± σ): 10.071 s ± 1.136 s [User: 9.724 s, System: 0.246 s]
Range (min … max): 9.352 s … 12.015 s 5 runs
```
pylint-2.4.2 + this patch
```
Time (mean ± σ): 6.282 s ± 0.046 s [User: 6.099 s, System: 0.155 s]
Range (min … max): 6.232 s … 6.327 s 5 runs
```
|
| |
|
|
|
|
|
| |
As reported on #3128, there is a bug when the handler bound object is being used inside a generator causing a false positive. This was due to the way we were identifying if the object was "inside" its handler or not. In the previous implementation we would visit the node parents until we reached the object scope (in the generator case, the scope of the node is the generator, not the handler), while this change continues to go up the parent stack until it reaches its parent handler, or, if it's not inside its handler, it reaches the module's parent (None).
Object is considered inside its handler if it reaches it by going up in the parent chain. It's considered outside its handler if it reaches None.
Signed-off-by: Gabriel R Sezefredo <g@briel.dev>
|
| |
|
|
| |
We no longer support Python 2 so we can remove
the compatibility code we had in place for that version.
|
| |
|
|
|
|
|
| |
This caused issues detecting that `OrderedDict` and similar non-builtin
predefined iterable consumers where not in fact in an *iterating* context.
Close #3075
|
| |
|
|
|
| |
Will permit to improve performance with less check but more
importantly simplify the message store a lot.
|
| | |
|
| |
|
|
|
|
|
|
| |
Some constants were package internal but were used by multiple
packages. This created circular dependencies. By creating a
file for constants we make sure this does not happen because
we won't import everything important in this file and every
thing else can depend on it.
|
| | |
|
| | |
|
| |
|
|
| |
Close #2808
|
| |
|
|
| |
Close #2731
|
| |
|
|
| |
Close #2651
|
| |
|
|
| |
Close #2643
|
| |
|
|
| |
Add OrderedDict as accepting iterator
|
| |
|
|
|
| |
``implicit-str-concat-in-sequence`` detects string concatenation inside lists, sets & tuples.
It would warn on code such as `('a', 'b' 'c')`.
|
| |
|
|
|
|
|
| |
a dictionary
This inhibits the capability of the check of finding occurrences of these methods. There's a low
chance of having a false positive.
|
| | |
|
| |
|
|
| |
Close #2453
|
| | |
|
| |
|
|
|
|
| |
inside a try-except
Close PyCQA/pylint#2228
|
| |
|
|
| |
with dict values and keys
|
| | |
|
| | |
|
| |
|
|
|
|
| |
with the Python 3 porting checker
Close #2187
|
| |
|
|
| |
Close #2186
|
| | |
|
| | |
|
| |
|
|
| |
for comprehension-escape values. Close #2106
|
| |
|
|
| |
exception-escape
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
corresponding nodes
These two checks were implemented in terms of visit_namne, that is, for every name in the tree,
we looked to see if that name leaked. This was resulting in a couple of false positives
and also in a performance issue, since we were calling nodes_of_class() and scope() for each
name node. Instead, this approach uses the visit methods for exception and comprehension nodes
and looks to see from there if the current scope uses leaked names.
This is not the ideal situation as well, ideal would be to have access to the definition
frame of each name, but that requires some extra engineering effort in astroid to get it right.
Close #2106
|
| | |
|