Skip to content

Commit 3f9fafb

Browse files
ilinumgvanrossum
authored andcommitted
Re-export code from _ast into ast. (#1515)
After mypy [started hiding](python/mypy#3706) imported names in stubs unless `from ... import ...` is used, we found an error with stubs of ast module. It looks like ast module should re-export everything in `_ast` and according to PEP 484, it can do that by doing `from _ast import *`, so this is what this PR does.
1 parent a249b40 commit 3f9fafb

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

stdlib/2/ast.pyi

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,7 @@
33
import typing
44
from typing import Any, Iterator, Union
55

6-
from _ast import (
7-
Add, alias, And, arguments, Assert, Assign, AST, Attribute, AugAssign,
8-
AugLoad, AugStore, BinOp, BitAnd, BitOr, BitXor, BoolOp, boolop, Break,
9-
Call, ClassDef, cmpop, Compare, comprehension, Continue, Del, Delete, Dict,
10-
DictComp, Div, Ellipsis, Eq, ExceptHandler, Exec, Expr, expr, Expression,
11-
expr_context, ExtSlice, FloorDiv, For, FunctionDef, GeneratorExp, Global,
12-
Gt, GtE, If, IfExp, Import, ImportFrom, In, Index, Interactive, Invert, Is,
13-
IsNot, keyword, Lambda, List, ListComp, Load, LShift, Lt, LtE, Mod, mod,
14-
Module, Mult, Name, Not, NotEq, NotIn, Num, operator, Or, Param, Pass, Pow,
15-
Print, Raise, Repr, Return, RShift, Set, SetComp, Slice, slice, stmt,
16-
Store, Str, Sub, Subscript, Suite, TryExcept, TryFinally, Tuple, UAdd,
17-
UnaryOp, unaryop, USub, While, With, Yield
18-
)
6+
from _ast import *
197

208
__version__ = ... # type: str
219
PyCF_ONLY_AST = ... # type: int

stdlib/3/ast.pyi

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@
33
import typing
44
from typing import Any, Union, Iterator
55

6-
from _ast import (
7-
Add, alias, And, arg, arguments, Assert, Assign, AST, AsyncFor,
8-
AsyncFunctionDef, AsyncWith, Attribute, AugAssign, AugLoad, AugStore,
9-
Await, BinOp, BitAnd, BitOr, BitXor, BoolOp, boolop, Break, Bytes, Call,
10-
ClassDef, cmpop, Compare, comprehension, Continue, Del, Delete, Dict,
11-
DictComp, Div, Ellipsis, Eq, ExceptHandler, Expr, expr, Expression,
12-
expr_context, ExtSlice, FloorDiv, For, FunctionDef, GeneratorExp, Global,
13-
Gt, GtE, If, IfExp, Import, ImportFrom, In, Index, Interactive, Invert, Is,
14-
IsNot, keyword, Lambda, List, ListComp, Load, LShift, Lt, LtE, MatMult,
15-
Mod, mod, Module, Mult, Name, NameConstant, Nonlocal, Not, NotEq, NotIn,
16-
Num, operator, Or, Param, Pass, Pow, Raise, Return, RShift, Set, SetComp,
17-
Slice, slice, Starred, stmt, Store, Str, Sub, Subscript, Suite, Try, Tuple,
18-
UAdd, UnaryOp, unaryop, USub, While, With, withitem, Yield, YieldFrom
19-
)
6+
from _ast import *
207

218
class NodeVisitor():
229
def visit(self, node: AST) -> Any: ...

0 commit comments

Comments
 (0)