-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
pylint-dev/astroid
#2375Labels
Blocked 🚧Blocked by a particular issueBlocked by a particular issue
Milestone
Description
Bug description
If module has both .py and .pyi files available, .py file is always used according to the code added in pull request pylint-dev/astroid#2182
Unfortunately, this doesn't always work correctly, as noted in the discussion of that pull request (even pylint-dev/astroid#2195 was created, but not merged)
One of the popular libraries where this doesn't work is opencv-python, here is an example code:
import cv2
# Correct line
c = cv2.VideoCapture(0)
# Incorrect line
i = cv2.ThisDoesntExist(0)
Removing /usr/local/lib/python3.10/dist-packages/cv2/__init__.py resolves the issue
Configuration
No response
Command used
pylint demo.py
Pylint output
************* Module demo
demo.py:1:0: C0114: Missing module docstring (missing-module-docstring)
demo.py:4:4: E1101: Module 'cv2' has no 'VideoCapture' member (no-member)
demo.py:6:4: E1101: Module 'cv2' has no 'ThisDoesntExist' member (no-member)
Expected behavior
************* Module demo
demo.py:1:0: C0114: Missing module docstring (missing-module-docstring)
demo.py:6:4: E1101: Module 'cv2' has no 'ThisDoesntExist' member (no-member)
Pylint version
pylint 3.0.2
astroid 3.0.1
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
OS / Environment
Ubuntu 22.04
Additional dependencies
opencv-python==4.8.1.78
Metadata
Metadata
Assignees
Labels
Blocked 🚧Blocked by a particular issueBlocked by a particular issue