Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPS474 False Positive #2962

Open
nrlulz opened this issue May 29, 2024 · 0 comments
Open

WPS474 False Positive #2962

nrlulz opened this issue May 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nrlulz
Copy link

nrlulz commented May 29, 2024

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 nrlulz added the bug Something isn't working label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant