From bf502024da52f47bb9347f45c7888ede6f797d04 Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Wed, 1 Apr 2020 00:44:47 +1000 Subject: [PATCH] Return types for some flask methods (#3888) --- third_party/2and3/flask/app.pyi | 2 +- third_party/2and3/flask/helpers.pyi | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/third_party/2and3/flask/app.pyi b/third_party/2and3/flask/app.pyi index 654d41c1f..1d0a5ee9e 100644 --- a/third_party/2and3/flask/app.pyi +++ b/third_party/2and3/flask/app.pyi @@ -174,7 +174,7 @@ class Flask(_PackageBoundObject): 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 app_context(self) -> AppContext: ... 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): ... diff --git a/third_party/2and3/flask/helpers.pyi b/third_party/2and3/flask/helpers.pyi index 726f8a03c..6a7db59a9 100644 --- a/third_party/2and3/flask/helpers.pyi +++ b/third_party/2and3/flask/helpers.pyi @@ -4,18 +4,19 @@ from .globals import _app_ctx_stack, _request_ctx_stack, current_app, request, session from .signals import message_flashed +from .wrappers import Response 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 make_response(*args: Any) -> Response: ... +def url_for(endpoint: str, **values: Any) -> str: ... 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 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] = ...) -> Response: ... def safe_join(directory: Any, *pathnames: Any): ... def send_from_directory(directory: Any, filename: Any, **options: Any): ... def get_root_path(import_name: Any): ...