From: Ɓukasz Langa Date: Thu, 17 May 2018 18:19:32 +0000 (-0700) Subject: Avoid treating ellipsis as a dot delimiter X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/31fbd1982f9511c5b7bce93eb133110811f90e0f Avoid treating ellipsis as a dot delimiter --- diff --git a/black.py b/black.py index c48b8d1..a1a3468 100644 --- a/black.py +++ b/black.py @@ -1741,7 +1741,7 @@ def is_split_before_delimiter(leaf: Leaf, previous: Leaf = None) -> int: leaf.type == token.DOT and leaf.parent and leaf.parent.type not in {syms.import_from, syms.dotted_name} - and (previous is None or previous.type != token.NAME) + and (previous is None or previous.type in CLOSING_BRACKETS) ): return DOT_PRIORITY diff --git a/tests/comments2.py b/tests/comments2.py index 2045c93..32a2ab3 100644 --- a/tests/comments2.py +++ b/tests/comments2.py @@ -23,6 +23,25 @@ __all__ = [ 'Generator', ] +not_shareables = [ + # singletons + True, + False, + NotImplemented, ..., + # builtin types and objects + type, + object, + object(), + Exception(), + 42, + 100.0, + "spam", + # user-defined types and objects + Cheese, + Cheese("Wensleydale"), + SubBytes(b"spam"), +] + if 'PYTHON' in os.environ: add_compiler(compiler_from_env()) else: @@ -152,6 +171,26 @@ __all__ = [ "Generator", ] +not_shareables = [ + # singletons + True, + False, + NotImplemented, + ..., + # builtin types and objects + type, + object, + object(), + Exception(), + 42, + 100.0, + "spam", + # user-defined types and objects + Cheese, + Cheese("Wensleydale"), + SubBytes(b"spam"), +] + if "PYTHON" in os.environ: add_compiler(compiler_from_env()) else: