E122: No valid indent for long function call nested in f-string?
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 754
- PR merge metrics
- No merged PRs in 30d
Description
For the following example
class T:
def m1(self):
print(f"""
preamble
{some_long_func(
some_long_arg, other_long_arg, more_long_arg)}
postamble
""")
def m2(self):
print(f"""
preamble
{some_long_func(
some_long_arg, other_long_arg, more_long_arg)}
postamble
""")
there appears to be no indentation of the "long args line" that makes pycodestyle not emit a E122 ("continuation line missing indentation or outdented") for that line. (If m1 and m2 are toplevel functions and not methods, then the second form makes pycodestyle happy.)
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 reproducing the two class-method examples and tracing the E122 check that handles continuation lines inside nested f-strings. Done means the valid indentation case no longer emits E122 while the relevant existing checks continue to pass.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100