X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/4c4a51cb6bd01e2e813354502b8327285fc00e75..b65af236cfd3c89938e3ddd012a5772d94826d84:/black.py diff --git a/black.py b/black.py index ada9b0e..f6f687b 100644 --- a/black.py +++ b/black.py @@ -2601,9 +2601,11 @@ def bracket_split_build_line( # Since body is a new indent level, remove spurious leading whitespace. normalize_prefix(leaves[0], inside_brackets=True) # Ensure a trailing comma for imports and standalone function arguments, but - # be careful not to add one after any comments. - no_commas = original.is_def and not any( - l.type == token.COMMA for l in leaves + # be careful not to add one after any comments or within type annotations. + no_commas = ( + original.is_def + and opening_bracket.value == "(" + and not any(l.type == token.COMMA for l in leaves) ) if original.is_import or no_commas: @@ -3778,8 +3780,10 @@ def dump_to_file(*output: str) -> str: @contextmanager def nullcontext() -> Iterator[None]: - """Return context manager that does nothing. - Similar to `nullcontext` from python 3.7""" + """Return an empty context manager. + + To be used like `nullcontext` in Python 3.7. + """ yield