Use tuple instead of _typing.Tuple in ast (#7639)

This commit is contained in:
Sebastian Rittau
2022-04-16 17:15:42 +02:00
committed by GitHub
parent 819900fa55
commit 7a3eb5a481

View File

@@ -1,13 +1,4 @@
# 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.
# The same unorthodox Bazel integration causes issues with sys, which
# is imported in both modules. unfortunately we can't just rename sys,
# since mypy only supports version checks with a sys that is named
# sys.
import sys
import typing as _typing
from _ast import *
from typing import Any, Iterator, TypeVar, overload
from typing_extensions import Literal
@@ -166,7 +157,7 @@ if sys.version_info >= (3, 8):
mode: Literal["exec"] = ...,
*,
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> Module: ...
@overload
def parse(
@@ -175,7 +166,7 @@ if sys.version_info >= (3, 8):
mode: Literal["eval"],
*,
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> Expression: ...
@overload
def parse(
@@ -184,7 +175,7 @@ if sys.version_info >= (3, 8):
mode: Literal["func_type"],
*,
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> FunctionType: ...
@overload
def parse(
@@ -193,7 +184,7 @@ if sys.version_info >= (3, 8):
mode: Literal["single"],
*,
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> Interactive: ...
@overload
def parse(
@@ -201,7 +192,7 @@ if sys.version_info >= (3, 8):
*,
mode: Literal["eval"],
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> Expression: ...
@overload
def parse(
@@ -209,7 +200,7 @@ if sys.version_info >= (3, 8):
*,
mode: Literal["func_type"],
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> FunctionType: ...
@overload
def parse(
@@ -217,7 +208,7 @@ if sys.version_info >= (3, 8):
*,
mode: Literal["single"],
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> Interactive: ...
@overload
def parse(
@@ -226,7 +217,7 @@ if sys.version_info >= (3, 8):
mode: str = ...,
*,
type_comments: bool = ...,
feature_version: None | int | _typing.Tuple[int, int] = ...,
feature_version: None | int | tuple[int, int] = ...,
) -> AST: ...
else:
@@ -260,7 +251,7 @@ def fix_missing_locations(node: _T) -> _T: ...
def get_docstring(node: AST, clean: bool = ...) -> str | None: ...
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 iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
def literal_eval(node_or_string: str | AST) -> Any: ...
if sys.version_info >= (3, 8):