Fix third_party errors with --disallow-any-generics (#3278)

Part of #3267. Together with #3276 this should fix all such problems.
This commit is contained in:
Sebastian Rittau
2019-09-30 13:14:01 +02:00
committed by Jelle Zijlstra
parent 412b9e74d5
commit ed4b1de0ad
51 changed files with 244 additions and 263 deletions

View File

@@ -35,7 +35,7 @@ class FlagValues:
def is_gnu_getopt(self) -> bool: ...
IsGnuGetOpt = is_gnu_getopt
# TODO dict type
def FlagDict(self) -> dict: ...
def FlagDict(self) -> Dict[Any, Any]: ...
def flags_by_module_dict(self) -> Dict[str, List[Flag]]: ...
FlagsByModuleDict = flags_by_module_dict
def flags_by_module_id_dict(self) -> Dict[int, List[Flag]]: ...
@@ -206,7 +206,7 @@ def DEFINE_enum(name: str, default: Optional[str], enum_values: List[str], help:
class BaseListParser(ArgumentParser):
def __init__(self, token: str = ..., name: str = ...) -> None: ...
def Parse(self, argument: Any) -> list: ...
def Parse(self, argument: Any) -> List[Any]: ...
class ListParser(BaseListParser):
def __init__(self) -> None: ...

View File

@@ -1,16 +1,16 @@
from typing import Any
from typing import Any, Dict
from tornado.util import ObjectDict
from collections import namedtuple
class SSLError(Exception): ...
class _NormalizedHeaderCache(dict):
class _NormalizedHeaderCache(Dict[Any, Any]):
size: Any
queue: Any
def __init__(self, size) -> None: ...
def __missing__(self, key): ...
class HTTPHeaders(dict):
class HTTPHeaders(Dict[Any, Any]):
def __init__(self, *args, **kwargs) -> None: ...
def add(self, name, value): ...
def get_list(self, name): ...

View File

@@ -43,12 +43,9 @@ class AsyncHTTPSTestCase(AsyncHTTPTestCase):
def get_protocol(self): ...
@overload
def gen_test(*, timeout: Optional[float] = ...) -> Callable[[Callable[..., Generator]], Callable[..., None]]:
...
def gen_test(*, timeout: Optional[float] = ...) -> Callable[[Callable[..., Generator[Any, Any, Any]]], Callable[..., None]]: ...
@overload
def gen_test(func: Callable[..., Generator]) -> Callable[..., None]:
...
def gen_test(func: Callable[..., Generator[Any, Any, Any]]) -> Callable[..., None]: ...
class LogTrapTestCase(unittest.TestCase):
def run(self, result: Optional[Any] = ...): ...

View File

@@ -1,8 +1,8 @@
from typing import Any
from typing import Any, Dict
xrange: Any
class ObjectDict(dict):
class ObjectDict(Dict[Any, Any]):
def __getattr__(self, name): ...
def __setattr__(self, name, value): ...

View File

@@ -1,13 +1,15 @@
from typing import AnyStr, Callable, ContextManager, IO, Optional, Text, Type
from typing import Any, AnyStr, Callable, ContextManager, Generic, IO, Optional, Text, Type, Union
def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ...
def move_atomic(src: AnyStr, dst: AnyStr) -> None: ...
class AtomicWriter(object):
def __init__(self, path: AnyStr, mode: Text = ..., overwrite: bool = ...) -> None: ...
def open(self) -> ContextManager[IO]: ...
def _open(self, get_fileobject: Callable) -> ContextManager[IO]: ...
def get_fileobject(self, dir: Optional[AnyStr] = ..., **kwargs) -> IO: ...
def sync(self, f: IO) -> None: ...
def commit(self, f: IO) -> None: ...
def rollback(self, f: IO) -> None: ...
def atomic_write(path: AnyStr, writer_cls: Type[AtomicWriter] = ..., **cls_kwargs: object) -> ContextManager[IO]: ...
def __init__(self, path: Union[Text, bytes], mode: Text = ..., overwrite: bool = ...) -> None: ...
def open(self) -> ContextManager[IO[Any]]: ...
def _open(self, get_fileobject: Callable[..., IO[AnyStr]]) -> ContextManager[IO[AnyStr]]: ...
def get_fileobject(self, dir: Union[None, Text, bytes] = ..., **kwargs: Any) -> IO[Any]: ...
def sync(self, f: IO[Any]) -> None: ...
def commit(self, f: IO[Any]) -> None: ...
def rollback(self, f: IO[Any]) -> None: ...
def atomic_write(
path: Union[Text, bytes], writer_cls: Type[AtomicWriter] = ..., **cls_kwargs: object,
) -> ContextManager[IO[Any]]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, List, Optional
class CORSRule:
allowed_method: Any
@@ -12,7 +12,7 @@ class CORSRule:
def endElement(self, name, value, connection): ...
def to_xml(self) -> str: ...
class CORSConfiguration(list):
class CORSConfiguration(List[CORSRule]):
def startElement(self, name, attrs, connection): ...
def endElement(self, name, value, connection): ...
def to_xml(self) -> str: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, List, Optional
class Rule:
id: Any
@@ -26,7 +26,7 @@ class Transition:
def __init__(self, days: Optional[Any] = ..., date: Optional[Any] = ..., storage_class: Optional[Any] = ...) -> None: ...
def to_xml(self): ...
class Transitions(list):
class Transitions(List[Transition]):
transition_properties: int
current_transition_property: int
temp_days: Any
@@ -44,7 +44,7 @@ class Transitions(list):
@property
def storage_class(self): ...
class Lifecycle(list):
class Lifecycle(List[Rule]):
def startElement(self, name, attrs, connection): ...
def endElement(self, name, value, connection): ...
def to_xml(self): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, List, Optional
class Tag:
key: Any
@@ -9,13 +9,13 @@ class Tag:
def to_xml(self): ...
def __eq__(self, other): ...
class TagSet(list):
class TagSet(List[Tag]):
def startElement(self, name, attrs, connection): ...
def endElement(self, name, value, connection): ...
def add_tag(self, key, value): ...
def to_xml(self): ...
class Tags(list):
class Tags(List[TagSet]):
def startElement(self, name, attrs, connection): ...
def endElement(self, name, value, connection): ...
def to_xml(self): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, List, Optional
def tag(key, value): ...
@@ -27,8 +27,8 @@ class RedirectLocation(_XMLKeyValue):
def __init__(self, hostname: Optional[Any] = ..., protocol: Optional[Any] = ...) -> None: ...
def to_xml(self): ...
class RoutingRules(list):
def add_rule(self, rule): ...
class RoutingRules(List[RoutingRule]):
def add_rule(self, rule: RoutingRule) -> RoutingRules: ...
def startElement(self, name, attrs, connection): ...
def endElement(self, name, value, connection): ...
def to_xml(self): ...

View File

@@ -91,7 +91,7 @@ def get_instance_metadata(
data: str = ...,
timeout: Optional[int] = ...,
num_retries: int = ...,
) -> Optional[LazyLoadMetadata]: ...
) -> Optional[LazyLoadMetadata[Any, Any]]: ...
def get_instance_identity(
version: str = ...,
url: str = ...,
@@ -138,7 +138,7 @@ class ShellCommand:
cwd: Optional[subprocess._TXT] = ...,
) -> None: ...
process: subprocess.Popen
process: subprocess.Popen[Any]
def run(self, cwd: Optional[subprocess._CMD] = ...) -> Optional[int]: ...
def setReadOnly(self, value) -> None: ...
@@ -204,7 +204,7 @@ def notify(
append_instance_id: bool = ...,
) -> None: ...
def get_utf8_value(value: str) -> bytes: ...
def mklist(value: Any) -> List: ...
def mklist(value: Any) -> List[Any]: ...
def pythonize_name(name: str) -> str: ...
def write_mime_multipart(
content: List[Tuple[str, str]],

View File

@@ -1,4 +1,4 @@
from typing import Sequence, Callable, Union, Any, Optional, AnyStr, TypeVar, Type
from typing import Sequence, Callable, Union, Any, Optional, AnyStr, TypeVar, Type, Dict
def with_repr(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ...
def with_cmp(attrs: Sequence[Union[AnyStr, Attribute]]) -> Callable[..., Any]: ...
@@ -18,7 +18,7 @@ def attributes(
apply_with_repr: bool = ...,
apply_immutable: bool = ...,
store_attributes: Optional[Callable[[type, Attribute], Any]] = ...,
**kw: Optional[dict]) -> Callable[[Type[_T]], Type[_T]]: ...
**kw: Optional[Dict[Any, Any]]) -> Callable[[Type[_T]], Type[_T]]: ...
class Attribute:
def __init__(

View File

@@ -19,6 +19,8 @@ from typing import (
from click.formatting import HelpFormatter
from click.parser import OptionParser
_CC = TypeVar("_CC", bound=Callable[[], Any])
def invoke_param_callback(
callback: Callable[[Context, Parameter, Optional[str]], Any],
ctx: Context,
@@ -45,7 +47,7 @@ class Context:
parent: Optional[Context]
command: Command
info_name: Optional[str]
params: Dict
params: Dict[Any, Any]
args: List[str]
protected_args: List[str]
obj: Any
@@ -62,7 +64,7 @@ class Context:
auto_envvar_prefix: Optional[str]
color: Optional[bool]
_meta: Dict[str, Any]
_close_callbacks: List
_close_callbacks: List[Any]
_depth: int
def __init__(
@@ -99,8 +101,7 @@ class Context:
def make_formatter(self) -> HelpFormatter:
...
def call_on_close(self, f: Callable) -> Callable:
...
def call_on_close(self, f: _CC) -> _CC: ...
def close(self) -> None:
...
@@ -132,25 +133,16 @@ class Context:
def get_help(self) -> str:
...
def invoke(
self, callback: Union[Command, Callable], *args, **kwargs
) -> Any:
...
def forward(
self, callback: Union[Command, Callable], *args, **kwargs
) -> Any:
...
def invoke(self, callback: Union[Command, Callable[..., Any]], *args, **kwargs) -> Any: ...
def forward(self, callback: Union[Command, Callable[..., Any]], *args, **kwargs) -> Any: ...
class BaseCommand:
allow_extra_args: bool
allow_interspersed_args: bool
ignore_unknown_options: bool
name: str
context_settings: Dict
def __init__(self, name: str, context_settings: Optional[Dict] = ...) -> None:
...
context_settings: Dict[Any, Any]
def __init__(self, name: str, context_settings: Optional[Dict[Any, Any]] = ...) -> None: ...
def get_usage(self, ctx: Context) -> str:
...
@@ -184,7 +176,7 @@ class BaseCommand:
class Command(BaseCommand):
callback: Optional[Callable]
callback: Optional[Callable[..., Any]]
params: List[Parameter]
help: Optional[str]
epilog: Optional[str]
@@ -197,8 +189,8 @@ class Command(BaseCommand):
def __init__(
self,
name: str,
context_settings: Optional[Dict] = ...,
callback: Optional[Callable] = ...,
context_settings: Optional[Dict[Any, Any]] = ...,
callback: Optional[Callable[..., Any]] = ...,
params: Optional[List[Parameter]] = ...,
help: Optional[str] = ...,
epilog: Optional[str] = ...,
@@ -257,7 +249,7 @@ class MultiCommand(Command):
invoke_without_command: bool
subcommand_metavar: str
chain: bool
result_callback: Callable
result_callback: Callable[..., Any]
def __init__(
self,
@@ -266,7 +258,7 @@ class MultiCommand(Command):
no_args_is_help: Optional[bool] = ...,
subcommand_metavar: Optional[str] = ...,
chain: bool = ...,
result_callback: Optional[Callable] = ...,
result_callback: Optional[Callable[..., Any]] = ...,
**attrs
) -> None:
...
@@ -302,11 +294,8 @@ class Group(MultiCommand):
def add_command(self, cmd: Command, name: Optional[str] = ...):
...
def command(self, *args, **kwargs) -> Callable[[Callable], Command]:
...
def group(self, *args, **kwargs) -> Callable[[Callable], Group]:
...
def command(self, *args, **kwargs) -> Callable[[Callable[..., Any]], Command]: ...
def group(self, *args, **kwargs) -> Callable[[Callable[..., Any]], Group]: ...
class CommandCollection(MultiCommand):

View File

@@ -35,7 +35,7 @@ def command(
name: Optional[str] = ...,
cls: Optional[Type[Command]] = ...,
# Command
context_settings: Optional[Dict] = ...,
context_settings: Optional[Dict[Any, Any]] = ...,
help: Optional[str] = ...,
epilog: Optional[str] = ...,
short_help: Optional[str] = ...,
@@ -43,9 +43,7 @@ def command(
add_help_option: bool = ...,
hidden: bool = ...,
deprecated: bool = ...,
) -> Callable[[Callable], Command]:
...
) -> Callable[[Callable[..., Any]], Command]: ...
# This inherits attrs from Group, MultiCommand and Command.
@@ -59,7 +57,7 @@ def group(
no_args_is_help: Optional[bool] = ...,
subcommand_metavar: Optional[str] = ...,
chain: bool = ...,
result_callback: Optional[Callable] = ...,
result_callback: Optional[Callable[..., Any]] = ...,
# Command
help: Optional[str] = ...,
epilog: Optional[str] = ...,
@@ -70,9 +68,7 @@ def group(
deprecated: bool = ...,
# User-defined
**kwargs: Any,
) -> Callable[[Callable], Group]:
...
) -> Callable[[Callable[..., Any]], Group]: ...
def argument(
*param_decls: str,

View File

@@ -20,11 +20,8 @@ class ClickException(Exception):
class UsageError(ClickException):
ctx: Optional[Context]
def __init__(self, message: str, ctx: Optional[Context] = ...) -> None:
...
def show(self, file: Optional[IO] = ...) -> None:
...
def __init__(self, message: str, ctx: Optional[Context] = ...) -> None: ...
def show(self, file: Optional[IO[Any]] = ...) -> None: ...
class BadParameter(UsageError):

View File

@@ -84,7 +84,7 @@ def progressbar(
bar_template: str = ...,
info_sep: str = ...,
width: int = ...,
file: Optional[IO] = ...,
file: Optional[IO[Any]] = ...,
color: Optional[bool] = ...,
) -> _ProgressBar[_T]:
...
@@ -103,7 +103,7 @@ def progressbar(
bar_template: str = ...,
info_sep: str = ...,
width: int = ...,
file: Optional[IO] = ...,
file: Optional[IO[Any]] = ...,
color: Optional[bool] = ...,
) -> _ProgressBar[int]:
...
@@ -133,7 +133,7 @@ def unstyle(text: Text) -> str:
# Styling options copied from style() for nicer type checking.
def secho(
message: Optional[str] = ...,
file: Optional[IO] = ...,
file: Optional[IO[Any]] = ...,
nl: bool = ...,
err: bool = ...,
color: Optional[bool] = ...,

View File

@@ -13,7 +13,7 @@ class EchoingStdin:
def readlines(self) -> List[bytes]: ...
def __iter__(self) -> Iterable[bytes]: ...
def make_input_stream(input: Optional[Union[bytes, Text, IO]], charset: Text) -> BinaryIO: ...
def make_input_stream(input: Optional[Union[bytes, Text, IO[Any]]], charset: Text) -> BinaryIO: ...
class Result:
runner: CliRunner
@@ -56,7 +56,7 @@ class CliRunner:
def make_env(self, overrides: Optional[Mapping[str, str]] = ...) -> Dict[str, str]: ...
def isolation(
self,
input: Optional[Union[bytes, Text, IO]] = ...,
input: Optional[Union[bytes, Text, IO[Any]]] = ...,
env: Optional[Mapping[str, str]] = ...,
color: bool = ...,
) -> ContextManager[BinaryIO]: ...
@@ -64,7 +64,7 @@ class CliRunner:
self,
cli: BaseCommand,
args: Optional[Union[str, Iterable[str]]] = ...,
input: Optional[Union[bytes, Text, IO]] = ...,
input: Optional[Union[bytes, Text, IO[Any]]] = ...,
env: Optional[Mapping[str, str]] = ...,
catch_exceptions: bool = ...,
color: bool = ...,

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, IO, Iterable, List, Optional, TypeVar, Union, Tuple as _PyTuple, Type
from typing import Any, Callable, Generic, IO, Iterable, List, Optional, TypeVar, Union, Tuple as _PyTuple, Type
import datetime
import uuid
@@ -79,7 +79,6 @@ class FloatRange(FloatParamType):
) -> None:
...
class File(ParamType):
def __init__(
self,
@@ -88,38 +87,19 @@ class File(ParamType):
errors: Optional[str] = ...,
lazy: Optional[bool] = ...,
atomic: Optional[bool] = ...,
) -> None:
...
def __call__(
self,
value: Optional[str],
param: Optional[Parameter] = ...,
ctx: Optional[Context] = ...,
) -> IO:
...
def convert(
self,
value: str,
param: Optional[Parameter],
ctx: Optional[Context],
) -> IO:
...
def resolve_lazy_flag(self, value: str) -> bool:
...
) -> None: ...
def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> IO[Any]: ...
def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> IO[Any]: ...
def resolve_lazy_flag(self, value: str) -> bool: ...
_F = TypeVar('_F') # result of the function
_Func = Callable[[Optional[str]], _F]
class FuncParamType(ParamType):
func: _Func
class FuncParamType(ParamType, Generic[_F]):
func: _Func[_F]
def __init__(self, func: _Func) -> None:
...
def __init__(self, func: _Func[_F]) -> None: ...
def __call__(
self,

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Iterator, IO, List, Optional, TypeVar, Union, Text
from typing import Any, AnyStr, Callable, Generic, Iterator, IO, List, Optional, TypeVar, Union, Text
_T = TypeVar('_T')
@@ -19,7 +19,7 @@ def make_default_short_help(help: str, max_length: int = ...):
...
class LazyFile:
class LazyFile(object):
name: str
mode: str
encoding: Optional[str]
@@ -33,47 +33,24 @@ class LazyFile:
encoding: Optional[str] = ...,
errors: str = ...,
atomic: bool = ...
) -> None:
...
def open(self) -> IO:
...
def close(self) -> None:
...
def close_intelligently(self) -> None:
...
def __enter__(self) -> LazyFile:
...
def __exit__(self, exc_type, exc_value, tb):
...
def __iter__(self) -> Iterator:
...
class KeepOpenFile:
_file: IO
def __init__(self, file: IO) -> None:
...
def __enter__(self) -> KeepOpenFile:
...
def __exit__(self, exc_type, exc_value, tb):
...
def __iter__(self) -> Iterator:
...
) -> None: ...
def open(self) -> IO[Any]: ...
def close(self) -> None: ...
def close_intelligently(self) -> None: ...
def __enter__(self) -> LazyFile: ...
def __exit__(self, exc_type, exc_value, tb): ...
def __iter__(self) -> Iterator[Any]: ...
class KeepOpenFile(Generic[AnyStr]):
_file: IO[AnyStr]
def __init__(self, file: IO[AnyStr]) -> None: ...
def __enter__(self) -> KeepOpenFile[AnyStr]: ...
def __exit__(self, exc_type, exc_value, tb): ...
def __iter__(self) -> Iterator[AnyStr]: ...
def echo(
message: object = ...,
file: Optional[IO] = ...,
file: Optional[IO[Text]] = ...,
nl: bool = ...,
err: bool = ...,
color: Optional[bool] = ...,
@@ -90,7 +67,6 @@ def get_text_stream(
) -> IO[str]:
...
def open_file(
filename: str,
mode: str = ...,
@@ -98,14 +74,10 @@ def open_file(
errors: str = ...,
lazy: bool = ...,
atomic: bool = ...
) -> Union[IO, LazyFile, KeepOpenFile]:
...
) -> Any: ... # really Union[IO, LazyFile, KeepOpenFile]
def get_os_args() -> List[str]:
...
def format_filename(filename: str, shorten: bool = ...) -> str:
...

View File

@@ -1,4 +1,4 @@
from typing import Tuple, Pattern, List, Dict, Union
from typing import Tuple, Pattern, List, Dict, Union, Text
_DEFAULT_DELIMITER: str
@@ -13,6 +13,6 @@ def demojize(
delimiters: Tuple[str, str] = ...
) -> str: ...
def get_emoji_regexp() -> Pattern: ...
def get_emoji_regexp() -> Pattern[Text]: ...
def emoji_lis(string: str) -> List[Dict[str, Union[int, str]]]: ...

View File

@@ -6,7 +6,7 @@ from abc import ABCMeta
from typing import Any, MutableMapping, Optional
from werkzeug.datastructures import CallbackDict
class SessionMixin(MutableMapping, metaclass=ABCMeta):
class SessionMixin(MutableMapping[str, Any], metaclass=ABCMeta):
@property
def permanent(self): ...
@permanent.setter
@@ -15,7 +15,7 @@ class SessionMixin(MutableMapping, metaclass=ABCMeta):
modified: bool = ...
accessed: bool = ...
class SecureCookieSession(CallbackDict, SessionMixin):
class SecureCookieSession(CallbackDict[str, Any], SessionMixin):
modified: bool = ...
accessed: bool = ...
def __init__(self, initial: Optional[Any] = ...) -> None: ...

View File

@@ -29,7 +29,7 @@ class FlaskCliRunner(CliRunner):
self,
cli: Optional[BaseCommand] = ...,
args: Optional[Union[str, Iterable[str]]] = ...,
input: Optional[Union[bytes, IO, Text]] = ...,
input: Optional[Union[bytes, IO[Any], Text]] = ...,
env: Optional[Mapping[str, str]] = ...,
catch_exceptions: bool = ...,
color: bool = ...,

View File

@@ -39,20 +39,20 @@ class NoneAlgorithm(SigningAlgorithm):
def get_signature(self, key: bytes, value: bytes) -> bytes: ...
class HMACAlgorithm(SigningAlgorithm):
default_digest_method: Callable
digest_method: Callable
def __init__(self, digest_method: Optional[Callable] = ...) -> None: ...
default_digest_method: Callable[..., Any]
digest_method: Callable[..., Any]
def __init__(self, digest_method: Optional[Callable[..., Any]] = ...) -> None: ...
def get_signature(self, key: bytes, value: bytes) -> bytes: ...
class Signer(object):
default_digest_method: Callable = ...
default_digest_method: Callable[..., Any] = ...
default_key_derivation: str = ...
secret_key: bytes
sep: bytes
salt: Union[Text, bytes]
key_derivation: str
digest_method: Callable
digest_method: Callable[..., Any]
algorithm: SigningAlgorithm
def __init__(self,
@@ -60,7 +60,7 @@ class Signer(object):
salt: Optional[Union[Text, bytes]] = ...,
sep: Optional[Union[Text, bytes]] = ...,
key_derivation: Optional[str] = ...,
digest_method: Optional[Callable] = ...,
digest_method: Optional[Callable[..., Any]] = ...,
algorithm: Optional[SigningAlgorithm] = ...) -> None: ...
def derive_key(self) -> bytes: ...
def get_signature(self, value: Union[Text, bytes]) -> bytes: ...

View File

@@ -36,7 +36,7 @@ class Environment:
keep_trailing_newline: bool
undefined: Type[Undefined]
optimized: bool
finalize: Callable
finalize: Callable[..., Any]
autoescape: Any
filters: Any
tests: Any
@@ -45,11 +45,56 @@ class Environment:
cache: Any
bytecode_cache: BytecodeCache
auto_reload: bool
extensions: List
def __init__(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., newline_sequence: Text = ..., keep_trailing_newline: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Optional[Callable] = ..., autoescape: Union[bool, Callable[[str], bool]] = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ..., enable_async: bool = ...) -> None: ...
extensions: List[Any]
def __init__(
self,
block_start_string: Text = ...,
block_end_string: Text = ...,
variable_start_string: Text = ...,
variable_end_string: Text = ...,
comment_start_string: Any = ...,
comment_end_string: Text = ...,
line_statement_prefix: Text = ...,
line_comment_prefix: Text = ...,
trim_blocks: bool = ...,
lstrip_blocks: bool = ...,
newline_sequence: Text = ...,
keep_trailing_newline: bool = ...,
extensions: List[Any] = ...,
optimized: bool = ...,
undefined: Type[Undefined] = ...,
finalize: Optional[Callable[..., Any]] = ...,
autoescape: Union[bool, Callable[[str], bool]] = ...,
loader: Optional[BaseLoader] = ...,
cache_size: int = ...,
auto_reload: bool = ...,
bytecode_cache: Optional[BytecodeCache] = ...,
enable_async: bool = ...,
) -> None: ...
def add_extension(self, extension): ...
def extend(self, **attributes): ...
def overlay(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., extensions: List = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Callable = ..., autoescape: bool = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ...): ...
def overlay(
self,
block_start_string: Text = ...,
block_end_string: Text = ...,
variable_start_string: Text = ...,
variable_end_string: Text = ...,
comment_start_string: Any = ...,
comment_end_string: Text = ...,
line_statement_prefix: Text = ...,
line_comment_prefix: Text = ...,
trim_blocks: bool = ...,
lstrip_blocks: bool = ...,
extensions: List[Any] = ...,
optimized: bool = ...,
undefined: Type[Undefined] = ...,
finalize: Callable[..., Any] = ...,
autoescape: bool = ...,
loader: Optional[BaseLoader] = ...,
cache_size: int = ...,
auto_reload: bool = ...,
bytecode_cache: Optional[BytecodeCache] = ...,
): ...
lexer: Any
def iter_extensions(self): ...
def getitem(self, obj, argument): ...
@@ -75,8 +120,7 @@ class Environment:
# from InternationalizationExtension:
def install_gettext_translations(self, translations: Any, newstyle: Optional[bool]): ...
def install_null_translations(self, newstyle: Optional[bool]): ...
def install_gettext_callables(self, gettext: Callable, ngettext: Callable,
newstyle: Optional[bool]): ...
def install_gettext_callables(self, gettext: Callable[..., Any], ngettext: Callable[..., Any], newstyle: Optional[bool]): ...
def uninstall_gettext_translations(self, translations: Any): ...
def extract_translations(self, source: Any, gettext_functions: Any): ...
newstyle_gettext: bool

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, NamedTuple, Optional
def contextfilter(f): ...
def evalcontextfilter(f): ...
@@ -37,10 +37,7 @@ def do_batch(value, linecount, fill_with: Optional[Any] = ...): ...
def do_round(value, precision: int = ..., method: str = ...): ...
def do_groupby(environment, value, attribute): ...
class _GroupTuple(tuple):
grouper: Any
list: Any
def __new__(cls, xxx_todo_changeme): ...
_GroupTuple = NamedTuple("_GroupTuple", [("grouper", Any), ("list", Any)])
def do_sum(environment, iterable, attribute: Optional[Any] = ..., start: int = ...): ...
def do_list(value): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Optional
from typing import Any, Optional, Tuple
whitespace_re: Any
string_re: Any
@@ -72,7 +72,7 @@ class Failure:
def __init__(self, message, cls: Any = ...) -> None: ...
def __call__(self, lineno, filename): ...
class Token(tuple):
class Token(Tuple[int, Any, Any]):
lineno: Any
type: Any
value: Any

View File

@@ -16,7 +16,7 @@ class FileSystemLoader(BaseLoader):
encoding: Any
followlinks: Any
def __init__(self, searchpath: Union[Text, Iterable[Text]], encoding: Text = ..., followlinks: bool = ...) -> None: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable]: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
def list_templates(self): ...
class PackageLoader(BaseLoader):
@@ -26,33 +26,35 @@ class PackageLoader(BaseLoader):
provider: Any
package_path: Any
def __init__(self, package_name: Text, package_path: Text = ..., encoding: Text = ...) -> None: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable]: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
def list_templates(self): ...
class DictLoader(BaseLoader):
mapping: Any
def __init__(self, mapping) -> None: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable]: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
def list_templates(self): ...
class FunctionLoader(BaseLoader):
load_func: Any
def __init__(self, load_func) -> None: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Optional[Text], Optional[Callable]]: ...
def get_source(
self, environment: Environment, template: Text,
) -> Tuple[Text, Optional[Text], Optional[Callable[..., Any]]]: ...
class PrefixLoader(BaseLoader):
mapping: Any
delimiter: Any
def __init__(self, mapping, delimiter: str = ...) -> None: ...
def get_loader(self, template): ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable]: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
def load(self, environment, name, globals: Optional[Any] = ...): ...
def list_templates(self): ...
class ChoiceLoader(BaseLoader):
loaders: Any
def __init__(self, loaders) -> None: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable]: ...
def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ...
def load(self, environment, name, globals: Optional[Any] = ...): ...
def list_templates(self): ...

View File

@@ -23,7 +23,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
def viewvalues(self) -> ValuesView[object]: ...
def __delitem__(self, k: NoReturn) -> None: ...
def TypedDict(typename: str, fields: Dict[str, Type[_T]], total: bool = ...) -> Type[dict]: ...
def TypedDict(typename: str, fields: Dict[str, Type[_T]], total: bool = ...) -> Type[Dict[str, Any]]: ...
def Arg(type: _T = ..., name: Optional[str] = ...) -> _T: ...
def DefaultArg(type: _T = ..., name: Optional[str] = ...) -> _T: ...

View File

@@ -1,6 +1,6 @@
# TODO(MichalPokorny): more precise types
from typing import Any, Tuple
from typing import Any, List, Tuple
GLOBAL_ACK_EINTR: int
GLOBAL_ALL: int
@@ -14,8 +14,7 @@ def global_cleanup() -> None: ...
version: str
def version_info() -> Tuple[int, str, int, str, int, str,
int, str, tuple, Any, int, Any]: ...
def version_info() -> Tuple[int, str, int, str, int, str, int, str, Tuple[str, ...], Any, int, Any]: ...
class error(Exception): ...
@@ -37,9 +36,9 @@ class CurlMulti(object):
def add_handle(self, obj: Curl) -> None: ...
def remove_handle(self, obj: Curl) -> None: ...
def perform(self) -> Tuple[Any, int]: ...
def fdset(self) -> tuple: ...
def fdset(self) -> Tuple[List[Any], List[Any], List[Any]]: ...
def select(self, timeout: float = ...) -> int: ...
def info_read(self, max_objects: int = ...) -> tuple: ...
def info_read(self, max_objects: int = ...) -> Tuple[int, List[Any], List[Any]]: ...
class CurlShare(object):
def close(self) -> None: ...

View File

@@ -1,4 +1,4 @@
from typing import Dict
from typing import Dict, NoReturn, Type
from .constants import ER as ER
class MySQLError(Exception): ...
@@ -13,6 +13,6 @@ class InternalError(DatabaseError): ...
class ProgrammingError(DatabaseError): ...
class NotSupportedError(DatabaseError): ...
error_map: Dict
error_map: Dict[int, Type[DatabaseError]]
def raise_mysql_exception(data) -> None: ...
def raise_mysql_exception(data) -> NoReturn: ...

View File

@@ -5,7 +5,7 @@ from datetime import datetime
_T = TypeVar('_T')
_KT = TypeVar('_KT')
_VT = TypeVar('_VT')
_MT = TypeVar('_MT', bound=MapAttribute)
_MT = TypeVar('_MT', bound=MapAttribute[Any, Any])
class Attribute(Generic[_T]):
attr_name: Optional[Text]
@@ -91,6 +91,6 @@ class ListAttribute(Generic[_T], Attribute[List[_T]]):
def __init__(self, hash_key: bool = ..., range_key: bool = ..., null: Optional[bool] = ..., default: Optional[Union[Any, Callable[..., Any]]] = ..., attr_name: Optional[Text] = ..., of: Optional[Type[_T]] = ...) -> None: ...
def __get__(self, instance: Any, owner: Any) -> List[_T]: ...
DESERIALIZE_CLASS_MAP: Dict[Text, Attribute]
SERIALIZE_CLASS_MAP: Dict[Type, Attribute]
SERIALIZE_KEY_MAP: Dict[Type, Text]
DESERIALIZE_CLASS_MAP: Dict[Text, Attribute[Any]]
SERIALIZE_CLASS_MAP: Dict[Type[Any], Attribute[Any]]
SERIALIZE_KEY_MAP: Dict[Type[Any], Text]

View File

@@ -4,8 +4,8 @@ BOTOCORE_EXCEPTIONS: Any
log: Any
class MetaTable:
data: Dict
def __init__(self, data: Dict) -> None: ...
data: Dict[Any, Any]
def __init__(self, data: Dict[Any, Any]) -> None: ...
@property
def range_keyname(self) -> Optional[Text]: ...
@property

View File

@@ -6,7 +6,7 @@ log: Any
class DefaultMeta: ...
class ResultSet(Iterable):
class ResultSet(object):
results: Any
operation: Any
arguments: Any
@@ -17,7 +17,7 @@ class MetaModel(type):
def __init__(self, name: Text, bases: Tuple[type, ...], attrs: Dict[Any, Any]) -> None: ...
_T = TypeVar('_T', bound='Model')
KeyType = Union[Text, bytes, float, int, Tuple]
KeyType = Union[Text, bytes, float, int, Tuple[Any, ...]]
class Model(metaclass=MetaModel):
DoesNotExist = DoesNotExist
@@ -86,9 +86,9 @@ class Model(metaclass=MetaModel):
@classmethod
def get_throttle(cls): ...
@classmethod
def get_attributes(cls) -> Dict[str, Attribute]: ...
def get_attributes(cls) -> Dict[str, Attribute[Any]]: ...
@classmethod
def _get_attributes(cls) -> Dict[str, Attribute]: ...
def _get_attributes(cls) -> Dict[str, Attribute[Any]]: ...
class ModelContextManager(Generic[_T]):
model: Type[_T]

View File

@@ -4,4 +4,4 @@ _T = TypeVar("_T")
def none_throws(optional: Optional[_T], message: str = ...) -> _T: ...
def safe_cast(new_type: Type[_T], value: Any) -> _T: ...
def ParameterSpecification(__name: str) -> List[Type]: ...
def ParameterSpecification(__name: str) -> List[Type[Any]]: ...

View File

@@ -41,7 +41,7 @@ def remove_cookie_by_name(cookiejar, name, domain=..., path=...): ...
class CookieConflictError(RuntimeError): ...
class RequestsCookieJar(CookieJar, MutableMapping):
class RequestsCookieJar(CookieJar, MutableMapping[Any, Any]):
def get(self, name, default=..., domain=..., path=...): ...
def set(self, name, value, **kwargs): ...
def iterkeys(self): ...

View File

@@ -83,7 +83,7 @@ class Request(RequestHooksMixin):
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
method: Optional[Union[str, Text]]
url: Optional[Union[str, Text]]
headers: CaseInsensitiveDict
headers: CaseInsensitiveDict[str]
body: Optional[Union[bytes, Text]]
hooks: Any
def __init__(self) -> None: ...

View File

@@ -1,11 +1,14 @@
from typing import Any
from typing import Any, NoReturn, TypeVar
from collections import MutableMapping
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
class RLock:
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback): ...
class RecentlyUsedContainer(MutableMapping):
class RecentlyUsedContainer(MutableMapping[_KT, _VT]):
ContainerCls: Any
dispose_func: Any
lock: Any
@@ -18,13 +21,15 @@ class RecentlyUsedContainer(MutableMapping):
def clear(self): ...
def keys(self): ...
class HTTPHeaderDict(dict):
class HTTPHeaderDict(MutableMapping[str, str]):
def __init__(self, headers=..., **kwargs) -> None: ...
def __setitem__(self, key, val): ...
def __getitem__(self, key): ...
def __delitem__(self, key): ...
def __contains__(self, key): ...
def __eq__(self, other): ...
def __iter__(self) -> NoReturn: ...
def __len__(self) -> int: ...
def __ne__(self, other): ...
values: Any
get: Any

