Use variable annotations everywhere (#2909)

This commit is contained in:
Michael Lee
2019-04-13 01:40:52 -07:00
committed by Sebastian Rittau
parent b3c76aab49
commit efb67946f8
458 changed files with 9135 additions and 9135 deletions

View File

@@ -1,5 +1,5 @@
from typing import Any
html_parts = ... # type: Any
html_parts: Any
def __getattr__(name) -> Any: ...

View File

@@ -38,6 +38,6 @@ InvalidIssuer = InvalidIssuerError
# exports them in __init__.py, so we should at least
# make sure that mypy doesn't raise spurious errors
# if they're used.
get_unverified_header = ... # type: Any
PyJWT = ... # type: Any
PyJWS = ... # type: Any
get_unverified_header: Any
PyJWT: Any
PyJWS: Any

View File

@@ -4,7 +4,7 @@ from jwt.algorithms import Algorithm
from . import _HashAlg
class ECAlgorithm(Algorithm):
SHA256 = ... # type: _HashAlg
SHA384 = ... # type: _HashAlg
SHA512 = ... # type: _HashAlg
SHA256: _HashAlg
SHA384: _HashAlg
SHA512: _HashAlg
def __init__(self, hash_alg: _HashAlg) -> None: ...

View File

@@ -4,7 +4,7 @@ from jwt.algorithms import Algorithm
from . import _HashAlg
class RSAAlgorithm(Algorithm):
SHA256 = ... # type: _HashAlg
SHA384 = ... # type: _HashAlg
SHA512 = ... # type: _HashAlg
SHA256: _HashAlg
SHA384: _HashAlg
SHA512: _HashAlg
def __init__(self, hash_alg: _HashAlg) -> None: ...

View File

@@ -40,7 +40,7 @@ _V = TypeVar('_V')
# https://github.com/python/typeshed/issues/17
PY2 = False
PY3 = True
PY34 = ... # type: bool
PY34: bool
string_types = str,
integer_types = int,
@@ -48,7 +48,7 @@ class_types = type,
text_type = str
binary_type = bytes
MAXSIZE = ... # type: int
MAXSIZE: int
# def add_move
# def remove_move

View File

@@ -19,135 +19,135 @@ 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]: ...
PyCF_ONLY_AST = ... # type: int
PyCF_ONLY_AST: int
# ast classes
identifier = str
class AST:
_attributes = ... # type: typing.Tuple[str, ...]
_fields = ... # type: typing.Tuple[str, ...]
_attributes: typing.Tuple[str, ...]
_fields: typing.Tuple[str, ...]
def __init__(self, *args, **kwargs) -> None: ...
class mod(AST):
...
class Module(mod):
body = ... # type: typing.List[stmt]
type_ignores = ... # type: typing.List[TypeIgnore]
body: typing.List[stmt]
type_ignores: typing.List[TypeIgnore]
class Interactive(mod):
body = ... # type: typing.List[stmt]
body: typing.List[stmt]
class Expression(mod):
body = ... # type: expr
body: expr
class FunctionType(mod):
argtypes = ... # type: typing.List[expr]
returns = ... # type: expr
argtypes: typing.List[expr]
returns: expr
class Suite(mod):
body = ... # type: typing.List[stmt]
body: typing.List[stmt]
class stmt(AST):
lineno = ... # type: int
col_offset = ... # type: int
lineno: int
col_offset: int
class FunctionDef(stmt):
name = ... # type: identifier
args = ... # type: arguments
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
type_comment = ... # type: Optional[str]
name: identifier
args: arguments
body: typing.List[stmt]
decorator_list: typing.List[expr]
type_comment: Optional[str]
class ClassDef(stmt):
name = ... # type: identifier
bases = ... # type: typing.List[expr]
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
name: identifier
bases: typing.List[expr]
body: typing.List[stmt]
decorator_list: typing.List[expr]
class Return(stmt):
value = ... # type: Optional[expr]
value: Optional[expr]
class Delete(stmt):
targets = ... # type: typing.List[expr]
targets: typing.List[expr]
class Assign(stmt):
targets = ... # type: typing.List[expr]
value = ... # type: expr
type_comment = ... # type: Optional[str]
targets: typing.List[expr]
value: expr
type_comment: Optional[str]
class AugAssign(stmt):
target = ... # type: expr
op = ... # type: operator
value = ... # type: expr
target: expr
op: operator
value: expr
class Print(stmt):
dest = ... # type: Optional[expr]
values = ... # type: typing.List[expr]
nl = ... # type: bool
dest: Optional[expr]
values: typing.List[expr]
nl: bool
class For(stmt):
target = ... # type: expr
iter = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
type_comment = ... # type: Optional[str]
target: expr
iter: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
type_comment: Optional[str]
class While(stmt):
test = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
test: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class If(stmt):
test = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
test: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class With(stmt):
context_expr = ... # type: expr
optional_vars = ... # type: Optional[expr]
body = ... # type: typing.List[stmt]
type_comment = ... # type: Optional[str]
context_expr: expr
optional_vars: Optional[expr]
body: typing.List[stmt]
type_comment: Optional[str]
class Raise(stmt):
type = ... # type: Optional[expr]
inst = ... # type: Optional[expr]
tback = ... # type: Optional[expr]
type: Optional[expr]
inst: Optional[expr]
tback: Optional[expr]
class TryExcept(stmt):
body = ... # type: typing.List[stmt]
handlers = ... # type: typing.List[ExceptHandler]
orelse = ... # type: typing.List[stmt]
body: typing.List[stmt]
handlers: typing.List[ExceptHandler]
orelse: typing.List[stmt]
class TryFinally(stmt):
body = ... # type: typing.List[stmt]
finalbody = ... # type: typing.List[stmt]
body: typing.List[stmt]
finalbody: typing.List[stmt]
class Assert(stmt):
test = ... # type: expr
msg = ... # type: Optional[expr]
test: expr
msg: Optional[expr]
class Import(stmt):
names = ... # type: typing.List[alias]
names: typing.List[alias]
class ImportFrom(stmt):
module = ... # type: Optional[identifier]
names = ... # type: typing.List[alias]
level = ... # type: Optional[int]
module: Optional[identifier]
names: typing.List[alias]
level: Optional[int]
class Exec(stmt):
body = ... # type: expr
globals = ... # type: Optional[expr]
locals = ... # type: Optional[expr]
body: expr
globals: Optional[expr]
locals: Optional[expr]
class Global(stmt):
names = ... # type: typing.List[identifier]
names: typing.List[identifier]
class Expr(stmt):
value = ... # type: expr
value: expr
class Pass(stmt): ...
class Break(stmt): ...
@@ -160,115 +160,115 @@ class slice(AST):
_slice = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower = ... # type: Optional[expr]
upper = ... # type: Optional[expr]
step = ... # type: Optional[expr]
lower: Optional[expr]
upper: Optional[expr]
step: Optional[expr]
class ExtSlice(slice):
dims = ... # type: typing.List[slice]
dims: typing.List[slice]
class Index(slice):
value = ... # type: expr
value: expr
class Ellipsis(slice): ...
class expr(AST):
lineno = ... # type: int
col_offset = ... # type: int
lineno: int
col_offset: int
class BoolOp(expr):
op = ... # type: boolop
values = ... # type: typing.List[expr]
op: boolop
values: typing.List[expr]
class BinOp(expr):
left = ... # type: expr
op = ... # type: operator
right = ... # type: expr
left: expr
op: operator
right: expr
class UnaryOp(expr):
op = ... # type: unaryop
operand = ... # type: expr
op: unaryop
operand: expr
class Lambda(expr):
args = ... # type: arguments
body = ... # type: expr
args: arguments
body: expr
class IfExp(expr):
test = ... # type: expr
body = ... # type: expr
orelse = ... # type: expr
test: expr
body: expr
orelse: expr
class Dict(expr):
keys = ... # type: typing.List[expr]
values = ... # type: typing.List[expr]
keys: typing.List[expr]
values: typing.List[expr]
class Set(expr):
elts = ... # type: typing.List[expr]
elts: typing.List[expr]
class ListComp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
elt: expr
generators: typing.List[comprehension]
class SetComp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
elt: expr
generators: typing.List[comprehension]
class DictComp(expr):
key = ... # type: expr
value = ... # type: expr
generators = ... # type: typing.List[comprehension]
key: expr
value: expr
generators: typing.List[comprehension]
class GeneratorExp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
elt: expr
generators: typing.List[comprehension]
class Yield(expr):
value = ... # type: Optional[expr]
value: Optional[expr]
class Compare(expr):
left = ... # type: expr
ops = ... # type: typing.List[cmpop]
comparators = ... # type: typing.List[expr]
left: expr
ops: typing.List[cmpop]
comparators: typing.List[expr]
class Call(expr):
func = ... # type: expr
args = ... # type: typing.List[expr]
keywords = ... # type: typing.List[keyword]
starargs = ... # type: Optional[expr]
kwargs = ... # type: Optional[expr]
func: expr
args: typing.List[expr]
keywords: typing.List[keyword]
starargs: Optional[expr]
kwargs: Optional[expr]
class Repr(expr):
value = ... # type: expr
value: expr
class Num(expr):
n = ... # type: Union[int, float, complex]
n: Union[int, float, complex]
class Str(expr):
s = ... # type: bytes
kind = ... # type: str
s: bytes
kind: str
class Attribute(expr):
value = ... # type: expr
attr = ... # type: identifier
ctx = ... # type: expr_context
value: expr
attr: identifier
ctx: expr_context
class Subscript(expr):
value = ... # type: expr
slice = ... # type: _slice
ctx = ... # type: expr_context
value: expr
slice: _slice
ctx: expr_context
class Name(expr):
id = ... # type: identifier
ctx = ... # type: expr_context
id: identifier
ctx: expr_context
class List(expr):
elts = ... # type: typing.List[expr]
ctx = ... # type: expr_context
elts: typing.List[expr]
ctx: expr_context
class Tuple(expr):
elts = ... # type: typing.List[expr]
ctx = ... # type: expr_context
elts: typing.List[expr]
ctx: expr_context
class expr_context(AST):
@@ -328,34 +328,34 @@ class NotIn(cmpop): ...
class comprehension(AST):
target = ... # type: expr
iter = ... # type: expr
ifs = ... # type: typing.List[expr]
target: expr
iter: expr
ifs: typing.List[expr]
class ExceptHandler(AST):
type = ... # type: Optional[expr]
name = ... # type: Optional[expr]
body = ... # type: typing.List[stmt]
lineno = ... # type: int
col_offset = ... # type: int
type: Optional[expr]
name: Optional[expr]
body: typing.List[stmt]
lineno: int
col_offset: int
class arguments(AST):
args = ... # type: typing.List[expr]
vararg = ... # type: Optional[identifier]
kwarg = ... # type: Optional[identifier]
defaults = ... # type: typing.List[expr]
type_comments = ... # type: typing.List[Optional[str]]
args: typing.List[expr]
vararg: Optional[identifier]
kwarg: Optional[identifier]
defaults: typing.List[expr]
type_comments: typing.List[Optional[str]]
class keyword(AST):
arg = ... # type: identifier
value = ... # type: expr
arg: identifier
value: expr
class alias(AST):
name = ... # type: identifier
asname = ... # type: Optional[identifier]
name: identifier
asname: Optional[identifier]
class TypeIgnore(AST):
lineno = ... # type: int
lineno: int

