Repository navigation
Create stubs for Flask #2740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Create stubs for Flask #2740
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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): ... | ||
|
pcorpet marked this conversation as resolved.
|
||
| @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): ... | ||
|
pcorpet marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 = ...): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: ... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.