View File

@@ -73,8 +73,8 @@ class Session(SessionRedirectMixin):
max_redirects: int
trust_env: bool
cookies: RequestsCookieJar
adapters: MutableMapping
redirect_cache: RecentlyUsedContainer
adapters: MutableMapping[Any, Any]
redirect_cache: RecentlyUsedContainer[Any, Any]
def __init__(self) -> None: ...
def __enter__(self) -> Session: ...
def __exit__(self, *args) -> None: ...
@@ -84,7 +84,7 @@ class Session(SessionRedirectMixin):
data: _Data = ...,
headers: Optional[MutableMapping[Text, Text]] = ...,
cookies: Union[None, RequestsCookieJar, MutableMapping[Text, Text]] = ...,
files: Optional[MutableMapping[Text, IO]] = ...,
files: Optional[MutableMapping[Text, IO[Any]]] = ...,
auth: Union[None, Tuple[Text, Text], _auth.AuthBase, Callable[[Request], Request]] = ...,
timeout: Union[None, float, Tuple[float, float]] = ...,
allow_redirects: Optional[bool] = ...,

View File

@@ -10,7 +10,7 @@ class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]):
def __delitem__(self, key: str) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
def copy(self) -> CaseInsensitiveDict: ...
def copy(self) -> CaseInsensitiveDict[_VT]: ...
class LookupDict(Dict[str, _VT]):
name: Any

