Fix signature of generic_visit method (#2100)

This methods returns something that has the same type as the first argument.
Fixes #2085.
This commit is contained in:
Thomas Schaper
2018-05-07 20:20:20 +02:00
committed by Guido van Rossum
parent 252d79981b
commit 39576c5d41
2 changed files with 7 additions and 4 deletions

View File

@@ -1,16 +1,18 @@
# Python 3.5 ast
import typing
from typing import Any, Union, Iterator
from typing import Any, Union, TypeVar, Iterator
from _ast import *
_T = TypeVar('_T', bound=AST)
class NodeVisitor():
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> None: ...
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> None: ...
def generic_visit(self, node: _T) -> _T: ...
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> Module: ...
def copy_location(new_node: AST, old_node: AST) -> AST: ...