Avoid treating ellipsis as a dot delimiter
This commit is contained in:
parent
dd4477b701
commit
31fbd1982f
2
black.py
2
black.py
@ -1741,7 +1741,7 @@ def is_split_before_delimiter(leaf: Leaf, previous: Leaf = None) -> int:
|
|||||||
leaf.type == token.DOT
|
leaf.type == token.DOT
|
||||||
and leaf.parent
|
and leaf.parent
|
||||||
and leaf.parent.type not in {syms.import_from, syms.dotted_name}
|
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
|
return DOT_PRIORITY
|
||||||
|
|
||||||
|
@ -23,6 +23,25 @@
|
|||||||
'Generator',
|
'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:
|
if 'PYTHON' in os.environ:
|
||||||
add_compiler(compiler_from_env())
|
add_compiler(compiler_from_env())
|
||||||
else:
|
else:
|
||||||
@ -152,6 +171,26 @@ def inline_comments_in_brackets_ruin_everything():
|
|||||||
"Generator",
|
"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:
|
if "PYTHON" in os.environ:
|
||||||
add_compiler(compiler_from_env())
|
add_compiler(compiler_from_env())
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user