2
2
#
3
3
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4
4
5
- from ._compat import integer_types , reraise , string_types , text_type
5
+ from .blueprints import Blueprint
6
6
from .config import Config , ConfigAttribute
7
7
from .ctx import AppContext , RequestContext , _AppCtxGlobals
8
8
from .globals import _request_ctx_stack , g , request , session
9
- from .helpers import _PackageBoundObject , _endpoint_from_view_func , find_package , get_debug_flag , get_env , get_flashed_messages , get_load_dotenv , locked_cached_property , url_for
9
+ from .helpers import _PackageBoundObject , find_package , get_debug_flag , get_env , get_flashed_messages , get_load_dotenv , locked_cached_property , url_for
10
10
from .logging import create_logger
11
11
from .sessions import SecureCookieSessionInterface
12
12
from .signals import appcontext_tearing_down , got_request_exception , request_finished , request_started , request_tearing_down
13
- from .templating import DispatchingJinjaLoader , Environment , _default_template_ctx_processor
13
+ from .templating import DispatchingJinjaLoader , Environment
14
14
from .wrappers import Request , Response
15
- from typing import Any , Optional
15
+ from .testing import FlaskClient
16
+ from typing import Any , Callable , ContextManager , Dict , List , Optional , Type , TypeVar , Union
16
17
17
18
def setupmethod (f : Any ): ...
18
19
20
+ _T = TypeVar ('_T' )
21
+
19
22
class Flask (_PackageBoundObject ):
20
- request_class : Any = ...
21
- response_class : Any = ...
22
- jinja_environment : Any = ...
23
- app_ctx_globals_class : Any = ...
24
- config_class : Any = ...
23
+ request_class : type = ...
24
+ response_class : type = ...
25
+ jinja_environment : type = ...
26
+ app_ctx_globals_class : type = ...
27
+ config_class : type = ...
25
28
testing : Any = ...
26
29
secret_key : Any = ...
27
30
session_cookie_name : Any = ...
@@ -32,25 +35,25 @@ class Flask(_PackageBoundObject):
32
35
json_decoder : Any = ...
33
36
jinja_options : Any = ...
34
37
default_config : Any = ...
35
- url_rule_class : Any = ...
36
- test_client_class : Any = ...
37
- test_cli_runner_class : Any = ...
38
+ url_rule_class : type = ...
39
+ test_client_class : type = ...
40
+ test_cli_runner_class : type = ...
38
41
session_interface : Any = ...
39
- import_name : Any = ...
40
- template_folder : Any = ...
42
+ import_name : str = ...
43
+ template_folder : str = ...
41
44
root_path : Any = ...
42
45
static_url_path : Any = ...
43
- static_folder : Any = ...
46
+ static_folder : str = ...
44
47
instance_path : Any = ...
45
- config : Any = ...
48
+ config : Dict [ str , Any ] = ...
46
49
view_functions : Any = ...
47
50
error_handler_spec : Any = ...
48
51
url_build_error_handlers : Any = ...
49
- before_request_funcs : Any = ...
50
- before_first_request_funcs : Any = ...
51
- after_request_funcs : Any = ...
52
- teardown_request_funcs : Any = ...
53
- teardown_appcontext_funcs : Any = ...
52
+ before_request_funcs : Dict [ Optional [ str ], List [ Callable [[], Any ]]] = ...
53
+ before_first_request_funcs : List [ Callable [[], None ]] = ...
54
+ after_request_funcs : Dict [ Optional [ str ], List [ Callable [[ Response ], Response ]]] = ...
55
+ teardown_request_funcs : Dict [ Optional [ str ], List [ Callable [[ Optional [ Exception ]], Any ]]] = ...
56
+ teardown_appcontext_funcs : List [ Callable [[ Optional [ Exception ]], Any ]] = ...
54
57
url_value_preprocessors : Any = ...
55
58
url_default_functions : Any = ...
56
59
template_context_processors : Any = ...
@@ -60,8 +63,8 @@ class Flask(_PackageBoundObject):
60
63
url_map : Any = ...
61
64
subdomain_matching : Any = ...
62
65
cli : Any = ...
63
- def __init__ (self , import_name : Any , static_url_path : Optional [Any ] = ..., static_folder : str = ..., static_host : Optional [Any ] = ..., host_matching : bool = ..., subdomain_matching : bool = ..., template_folder : str = ..., instance_path : Optional [Any ] = ..., instance_relative_config : bool = ..., root_path : Optional [Any ] = ...) -> None : ...
64
- def name (self ): ...
66
+ 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 : ...
67
+ def name (self ) -> str : ...
65
68
@property
66
69
def propagate_exceptions (self ): ...
67
70
@property
@@ -81,30 +84,30 @@ class Flask(_PackageBoundObject):
81
84
def make_shell_context (self ): ...
82
85
env : Any = ...
83
86
debug : Any = ...
84
- def run (self , host : Optional [Any ] = ..., port : Optional [Any ] = ..., debug : Optional [Any ] = ..., load_dotenv : bool = ..., ** options : Any ): ...
85
- def test_client (self , use_cookies : bool = ..., ** kwargs : Any ): ...
87
+ def run (self , host : Optional [str ] = ..., port : Optional [int ] = ..., debug : Optional [bool ] = ..., load_dotenv : bool = ..., ** options : Any ) -> None : ...
88
+ def test_client (self , use_cookies : bool = ..., ** kwargs : Any ) -> testing . FlaskClient : ...
86
89
def test_cli_runner (self , ** kwargs : Any ): ...
87
90
def open_session (self , request : Any ): ...
88
91
def save_session (self , session : Any , response : Any ): ...
89
92
def make_null_session (self ): ...
90
- def register_blueprint (self , blueprint : Any , ** options : Any ) -> None : ...
93
+ def register_blueprint (self , blueprint : Blueprint , ** options : Any ) -> None : ...
91
94
def iter_blueprints (self ): ...
92
- def add_url_rule (self , rule : Any , endpoint : Optional [Any ] = ..., view_func : Optional [ Any ] = ..., provide_automatic_options : Optional [Any ] = ..., ** options : Any ) -> None : ...
93
- def route (self , rule : Any , ** options : Any ): ...
94
- def endpoint (self , endpoint : Any ) : ...
95
- def errorhandler (self , code_or_exception : Any ) : ...
96
- def register_error_handler (self , code_or_exception : Any , f : Any ) -> None : ...
95
+ def add_url_rule (self , rule : str , endpoint : Optional [str ] = ..., view_func : Callable [..., Any ] = ..., provide_automatic_options : Optional [bool ] = ..., ** options : Any ) -> None : ...
96
+ def route (self , rule : str , ** options : Any ) -> Callable [[ Callable [..., _T ]], Callable [..., _T ]] : ...
97
+ def endpoint (self , endpoint : str ) -> Callable [[ Callable [..., _T ]], Callable [..., _T ]] : ...
98
+ def errorhandler (self , code_or_exception : Union [ int , Type [ Exception ]]) -> Callable [[ Callable [..., _T ]], Callable [..., _T ]] : ...
99
+ def register_error_handler (self , code_or_exception : Union [ int , Type [ Exception ]], f : Callable [..., Any ] ) -> None : ...
97
100
def template_filter (self , name : Optional [Any ] = ...): ...
98
101
def add_template_filter (self , f : Any , name : Optional [Any ] = ...) -> None : ...
99
102
def template_test (self , name : Optional [Any ] = ...): ...
100
103
def add_template_test (self , f : Any , name : Optional [Any ] = ...) -> None : ...
101
104
def template_global (self , name : Optional [Any ] = ...): ...
102
105
def add_template_global (self , f : Any , name : Optional [Any ] = ...) -> None : ...
103
- def before_request (self , f : Any ) : ...
104
- def before_first_request (self , f : Any ) : ...
105
- def after_request (self , f : Any ) : ...
106
- def teardown_request (self , f : Any ) : ...
107
- def teardown_appcontext (self , f : Any ) : ...
106
+ def before_request (self , f : Callable [[], _T ]) -> Callable [[], _T ] : ...
107
+ def before_first_request (self , f : Callable [[], _T ]) -> Callable [[], _T ] : ...
108
+ def after_request (self , f : Callable [[ Response ], Response ]) -> Callable [[ Response ], Response ] : ...
109
+ def teardown_request (self , f : Callable [[ Optional [ Exception ]], _T ]) -> Callable [[ Optional [ Exception ]], _T ] : ...
110
+ def teardown_appcontext (self , f : Callable [[ Optional [ Exception ]], _T ]) -> Callable [[ Optional [ Exception ]], _T ] : ...
108
111
def context_processor (self , f : Any ): ...
109
112
def shell_context_processor (self , f : Any ): ...
110
113
def url_value_preprocessor (self , f : Any ): ...
@@ -131,6 +134,6 @@ class Flask(_PackageBoundObject):
131
134
def do_teardown_appcontext (self , exc : Any = ...) -> None : ...
132
135
def app_context (self ): ...
133
136
def request_context (self , environ : Any ): ...
134
- def test_request_context (self , * args : Any , ** kwargs : Any ): ...
137
+ def test_request_context (self , * args : Any , ** kwargs : Any ) -> ContextManager [ RequestContext ] : ...
135
138
def wsgi_app (self , environ : Any , start_response : Any ): ...
136
139
def __call__ (self , environ : Any , start_response : Any ): ...
0 commit comments