-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Labels
Description
Bug description
Pylint is reporting an invalid no-name-in-module when a module is using lazy_loader. This was tested in a conda environment created by:
conda create -n pylint_env -c conda-forge python=3.10 lazy_loader==0.4.0 pylint==3.1.0 -y
Creating a dummy library example:
# lib/__init__.py
import lazy_loader as lazy
__getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)# lib/__init__.pyi
__all__ == ["bar"]
from ._foo import bar# lib/_foo.py
def bar():
print("I'm happy")# test.py
from lib import bar
bar()Running test.py executes as expected but pylint is reporting an error.
conda activate pylint_env
python test.py # works and prints "I'm happy"
pylint test.py # fails with
# test.py:1:0: E0611: No name 'bar' in module 'lib' (no-name-in-module)
Configuration
No response
Command used
pylint test.pyPylint output
************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:1:0: E0611: No name 'bar' in module 'lib' (no-name-in-module)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)Expected behavior
I would expect the no-name-in-module error to not be reported.
Pylint version
pylint 3.1.0
astroid 3.1.0
Python 3.10.14 | packaged by conda-forge | (main, Mar 20 2024, 12:45:18) [GCC 12.3.0]OS / Environment
RHEL7
Additional dependencies
lazy_loader==0.4.0