$ pycodestyle -v foo.py
checking foo.py
foo.py:2:10: E201 whitespace after '{'
foo.py:2:12: E251 unexpected spaces around keyword / parameter equals
foo.py:2:14: E202 whitespace before '}'
foo.py:2:14: E251 unexpected spaces around keyword / parameter equals
Those spaces should not be reported as problems. Spaces in front of x and around = in that string are significant. The = format was designed and implemented to allow such spaces. To quote from https://github.com/python/cpython/issues/80998,
Finally, and this is the best part: what if you want whitespace around
the equals sign? Well, to the left is no problem; whitespace is preserved
from the original text inside the curly braces:
f"{ chr(65) =}" => " chr(65) ='A'"
But we also explicitly permit, and preserve, whitespace after the
equals sign:
f"{chr(65) = }" => "chr(65) = 'A'"
With this file:
pycodestyle 2.12.1 gives this output:
Those spaces should not be reported as problems. Spaces in front of
x
and around=
in that string are significant. The=
format was designed and implemented to allow such spaces. To quote from https://github.com/python/cpython/issues/80998,