Skip to content

Commit 7a3eb5a

Browse files
authored
Use tuple instead of _typing.Tuple in ast (#7639)
1 parent 819900f commit 7a3eb5a

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

stdlib/ast.pyi

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
# Rename typing to _typing, as not to conflict with typing imported
2-
# from _ast below when loaded in an unorthodox way by the Dropbox
3-
# internal Bazel integration.
4-
5-
# The same unorthodox Bazel integration causes issues with sys, which
6-
# is imported in both modules. unfortunately we can't just rename sys,
7-
# since mypy only supports version checks with a sys that is named
8-
# sys.
91
import sys
10-
import typing as _typing
112
from _ast import *
123
from typing import Any, Iterator, TypeVar, overload
134
from typing_extensions import Literal
@@ -166,7 +157,7 @@ if sys.version_info >= (3, 8):
166157
mode: Literal["exec"] = ...,
167158
*,
168159
type_comments: bool = ...,
169-
feature_version: None | int | _typing.Tuple[int, int] = ...,
160+
feature_version: None | int | tuple[int, int] = ...,
170161
) -> Module: ...
171162
@overload
172163
def parse(
@@ -175,7 +166,7 @@ if sys.version_info >= (3, 8):
175166
mode: Literal["eval"],
176167
*,
177168
type_comments: bool = ...,
178-
feature_version: None | int | _typing.Tuple[int, int] = ...,
169+
feature_version: None | int | tuple[int, int] = ...,
179170
) -> Expression: ...
180171
@overload
181172
def parse(
@@ -184,7 +175,7 @@ if sys.version_info >= (3, 8):
184175
mode: Literal["func_type"],
185176
*,
186177
type_comments: bool = ...,
187-
feature_version: None | int | _typing.Tuple[int, int] = ...,
178+
feature_version: None | int | tuple[int, int] = ...,
188179
) -> FunctionType: ...
189180
@overload
190181
def parse(
@@ -193,31 +184,31 @@ if sys.version_info >= (3, 8):
193184
mode: Literal["single"],
194185
*,
195186
type_comments: bool = ...,
196-
feature_version: None | int | _typing.Tuple[int, int] = ...,
187+
feature_version: None | int | tuple[int, int] = ...,
197188
) -> Interactive: ...
198189
@overload
199190
def parse(
200191
source: str | bytes,
201192
*,
202193
mode: Literal["eval"],
203194
type_comments: bool = ...,
204-
feature_version: None | int | _typing.Tuple[int, int] = ...,
195+
feature_version: None | int | tuple[int, int] = ...,
205196
) -> Expression: ...
206197
@overload
207198
def parse(
208199
source: str | bytes,
209200
*,
210201
mode: Literal["func_type"],
211202
type_comments: bool = ...,
212-
feature_version: None | int | _typing.Tuple[int, int] = ...,
203+
feature_version: None | int | tuple[int, int] = ...,
213204
) -> FunctionType: ...
214205
@overload
215206
def parse(
216207
source: str | bytes,
217208
*,
218209
mode: Literal["single"],
219210
type_comments: bool = ...,
220-
feature_version: None | int | _typing.Tuple[int, int] = ...,
211+
feature_version: None | int | tuple[int, int] = ...,
221212
) -> Interactive: ...
222213
@overload
223214
def parse(
@@ -226,7 +217,7 @@ if sys.version_info >= (3, 8):
226217
mode: str = ...,
227218
*,
228219
type_comments: bool = ...,
229-
feature_version: None | int | _typing.Tuple[int, int] = ...,
220+
feature_version: None | int | tuple[int, int] = ...,
230221
) -> AST: ...
231222

232223
else:
@@ -260,7 +251,7 @@ def fix_missing_locations(node: _T) -> _T: ...
260251
def get_docstring(node: AST, clean: bool = ...) -> str | None: ...
261252
def increment_lineno(node: _T, n: int = ...) -> _T: ...
262253
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
263-
def iter_fields(node: AST) -> Iterator[_typing.Tuple[str, Any]]: ...
254+
def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
264255
def literal_eval(node_or_string: str | AST) -> Any: ...
265256

266257
if sys.version_info >= (3, 8):

0 commit comments

Comments
 (0)