google / google/yapf

"E125 continuation line with same indent as next logical line" in except clause

Open
#600 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

yapf (tested with 2c13f6f93e8ccfa0c966b67f88eeffe20ccb32a0) turns the following admittedly rather strange code:

```python
try:
pass
except 0 + A(
(lambda: 0), -768, b"\x00\x00\x00\x00\x00\x00\x00\x00", 285873023221760.0
):
pass
```

into the following:

```python
try:
pass
except 0 + A(
(lambda: 0), -768, b"\x00\x00\x00\x00\x00\x00\x00\x00", 285873023221760.0):
pass
```

which causes pycodestyle to complain about the fact that the continuation line starting with the lambda lines up with the pass.

I know pycodestyle isn't generally considered a source of truth for yapf, and pep8 is somewhat ambiguous about what should happen here IMO, but FWIW the former is what [black](https://github.com/ambv/black) produces and definitely seems more in line with how I expect except clauses to be formatted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.