pylint-dev / pylint-dev/astroid
Regression in 2.5.7 causing false positives in matplotlib
- Dominant language
- Python
- Stars
- 582
- Forks
- 357
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
### Steps to reproduce
I'm seeing a lot of false positives inside matplotlib with the latest release of `astroid` but they all appear to haver a common cause. To reproduce create a file named `test.py` and install matplotlib 3.4.2:
```python
from matplotlib import pyplot as plt
ax = plt.Axes(plt.gcf(), [0.0, 0.0, 1.0, 1.0])
ax.set_yticks([0, 1])
```
It looks like the issue is coming from an advanced use of wrappers to define the `set_yticks` methods:
```python
get_yticks = _axis_method_wrapper("yaxis", "get_ticklocs")
set_yticks = _axis_method_wrapper("yaxis", "set_ticks")
```
https://github.com/matplotlib/matplotlib/blob/v3.4.2/lib/matplotlib/axes/_base.py#L34-L92
### Current behavior
With astroid 2.5.7:
```bash
$ pylint -E test.py
************* Module test
test.py:3:0: E1102: ax.set_yticks is not callable (not-callable)
```
### Expected behavior
With astroid 2.5.6:
```bash
$ pylint -E test.py
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Create test.py with the reported matplotlib 3.4.2 example and run `pylint -E test.py` using astroid 2.5.7, then compare with 2.5.6. Trace how the wrapper assignments for `get_yticks` and `set_yticks` are inferred; done means the example no longer emits E1102 while preserving the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100