Support calling eval and ast module with unicode in Python 2 (#1440)

This commit is contained in:
Roy Williams
2017-06-26 19:06:17 -07:00
committed by Jelle Zijlstra
parent d3f9c55203
commit 31d7393cae
2 changed files with 3 additions and 3 deletions

View File

@@ -939,7 +939,7 @@ class UnicodeWarning(Warning): ...
class BytesWarning(Warning): ...
class ResourceWarning(Warning): ...
def eval(s: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
def eval(s: Union[str, unicode], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> Any: ...
def exec(object: str,
globals: Optional[Dict[str, Any]] = None,
locals: Optional[Dict[str, Any]] = None) -> Any: ... # TODO code object as source

View File

@@ -21,7 +21,7 @@ __version__ = ... # type: str
PyCF_ONLY_AST = ... # type: int
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> Module: ...
def parse(source: Union[str, unicode], filename: Union[str, unicode] = ..., mode: Union[str, unicode] = ...) -> Module: ...
def copy_location(new_node: AST, old_node: AST) -> AST: ...
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
def fix_missing_locations(node: AST) -> AST: ...
@@ -29,7 +29,7 @@ def get_docstring(node: AST, clean: bool = ...) -> str: ...
def increment_lineno(node: AST, n: int = ...) -> AST: ...
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: ...
def literal_eval(node_or_string: Union[str, unicode, AST]) -> Any: ...
def walk(node: AST) -> Iterator[AST]: ...
class NodeVisitor():