Avoid treating ellipsis as a dot delimiter

This commit is contained in:
Łukasz Langa 2018-05-17 11:19:32 -07:00
parent dd4477b701
commit 31fbd1982f
2 changed files with 40 additions and 1 deletions

View File

@ -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

View File

@ -23,6 +23,25 @@
'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 @@ def inline_comments_in_brackets_ruin_everything():
"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: