mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove extra space from the unparser
This commit is contained in:
parent
873d9f6fda
commit
b58ef001ac
@ -202,6 +202,8 @@ class _UnparseVisitor(ast.NodeVisitor):
|
||||
return "%s[%s]" % (self.visit(node.value), self.visit(node.slice))
|
||||
|
||||
def visit_UnaryOp(self, node: ast.UnaryOp) -> str:
|
||||
if not isinstance(node.op, ast.Not):
|
||||
return "%s%s" % (self.visit(node.op), self.visit(node.operand))
|
||||
return "%s %s" % (self.visit(node.op), self.visit(node.operand))
|
||||
|
||||
def visit_Tuple(self, node: ast.Tuple) -> str:
|
||||
|
@ -25,7 +25,7 @@ from sphinx.pycode import ast
|
||||
("...", "..."), # Ellipsis
|
||||
("a // b", "a // b"), # FloorDiv
|
||||
("Tuple[int, int]", "Tuple[int, int]"), # Index, Subscript
|
||||
("~ 1", "~ 1"), # Invert
|
||||
("~1", "~1"), # Invert
|
||||
("lambda x, y: x + y",
|
||||
"lambda x, y: ..."), # Lambda
|
||||
("[1, 2, 3]", "[1, 2, 3]"), # List
|
||||
@ -42,9 +42,9 @@ from sphinx.pycode import ast
|
||||
("{1, 2, 3}", "{1, 2, 3}"), # Set
|
||||
("a - b", "a - b"), # Sub
|
||||
("'str'", "'str'"), # Str
|
||||
("+ a", "+ a"), # UAdd
|
||||
("- 1", "- 1"), # UnaryOp
|
||||
("- a", "- a"), # USub
|
||||
("+a", "+a"), # UAdd
|
||||
("-1", "-1"), # UnaryOp
|
||||
("-a", "-a"), # USub
|
||||
("(1, 2, 3)", "(1, 2, 3)"), # Tuple
|
||||
("()", "()"), # Tuple (empty)
|
||||
("(1,)", "(1,)"), # Tuple (single item)
|
||||
|
Loading…
Reference in New Issue
Block a user