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

:= gets turned into : =, which is not correct syntax #507

Closed
andOlga opened this issue Oct 21, 2019 · 4 comments
Closed

:= gets turned into : =, which is not correct syntax #507

andOlga opened this issue Oct 21, 2019 · 4 comments

Comments

@andOlga
Copy link

andOlga commented Oct 21, 2019

Python Code

items = [{(s := y.split('='))[0]: s[1] for y in x} for x in items]

Your Environment

  • Python version: 3.8.0
  • autopep8 version: 1.4.4
  • Platform: Windows
@hhatto
Copy link
Owner

hhatto commented Nov 3, 2019

The release version of pycodestyle is not yet compatible with pep-572.
However, the latest master branch is already supported.

So the workaround is to install pycodestyle master.

$ pip install --upgrade git+https://github.com/PyCQA/pycodestyle.git@master

Thanks

@dzpt
Copy link

dzpt commented Feb 13, 2020

autopep8==1.5 still doesn't work ?

@hwalinga
Copy link

pycodestyle 2.6.0 released

https://github.com/PyCQA/pycodestyle/releases

And it works.

@sdstewar
Copy link

Just want to add a note in case anyone else runs into the same issue I did. I use pyenv to manage multiple python versions on my dev machines and was running into this issue on a newer instance.

Turns out that the pip install of autopep8 hardcodes the python path in the shebang part of the script.

#!/usr/bin/python3.6

So while the script (and pycodestyle were at the latest version) autopep8 was installed using the python 3.6 env on the box and didn't pick up the setting 3.9.1 version that was setup later. As such it was still correcting the syntax per 3.6.

Reinstalling while being sure the python 3.9 env was coming up first in the path, via pyenv, fixed the issue.

#!/home/user/.pyenv/versions/3.9.1/bin/python3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants