pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.31k stars 1.14k forks source link

Random Failures at pylint/checkers/imports.py with v 2.16 #8171

Closed hkallalathera closed 1 year ago

hkallalathera commented 1 year ago

Bug description

This bug happens from time to time (70% success, 30% failures I would say) It never happened before upgrading to 2.16 (I was using 2.15.6)

Configuration

here is an example of python code that generates this problem

import numpy as np

def func(x):
    return x*2

Command used

pylint -ry  myfile.py

Pylint output

.
Traceback (most recent call last):
  File "/usr/local/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/usr/local/lib/python3.8/dist-packages/pylint/__init__.py", line 36, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "/usr/local/lib/python3.8/dist-packages/pylint/lint/run.py", line 214, in __init__
    score_value = linter.generate_reports()
  File "/usr/local/lib/python3.8/dist-packages/pylint/lint/pylinter.py", line 1149, in generate_reports
    sect = self.make_reports(self.stats, previous_stats)
  File "/usr/local/lib/python3.8/dist-packages/pylint/reporters/reports_handler_mix_in.py", line 76, in make_reports
    r_cb(report_sect, stats, old_stats)
  File "/usr/local/lib/python3.8/dist-packages/pylint/checkers/imports.py", line 981, in _report_external_dependencies
    dep_info = _make_tree_defs(self._external_dependencies_info().items())
  File "/usr/local/lib/python3.8/dist-packages/pylint/checkers/imports.py", line 179, in _make_tree_defs
    node[1] += files
TypeError: 'tuple' object does not support item assignment

Expected behavior

Messages by category

+-----------+-------+---------+-----------+ |type |number |previous |difference | +===========+=======+=========+===========+ |convention |0 |NC |NC | +-----------+-------+---------+-----------+ |refactor |0 |NC |NC | +-----------+-------+---------+-----------+ |warning |0 |NC |NC | +-----------+-------+---------+-----------+ |error |0 |NC |NC | +-----------+-------+---------+-----------+

Messages

+-----------+------------+ |message id |occurrences | +===========+============+


Your code has been rated at 10.00/10

Pylint version

pylint 2.16
astroid 2.14.1
python 3.8.10

OS / Environment

Ubuntu 22.04

Additional dependencies

