Fix type annotation of ast.NodeTransformer.generic_visit(). It always returns an ast.ASt object. (#4483)

This commit is contained in:
MapleCCC
2020-08-27 01:24:17 +08:00
committed by GitHub
parent 5f9fd3d127
commit cfe832b907

View File

@@ -144,7 +144,7 @@ class NodeVisitor:
def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> Optional[AST]: ...
def generic_visit(self, node: AST) -> AST: ...
# TODO: Override the visit_* methods with better return types.
# The usual return type is Optional[AST], but Iterable[AST]
# is also allowed in some cases -- this needs to be mapped.