mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Tweak how ast.pyi imports typing (#2668)
When we import typeshed internally at Dropbox, somehow the fact that these files are all stubs gets lost (it's a long story...). This causes errors like this: .../stdlib/2/ast.pyi:6: error: Name 'typing' already defined (by an import) The quickest way around this is to rename the import to _typing.
This commit is contained in:
committed by
Sebastian Rittau
parent
3e4737c683
commit
e08a5ac367
@@ -1,7 +1,10 @@
|
||||
# Python 3.5 ast
|
||||
|
||||
import typing
|
||||
from typing import Any, Union, Iterator, Optional
|
||||
# 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.
|
||||
import typing as _typing
|
||||
from typing import Any, Iterator, Optional, Union
|
||||
|
||||
from _ast import *
|
||||
|
||||
@@ -19,7 +22,7 @@ def fix_missing_locations(node: AST) -> AST: ...
|
||||
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 iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
|
||||
def literal_eval(node_or_string: Union[str, AST]) -> Any: ...
|
||||
def walk(node: AST) -> Iterator[AST]: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user