absl-py==1.3.0 aiobotocore==1.4.2 aiohttp==3.8.3 aiohttp-retry==2.4.5 aioitertools==0.11.0 aiosignal==1.3.1 alabaster==0.7.12 alembic==1.4.3 anyio==3.6.2 appdirs==1.4.4 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 astroid==2.14.1 asttokens==2.2.0 astunparse==1.6.3 async-timeout==4.0.2 atpublic==3.1.1 attrs==22.2.0 autopep8==1.5.4 Babel==2.11.0 backcall==0.2.0 beautifulsoup4==4.9.3 black==23.1a1 bleach==5.0.1 blessings==1.6 bokeh==2.4.3 boto3==1.17.106 botocore==1.20.106 bottle==0.12.18 cached-property==1.5.2 cachetools==5.2.1 cairocffi==1.2.0 CairoSVG==2.5.2 certifi==2020.12.5 cffi==1.14.5 cfgv==3.3.1 chardet==3.0.4 charset-normalizer==2.1.1 chex==0.1.5 click==8.1.3 colorama==0.4.6 commonmark==0.9.1 configobj==5.0.6 coverage==5.3 cpplint==1.6.1 cssselect2==0.4.1 cupy-cuda11x==11.5.0 cycler==0.10.0 darker==1.6.1 dataclasses-json==0.5.2 debugpy==1.6.4 decorator==4.4.2 defusedxml==0.7.1 Deprecated==1.2.13 dictdiffer==0.9.0 dill==0.3.6 diskcache==5.4.0 distlib==0.3.6 distro==1.4.0 dm-tree==0.1.8 docutils==0.19 dpath==2.1.1 dulwich==0.20.50 dvc==2.7.4 elasticdeform==0.5.0 entrypoints==0.4 et-xmlfile==1.0.1 etils==0.9.0 exceptiongroup==1.0.4 executing==1.2.0 fakeredis==1.4.3 fancycompleter==0.9.1 fastjsonschema==2.16.2 fastrlock==0.8.1 filelock==3.8.0 flatbuffers==2.0.7 flatten-dict==0.4.2 flax==0.6.3 flufl.lock==3.2 fortls==2.13.0 fpdf==1.7.2 frozenlist==1.3.3 fsspec==2021.8.1 ftfy==6.1.1 funcy==1.17 future==0.18.2 ghp-import==2.1.0 gin-config==0.5.0 gitdb==4.0.10 GitPython==3.1.27 glog==0.3.1 google-auth==2.16.0 google-auth-oauthlib==0.4.6 gprof2dot==2022.7.29 gpustat==0.6.0 grandalf==0.6 graphviz==0.20.1 grpcio==1.51.1 h5py==3.7.0 html5lib==1.1 humanize==4.4.0 identify==2.5.9 idna==2.10 imageio==2.9.0 imagesize==1.4.1 importlab==0.8 importlib-metadata==5.1.0 importlib-resources==5.10.0 iniconfig==1.1.1 ipykernel==6.17.1 ipython==8.7.0 ipython-genutils==0.2.0 isort==5.8.0 jax==0.3.22 jaxlib==0.3.15 jaxopt==0.4.3 jdcal==1.4.1 jedi==0.18.2 Jinja2==3.1.2 jmespath==0.10.0 joblib==1.0.1 json5==0.9.10 jsons==1.4.0 jsonschema==4.17.3 jupyter-server==1.23.3 jupyter_client==7.4.7 jupyter_core==5.1.0 jupyterlab==3.5.0 jupyterlab-pygments==0.2.2 jupyterlab_server==2.16.3 kaleido==0.2.1 kiwisolver==1.3.1 kornia==0.6.6 lazy-object-proxy==1.6.0 lcov-cobertura==1.6 libcst==0.4.9 livereload==2.6.3 llvmlite==0.39.1 lmdb==1.4.0 loguru==0.6.0 lunr==0.5.8 lupa==1.14.1 mailchecker==5.0.4 Mako==1.1.3 Markdown==3.3 markdown2==2.3.9 MarkupSafe==2.1.1 marshmallow==3.8.0 marshmallow-enum==1.5.1 matplotlib==3.3.2 matplotlib-inline==0.1.6 mccabe==0.6.1 mergedeep==1.3.4 minio==7.1.1 mistletoe==0.9.0 mistune==2.0.4 mkdocs==1.2.4 mkdocs-material==6.0.2 mkdocs-material-extensions==1.0.1 mkdocs-pdf-export-plugin==0.5.8 mock==4.0.2 mpi4py==3.1.4 msgpack==1.0.4 multidict==6.0.2 mypy-extensions==0.4.3 nanotime==0.5.2 natsort==8.2.0 nbclassic==0.4.8 nbclient==0.7.2 nbconvert==7.2.5 nbformat==5.7.0 nest-asyncio==1.5.4 networkx==2.5 nibabel==5.0.0 ninja==1.11.1 nltk==3.5 nodeenv==1.7.0 notebook==6.5.2 notebook_shim==0.2.2 numba==0.56.0 numpy==1.22.0 nvidia-ml-py3==7.352.0 oauthlib==3.2.2 opencv-python==4.4.0.44 openpyxl==3.0.5 opt-einsum==3.3.0 optax==0.1.4 orbax==0.0.23 ott-jax==0.3.1 packaging==23.0 pandas==1.5.2 pandocfilters==1.5.0 panel==0.14.1 param==1.12.2 parso==0.8.3 pathspec==0.8.1 pdbpp==0.10.3 pexpect==4.8.0 phonenumbers==8.13.1 pickleshare==0.7.5 Pillow==7.2.0 pkgutil_resolve_name==1.3.10 platformdirs==2.5.4 plotly==5.11.0 pluggy==0.13.1 ply==3.11 POT==0.8.2 pre-commit==2.20.0 prometheus-client==0.15.0 prompt-toolkit==3.0.33 protobuf==3.20.3 psutil==5.9.2 psycopg2-binary==2.8.6 ptyprocess==0.7.0 PuLP==2.7.0 pure-eval==0.2.2 py==1.10.0 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycodestyle==2.7.0 pycparser==2.20 pycrypto==2.6.1 pyct==0.4.8 pydicom==2.0.0 pydot==1.4.2 pygit2==1.11.1 Pygments==2.14.0 pygtrie==2.5.0 PyJWT==1.7.1 pylint==2.16.0 pymdown-extensions==8.0.1 pymp==0.0.6 pymp-pypi==0.5.0 pynvml==11.4.1 pyparsing==2.4.7 PyPDF2==2.11.2 Pyphen==0.10.0 pyrepl==0.9.0 pyrsistent==0.19.2 pytest==7.2.0 pytest-cov==2.10.1 pytest-dotenv==0.5.2 pytest-html==3.2.0 pytest-metadata==2.0.4 pytest-mock==3.6.0 pytest-picked==0.4.6 python-benedict==0.26.0 python-dateutil==2.8.2 python-dotenv==0.16.0 python-editor==1.0.4 python-fsutil==0.7.0 python-gflags==3.1.2 python-gitlab==3.11.0 python-markdown-math==0.7 python-slugify==6.1.2 pytype==2022.12.15 pytz==2020.1 pyviz-comms==2.2.1 PyWavelets==1.1.1 PyYAML==6.0 pyyaml_env_tag==0.1 pyzmq==24.0.1 redis==3.5.3 regex==2020.9.27 requests==2.28.1 requests-oauthlib==1.3.1 requests-toolbelt==0.10.1 retrying==1.3.3 rich==12.6.0 rq==1.5.2 rsa==4.9 ruamel.yaml==0.17.21 ruamel.yaml.clib==0.2.7 s3fs==2021.8.1 s3transfer==0.4.2 sadisplay==0.4.9 scikit-image==0.17.2 scikit-learn==1.1.3 scipy==1.9.3 Send2Trash==1.8.0 shortuuid==1.0.11 shtab==1.5.8 SimpleITK==2.1.0 sinkhorn-knopp==0.2 six==1.15.0 slack-sdk==3.19.5 smmap==5.0.0 sniffio==1.3.0 snowballstemmer==2.2.0 sortedcontainers==2.3.0 soupsieve==2.2.1 sourceinspect==0.0.4 Sphinx==6.1.2 sphinx-copybutton==0.5.1 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 sphinxcontrib.applehelp==1.0.3 SQLAlchemy==1.3.19 ssh-import-id==5.10 stack-data==0.6.2 stringcase==1.2.0 tabulate==0.9.0 taichi==1.3.0 tailer==0.4.1 tenacity==8.1.0 tensorboard==2.11.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.1 tensorstore==0.1.28 termcolor==2.1.1 terminado==0.17.0 text-unidecode==1.3 threadpoolctl==3.1.0 tifffile==2021.3.17 tinycss2==1.1.0 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.6 toolz==0.12.0 torch==1.12.1 torchaudio==0.12.1 torchio==0.18.83 torchvision==0.13.1 torchviz==0.0.2 tornado==6.2 tornado-sqlalchemy==0.7.0 tqdm==4.50.0 traitlets==5.6.0 typing-inspect==0.8.0 typing_extensions==4.4.0 typish==1.9.3 Unidecode==1.3.4 urllib3==1.25.10 virtualenv==20.17.0 voluptuous==0.13.1 watchdog==2.1.9 wcwidth==0.2.5 WeasyPrint==52.5 webencodings==0.5.1 websocket-client==1.4.2 Werkzeug==2.2.2 wget==3.2 wmctrl==0.4 wrapt==1.12.1 xlrd==2.0.1 xmltodict==0.13.0 yarl==1.8.1 zc.lockfile==2.0 zipp==3.11.0

mbyrnepr2 commented 1 year ago

Thanks @hkallalathera! Looks like a duplicate of https://github.com/PyCQA/pylint/issues/8161