Make appropriate ast methods generic (#2715)

Closes #2714
This commit is contained in:
Tomer Keren
2018-12-24 21:03:09 +02:00
committed by Sebastian Rittau
parent 8542916231
commit d9a202e352

View File

@@ -4,7 +4,7 @@
# from _ast below when loaded in an unorthodox way by the Dropbox
# internal Bazel integration.
import typing as _typing
from typing import Any, Iterator, Optional, Union
from typing import Any, Iterator, Optional, Union, TypeVar
from _ast import *
@@ -15,12 +15,14 @@ class NodeVisitor():
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> Optional[AST]: ...
_T = TypeVar('_T', bound=AST)
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> Module: ...
def copy_location(new_node: AST, old_node: AST) -> AST: ...
def copy_location(new_node: _T, old_node: AST) -> _T: ...
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
def fix_missing_locations(node: AST) -> AST: ...
def fix_missing_locations(node: _T) -> _T: ...
def get_docstring(node: AST, clean: bool = ...) -> str: ...
def increment_lineno(node: AST, n: int = ...) -> AST: ...
def increment_lineno(node: _T, n: int = ...) -> _T: ...
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
def literal_eval(node_or_string: Union[str, AST]) -> Any: ...