View File

@@ -26,7 +26,7 @@ Protocol: _SpecialForm = ...
Final: _SpecialForm = ...
def final(f: _F) -> _F: ...
Literal: _SpecialForm = ...
def IntVar(__name: str) -> Type: ...
def IntVar(__name: str) -> Any: ... # returns a new TypeVar
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):

View File

@@ -5,7 +5,7 @@ from werkzeug.contrib.sessions import ModificationTrackingDict
class UnquoteError(Exception): ...
class SecureCookie(ModificationTrackingDict):
class SecureCookie(ModificationTrackingDict[Any, Any]):
hash_method: Any
serialization_method: Any
quote_base64: Any

View File

@@ -1,15 +1,18 @@
from typing import Any, Optional, Text
from typing import Any, Optional, Text, TypeVar
from werkzeug.datastructures import CallbackDict
_K = TypeVar("_K")
_V = TypeVar("_V")
def generate_key(salt: Optional[Any] = ...): ...
class ModificationTrackingDict(CallbackDict):
class ModificationTrackingDict(CallbackDict[_K, _V]):
modified: Any
def __init__(self, *args, **kwargs): ...
def copy(self): ...
def __copy__(self): ...
class Session(ModificationTrackingDict):
class Session(ModificationTrackingDict[_K, _V]):
sid: Any
new: Any
def __init__(self, data, sid, new: bool = ...): ...

