Python e226 missing whitespace around arithmetic operator

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

extend-select argument not working with arithmetic operator whitespace E226 #1470

extend-select argument not working with arithmetic operator whitespace E226 #1470

Comments

< "dependencies": [], "platform": < "python_implementation": "CPython", "python_version": "3.8.12", "system": "Darwin" >, "plugins": [ < "is_local": false, "plugin": "mccabe", "version": "0.6.1" >, < "is_local": false, "plugin": "pycodestyle", "version": "2.8.0" >, < "is_local": false, "plugin": "pyflakes", "version": "2.4.0" > ], "version": "4.0.1" >

My initial expectation is that flake8 should error when binary arithmetic operators are not surrounded by whitespace ( E226 ). My further expectation is that if E226 is not enabled by default I should be able to enable it as an additional check. It seems like there might be a bug breaking E226 validation and potentially extend-select as well.

Читайте также:  Знак отношения в питоне

My project uses a setup.cfg configure flake8. For that reason I would like to use extend-select to avoid calling flake8 in the command line twice. The following example reproduces the issue:

# E226 is not found in a.py $ flake8 a.py no output> # explicitly selecting E226 has the desired output, but will not catch other errors (by design) $ flake8 a.py --select E226 a.py:1:6: E226 missing whitespace around arithmetic operator # extend-select does not work as expected to catching default errors and E226 $ flake8 a.py --extend-select E226 no output> # ignoring all warnings somehow circumvents the issue and allows E226 to be caught $ flake8 a.py --ignore W a.py:1:6: E226 missing whitespace around arithmetic operator # ignoring random text works the same way $ flake8 a.py --ignore 0 a.py:1:6: E226 missing whitespace around arithmetic operator

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

E226: ‘missing whitespace’ introspection issue #248

E226: ‘missing whitespace’ introspection issue #248

Comments

I’m getting «PEP 8: missing whitespace around arithmetic operator» introspection flag in cases where I should not, per this section of Pep 8:

«If operators with different priorities are used, consider adding whitespace around the operators with the lowest priority(ies). Use your own judgment; however, never use more than one space, and always have the same amount of whitespace on both sides of a binary operator.

i = i + 1 submitted += 1 x = x_2 - 1 hypot2 = x_x + y*y c = (a+b) * (a-b)" 

This may be to a change in Pep 8 that this tool hasn’t caught up with:

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

«E226 missing whitespace around arithmetic operator» around high priority operator #599

«E226 missing whitespace around arithmetic operator» around high priority operator #599

Comments

In GitLab by @hakon.hagland on Jul 11, 2017, 23:33

If operators with different priorities are used, consider adding whitespace around the operators with the lowest priority(ies)
x = x*2 — 1

I have this test program t.py : y = x*x + 2 . When I run this under flake8 :

$ flake8 --show-source --select=E226 t.py .py:3:6: E226 missing whitespace around arithmetic operator y = x*x + 2 ^ 

I wonder why I get an E226 here? It seems to be in conflict with the PEP8 guidelines?

How I installed flake8

Output of flake8 —bug-report

$ flake8 --bug-report < "dependencies": [ < "dependency": "setuptools", "version": "28.8.0" >], "platform": < "python_implementation": "CPython", "python_version": "3.6.1", "system": "Linux" >, "plugins": [ < "plugin": "mccabe", "version": "0.6.1" >, < "plugin": "pycodestyle", "version": "2.3.1" >, < "plugin": "pyflakes", "version": "1.5.0" >], "version": "3.3.0" > 

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

E226 «missing whitespace around arithmetic operator» raised on star args #444

E226 «missing whitespace around arithmetic operator» raised on star args #444

Comments

The following erroneous error is reported on this code:

% pep8 --config /dev/null --exclude E,W --select E226 ~/git/yturl/yturl.py /home/chris/git/yturl/yturl.py:113:39: E226 missing whitespace around arithmetic operator 

The offending line is this — it seems it detects the star arg operator as an arithmetic operator:

similar_itags = [x for x in chain(*pairs_by_distance) if x is not None]

It seems difficult to reproduce a small test case though, because this doesn’t manifest with just that kind of syntax:

% pep8 --config /dev/null --exclude E,W --select E226 -  

Here is some system and version information:

% python --version Python 3.5.0 % pep8 --version 1.5.7 % uname -a Linux jia 4.2.2-1-ARCH #1 SMP PREEMPT Tue Sep 29 22:21:33 CEST 2015 x86_64 GNU/Linux 

Thanks for the great tool!

The text was updated successfully, but these errors were encountered:

Er, I meant "ignore", not "exclude". Whoops!

I just tested on 2.7.10, 3.4.3, and 3.5.0 with pep8 1.6.2 and see this on all:

% pyenv shell 2.7.10 % python --version && pep8 --version Python 2.7.10 1.6.2 % curl -s 'https://raw.githubusercontent.com/cdown/yturl/1224eec/yturl.py' | pep8 --config /dev/null --select E226 - | grep 113 stdin:113:39: E226 missing whitespace around arithmetic operator % pyenv shell 3.4.3 % python --version && pep8 --version Python 3.4.3 1.6.2 % curl -s 'https://raw.githubusercontent.com/cdown/yturl/1224eec/yturl.py' | pep8 --config /dev/null --select E226 - | grep 113 stdin:113:39: E226 missing whitespace around arithmetic operator % pyenv shell 3.5.0 % python --version && pep8 --version Python 3.5.0 1.6.2 % curl -s 'https://raw.githubusercontent.com/cdown/yturl/1224eec/yturl.py' | pep8 --config /dev/null --select E226 - | grep 113 stdin:113:39: E226 missing whitespace around arithmetic operator 

Holy crap, I can't read. Somehow I read line 116, not line 113.

There's no bug here, sorry for the noise.

Источник

Оцените статью