Skip to content

Keep terminal empty function calls on one line - #1332

Draft
srijan2607 wants to merge 1 commit into
google:mainfrom
srijan2607:fix/terminal-empty-call
Draft

srijan2607 wants to merge 1 commit into
google:mainfrom
srijan2607:fix/terminal-empty-call

Conversation

@srijan2607

Copy link
Copy Markdown

An overlong zero-argument call can be formatted with its closing parenthesis alone on the next line, even when there is no following expression to move there.

Keep adjacent empty parentheses together at the end of a logical line or before a comma. Apply the same rule to optional and mandatory splits so enclosing argument lists can still wrap normally. Existing splits before call-chain suffixes, operators and return annotations are unchanged.

Adds regressions for terminal calls, closing-bracket styles, nested calls and comments inside otherwise empty calls.

Testing: python -m unittest discover -p '*_test.py' yapftests/ passes all 614 tests on Python 3.11 and 3.13. YAPF, Flake8 and isort checks pass for both changed files. The full tox/build and pre-commit matrices were not run.

Fixes #1197.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function call without arguments.

1 participant