Reputation: 5324
import typing
from dataclasses import dataclass
@dataclass
class Parameter:
default: typing.Any = None
I'm getting a flake8 error on line 7:
default: typing.Any = None
The error is:
E704 multiple statements on one line (def)
Is this a bug in flake8's parsing?
Upvotes: 0
Views: 883
Reputation: 365717
So, there's good news and bad news.
If I install pycodestyle 2.3.1 and flake8 3.5.0 (and pyflakes 1.6.0) in a clean 3.7 environment, I can reproduce this warning.
If I force pip to install pycodestyle 2.4.0 even though flake8 complains about it, the warning goes away.
If I install flake8 off GitLab, it drags in pycodestyle 2.4.0 (and pyflakes 2.0.0), and again the warning goes away.
This isn't too surprising, given that 2.4.0 claims to add Python 3.7 support (even though its PyPI entry still only lists 3.6), and fixes multiple bugs related to E704, like this one, but I couldn't find the specific relevant change from a quick scan.
Unfortunately, since flake8 hasn't actually been tested with 2.4.0 yet, it's possible that fixing things this way (whether forcibly installing incompatible versions, or installing the bleeding-edge version off GitLab) will break other things.
In which case the only real options are:
noqa
flags added by flake8, etc.)Upvotes: 1