Spurious E231 for nested format substitutions
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 754
- PR merge metrics
- No merged PRs in 30d
Description
For
x = 1
digits = 1
print(f"{x:0.{digits:d}f}") # admittedly the :d is not needed in this minimal repro, but still valid.
pycodestyle 2.11.1 spuriously complains about a missing whitespace after the second colon in the f-string:
test.py:3:21: E231 missing whitespace after ':'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running pycodestyle 2.11.1 on the Python snippet in the issue and trace the E231 path that handles colons in f-string substitutions. Done means this valid nested format expression no longer reports E231, with a regression check covering the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100