hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.56k stars 290 forks source link

Question: How to automatically make spaces between math expressions? #634

Closed SUPERustam closed 2 years ago

SUPERustam commented 2 years ago

For instance, I have this code

a=2*5+10/4

And I want this as result of autopep8 work:

a = 2 * 5 + 10 / 4 

But I get only this:

a = 2*5+10/4 

What settings I should turn on to let autopep8 do what I want?

My Environment

downeykking commented 2 years ago

in the default args setting, --ignore will ignore E226,E24,W50,W690( see https://github.com/hhatto/autopep8/blob/master/README.rst#id3), so you just need to overwrite it. for instance: --ignore= or --select=E,W in this way all E/W problems will be formattd.(see this https://github.com/hhatto/autopep8/issues/424)

SUPERustam commented 2 years ago

Thanks!