wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

WPS474 False Positive

Open nrlulz opened this issue 1 year ago • 0 comments

What's wrong

This rule is falsely flagging a second function level import of the same name as a collision. Appears to have been introduced in version 0.19.0, does not happen in 0.18.0.

Example which reproduces the error:

def a():
    from datetime import timedelta

    return timedelta(days=1)


def b():
    from datetime import timedelta  # <-- WPS474 Found import object collision: timedelta

    return timedelta(days=7)

How it should be

It should not be an error

Flake8 version and plugins

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.11.8",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "darglint",
      "version": "1.8.1"
    },
    {
      "plugin": "flake8-bandit",
      "version": "4.1.1"
    },
    {
      "plugin": "flake8-broken-line",
      "version": "1.0.0"
    },
    {
      "plugin": "flake8-bugbear",
      "version": "24.4.26"
    },
    {
      "plugin": "flake8-commas",
      "version": "2.1.0"
    },
    {
      "plugin": "flake8-comprehensions",
      "version": "3.14.0"
    },
    {
      "plugin": "flake8-debugger",
      "version": "4.1.2"
    },
    {
      "plugin": "flake8-docstrings",
      "version": "1.7.0"
    },
    {
      "plugin": "flake8-eradicate",
      "version": "1.5.0"
    },
    {
      "plugin": "flake8-isort",
      "version": "6.1.1"
    },
    {
      "plugin": "flake8-quotes",
      "version": "3.4.0"
    },
    {
      "plugin": "flake8-rst-docstrings",
      "version": "0.3.0"
    },
    {
      "plugin": "flake8-string-format",
      "version": "0.3.0"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pep8-naming",
      "version": "0.13.3"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.2.0"
    },
    {
      "plugin": "wemake-python-styleguide",
      "version": "0.19.2"
    }
  ],
  "version": "7.0.0"
}

pip information

(.venv) nparker@Neils-Work-MBP bug_test % pip --version            
pip 24.0 from /Users/nparker/Projects/bug_test/.venv/lib/python3.11/site-packages/pip (python 3.11)
(.venv) nparker@Neils-Work-MBP bug_test % pip freeze               
astor==0.8.1
attrs==23.2.0
bandit==1.7.8
darglint==1.8.1
docutils==0.21.2
eradicate==2.3.0
flake8==7.0.0
flake8-bandit==4.1.1
flake8-broken-line==1.0.0
flake8-bugbear==24.4.26
flake8-commas==2.1.0
flake8-comprehensions==3.14.0
flake8-debugger==4.1.2
flake8-docstrings==1.7.0
flake8-eradicate==1.5.0
flake8-isort==6.1.1
flake8-quotes==3.4.0
flake8-rst-docstrings==0.3.0
flake8-string-format==0.3.0
isort==5.13.2
markdown-it-py==3.0.0
mccabe==0.7.0
mdurl==0.1.2
pbr==6.0.0
pep8-naming==0.13.3
pycodestyle==2.11.1
pydocstyle==6.3.0
pyflakes==3.2.0
Pygments==2.18.0
PyYAML==6.0.1
restructuredtext_lint==1.4.0
rich==13.7.1
snowballstemmer==2.2.0
stevedore==5.2.0
typing_extensions==4.12.0
wemake-python-styleguide==0.19.2

OS information

MacOS 14.5

nrlulz avatar May 29 '24 17:05 nrlulz