Description
Bug description
when a project holds a module name that shadows builtin module name, pylist fails on no-member
, when clearly this is not the case.
reproduction
given 2 files:
os.py
an empty filetest.py
with the following content"""test.py""" import os print(os.environ['SHELL'])
and now pylint fails on no-member
as follows
$ pylint **/*.py
************* Module test
test.py:4:6: E1101: Module 'os' has no 'environ' member (no-member)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
but the code is correct
$ python test.py
/usr/local/bin/bash
Configuration
No response
Command used
pylint **/*.py
Pylint output
************* Module test
test.py:4:6: E1101: Module 'os' has no 'environ' member (no-member)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Expected behavior
pylint should be aware of the import
tree, and report such issue if that is indeed the case.
in the reproduction snippet above, test.py
imports the os
builtin module (and not os.py
) that has the environ()
.
Pylint version
pylint 2.13.8
astroid 2.11.4
Python 3.10.3 (main, Mar 17 2022, 09:46:58) [Clang 13.1.6 (clang-1316.0.21.2)]
OS / Environment
macos
$ sw_vers
ProductName: macOS
ProductVersion: 12.3.1
BuildVersion: 21E258
Additional dependencies
No response