View File

@@ -51,7 +51,7 @@ class ImmutableMultiDictMixin(ImmutableDictMixin):
def setlist(self, key, new_list): ...
def setlistdefault(self, key, default_list: Optional[Any] = ...): ...
class UpdateDictMixin:
class UpdateDictMixin(object):
on_update: Any
def setdefault(self, key, default: Optional[Any] = ...): ...
def pop(self, key, default=...): ...
@@ -79,7 +79,7 @@ class ViewItems:
def __init__(self, multi_dict, method, repr_name, *a, **kw): ...
def __iter__(self): ...
class MultiDict(TypeConversionDict):
class MultiDict(TypeConversionDict[_K, _V]):
def __init__(self, mapping: Optional[Any] = ...): ...
def __getitem__(self, key): ...
def __setitem__(self, key, value): ...
@@ -113,7 +113,7 @@ class _omd_bucket:
def __init__(self, omd, key, value): ...
def unlink(self, omd): ...
class OrderedMultiDict(MultiDict):
class OrderedMultiDict(MultiDict[_K, _V]):
def __init__(self, mapping: Optional[Any] = ...): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
@@ -137,7 +137,7 @@ class OrderedMultiDict(MultiDict):
def popitem(self): ...
def popitemlist(self): ...
class Headers(collections.Mapping):
class Headers(object):
def __init__(self, defaults: Optional[Any] = ...): ...
def __getitem__(self, key, _get_mode: bool = ...): ...
def __eq__(self, other): ...
@@ -207,7 +207,7 @@ class EnvironHeaders(ImmutableHeadersMixin, Headers):
def __iter__(self): ...
def copy(self): ...
class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict): # type: ignore
class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore
def __reduce_ex__(self, protocol): ...
dicts: Any
def __init__(self, dicts: Optional[Any] = ...): ...
@@ -228,18 +228,18 @@ class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict): # type: ignore
def __contains__(self, key): ...
has_key: Any
class FileMultiDict(MultiDict):
class FileMultiDict(MultiDict[_K, _V]):
def add_file(self, name, file, filename: Optional[Any] = ..., content_type: Optional[Any] = ...): ...
class ImmutableDict(ImmutableDictMixin, dict): # type: ignore
class ImmutableDict(ImmutableDictMixin, Dict[_K, _V]): # type: ignore
def copy(self): ...
def __copy__(self): ...
class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict): # type: ignore
class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore
def copy(self): ...
def __copy__(self): ...
class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict): # type: ignore
class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V]): # type: ignore
def copy(self): ...
def __copy__(self): ...
@@ -270,7 +270,7 @@ class CharsetAccept(Accept): ...
def cache_property(key, empty, type): ...
class _CacheControl(UpdateDictMixin, dict):
class _CacheControl(UpdateDictMixin, Dict[str, Any]):
no_cache: Any
no_store: Any
max_age: Any
@@ -293,11 +293,11 @@ class ResponseCacheControl(_CacheControl):
proxy_revalidate: Any
s_maxage: Any
class CallbackDict(UpdateDictMixin, dict):
class CallbackDict(UpdateDictMixin, Dict[_K, _V]):
on_update: Any
def __init__(self, initial: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
class HeaderSet(MutableSet):
class HeaderSet(MutableSet[str]):
on_update: Any
def __init__(self, headers: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def add(self, header): ...
@@ -317,7 +317,7 @@ class HeaderSet(MutableSet):
def __iter__(self): ...
def __nonzero__(self): ...
class ETags(Container, Iterable):
class ETags(Container[str], Iterable[str]):
star_tag: Any
def __init__(self, strong_etags: Optional[Any] = ..., weak_etags: Optional[Any] = ..., star_tag: bool = ...): ...
def as_set(self, include_weak: bool = ...): ...
@@ -384,7 +384,7 @@ class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore
@property
def qop(self) -> Optional[str]: ...
class WWWAuthenticate(UpdateDictMixin, dict):
class WWWAuthenticate(UpdateDictMixin, Dict[str, Any]):
on_update: Any
def __init__(self, auth_type: Optional[Any] = ..., values: Optional[Any] = ..., on_update: Optional[Any] = ...): ...
def set_basic(self, realm: str = ...): ...

View File

@@ -47,7 +47,7 @@ class FormDataParser(object):
silent: bool = ...,
) -> None: ...
def get_parse_func(self, mimetype: str, options: Any) -> Optional[_ParseFunc]: ...
def parse_from_environ(self, environ: WSGIEnvironment) -> Tuple[IO[bytes], _Dict, Dict]: ...
def parse_from_environ(self, environ: WSGIEnvironment) -> Tuple[IO[bytes], _Dict, _Dict]: ...
def parse(
self, stream: IO[bytes], mimetype: Text, content_length: Optional[int], options: Optional[Mapping[str, str]] = ...,
) -> Tuple[IO[bytes], _Dict, _Dict]: ...

View File

@@ -81,12 +81,12 @@ def is_entity_header(header: Text) -> bool: ...
def is_hop_by_hop_header(header: Text) -> bool: ...
@overload
def parse_cookie(header: Union[None, WSGIEnvironment, Text, bytes], charset: Text = ...,
errors: Text = ...) -> TypeConversionDict: ...
errors: Text = ...) -> TypeConversionDict[Any, Any]: ...
@overload
def parse_cookie(header: Union[None, WSGIEnvironment, Text, bytes], charset: Text = ...,
errors: Text = ..., cls: Optional[Callable[[Iterable[Tuple[Text, Text]]], _T]] = ...) -> _T: ...
def dump_cookie(key: _ToBytes, value: _ToBytes = ..., max_age: Union[None, float, timedelta] = ...,
expires: Union[None, Text, float, datetime] = ..., path: Union[None, tuple, str, bytes] = ...,
expires: Union[None, Text, float, datetime] = ..., path: Union[None, Tuple[Any, ...], str, bytes] = ...,
domain: Union[None, str, bytes] = ..., secure: bool = ..., httponly: bool = ..., charset: Text = ...,
sync_expires: bool = ...) -> str: ...
def is_byte_range_valid(start: Optional[int], stop: Optional[int], length: Optional[int]) -> bool: ...