View File

@@ -22,151 +22,151 @@ 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]: ...
PyCF_ONLY_AST = ... # type: int
PyCF_ONLY_AST: int
# ast classes
identifier = str
class AST:
_attributes = ... # type: typing.Tuple[str, ...]
_fields = ... # type: typing.Tuple[str, ...]
_attributes: typing.Tuple[str, ...]
_fields: typing.Tuple[str, ...]
def __init__(self, *args, **kwargs) -> None: ...
class mod(AST):
...
class Module(mod):
body = ... # type: typing.List[stmt]
type_ignores = ... # type: typing.List[TypeIgnore]
body: typing.List[stmt]
type_ignores: typing.List[TypeIgnore]
class Interactive(mod):
body = ... # type: typing.List[stmt]
body: typing.List[stmt]
class Expression(mod):
body = ... # type: expr
body: expr
class FunctionType(mod):
argtypes = ... # type: typing.List[expr]
returns = ... # type: expr
argtypes: typing.List[expr]
returns: expr
class Suite(mod):
body = ... # type: typing.List[stmt]
body: typing.List[stmt]
class stmt(AST):
lineno = ... # type: int
col_offset = ... # type: int
lineno: int
col_offset: int
class FunctionDef(stmt):
name = ... # type: identifier
args = ... # type: arguments
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
returns = ... # type: Optional[expr]
type_comment = ... # type: Optional[str]
name: identifier
args: arguments
body: typing.List[stmt]
decorator_list: typing.List[expr]
returns: Optional[expr]
type_comment: Optional[str]
class AsyncFunctionDef(stmt):
name = ... # type: identifier
args = ... # type: arguments
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
returns = ... # type: Optional[expr]
type_comment = ... # type: Optional[str]
name: identifier
args: arguments
body: typing.List[stmt]
decorator_list: typing.List[expr]
returns: Optional[expr]
type_comment: Optional[str]
class ClassDef(stmt):
name = ... # type: identifier
bases = ... # type: typing.List[expr]
keywords = ... # type: typing.List[keyword]
body = ... # type: typing.List[stmt]
decorator_list = ... # type: typing.List[expr]
name: identifier
bases: typing.List[expr]
keywords: typing.List[keyword]
body: typing.List[stmt]
decorator_list: typing.List[expr]
class Return(stmt):
value = ... # type: Optional[expr]
value: Optional[expr]
class Delete(stmt):
targets = ... # type: typing.List[expr]
targets: typing.List[expr]
class Assign(stmt):
targets = ... # type: typing.List[expr]
value = ... # type: expr
type_comment = ... # type: Optional[str]
targets: typing.List[expr]
value: expr
type_comment: Optional[str]
class AugAssign(stmt):
target = ... # type: expr
op = ... # type: operator
value = ... # type: expr
target: expr
op: operator
value: expr
class AnnAssign(stmt):
target = ... # type: expr
annotation = ... # type: expr
value = ... # type: Optional[expr]
simple = ... # type: int
target: expr
annotation: expr
value: Optional[expr]
simple: int
class For(stmt):
target = ... # type: expr
iter = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
type_comment = ... # type: Optional[str]
target: expr
iter: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
type_comment: Optional[str]
class AsyncFor(stmt):
target = ... # type: expr
iter = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
type_comment = ... # type: Optional[str]
target: expr
iter: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
type_comment: Optional[str]
class While(stmt):
test = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
test: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class If(stmt):
test = ... # type: expr
body = ... # type: typing.List[stmt]
orelse = ... # type: typing.List[stmt]
test: expr
body: typing.List[stmt]
orelse: typing.List[stmt]
class With(stmt):
items = ... # type: typing.List[withitem]
body = ... # type: typing.List[stmt]
type_comment = ... # type: Optional[str]
items: typing.List[withitem]
body: typing.List[stmt]
type_comment: Optional[str]
class AsyncWith(stmt):
items = ... # type: typing.List[withitem]
body = ... # type: typing.List[stmt]
type_comment = ... # type: Optional[str]
items: typing.List[withitem]
body: typing.List[stmt]
type_comment: Optional[str]
class Raise(stmt):
exc = ... # type: Optional[expr]
cause = ... # type: Optional[expr]
exc: Optional[expr]
cause: Optional[expr]
class Try(stmt):
body = ... # type: typing.List[stmt]
handlers = ... # type: typing.List[ExceptHandler]
orelse = ... # type: typing.List[stmt]
finalbody = ... # type: typing.List[stmt]
body: typing.List[stmt]
handlers: typing.List[ExceptHandler]
orelse: typing.List[stmt]
finalbody: typing.List[stmt]
class Assert(stmt):
test = ... # type: expr
msg = ... # type: Optional[expr]
test: expr
msg: Optional[expr]
class Import(stmt):
names = ... # type: typing.List[alias]
names: typing.List[alias]
class ImportFrom(stmt):
module = ... # type: Optional[identifier]
names = ... # type: typing.List[alias]
level = ... # type: Optional[int]
module: Optional[identifier]
names: typing.List[alias]
level: Optional[int]
class Global(stmt):
names = ... # type: typing.List[identifier]
names: typing.List[identifier]
class Nonlocal(stmt):
names = ... # type: typing.List[identifier]
names: typing.List[identifier]
class Expr(stmt):
value = ... # type: expr
value: expr
class Pass(stmt): ...
class Break(stmt): ...
@@ -179,134 +179,134 @@ class slice(AST):
_slice = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower = ... # type: Optional[expr]
upper = ... # type: Optional[expr]
step = ... # type: Optional[expr]
lower: Optional[expr]
upper: Optional[expr]
step: Optional[expr]
class ExtSlice(slice):
dims = ... # type: typing.List[slice]
dims: typing.List[slice]
class Index(slice):
value = ... # type: expr
value: expr
class expr(AST):
lineno = ... # type: int
col_offset = ... # type: int
lineno: int
col_offset: int
class BoolOp(expr):
op = ... # type: boolop
values = ... # type: typing.List[expr]
op: boolop
values: typing.List[expr]
class BinOp(expr):
left = ... # type: expr
op = ... # type: operator
right = ... # type: expr
left: expr
op: operator
right: expr
class UnaryOp(expr):
op = ... # type: unaryop
operand = ... # type: expr
op: unaryop
operand: expr
class Lambda(expr):
args = ... # type: arguments
body = ... # type: expr
args: arguments
body: expr
class IfExp(expr):
test = ... # type: expr
body = ... # type: expr
orelse = ... # type: expr
test: expr
body: expr
orelse: expr
class Dict(expr):
keys = ... # type: typing.List[expr]
values = ... # type: typing.List[expr]
keys: typing.List[expr]
values: typing.List[expr]
class Set(expr):
elts = ... # type: typing.List[expr]
elts: typing.List[expr]
class ListComp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
elt: expr
generators: typing.List[comprehension]
class SetComp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
elt: expr
generators: typing.List[comprehension]
class DictComp(expr):
key = ... # type: expr
value = ... # type: expr
generators = ... # type: typing.List[comprehension]
key: expr
value: expr
generators: typing.List[comprehension]
class GeneratorExp(expr):
elt = ... # type: expr
generators = ... # type: typing.List[comprehension]
elt: expr
generators: typing.List[comprehension]
class Await(expr):
value = ... # type: expr
value: expr
class Yield(expr):
value = ... # type: Optional[expr]
value: Optional[expr]
class YieldFrom(expr):
value = ... # type: expr
value: expr
class Compare(expr):
left = ... # type: expr
ops = ... # type: typing.List[cmpop]
comparators = ... # type: typing.List[expr]
left: expr
ops: typing.List[cmpop]
comparators: typing.List[expr]
class Call(expr):
func = ... # type: expr
args = ... # type: typing.List[expr]
keywords = ... # type: typing.List[keyword]
func: expr
args: typing.List[expr]
keywords: typing.List[keyword]
class Num(expr):
n = ... # type: Union[float, int, complex]
n: Union[float, int, complex]
class Str(expr):
s = ... # type: str
kind = ... # type: str
s: str
kind: str
class FormattedValue(expr):
value = ... # type: expr
conversion = ... # type: typing.Optional[int]
format_spec = ... # type: typing.Optional[expr]
value: expr
conversion: typing.Optional[int]
format_spec: typing.Optional[expr]
class JoinedStr(expr):
values = ... # type: typing.List[expr]
values: typing.List[expr]
class Bytes(expr):
s = ... # type: bytes
s: bytes
class NameConstant(expr):
value = ... # type: Any
value: Any
class Ellipsis(expr): ...
class Attribute(expr):
value = ... # type: expr
attr = ... # type: identifier
ctx = ... # type: expr_context
value: expr
attr: identifier
ctx: expr_context
class Subscript(expr):
value = ... # type: expr
slice = ... # type: _slice
ctx = ... # type: expr_context
value: expr
slice: _slice
ctx: expr_context
class Starred(expr):
value = ... # type: expr
ctx = ... # type: expr_context
value: expr
ctx: expr_context
class Name(expr):
id = ... # type: identifier
ctx = ... # type: expr_context
id: identifier
ctx: expr_context
class List(expr):
elts = ... # type: typing.List[expr]
ctx = ... # type: expr_context
elts: typing.List[expr]
ctx: expr_context
class Tuple(expr):
elts = ... # type: typing.List[expr]
ctx = ... # type: expr_context
elts: typing.List[expr]
ctx: expr_context
class expr_context(AST):
@@ -367,47 +367,47 @@ class NotIn(cmpop): ...
class comprehension(AST):
target = ... # type: expr
iter = ... # type: expr
ifs = ... # type: typing.List[expr]
is_async = ... # type: int
target: expr
iter: expr
ifs: typing.List[expr]
is_async: int
class ExceptHandler(AST):
type = ... # type: Optional[expr]
name = ... # type: Optional[identifier]
body = ... # type: typing.List[stmt]
lineno = ... # type: int
col_offset = ... # type: int
type: Optional[expr]
name: Optional[identifier]
body: typing.List[stmt]
lineno: int
col_offset: int
class arguments(AST):
args = ... # type: typing.List[arg]
vararg = ... # type: Optional[arg]
kwonlyargs = ... # type: typing.List[arg]
kw_defaults = ... # type: typing.List[expr]
kwarg = ... # type: Optional[arg]
defaults = ... # type: typing.List[expr]
args: typing.List[arg]
vararg: Optional[arg]
kwonlyargs: typing.List[arg]
kw_defaults: typing.List[expr]
kwarg: Optional[arg]
defaults: typing.List[expr]
class arg(AST):
arg = ... # type: identifier
annotation = ... # type: Optional[expr]
lineno = ... # type: int
col_offset = ... # type: int
type_comment = ... # type: typing.Optional[str]
arg: identifier
annotation: Optional[expr]
lineno: int
col_offset: int
type_comment: typing.Optional[str]
class keyword(AST):
arg = ... # type: Optional[identifier]
value = ... # type: expr
arg: Optional[identifier]
value: expr
class alias(AST):
name = ... # type: identifier
asname = ... # type: Optional[identifier]
name: identifier
asname: Optional[identifier]
class withitem(AST):
context_expr = ... # type: expr
optional_vars = ... # type: Optional[expr]
context_expr: expr
optional_vars: Optional[expr]
class TypeIgnore(AST):
lineno = ... # type: int
lineno: int