PyCQA / pyflakes

A simple program which checks Python source files for errors
https://pypi.org/project/pyflakes
MIT License
1.37k stars 178 forks source link

f-string like f"{foo = }" is detected as an error #790

Closed jfcherng closed 12 months ago

jfcherng commented 12 months ago

how did you install flake8?

[jfcherng@jfcherng-vm Desktop]$ python -m pip install -U flake8                                          
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: flake8 in /home/jfcherng/.local/lib/python3.12/site-packages (6.1.0)
Requirement already satisfied: mccabe<0.8.0,>=0.7.0 in /home/jfcherng/.local/lib/python3.12/site-packages (from flake8) (0.7.0)
Requirement already satisfied: pycodestyle<2.12.0,>=2.11.0 in /home/jfcherng/.local/lib/python3.12/site-packages (from flake8) (2.11.1)
Requirement already satisfied: pyflakes<3.2.0,>=3.1.0 in /home/jfcherng/.local/lib/python3.12/site-packages (from flake8) (3.1.0)

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.12.0",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.1.0"
    }
  ],
  "version": "6.1.0"
}

describe the problem

what I expected to happen

Expect no error but I get

[jfcherng@jfcherng-vm Desktop]$ flake8 test.py 
test.py:2:13: E251 unexpected spaces around keyword / parameter equals
test.py:2:15: E202 whitespace before '}'
test.py:2:15: E251 unexpected spaces around keyword / parameter equals

sample code

foo = "bar"
print(f"{foo = }")

commands ran

$ flake8 test.py
asottile commented 12 months ago

pyflakes does not report E codes (and there's a duplicate in the correct place)