View File

@@ -60,7 +60,7 @@ class LintMiddleware(object):
self,
status: str,
headers: List[Tuple[str, str]],
exc_info: Optional[tuple],
exc_info: Optional[Tuple[Any, ...]],
) -> Tuple[int, Headers]: ...
def check_headers(self, headers: Mapping[str, str]) -> None: ...
def check_iterator(self, app_iter: Iterable[bytes]) -> None: ...

View File

@@ -22,10 +22,10 @@ class BaseRequest:
encoding_errors: str
max_content_length: Optional[int]
max_form_memory_size: int
parameter_storage_class: Type
list_storage_class: Type
dict_storage_class: Type
form_data_parser_class: Type
parameter_storage_class: Type[Any]
list_storage_class: Type[Any]
dict_storage_class: Type[Any]
form_data_parser_class: Type[Any]
trusted_hosts: Optional[Sequence[Text]]
disable_data_descriptor: Any
environ: WSGIEnvironment = ...
@@ -46,7 +46,7 @@ class BaseRequest:
@property
def stream(self) -> InputStream: ...
input_stream: InputStream
args: ImmutableMultiDict
args: ImmutableMultiDict[Any, Any]
@property
def data(self) -> bytes: ...
@overload
@@ -59,9 +59,9 @@ class BaseRequest:
def get_data(self, cache: bool, as_text: bool, parse_form_data: bool = ...) -> Any: ...
@overload
def get_data(self, *, as_text: bool, parse_form_data: bool = ...) -> Any: ...
form: ImmutableMultiDict
values: CombinedMultiDict
files: MultiDict
form: ImmutableMultiDict[Any, Any]
values: CombinedMultiDict[Any, Any]
files: MultiDict[Any, Any]
@property
def cookies(self) -> ImmutableTypeConversionDict[str, str]: ...
headers: EnvironHeaders

