mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
Support new ast features and node types introduced in Python 3.8 (#2859)
Had to adjust the return type of ast.parse() from Module to AST, which is more truthful anyways.
This commit is contained in:
committed by
Sebastian Rittau
parent
5918098576
commit
6b6d8c82ac
@@ -1,5 +1,6 @@
|
||||
# Python 3.5 ast
|
||||
|
||||
import sys
|
||||
# Rename typing to _typing, as not to conflict with typing imported
|
||||
# from _ast below when loaded in an unorthodox way by the Dropbox
|
||||
# internal Bazel integration.
|
||||
@@ -17,7 +18,12 @@ class NodeTransformer(NodeVisitor):
|
||||
|
||||
_T = TypeVar('_T', bound=AST)
|
||||
|
||||
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> Module: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...,
|
||||
type_comments: bool = ..., feature_version: int = ...) -> AST: ...
|
||||
else:
|
||||
def parse(source: Union[str, bytes], filename: Union[str, bytes] = ..., mode: str = ...) -> 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: _T) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user