Fix docstrings of visit_stmt and normalize_invisible_parens

This commit is contained in:
Łukasz Langa 2018-05-08 16:42:41 -07:00
parent 7811f957f3
commit a68dd928e6

View File

@ -1257,9 +1257,8 @@ def visit_stmt(
The relevant Python language `keywords` for a given statement will be The relevant Python language `keywords` for a given statement will be
NAME leaves within it. This methods puts those on a separate line. NAME leaves within it. This methods puts those on a separate line.
`parens` holds pairs of nodes where invisible parentheses should be put. `parens` holds a set of string leaf values immeditely after which
Keys hold nodes after which opening parentheses should be put, values invisible parens should be put.
hold nodes before which closing parentheses should be put.
""" """
normalize_invisible_parens(node, parens_after=parens) normalize_invisible_parens(node, parens_after=parens)
for child in node.children: for child in node.children:
@ -2205,6 +2204,9 @@ def normalize_string_quotes(leaf: Leaf) -> None:
def normalize_invisible_parens(node: Node, parens_after: Set[str]) -> None: def normalize_invisible_parens(node: Node, parens_after: Set[str]) -> None:
"""Make existing optional parentheses invisible or create new ones. """Make existing optional parentheses invisible or create new ones.
`parens_after` is a set of string leaf values immeditely after which parens
should be put.
Standardizes on visible parentheses for single-element tuples, and keeps Standardizes on visible parentheses for single-element tuples, and keeps
existing visible parentheses for other tuples and generator expressions. existing visible parentheses for other tuples and generator expressions.
""" """