View File

@@ -3,10 +3,11 @@ import docutils.parsers.rst.states
from typing import Callable, Any, List, Dict, Tuple
def register_local_role(name: str,
role_fn: Callable[[str, str, str, int, docutils.parsers.rst.states.Inliner, Dict, List],
Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]]]
) -> None:
...
_RoleFn = Callable[
[str, str, str, int, docutils.parsers.rst.states.Inliner, Dict[str, Any], List[str]],
Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]],
]
def __getattr__(name) -> Any: ...
def register_local_role(name: str, role_fn: _RoleFn) -> None: ...
def __getattr__(name: str) -> Any: ... # incomplete

View File

@@ -11,9 +11,7 @@ def encode(payload: Mapping[str, Any], key: Union[str, bytes],
algorithm: str = ..., headers: Optional[Mapping[str, Any]] = ...,
json_encoder: Optional[Any] = ...) -> bytes: ...
def register_algorithm(alg_id: str,
alg_obj: algorithms.Algorithm) -> None: ...
def register_algorithm(alg_id: str, alg_obj: algorithms.Algorithm[Any]) -> None: ...
def unregister_algorithm(alg_id: str) -> None: ...
class PyJWTError(Exception): ...

View File

@@ -4,7 +4,7 @@ from typing import Any, Set, Dict, Optional, ClassVar, Union, Generic, TypeVar
requires_cryptography = Set[str]
def get_default_algorithms() -> Dict[str, Algorithm]: ...
def get_default_algorithms() -> Dict[str, Algorithm[Any]]: ...
_K = TypeVar("_K")
@@ -13,10 +13,9 @@ class Algorithm(Generic[_K]):
def sign(self, msg: bytes, key: _K) -> bytes: ...
def verify(self, msg: bytes, key: _K, sig: bytes) -> bool: ...
@staticmethod
def to_jwk(key_obj: Any) -> str: ... # should be key_obj: _K, see python/mypy#1337
def to_jwk(key_obj: _K) -> str: ...
@staticmethod
def from_jwk(jwk: str) -> Any: ... # should return _K, see python/mypy#1337
def from_jwk(jwk: str) -> _K: ...
class NoneAlgorithm(Algorithm[None]):
def prepare_key(self, key: Optional[str]) -> None: ...
@@ -44,7 +43,7 @@ class HMACAlgorithm(Algorithm[bytes]):
# Only defined if cryptography is installed. Types should be tightened when
# cryptography gets type hints.
# See https://github.com/python/typeshed/issues/2542
class RSAAlgorithm(Algorithm):
class RSAAlgorithm(Algorithm[Any]):
SHA256: ClassVar[Any]
SHA384: ClassVar[Any]
SHA512: ClassVar[Any]
@@ -61,7 +60,7 @@ class RSAAlgorithm(Algorithm):
# Only defined if cryptography is installed. Types should be tightened when
# cryptography gets type hints.
# See https://github.com/python/typeshed/issues/2542
class ECAlgorithm(Algorithm):
class ECAlgorithm(Algorithm[Any]):
SHA256: ClassVar[Any]
SHA384: ClassVar[Any]
SHA512: ClassVar[Any]

View File

@@ -3,7 +3,7 @@ from jwt.algorithms import Algorithm
from . import _HashAlg
class ECAlgorithm(Algorithm):
class ECAlgorithm(Algorithm[Any]):
SHA256: _HashAlg
SHA384: _HashAlg
SHA512: _HashAlg

View File

@@ -3,7 +3,7 @@ from jwt.algorithms import Algorithm
from . import _HashAlg
class RSAAlgorithm(Algorithm):
class RSAAlgorithm(Algorithm[Any]):
SHA256: _HashAlg
SHA384: _HashAlg
SHA512: _HashAlg