summaryrefslogtreecommitdiff
path: root/sphinx/pycode
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-06-14 09:46:12 +0100
committerAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-06-14 09:54:01 +0100
commitb58ef001ac2337a0fa40411a80ee5611d97ef0f3 (patch)
tree6b55444a22212a0c988c1d74c56e2580c4e4f29e /sphinx/pycode
parent873d9f6fdababb96f0763f538e85921f7d332b70 (diff)
downloadsphinx-git-b58ef001ac2337a0fa40411a80ee5611d97ef0f3.tar.gz
Remove extra space from the unparser
Diffstat (limited to 'sphinx/pycode')
-rw-r--r--sphinx/pycode/ast.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py
index 755116475..2a896a7c3 100644
--- a/sphinx/pycode/ast.py
+++ b/sphinx/pycode/ast.py
@@ -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: