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

false positive WPS526 #3073

Open
Xoriun opened this issue Oct 14, 2024 · 0 comments
Open

false positive WPS526 #3073

Xoriun opened this issue Oct 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Xoriun
Copy link

Xoriun commented Oct 14, 2024

What's wrong

when yielding a tuple where the first element is always the same and the second one iterates through a list, I get a WPS526 implicit yield from error.

MWE:

a = 4
for b in (1, 2, 3, 4):
    yield a, b

I know I could write this as

a = 4
yield from (a, b for b in (1, 2, 3, 4))

but I would argue that the first version is significantly more readable (and if my list was a generator like range arguably better).

How it should be

When implicitly yielding from a loop but combined with something with outside the loop, WPS526 should not be raised.

Flake8 version and plugins

{
"platform": {
"python_implementation": "CPython",
"python_version": "3.11.2",
"system": "Windows"
},
"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.8.19"
},
{
"plugin": "flake8-commas",
"version": "2.1.0"
},
{
"plugin": "flake8-comprehensions",
"version": "3.15.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.12.1"
},
{
"plugin": "pyflakes",
"version": "3.2.0"
},
{
"plugin": "wemake-python-styleguide",
"version": "0.19.2"
}
],
"version": "7.1.1"
}

pip information

pip 24.0 from C:\Users\Leo\AppData\Roaming\Python\Python311\site-packages\pip (python 3.11)
aiohappyeyeballs==2.4.3
aiohttp==3.10.10
aiosignal==1.3.1
astor==0.8.1
attrs==24.2.0
bandit==1.7.10
certifi==2023.5.7
charset-normalizer==3.1.0
colorama==0.4.6
contourpy==1.0.7
cycler==0.11.0
darglint==1.8.1
docutils==0.21.2
dropbox==11.36.0
eradicate==2.3.0
ffmpeg-python==0.2.0
flake8==7.1.1
flake8-bandit==4.1.1
flake8-broken-line==1.0.0
flake8-bugbear==24.8.19
flake8-commas==2.1.0
flake8-comprehensions==3.15.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
fonttools==4.39.3
frozenlist==1.4.1
future==1.0.0
idna==3.4
imageio-ffmpeg==0.5.1
isort==5.13.2
kiwisolver==1.4.4
line-profiler==4.0.3
markdown-it-py==3.0.0
matplotlib==3.7.1
mccabe==0.7.0
mdurl==0.1.2
mss==9.0.1
multidict==6.1.0
NightPy==2018.1.1
numpy==1.24.2
packaging==23.1
pbr==6.1.0
pep8-naming==0.13.3
Pillow==9.5.0
ply==3.11
propcache==0.2.0
py-cord==2.6.1
pycodestyle==2.12.1
pydocstyle==6.3.0
pyflakes==3.2.0
Pygments==2.18.0
pyimgur==0.6.0
pyparsing==3.0.9
pyperclip==1.8.2
PySimpleGUI==4.60.4
python-dateutil==2.8.2
pywin32==306
PyYAML==6.0.2
requests==2.31.0
restructuredtext_lint==1.4.0
rich==13.9.2
six==1.16.0
snowballstemmer==2.2.0
stevedore==5.3.0
stone==3.3.1
typing_extensions==4.12.2
urllib3==2.0.2
wemake-python-styleguide==0.19.2
yarl==1.15.0

OS information

windows 10

@Xoriun Xoriun added the bug Something isn't working label Oct 14, 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