mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 09:33:25 +08:00
Remove stubs for typed-ast (#10415)
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
version = "1.5.*"
|
||||
no_longer_updated = true
|
||||
@@ -1,337 +0,0 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
class NodeVisitor:
|
||||
def visit(self, node: AST) -> Any: ...
|
||||
def generic_visit(self, node: AST) -> None: ...
|
||||
|
||||
class NodeTransformer(NodeVisitor):
|
||||
def generic_visit(self, node: AST) -> None: ...
|
||||
|
||||
def parse(source: str | ReadableBuffer, filename: str | ReadableBuffer = "<unknown>", mode: str = "exec") -> AST: ...
|
||||
def copy_location(new_node: AST, old_node: AST) -> AST: ...
|
||||
def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = False) -> str: ...
|
||||
def fix_missing_locations(node: AST) -> AST: ...
|
||||
def get_docstring(node: AST, clean: bool = True) -> str | bytes | None: ...
|
||||
def increment_lineno(node: AST, n: int = 1) -> AST: ...
|
||||
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
|
||||
def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
|
||||
def literal_eval(node_or_string: str | AST) -> Any: ...
|
||||
def walk(node: AST) -> Iterator[AST]: ...
|
||||
|
||||
PyCF_ONLY_AST: int
|
||||
|
||||
# ast classes
|
||||
|
||||
_Identifier: TypeAlias = str
|
||||
|
||||
class AST:
|
||||
_attributes: tuple[str, ...]
|
||||
_fields: tuple[str, ...]
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class mod(AST): ...
|
||||
|
||||
class Module(mod):
|
||||
body: list[stmt]
|
||||
type_ignores: list[TypeIgnore]
|
||||
|
||||
class Interactive(mod):
|
||||
body: list[stmt]
|
||||
|
||||
class Expression(mod):
|
||||
body: expr
|
||||
|
||||
class FunctionType(mod):
|
||||
argtypes: list[expr]
|
||||
returns: expr
|
||||
|
||||
class Suite(mod):
|
||||
body: list[stmt]
|
||||
|
||||
class stmt(AST):
|
||||
lineno: int
|
||||
col_offset: int
|
||||
|
||||
class FunctionDef(stmt):
|
||||
name: _Identifier
|
||||
args: arguments
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
type_comment: str | None
|
||||
|
||||
class ClassDef(stmt):
|
||||
name: _Identifier
|
||||
bases: list[expr]
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
|
||||
class Return(stmt):
|
||||
value: expr | None
|
||||
|
||||
class Delete(stmt):
|
||||
targets: list[expr]
|
||||
|
||||
class Assign(stmt):
|
||||
targets: list[expr]
|
||||
value: expr
|
||||
type_comment: str | None
|
||||
|
||||
class AugAssign(stmt):
|
||||
target: expr
|
||||
op: operator
|
||||
value: expr
|
||||
|
||||
class Print(stmt):
|
||||
dest: expr | None
|
||||
values: list[expr]
|
||||
nl: bool
|
||||
|
||||
class For(stmt):
|
||||
target: expr
|
||||
iter: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
type_comment: str | None
|
||||
|
||||
class While(stmt):
|
||||
test: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
|
||||
class If(stmt):
|
||||
test: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
|
||||
class With(stmt):
|
||||
context_expr: expr
|
||||
optional_vars: expr | None
|
||||
body: list[stmt]
|
||||
type_comment: str | None
|
||||
|
||||
class Raise(stmt):
|
||||
type: expr | None
|
||||
inst: expr | None
|
||||
tback: expr | None
|
||||
|
||||
class TryExcept(stmt):
|
||||
body: list[stmt]
|
||||
handlers: list[ExceptHandler]
|
||||
orelse: list[stmt]
|
||||
|
||||
class TryFinally(stmt):
|
||||
body: list[stmt]
|
||||
finalbody: list[stmt]
|
||||
|
||||
class Assert(stmt):
|
||||
test: expr
|
||||
msg: expr | None
|
||||
|
||||
class Import(stmt):
|
||||
names: list[alias]
|
||||
|
||||
class ImportFrom(stmt):
|
||||
module: _Identifier | None
|
||||
names: list[alias]
|
||||
level: int | None
|
||||
|
||||
class Exec(stmt):
|
||||
body: expr
|
||||
globals: expr | None
|
||||
locals: expr | None
|
||||
|
||||
class Global(stmt):
|
||||
names: list[_Identifier]
|
||||
|
||||
class Expr(stmt):
|
||||
value: expr
|
||||
|
||||
class Pass(stmt): ...
|
||||
class Break(stmt): ...
|
||||
class Continue(stmt): ...
|
||||
class slice(AST): ...
|
||||
|
||||
_Slice: TypeAlias = slice # this lets us type the variable named 'slice' below
|
||||
|
||||
class Slice(slice):
|
||||
lower: expr | None
|
||||
upper: expr | None
|
||||
step: expr | None
|
||||
|
||||
class ExtSlice(slice):
|
||||
dims: list[slice]
|
||||
|
||||
class Index(slice):
|
||||
value: expr
|
||||
|
||||
class Ellipsis(slice): ...
|
||||
|
||||
class expr(AST):
|
||||
lineno: int
|
||||
col_offset: int
|
||||
|
||||
class BoolOp(expr):
|
||||
op: boolop
|
||||
values: list[expr]
|
||||
|
||||
class BinOp(expr):
|
||||
left: expr
|
||||
op: operator
|
||||
right: expr
|
||||
|
||||
class UnaryOp(expr):
|
||||
op: unaryop
|
||||
operand: expr
|
||||
|
||||
class Lambda(expr):
|
||||
args: arguments
|
||||
body: expr
|
||||
|
||||
class IfExp(expr):
|
||||
test: expr
|
||||
body: expr
|
||||
orelse: expr
|
||||
|
||||
class Dict(expr):
|
||||
keys: list[expr]
|
||||
values: list[expr]
|
||||
|
||||
class Set(expr):
|
||||
elts: list[expr]
|
||||
|
||||
class ListComp(expr):
|
||||
elt: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class SetComp(expr):
|
||||
elt: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class DictComp(expr):
|
||||
key: expr
|
||||
value: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class GeneratorExp(expr):
|
||||
elt: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class Yield(expr):
|
||||
value: expr | None
|
||||
|
||||
class Compare(expr):
|
||||
left: expr
|
||||
ops: list[cmpop]
|
||||
comparators: list[expr]
|
||||
|
||||
class Call(expr):
|
||||
func: expr
|
||||
args: list[expr]
|
||||
keywords: list[keyword]
|
||||
starargs: expr | None
|
||||
kwargs: expr | None
|
||||
|
||||
class Repr(expr):
|
||||
value: expr
|
||||
|
||||
class Num(expr):
|
||||
n: int | float | complex
|
||||
|
||||
class Str(expr):
|
||||
s: str | bytes
|
||||
kind: str
|
||||
|
||||
class Attribute(expr):
|
||||
value: expr
|
||||
attr: _Identifier
|
||||
ctx: expr_context
|
||||
|
||||
class Subscript(expr):
|
||||
value: expr
|
||||
slice: _Slice
|
||||
ctx: expr_context
|
||||
|
||||
class Name(expr):
|
||||
id: _Identifier
|
||||
ctx: expr_context
|
||||
|
||||
class List(expr):
|
||||
elts: list[expr]
|
||||
ctx: expr_context
|
||||
|
||||
class Tuple(expr):
|
||||
elts: list[expr]
|
||||
ctx: expr_context
|
||||
|
||||
class expr_context(AST): ...
|
||||
class AugLoad(expr_context): ...
|
||||
class AugStore(expr_context): ...
|
||||
class Del(expr_context): ...
|
||||
class Load(expr_context): ...
|
||||
class Param(expr_context): ...
|
||||
class Store(expr_context): ...
|
||||
class boolop(AST): ...
|
||||
class And(boolop): ...
|
||||
class Or(boolop): ...
|
||||
class operator(AST): ...
|
||||
class Add(operator): ...
|
||||
class BitAnd(operator): ...
|
||||
class BitOr(operator): ...
|
||||
class BitXor(operator): ...
|
||||
class Div(operator): ...
|
||||
class FloorDiv(operator): ...
|
||||
class LShift(operator): ...
|
||||
class Mod(operator): ...
|
||||
class Mult(operator): ...
|
||||
class Pow(operator): ...
|
||||
class RShift(operator): ...
|
||||
class Sub(operator): ...
|
||||
class unaryop(AST): ...
|
||||
class Invert(unaryop): ...
|
||||
class Not(unaryop): ...
|
||||
class UAdd(unaryop): ...
|
||||
class USub(unaryop): ...
|
||||
class cmpop(AST): ...
|
||||
class Eq(cmpop): ...
|
||||
class Gt(cmpop): ...
|
||||
class GtE(cmpop): ...
|
||||
class In(cmpop): ...
|
||||
class Is(cmpop): ...
|
||||
class IsNot(cmpop): ...
|
||||
class Lt(cmpop): ...
|
||||
class LtE(cmpop): ...
|
||||
class NotEq(cmpop): ...
|
||||
class NotIn(cmpop): ...
|
||||
|
||||
class comprehension(AST):
|
||||
target: expr
|
||||
iter: expr
|
||||
ifs: list[expr]
|
||||
|
||||
class ExceptHandler(AST):
|
||||
type: expr | None
|
||||
name: expr | None
|
||||
body: list[stmt]
|
||||
lineno: int
|
||||
col_offset: int
|
||||
|
||||
class arguments(AST):
|
||||
args: list[expr]
|
||||
vararg: _Identifier | None
|
||||
kwarg: _Identifier | None
|
||||
defaults: list[expr]
|
||||
type_comments: list[str | None]
|
||||
|
||||
class keyword(AST):
|
||||
arg: _Identifier
|
||||
value: expr
|
||||
|
||||
class alias(AST):
|
||||
name: _Identifier
|
||||
asname: _Identifier | None
|
||||
|
||||
class TypeIgnore(AST):
|
||||
lineno: int
|
||||
@@ -1,391 +0,0 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
LATEST_MINOR_VERSION: int
|
||||
|
||||
class NodeVisitor:
|
||||
def visit(self, node: AST) -> Any: ...
|
||||
def generic_visit(self, node: AST) -> None: ...
|
||||
|
||||
class NodeTransformer(NodeVisitor):
|
||||
def generic_visit(self, node: AST) -> None: ...
|
||||
|
||||
def parse(
|
||||
source: str | ReadableBuffer, filename: str | ReadableBuffer = "<unknown>", mode: str = "exec", feature_version: int = 7
|
||||
) -> AST: ...
|
||||
def copy_location(new_node: AST, old_node: AST) -> AST: ...
|
||||
def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = False) -> str: ...
|
||||
def fix_missing_locations(node: AST) -> AST: ...
|
||||
def get_docstring(node: AST, clean: bool = True) -> str | None: ...
|
||||
def increment_lineno(node: AST, n: int = 1) -> AST: ...
|
||||
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
|
||||
def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
|
||||
def literal_eval(node_or_string: str | AST) -> Any: ...
|
||||
def walk(node: AST) -> Iterator[AST]: ...
|
||||
|
||||
PyCF_ONLY_AST: int
|
||||
|
||||
# ast classes
|
||||
|
||||
_Identifier: TypeAlias = str
|
||||
|
||||
class AST:
|
||||
_attributes: tuple[str, ...]
|
||||
_fields: tuple[str, ...]
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
|
||||
class mod(AST): ...
|
||||
|
||||
class Module(mod):
|
||||
body: list[stmt]
|
||||
type_ignores: list[TypeIgnore]
|
||||
|
||||
class Interactive(mod):
|
||||
body: list[stmt]
|
||||
|
||||
class Expression(mod):
|
||||
body: expr
|
||||
|
||||
class FunctionType(mod):
|
||||
argtypes: list[expr]
|
||||
returns: expr
|
||||
|
||||
class Suite(mod):
|
||||
body: list[stmt]
|
||||
|
||||
class stmt(AST):
|
||||
lineno: int
|
||||
col_offset: int
|
||||
|
||||
class FunctionDef(stmt):
|
||||
name: _Identifier
|
||||
args: arguments
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
returns: expr | None
|
||||
type_comment: str | None
|
||||
|
||||
class AsyncFunctionDef(stmt):
|
||||
name: _Identifier
|
||||
args: arguments
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
returns: expr | None
|
||||
type_comment: str | None
|
||||
|
||||
class ClassDef(stmt):
|
||||
name: _Identifier
|
||||
bases: list[expr]
|
||||
keywords: list[keyword]
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
|
||||
class Return(stmt):
|
||||
value: expr | None
|
||||
|
||||
class Delete(stmt):
|
||||
targets: list[expr]
|
||||
|
||||
class Assign(stmt):
|
||||
targets: list[expr]
|
||||
value: expr
|
||||
type_comment: str | None
|
||||
|
||||
class AugAssign(stmt):
|
||||
target: expr
|
||||
op: operator
|
||||
value: expr
|
||||
|
||||
class AnnAssign(stmt):
|
||||
target: expr
|
||||
annotation: expr
|
||||
value: expr | None
|
||||
simple: int
|
||||
|
||||
class For(stmt):
|
||||
target: expr
|
||||
iter: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
type_comment: str | None
|
||||
|
||||
class AsyncFor(stmt):
|
||||
target: expr
|
||||
iter: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
type_comment: str | None
|
||||
|
||||
class While(stmt):
|
||||
test: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
|
||||
class If(stmt):
|
||||
test: expr
|
||||
body: list[stmt]
|
||||
orelse: list[stmt]
|
||||
|
||||
class With(stmt):
|
||||
items: list[withitem]
|
||||
body: list[stmt]
|
||||
type_comment: str | None
|
||||
|
||||
class AsyncWith(stmt):
|
||||
items: list[withitem]
|
||||
body: list[stmt]
|
||||
type_comment: str | None
|
||||
|
||||
class Raise(stmt):
|
||||
exc: expr | None
|
||||
cause: expr | None
|
||||
|
||||
class Try(stmt):
|
||||
body: list[stmt]
|
||||
handlers: list[ExceptHandler]
|
||||
orelse: list[stmt]
|
||||
finalbody: list[stmt]
|
||||
|
||||
class Assert(stmt):
|
||||
test: expr
|
||||
msg: expr | None
|
||||
|
||||
class Import(stmt):
|
||||
names: list[alias]
|
||||
|
||||
class ImportFrom(stmt):
|
||||
module: _Identifier | None
|
||||
names: list[alias]
|
||||
level: int | None
|
||||
|
||||
class Global(stmt):
|
||||
names: list[_Identifier]
|
||||
|
||||
class Nonlocal(stmt):
|
||||
names: list[_Identifier]
|
||||
|
||||
class Expr(stmt):
|
||||
value: expr
|
||||
|
||||
class Pass(stmt): ...
|
||||
class Break(stmt): ...
|
||||
class Continue(stmt): ...
|
||||
class slice(AST): ...
|
||||
|
||||
_Slice: TypeAlias = slice # this lets us type the variable named 'slice' below
|
||||
|
||||
class Slice(slice):
|
||||
lower: expr | None
|
||||
upper: expr | None
|
||||
step: expr | None
|
||||
|
||||
class ExtSlice(slice):
|
||||
dims: list[slice]
|
||||
|
||||
class Index(slice):
|
||||
value: expr
|
||||
|
||||
class expr(AST):
|
||||
lineno: int
|
||||
col_offset: int
|
||||
|
||||
class BoolOp(expr):
|
||||
op: boolop
|
||||
values: list[expr]
|
||||
|
||||
class BinOp(expr):
|
||||
left: expr
|
||||
op: operator
|
||||
right: expr
|
||||
|
||||
class UnaryOp(expr):
|
||||
op: unaryop
|
||||
operand: expr
|
||||
|
||||
class Lambda(expr):
|
||||
args: arguments
|
||||
body: expr
|
||||
|
||||
class IfExp(expr):
|
||||
test: expr
|
||||
body: expr
|
||||
orelse: expr
|
||||
|
||||
class Dict(expr):
|
||||
keys: list[expr]
|
||||
values: list[expr]
|
||||
|
||||
class Set(expr):
|
||||
elts: list[expr]
|
||||
|
||||
class ListComp(expr):
|
||||
elt: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class SetComp(expr):
|
||||
elt: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class DictComp(expr):
|
||||
key: expr
|
||||
value: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class GeneratorExp(expr):
|
||||
elt: expr
|
||||
generators: list[comprehension]
|
||||
|
||||
class Await(expr):
|
||||
value: expr
|
||||
|
||||
class Yield(expr):
|
||||
value: expr | None
|
||||
|
||||
class YieldFrom(expr):
|
||||
value: expr
|
||||
|
||||
class Compare(expr):
|
||||
left: expr
|
||||
ops: list[cmpop]
|
||||
comparators: list[expr]
|
||||
|
||||
class Call(expr):
|
||||
func: expr
|
||||
args: list[expr]
|
||||
keywords: list[keyword]
|
||||
|
||||
class Num(expr):
|
||||
n: int | float | complex
|
||||
|
||||
class Str(expr):
|
||||
s: str
|
||||
kind: str
|
||||
|
||||
class FormattedValue(expr):
|
||||
value: expr
|
||||
conversion: int | None
|
||||
format_spec: expr | None
|
||||
|
||||
class JoinedStr(expr):
|
||||
values: list[expr]
|
||||
|
||||
class Bytes(expr):
|
||||
s: bytes
|
||||
|
||||
class NameConstant(expr):
|
||||
value: Any
|
||||
|
||||
class Ellipsis(expr): ...
|
||||
|
||||
class Attribute(expr):
|
||||
value: expr
|
||||
attr: _Identifier
|
||||
ctx: expr_context
|
||||
|
||||
class Subscript(expr):
|
||||
value: expr
|
||||
slice: _Slice
|
||||
ctx: expr_context
|
||||
|
||||
class Starred(expr):
|
||||
value: expr
|
||||
ctx: expr_context
|
||||
|
||||
class Name(expr):
|
||||
id: _Identifier
|
||||
ctx: expr_context
|
||||
|
||||
class List(expr):
|
||||
elts: list[expr]
|
||||
ctx: expr_context
|
||||
|
||||
class Tuple(expr):
|
||||
elts: list[expr]
|
||||
ctx: expr_context
|
||||
|
||||
class expr_context(AST): ...
|
||||
class AugLoad(expr_context): ...
|
||||
class AugStore(expr_context): ...
|
||||
class Del(expr_context): ...
|
||||
class Load(expr_context): ...
|
||||
class Param(expr_context): ...
|
||||
class Store(expr_context): ...
|
||||
class boolop(AST): ...
|
||||
class And(boolop): ...
|
||||
class Or(boolop): ...
|
||||
class operator(AST): ...
|
||||
class Add(operator): ...
|
||||
class BitAnd(operator): ...
|
||||
class BitOr(operator): ...
|
||||
class BitXor(operator): ...
|
||||
class Div(operator): ...
|
||||
class FloorDiv(operator): ...
|
||||
class LShift(operator): ...
|
||||
class Mod(operator): ...
|
||||
class Mult(operator): ...
|
||||
class MatMult(operator): ...
|
||||
class Pow(operator): ...
|
||||
class RShift(operator): ...
|
||||
class Sub(operator): ...
|
||||
class unaryop(AST): ...
|
||||
class Invert(unaryop): ...
|
||||
class Not(unaryop): ...
|
||||
class UAdd(unaryop): ...
|
||||
class USub(unaryop): ...
|
||||
class cmpop(AST): ...
|
||||
class Eq(cmpop): ...
|
||||
class Gt(cmpop): ...
|
||||
class GtE(cmpop): ...
|
||||
class In(cmpop): ...
|
||||
class Is(cmpop): ...
|
||||
class IsNot(cmpop): ...
|
||||
class Lt(cmpop): ...
|
||||
class LtE(cmpop): ...
|
||||
class NotEq(cmpop): ...
|
||||
class NotIn(cmpop): ...
|
||||
|
||||
class comprehension(AST):
|
||||
target: expr
|
||||
iter: expr
|
||||
ifs: list[expr]
|
||||
is_async: int
|
||||
|
||||
class ExceptHandler(AST):
|
||||
type: expr | None
|
||||
name: _Identifier | None
|
||||
body: list[stmt]
|
||||
lineno: int
|
||||
col_offset: int
|
||||
|
||||
class arguments(AST):
|
||||
args: list[arg]
|
||||
vararg: arg | None
|
||||
kwonlyargs: list[arg]
|
||||
kw_defaults: list[expr | None]
|
||||
kwarg: arg | None
|
||||
defaults: list[expr]
|
||||
|
||||
class arg(AST):
|
||||
arg: _Identifier
|
||||
annotation: expr | None
|
||||
lineno: int
|
||||
col_offset: int
|
||||
type_comment: str | None
|
||||
|
||||
class keyword(AST):
|
||||
arg: _Identifier | None
|
||||
value: expr
|
||||
|
||||
class alias(AST):
|
||||
name: _Identifier
|
||||
asname: _Identifier | None
|
||||
|
||||
class withitem(AST):
|
||||
context_expr: expr
|
||||
optional_vars: expr | None
|
||||
|
||||
class TypeIgnore(AST):
|
||||
lineno: int
|
||||
tag: str
|
||||
@@ -1,3 +0,0 @@
|
||||
from . import ast3, ast27
|
||||
|
||||
def py2to3(ast: ast27.AST) -> ast3.AST: ...
|
||||
Reference in New Issue
Block a user