mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Create stubs for Flask (#2740)
See permission in pallets/flask#2012. Fixes #28.
This commit is contained in:
committed by
Ivan Levkivskyi
parent
ad803e1caa
commit
75581cf7da
45
third_party/2and3/flask/__init__.pyi
vendored
Normal file
45
third_party/2and3/flask/__init__.pyi
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Stubs for flask (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .app import Flask as Flask
|
||||
from .blueprints import Blueprint as Blueprint
|
||||
from .config import Config as Config
|
||||
from .ctx import after_this_request as after_this_request
|
||||
from .ctx import copy_current_request_context as copy_current_request_context
|
||||
from .ctx import has_app_context as has_app_context
|
||||
from .ctx import has_request_context as has_request_context
|
||||
from .globals import current_app as current_app
|
||||
from .globals import g as g
|
||||
from .globals import request as request
|
||||
from .globals import session as session
|
||||
from .helpers import flash as flash
|
||||
from .helpers import get_flashed_messages as get_flashed_messages
|
||||
from .helpers import get_template_attribute as get_template_attribute
|
||||
from .helpers import make_response as make_response
|
||||
from .helpers import safe_join as safe_join
|
||||
from .helpers import send_file as send_file
|
||||
from .helpers import send_from_directory as send_from_directory
|
||||
from .helpers import stream_with_context as stream_with_context
|
||||
from .helpers import url_for as url_for
|
||||
from .json import jsonify as jsonify
|
||||
from .signals import appcontext_popped as appcontext_popped
|
||||
from .signals import appcontext_pushed as appcontext_pushed
|
||||
from .signals import appcontext_tearing_down as appcontext_tearing_down
|
||||
from .signals import before_render_template as before_render_template
|
||||
from .signals import got_request_exception as got_request_exception
|
||||
from .signals import message_flashed as message_flashed
|
||||
from .signals import request_finished as request_finished
|
||||
from .signals import request_started as request_started
|
||||
from .signals import request_tearing_down as request_tearing_down
|
||||
from .signals import signals_available as signals_available
|
||||
from .signals import template_rendered as template_rendered
|
||||
from .templating import render_template as render_template
|
||||
from .templating import render_template_string as render_template_string
|
||||
from .wrappers import Request as Request
|
||||
from .wrappers import Response as Response
|
||||
|
||||
from werkzeug.exceptions import abort as abort
|
||||
from werkzeug.utils import redirect as redirect
|
||||
from jinja2 import Markup as Markup
|
||||
from jinja2 import escape as escape
|
||||
147
third_party/2and3/flask/app.pyi
vendored
Normal file
147
third_party/2and3/flask/app.pyi
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
# Stubs for flask.app (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .blueprints import Blueprint
|
||||
from .config import Config, ConfigAttribute
|
||||
from .ctx import AppContext, RequestContext, _AppCtxGlobals
|
||||
from .globals import _request_ctx_stack, g, request, session
|
||||
from .helpers import _PackageBoundObject, find_package, get_debug_flag, get_env, get_flashed_messages, get_load_dotenv, locked_cached_property, url_for
|
||||
from .logging import create_logger
|
||||
from .sessions import SecureCookieSessionInterface
|
||||
from .signals import appcontext_tearing_down, got_request_exception, request_finished, request_started, request_tearing_down
|
||||
from .templating import DispatchingJinjaLoader, Environment
|
||||
from .wrappers import Request, Response
|
||||
from .testing import FlaskClient
|
||||
from typing import Any, Callable, ContextManager, Dict, List, Optional, Type, TypeVar, Union
|
||||
|
||||
def setupmethod(f: Any): ...
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Flask(_PackageBoundObject):
|
||||
request_class: type = ...
|
||||
response_class: type = ...
|
||||
jinja_environment: type = ...
|
||||
app_ctx_globals_class: type = ...
|
||||
config_class: type = ...
|
||||
testing: Any = ...
|
||||
secret_key: Any = ...
|
||||
session_cookie_name: Any = ...
|
||||
permanent_session_lifetime: Any = ...
|
||||
send_file_max_age_default: Any = ...
|
||||
use_x_sendfile: Any = ...
|
||||
json_encoder: Any = ...
|
||||
json_decoder: Any = ...
|
||||
jinja_options: Any = ...
|
||||
default_config: Any = ...
|
||||
url_rule_class: type = ...
|
||||
test_client_class: type = ...
|
||||
test_cli_runner_class: type = ...
|
||||
session_interface: Any = ...
|
||||
import_name: str = ...
|
||||
template_folder: str = ...
|
||||
root_path: Any = ...
|
||||
static_url_path: Any = ...
|
||||
static_folder: str = ...
|
||||
instance_path: Any = ...
|
||||
config: Dict[str, Any] = ...
|
||||
view_functions: Any = ...
|
||||
error_handler_spec: Any = ...
|
||||
url_build_error_handlers: Any = ...
|
||||
before_request_funcs: Dict[Optional[str], List[Callable[[], Any]]] = ...
|
||||
before_first_request_funcs: List[Callable[[], None]] = ...
|
||||
after_request_funcs: Dict[Optional[str], List[Callable[[Response], Response]]] = ...
|
||||
teardown_request_funcs: Dict[Optional[str], List[Callable[[Optional[Exception]], Any]]] = ...
|
||||
teardown_appcontext_funcs: List[Callable[[Optional[Exception]], Any]] = ...
|
||||
url_value_preprocessors: Any = ...
|
||||
url_default_functions: Any = ...
|
||||
template_context_processors: Any = ...
|
||||
shell_context_processors: Any = ...
|
||||
blueprints: Any = ...
|
||||
extensions: Any = ...
|
||||
url_map: Any = ...
|
||||
subdomain_matching: Any = ...
|
||||
cli: Any = ...
|
||||
def __init__(self, import_name: str, static_url_path: Optional[str] = ..., static_folder: str = ..., static_host: Optional[str] = ..., host_matching: bool = ..., subdomain_matching: bool = ..., template_folder: str = ..., instance_path: Optional[str] = ..., instance_relative_config: bool = ..., root_path: Optional[str] = ...) -> None: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def propagate_exceptions(self): ...
|
||||
@property
|
||||
def preserve_context_on_exception(self): ...
|
||||
@property
|
||||
def logger(self): ...
|
||||
@property
|
||||
def jinja_env(self): ...
|
||||
@property
|
||||
def got_first_request(self): ...
|
||||
def make_config(self, instance_relative: bool = ...): ...
|
||||
def auto_find_instance_path(self): ...
|
||||
def open_instance_resource(self, resource: Any, mode: str = ...): ...
|
||||
templates_auto_reload: Any = ...
|
||||
def create_jinja_environment(self): ...
|
||||
def create_global_jinja_loader(self): ...
|
||||
def select_jinja_autoescape(self, filename: Any): ...
|
||||
def update_template_context(self, context: Any) -> None: ...
|
||||
def make_shell_context(self): ...
|
||||
env: Any = ...
|
||||
debug: Any = ...
|
||||
def run(self, host: Optional[str] = ..., port: Optional[int] = ..., debug: Optional[bool] = ..., load_dotenv: bool = ..., **options: Any) -> None: ...
|
||||
def test_client(self, use_cookies: bool = ..., **kwargs: Any) -> testing.FlaskClient: ...
|
||||
def test_cli_runner(self, **kwargs: Any): ...
|
||||
def open_session(self, request: Any): ...
|
||||
def save_session(self, session: Any, response: Any): ...
|
||||
def make_null_session(self): ...
|
||||
def register_blueprint(self, blueprint: Blueprint, **options: Any) -> None: ...
|
||||
def iter_blueprints(self): ...
|
||||
def add_url_rule(self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., provide_automatic_options: Optional[bool] = ..., **options: Any) -> None: ...
|
||||
def route(self, rule: str, **options: Any) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def endpoint(self, endpoint: str) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def errorhandler(self, code_or_exception: Union[int, Type[Exception]]) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def register_error_handler(self, code_or_exception: Union[int, Type[Exception]], f: Callable[..., Any]) -> None: ...
|
||||
def template_filter(self, name: Optional[Any] = ...): ...
|
||||
def add_template_filter(self, f: Any, name: Optional[Any] = ...) -> None: ...
|
||||
def template_test(self, name: Optional[Any] = ...): ...
|
||||
def add_template_test(self, f: Any, name: Optional[Any] = ...) -> None: ...
|
||||
def template_global(self, name: Optional[Any] = ...): ...
|
||||
def add_template_global(self, f: Any, name: Optional[Any] = ...) -> None: ...
|
||||
def before_request(self, f: Callable[[], _T]) -> Callable[[], _T]: ...
|
||||
def before_first_request(self, f: Callable[[], _T]) -> Callable[[], _T]: ...
|
||||
def after_request(self, f: Callable[[Response], Response]) -> Callable[[Response], Response]: ...
|
||||
def teardown_request(self, f: Callable[[Optional[Exception]], _T]) -> Callable[[Optional[Exception]], _T]: ...
|
||||
def teardown_appcontext(self, f: Callable[[Optional[Exception]], _T]) -> Callable[[Optional[Exception]], _T]: ...
|
||||
def context_processor(self, f: Any): ...
|
||||
def shell_context_processor(self, f: Any): ...
|
||||
def url_value_preprocessor(self, f: Any): ...
|
||||
def url_defaults(self, f: Any): ...
|
||||
def handle_http_exception(self, e: Any): ...
|
||||
def trap_http_exception(self, e: Any): ...
|
||||
def handle_user_exception(self, e: Any): ...
|
||||
def handle_exception(self, e: Any): ...
|
||||
def log_exception(self, exc_info: Any) -> None: ...
|
||||
def raise_routing_exception(self, request: Any) -> None: ...
|
||||
def dispatch_request(self): ...
|
||||
def full_dispatch_request(self): ...
|
||||
def finalize_request(self, rv: Any, from_error_handler: bool = ...): ...
|
||||
def try_trigger_before_first_request_functions(self): ...
|
||||
def make_default_options_response(self): ...
|
||||
def should_ignore_error(self, error: Any): ...
|
||||
def make_response(self, rv: Any): ...
|
||||
def create_url_adapter(self, request: Any): ...
|
||||
def inject_url_defaults(self, endpoint: Any, values: Any) -> None: ...
|
||||
def handle_url_build_error(self, error: Any, endpoint: Any, values: Any): ...
|
||||
def preprocess_request(self): ...
|
||||
def process_response(self, response: Any): ...
|
||||
def do_teardown_request(self, exc: Any = ...) -> None: ...
|
||||
def do_teardown_appcontext(self, exc: Any = ...) -> None: ...
|
||||
def app_context(self): ...
|
||||
def request_context(self, environ: Any): ...
|
||||
def test_request_context(self, *args: Any, **kwargs: Any) -> ContextManager[RequestContext]: ...
|
||||
def wsgi_app(self, environ: Any, start_response: Any): ...
|
||||
def __call__(self, environ: Any, start_response: Any): ...
|
||||
|
||||
# These are not preset at runtime but we add them since monkeypatching this
|
||||
# class is quite common.
|
||||
def __setattr__(self, name: str, value: Any): ...
|
||||
def __getattr__(self, name: str): ...
|
||||
64
third_party/2and3/flask/blueprints.pyi
vendored
Normal file
64
third_party/2and3/flask/blueprints.pyi
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Stubs for flask.blueprints (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .helpers import _PackageBoundObject
|
||||
from typing import Any, Callable, Optional, Type, TypeVar, Union
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class BlueprintSetupState:
|
||||
app: Any = ...
|
||||
blueprint: Any = ...
|
||||
options: Any = ...
|
||||
first_registration: Any = ...
|
||||
subdomain: Any = ...
|
||||
url_prefix: Any = ...
|
||||
url_defaults: Any = ...
|
||||
def __init__(self, blueprint: Any, app: Any, options: Any, first_registration: Any) -> None: ...
|
||||
def add_url_rule(self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., **options: Any) -> None: ...
|
||||
|
||||
class Blueprint(_PackageBoundObject):
|
||||
warn_on_modifications: bool = ...
|
||||
json_encoder: Any = ...
|
||||
json_decoder: Any = ...
|
||||
import_name: str = ...
|
||||
template_folder: Optional[str] = ...
|
||||
root_path: Optional[str] = ...
|
||||
name: str = ...
|
||||
url_prefix: Optional[str] = ...
|
||||
subdomain: Optional[str] = ...
|
||||
static_folder: Optional[str] = ...
|
||||
static_url_path: Optional[str] = ...
|
||||
deferred_functions: Any = ...
|
||||
url_values_defaults: Any = ...
|
||||
def __init__(self, name: str, import_name: str, static_folder: Optional[str] = ..., static_url_path: Optional[str] = ..., template_folder: Optional[str] = ..., url_prefix: Optional[str] = ..., subdomain: Optional[str] = ..., url_defaults: Optional[Any] = ..., root_path: Optional[str] = ...) -> None: ...
|
||||
def record(self, func: Any) -> None: ...
|
||||
def record_once(self, func: Any): ...
|
||||
def make_setup_state(self, app: Any, options: Any, first_registration: bool = ...): ...
|
||||
def register(self, app: Any, options: Any, first_registration: bool = ...) -> None: ...
|
||||
def route(self, rule: str, **options: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...
|
||||
def add_url_rule(self, rule: str, endpoint: Optional[str] = ..., view_func: Callable[..., Any] = ..., **options: Any) -> None: ...
|
||||
def endpoint(self, endpoint: str) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def app_template_filter(self, name: Optional[Any] = ...): ...
|
||||
def add_app_template_filter(self, f: Any, name: Optional[Any] = ...) -> None: ...
|
||||
def app_template_test(self, name: Optional[Any] = ...): ...
|
||||
def add_app_template_test(self, f: Any, name: Optional[Any] = ...) -> None: ...
|
||||
def app_template_global(self, name: Optional[Any] = ...): ...
|
||||
def add_app_template_global(self, f: Any, name: Optional[Any] = ...) -> None: ...
|
||||
def before_request(self, f: Any): ...
|
||||
def before_app_request(self, f: Any): ...
|
||||
def before_app_first_request(self, f: Any): ...
|
||||
def after_request(self, f: Any): ...
|
||||
def after_app_request(self, f: Any): ...
|
||||
def teardown_request(self, f: Any): ...
|
||||
def teardown_app_request(self, f: Any): ...
|
||||
def context_processor(self, f: Any): ...
|
||||
def app_context_processor(self, f: Any): ...
|
||||
def app_errorhandler(self, code: Any): ...
|
||||
def url_value_preprocessor(self, f: Any): ...
|
||||
def url_defaults(self, f: Any): ...
|
||||
def app_url_value_preprocessor(self, f: Any): ...
|
||||
def app_url_defaults(self, f: Any): ...
|
||||
def errorhandler(self, code_or_exception: Union[int, Type[Exception]]) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
|
||||
def register_error_handler(self, code_or_exception: Union[int, Type[Exception]], f: Callable[..., Any]) -> None: ...
|
||||
64
third_party/2and3/flask/cli.pyi
vendored
Normal file
64
third_party/2and3/flask/cli.pyi
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Stubs for flask.cli (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
import click
|
||||
from .globals import current_app
|
||||
from .helpers import get_debug_flag, get_env, get_load_dotenv
|
||||
from typing import Any, Optional
|
||||
|
||||
class NoAppException(click.UsageError): ...
|
||||
|
||||
def find_best_app(script_info: Any, module: Any): ...
|
||||
def call_factory(script_info: Any, app_factory: Any, arguments: Any = ...): ...
|
||||
def find_app_by_string(script_info: Any, module: Any, app_name: Any): ...
|
||||
def prepare_import(path: Any): ...
|
||||
def locate_app(script_info: Any, module_name: Any, app_name: Any, raise_if_not_found: bool = ...): ...
|
||||
def get_version(ctx: Any, param: Any, value: Any): ...
|
||||
|
||||
version_option: Any
|
||||
|
||||
class DispatchingApp:
|
||||
loader: Any = ...
|
||||
def __init__(self, loader: Any, use_eager_loading: bool = ...) -> None: ...
|
||||
def __call__(self, environ: Any, start_response: Any): ...
|
||||
|
||||
class ScriptInfo:
|
||||
app_import_path: Any = ...
|
||||
create_app: Any = ...
|
||||
data: Any = ...
|
||||
def __init__(self, app_import_path: Optional[Any] = ..., create_app: Optional[Any] = ...) -> None: ...
|
||||
def load_app(self): ...
|
||||
|
||||
pass_script_info: Any
|
||||
|
||||
def with_appcontext(f: Any): ...
|
||||
|
||||
class AppGroup(click.Group):
|
||||
def command(self, *args: Any, **kwargs: Any): ...
|
||||
def group(self, *args: Any, **kwargs: Any): ...
|
||||
|
||||
class FlaskGroup(AppGroup):
|
||||
create_app: Any = ...
|
||||
load_dotenv: Any = ...
|
||||
def __init__(self, add_default_commands: bool = ..., create_app: Optional[Any] = ..., add_version_option: bool = ..., load_dotenv: bool = ..., **extra: Any) -> None: ...
|
||||
def get_command(self, ctx: Any, name: Any): ...
|
||||
def list_commands(self, ctx: Any): ...
|
||||
def main(self, *args: Any, **kwargs: Any): ...
|
||||
|
||||
def load_dotenv(path: Optional[Any] = ...): ...
|
||||
def show_server_banner(env: Any, debug: Any, app_import_path: Any, eager_loading: Any): ...
|
||||
|
||||
class CertParamType(click.ParamType):
|
||||
name: str = ...
|
||||
path_type: Any = ...
|
||||
def __init__(self) -> None: ...
|
||||
def convert(self, value: Any, param: Any, ctx: Any): ...
|
||||
|
||||
def run_command(info: Any, host: Any, port: Any, reload: Any, debugger: Any, eager_loading: Any, with_threads: Any, cert: Any) -> None: ...
|
||||
def shell_command() -> None: ...
|
||||
def routes_command(sort: Any, all_methods: Any): ...
|
||||
|
||||
cli: Any
|
||||
|
||||
def main(as_module: bool = ...) -> None: ...
|
||||
22
third_party/2and3/flask/config.pyi
vendored
Normal file
22
third_party/2and3/flask/config.pyi
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Stubs for flask.config (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
class ConfigAttribute:
|
||||
__name__: Any = ...
|
||||
get_converter: Any = ...
|
||||
def __init__(self, name: Any, get_converter: Optional[Any] = ...) -> None: ...
|
||||
def __get__(self, obj: Any, type: Optional[Any] = ...): ...
|
||||
def __set__(self, obj: Any, value: Any) -> None: ...
|
||||
|
||||
class Config(dict):
|
||||
root_path: Any = ...
|
||||
def __init__(self, root_path: Any, defaults: Optional[Any] = ...) -> None: ...
|
||||
def from_envvar(self, variable_name: Any, silent: bool = ...): ...
|
||||
def from_pyfile(self, filename: Any, silent: bool = ...): ...
|
||||
def from_object(self, obj: Any) -> None: ...
|
||||
def from_json(self, filename: Any, silent: bool = ...): ...
|
||||
def from_mapping(self, *mapping: Any, **kwargs: Any): ...
|
||||
def get_namespace(self, namespace: Any, lowercase: bool = ..., trim_namespace: bool = ...): ...
|
||||
46
third_party/2and3/flask/ctx.pyi
vendored
Normal file
46
third_party/2and3/flask/ctx.pyi
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Stubs for flask.ctx (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .globals import _app_ctx_stack, _request_ctx_stack
|
||||
from .signals import appcontext_popped, appcontext_pushed
|
||||
from typing import Any, Optional
|
||||
|
||||
class _AppCtxGlobals:
|
||||
def get(self, name: Any, default: Optional[Any] = ...): ...
|
||||
def pop(self, name: Any, default: Any = ...): ...
|
||||
def setdefault(self, name: Any, default: Optional[Any] = ...): ...
|
||||
def __contains__(self, item: Any): ...
|
||||
def __iter__(self): ...
|
||||
|
||||
def after_this_request(f: Any): ...
|
||||
def copy_current_request_context(f: Any): ...
|
||||
def has_request_context(): ...
|
||||
def has_app_context(): ...
|
||||
|
||||
class AppContext:
|
||||
app: Any = ...
|
||||
url_adapter: Any = ...
|
||||
g: Any = ...
|
||||
def __init__(self, app: Any) -> None: ...
|
||||
def push(self) -> None: ...
|
||||
def pop(self, exc: Any = ...) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ...
|
||||
|
||||
class RequestContext:
|
||||
app: Any = ...
|
||||
request: Any = ...
|
||||
url_adapter: Any = ...
|
||||
flashes: Any = ...
|
||||
session: Any = ...
|
||||
preserved: bool = ...
|
||||
def __init__(self, app: Any, environ: Any, request: Optional[Any] = ...) -> None: ...
|
||||
g: Any = ...
|
||||
def copy(self): ...
|
||||
def match_request(self) -> None: ...
|
||||
def push(self) -> None: ...
|
||||
def pop(self, exc: Any = ...) -> None: ...
|
||||
def auto_pop(self, exc: Any) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ...
|
||||
21
third_party/2and3/flask/debughelpers.pyi
vendored
Normal file
21
third_party/2and3/flask/debughelpers.pyi
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Stubs for flask.debughelpers (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .app import Flask
|
||||
from .blueprints import Blueprint
|
||||
from .globals import _request_ctx_stack
|
||||
from typing import Any
|
||||
|
||||
class UnexpectedUnicodeError(AssertionError, UnicodeError): ...
|
||||
|
||||
class DebugFilesKeyError(KeyError, AssertionError):
|
||||
msg: Any = ...
|
||||
def __init__(self, request: Any, key: Any) -> None: ...
|
||||
|
||||
class FormDataRoutingRedirect(AssertionError):
|
||||
def __init__(self, request: Any) -> None: ...
|
||||
|
||||
def attach_enctype_error_multidict(request: Any): ...
|
||||
def explain_template_loading_attempts(app: Any, template: Any, attempts: Any) -> None: ...
|
||||
def explain_ignored_app_run() -> None: ...
|
||||
18
third_party/2and3/flask/globals.pyi
vendored
Normal file
18
third_party/2and3/flask/globals.pyi
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Stubs for flask.globals (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .app import Flask
|
||||
from .wrappers import Request
|
||||
from typing import Any
|
||||
from werkzeug.local import LocalStack
|
||||
|
||||
class _FlaskLocalProxy(Flask):
|
||||
def _get_current_object(self) -> Flask: ...
|
||||
|
||||
_request_ctx_stack: LocalStack
|
||||
_app_ctx_stack: LocalStack
|
||||
current_app: _FlaskLocalProxy
|
||||
request: Request
|
||||
session: Any
|
||||
g: Any
|
||||
48
third_party/2and3/flask/helpers.pyi
vendored
Normal file
48
third_party/2and3/flask/helpers.pyi
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# Stubs for flask.helpers (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .globals import _app_ctx_stack, _request_ctx_stack, current_app, request, session
|
||||
from .signals import message_flashed
|
||||
from typing import Any, Optional
|
||||
|
||||
def get_env(): ...
|
||||
def get_debug_flag(): ...
|
||||
def get_load_dotenv(default: bool = ...): ...
|
||||
def stream_with_context(generator_or_function: Any): ...
|
||||
def make_response(*args: Any): ...
|
||||
def url_for(endpoint: Any, **values: Any): ...
|
||||
def get_template_attribute(template_name: Any, attribute: Any): ...
|
||||
def flash(message: Any, category: str = ...) -> None: ...
|
||||
def get_flashed_messages(with_categories: bool = ..., category_filter: Any = ...): ...
|
||||
def send_file(filename_or_fp: Any, mimetype: Optional[Any] = ..., as_attachment: bool = ..., attachment_filename: Optional[Any] = ..., add_etags: bool = ..., cache_timeout: Optional[Any] = ..., conditional: bool = ..., last_modified: Optional[Any] = ...): ...
|
||||
def safe_join(directory: Any, *pathnames: Any): ...
|
||||
def send_from_directory(directory: Any, filename: Any, **options: Any): ...
|
||||
def get_root_path(import_name: Any): ...
|
||||
def find_package(import_name: Any): ...
|
||||
|
||||
class locked_cached_property:
|
||||
__name__: Any = ...
|
||||
__module__: Any = ...
|
||||
__doc__: Any = ...
|
||||
func: Any = ...
|
||||
lock: Any = ...
|
||||
def __init__(self, func: Any, name: Optional[Any] = ..., doc: Optional[Any] = ...) -> None: ...
|
||||
def __get__(self, obj: Any, type: Optional[Any] = ...): ...
|
||||
|
||||
class _PackageBoundObject:
|
||||
import_name: Any = ...
|
||||
template_folder: Any = ...
|
||||
root_path: Any = ...
|
||||
def __init__(self, import_name: Any, template_folder: Optional[Any] = ..., root_path: Optional[Any] = ...) -> None: ...
|
||||
static_folder: Any = ...
|
||||
static_url_path: Any = ...
|
||||
@property
|
||||
def has_static_folder(self): ...
|
||||
def jinja_loader(self): ...
|
||||
def get_send_file_max_age(self, filename: Any): ...
|
||||
def send_static_file(self, filename: Any): ...
|
||||
def open_resource(self, resource: Any, mode: str = ...): ...
|
||||
|
||||
def total_seconds(td: Any): ...
|
||||
def is_ip(value: Any): ...
|
||||
19
third_party/2and3/flask/json/__init__.pyi
vendored
Normal file
19
third_party/2and3/flask/json/__init__.pyi
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Stubs for flask.json (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
import json as _json
|
||||
from typing import Any
|
||||
|
||||
class JSONEncoder(_json.JSONEncoder):
|
||||
def default(self, o: Any): ...
|
||||
|
||||
class JSONDecoder(_json.JSONDecoder): ...
|
||||
|
||||
def dumps(obj: Any, **kwargs: Any): ...
|
||||
def dump(obj: Any, fp: Any, **kwargs: Any) -> None: ...
|
||||
def loads(s: Any, **kwargs: Any): ...
|
||||
def load(fp: Any, **kwargs: Any): ...
|
||||
def htmlsafe_dumps(obj: Any, **kwargs: Any): ...
|
||||
def htmlsafe_dump(obj: Any, fp: Any, **kwargs: Any) -> None: ...
|
||||
def jsonify(*args: Any, **kwargs: Any): ...
|
||||
71
third_party/2and3/flask/json/tag.pyi
vendored
Normal file
71
third_party/2and3/flask/json/tag.pyi
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# Stubs for flask.json.tag (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
class JSONTag:
|
||||
key: Any = ...
|
||||
serializer: Any = ...
|
||||
def __init__(self, serializer: Any) -> None: ...
|
||||
def check(self, value: Any) -> None: ...
|
||||
def to_json(self, value: Any) -> None: ...
|
||||
def to_python(self, value: Any) -> None: ...
|
||||
def tag(self, value: Any): ...
|
||||
|
||||
class TagDict(JSONTag):
|
||||
key: str = ...
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
|
||||
class PassDict(JSONTag):
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
tag: Any = ...
|
||||
|
||||
class TagTuple(JSONTag):
|
||||
key: str = ...
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
|
||||
class PassList(JSONTag):
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
tag: Any = ...
|
||||
|
||||
class TagBytes(JSONTag):
|
||||
key: str = ...
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
|
||||
class TagMarkup(JSONTag):
|
||||
key: str = ...
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
|
||||
class TagUUID(JSONTag):
|
||||
key: str = ...
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
|
||||
class TagDateTime(JSONTag):
|
||||
key: str = ...
|
||||
def check(self, value: Any): ...
|
||||
def to_json(self, value: Any): ...
|
||||
def to_python(self, value: Any): ...
|
||||
|
||||
class TaggedJSONSerializer:
|
||||
default_tags: Any = ...
|
||||
tags: Any = ...
|
||||
order: Any = ...
|
||||
def __init__(self) -> None: ...
|
||||
def register(self, tag_class: Any, force: bool = ..., index: Optional[Any] = ...) -> None: ...
|
||||
def tag(self, value: Any): ...
|
||||
def untag(self, value: Any): ...
|
||||
def dumps(self, value: Any): ...
|
||||
def loads(self, value: Any): ...
|
||||
13
third_party/2and3/flask/logging.pyi
vendored
Normal file
13
third_party/2and3/flask/logging.pyi
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Stubs for flask.logging (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .globals import request
|
||||
from typing import Any
|
||||
|
||||
def wsgi_errors_stream(): ...
|
||||
def has_level_handler(logger: Any): ...
|
||||
|
||||
default_handler: Any
|
||||
|
||||
def create_logger(app: Any): ...
|
||||
60
third_party/2and3/flask/sessions.pyi
vendored
Normal file
60
third_party/2and3/flask/sessions.pyi
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# Stubs for flask.sessions (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from abc import ABCMeta
|
||||
from typing import Any, MutableMapping, Optional
|
||||
from werkzeug.datastructures import CallbackDict
|
||||
|
||||
class SessionMixin(MutableMapping, metaclass=ABCMeta):
|
||||
@property
|
||||
def permanent(self): ...
|
||||
@permanent.setter
|
||||
def permanent(self, value: Any) -> None: ...
|
||||
new: bool = ...
|
||||
modified: bool = ...
|
||||
accessed: bool = ...
|
||||
|
||||
class SecureCookieSession(CallbackDict, SessionMixin):
|
||||
modified: bool = ...
|
||||
accessed: bool = ...
|
||||
def __init__(self, initial: Optional[Any] = ...) -> None: ...
|
||||
def __getitem__(self, key: Any): ...
|
||||
def get(self, key: Any, default: Optional[Any] = ...): ...
|
||||
def setdefault(self, key: Any, default: Optional[Any] = ...): ...
|
||||
|
||||
class NullSession(SecureCookieSession):
|
||||
__setitem__: Any = ...
|
||||
__delitem__: Any = ...
|
||||
clear: Any = ...
|
||||
pop: Any = ...
|
||||
popitem: Any = ...
|
||||
update: Any = ...
|
||||
setdefault: Any = ...
|
||||
|
||||
class SessionInterface:
|
||||
null_session_class: Any = ...
|
||||
pickle_based: bool = ...
|
||||
def make_null_session(self, app: Any): ...
|
||||
def is_null_session(self, obj: Any): ...
|
||||
def get_cookie_domain(self, app: Any): ...
|
||||
def get_cookie_path(self, app: Any): ...
|
||||
def get_cookie_httponly(self, app: Any): ...
|
||||
def get_cookie_secure(self, app: Any): ...
|
||||
def get_cookie_samesite(self, app: Any): ...
|
||||
def get_expiration_time(self, app: Any, session: Any): ...
|
||||
def should_set_cookie(self, app: Any, session: Any): ...
|
||||
def open_session(self, app: Any, request: Any) -> None: ...
|
||||
def save_session(self, app: Any, session: Any, response: Any) -> None: ...
|
||||
|
||||
session_json_serializer: Any
|
||||
|
||||
class SecureCookieSessionInterface(SessionInterface):
|
||||
salt: str = ...
|
||||
digest_method: Any = ...
|
||||
key_derivation: str = ...
|
||||
serializer: Any = ...
|
||||
session_class: Any = ...
|
||||
def get_signing_serializer(self, app: Any): ...
|
||||
def open_session(self, app: Any, request: Any): ...
|
||||
def save_session(self, app: Any, session: Any, response: Any): ...
|
||||
33
third_party/2and3/flask/signals.pyi
vendored
Normal file
33
third_party/2and3/flask/signals.pyi
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# Stubs for flask.signals (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
signals_available: bool
|
||||
|
||||
class Namespace:
|
||||
def signal(self, name: Any, doc: Optional[Any] = ...): ...
|
||||
|
||||
class _FakeSignal:
|
||||
name: Any = ...
|
||||
__doc__: Any = ...
|
||||
def __init__(self, name: Any, doc: Optional[Any] = ...) -> None: ...
|
||||
send: Any = ...
|
||||
connect: Any = ...
|
||||
disconnect: Any = ...
|
||||
has_receivers_for: Any = ...
|
||||
receivers_for: Any = ...
|
||||
temporarily_connected_to: Any = ...
|
||||
connected_to: Any = ...
|
||||
|
||||
template_rendered: Any
|
||||
before_render_template: Any
|
||||
request_started: Any
|
||||
request_finished: Any
|
||||
request_tearing_down: Any
|
||||
got_request_exception: Any
|
||||
appcontext_tearing_down: Any
|
||||
appcontext_pushed: Any
|
||||
appcontext_popped: Any
|
||||
message_flashed: Any
|
||||
21
third_party/2and3/flask/templating.pyi
vendored
Normal file
21
third_party/2and3/flask/templating.pyi
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Stubs for flask.templating (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .globals import _app_ctx_stack, _request_ctx_stack
|
||||
from .signals import before_render_template, template_rendered
|
||||
from jinja2 import BaseLoader, Environment as BaseEnvironment
|
||||
from typing import Any
|
||||
|
||||
class Environment(BaseEnvironment):
|
||||
app: Any = ...
|
||||
def __init__(self, app: Any, **options: Any) -> None: ...
|
||||
|
||||
class DispatchingJinjaLoader(BaseLoader):
|
||||
app: Any = ...
|
||||
def __init__(self, app: Any) -> None: ...
|
||||
def get_source(self, environment: Any, template: Any): ...
|
||||
def list_templates(self): ...
|
||||
|
||||
def render_template(template_name_or_list: Any, **context: Any): ...
|
||||
def render_template_string(source: Any, **context: Any): ...
|
||||
34
third_party/2and3/flask/testing.pyi
vendored
Normal file
34
third_party/2and3/flask/testing.pyi
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# Stubs for flask.testing (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from click import BaseCommand
|
||||
from click.testing import CliRunner, Result
|
||||
from typing import Any, IO, Iterable, Mapping, Optional, Union
|
||||
from werkzeug.test import Client
|
||||
|
||||
def make_test_environ_builder(app: Any, path: str = ..., base_url: Optional[Any] = ..., subdomain: Optional[Any] = ..., url_scheme: Optional[Any] = ..., *args: Any, **kwargs: Any): ...
|
||||
|
||||
class FlaskClient(Client):
|
||||
preserve_context: bool = ...
|
||||
environ_base: Any = ...
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def session_transaction(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def open(self, *args: Any, **kwargs: Any): ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ...
|
||||
|
||||
class FlaskCliRunner(CliRunner):
|
||||
app: Any = ...
|
||||
def __init__(self, app: Any, **kwargs: Any) -> None: ...
|
||||
def invoke(
|
||||
self,
|
||||
cli: Optional[BaseCommand] = ...,
|
||||
args: Optional[Union[str, Iterable[str]]] = ...,
|
||||
input: Optional[IO] = ...,
|
||||
env: Optional[Mapping[str, str]] = ...,
|
||||
catch_exceptions: bool = ...,
|
||||
color: bool = ...,
|
||||
**extra: Any,
|
||||
) -> Result:
|
||||
...
|
||||
22
third_party/2and3/flask/views.pyi
vendored
Normal file
22
third_party/2and3/flask/views.pyi
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Stubs for flask.views (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from .globals import request
|
||||
from typing import Any
|
||||
|
||||
http_method_funcs: Any
|
||||
|
||||
class View:
|
||||
methods: Any = ...
|
||||
provide_automatic_options: Any = ...
|
||||
decorators: Any = ...
|
||||
def dispatch_request(self) -> None: ...
|
||||
@classmethod
|
||||
def as_view(cls, name: Any, *class_args: Any, **class_kwargs: Any): ...
|
||||
|
||||
class MethodViewType(type):
|
||||
def __init__(cls, name: Any, bases: Any, d: Any) -> None: ...
|
||||
|
||||
class MethodView(View, metaclass=MethodViewType):
|
||||
def dispatch_request(self, *args: Any, **kwargs: Any): ...
|
||||
35
third_party/2and3/flask/wrappers.pyi
vendored
Normal file
35
third_party/2and3/flask/wrappers.pyi
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# Stubs for flask.wrappers (Python 3.6)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from werkzeug.exceptions import HTTPException
|
||||
from werkzeug.routing import Rule
|
||||
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
|
||||
|
||||
class JSONMixin:
|
||||
@property
|
||||
def is_json(self) -> bool: ...
|
||||
@property
|
||||
def json(self): ...
|
||||
def get_json(self, force: bool = ..., silent: bool = ..., cache: bool = ...): ...
|
||||
def on_json_loading_failed(self, e: Any) -> None: ...
|
||||
|
||||
class Request(RequestBase, JSONMixin):
|
||||
url_rule: Optional[Rule] = ...
|
||||
view_args: Dict[str, Any] = ...
|
||||
routing_exception: Optional[HTTPException] = ...
|
||||
# Request is making the max_content_length readonly, where it was not the
|
||||
# case in its supertype.
|
||||
# We would require something like https://github.com/python/typing/issues/241
|
||||
@property
|
||||
def max_content_length(self) -> Optional[int]: ... # type: ignore
|
||||
@property
|
||||
def endpoint(self) -> Optional[str]: ...
|
||||
@property
|
||||
def blueprint(self) -> Optional[str]: ...
|
||||
|
||||
class Response(ResponseBase, JSONMixin):
|
||||
default_mimetype: str = ...
|
||||
@property
|
||||
def max_cookie_size(self) -> int: ...
|
||||
3
third_party/2and3/werkzeug/utils.pyi
vendored
3
third_party/2and3/werkzeug/utils.pyi
vendored
@@ -1,5 +1,6 @@
|
||||
from typing import Any, Optional
|
||||
from werkzeug._internal import _DictAccessorProperty
|
||||
from werkzeug.wrappers import Response
|
||||
|
||||
class cached_property(property):
|
||||
__name__ = ... # type: Any
|
||||
@@ -30,7 +31,7 @@ def format_string(string, context): ...
|
||||
def secure_filename(filename): ...
|
||||
def escape(s, quote: Optional[Any] = ...): ...
|
||||
def unescape(s): ...
|
||||
def redirect(location, code: int = ..., Response: Optional[Any] = ...): ...
|
||||
def redirect(location, code: int = ..., Response: Optional[Any] = ...) -> Response: ...
|
||||
def append_slash_redirect(environ, code: int = ...): ...
|
||||
def import_string(import_name, silent: bool = ...): ...
|
||||
def find_modules(import_path, include_packages: bool = ..., recursive: bool = ...): ...
|
||||
|
||||
10
third_party/2and3/werkzeug/wrappers.pyi
vendored
10
third_party/2and3/werkzeug/wrappers.pyi
vendored
@@ -14,7 +14,7 @@ from .datastructures import (
|
||||
class BaseRequest:
|
||||
charset = ... # type: str
|
||||
encoding_errors = ... # type: str
|
||||
max_content_length = ... # type: int
|
||||
max_content_length = ... # type: Optional[int]
|
||||
max_form_memory_size = ... # type: int
|
||||
parameter_storage_class = ... # type: Type
|
||||
list_storage_class = ... # type: Type
|
||||
@@ -60,7 +60,8 @@ class BaseRequest:
|
||||
host = ... # type: Text
|
||||
query_string = ... # type: bytes
|
||||
method = ... # type: Text
|
||||
def access_route(self): ...
|
||||
@property
|
||||
def access_route(self) -> Sequence[str]: ...
|
||||
@property
|
||||
def remote_addr(self) -> str: ...
|
||||
remote_user = ... # type: Text
|
||||
@@ -71,6 +72,11 @@ class BaseRequest:
|
||||
is_multiprocess = ... # type: bool
|
||||
is_run_once = ... # type: bool
|
||||
|
||||
# These are not preset at runtime but we add them since monkeypatching this
|
||||
# class is quite common.
|
||||
def __setattr__(self, name: str, value: Any): ...
|
||||
def __getattr__(self, name: str): ...
|
||||
|
||||
_OnCloseT = TypeVar('_OnCloseT', bound=Callable[[], Any])
|
||||
_SelfT = TypeVar('_SelfT', bound=BaseResponse)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user