22import logging .config
33import os
44import os .path
5+ import typing as t
56from contextlib import contextmanager
67from datetime import datetime , UTC
78
@@ -41,8 +42,9 @@ def create_app(**kwargs) -> Flask:
4142 return init_app (Flask ("sipa" ), ** kwargs )
4243
4344
44- def init_app (app , ** kwargs ) -> Flask :
45+ def init_app (app : Flask , config : dict [ str , t . Any ] | None = None ) -> Flask :
4546 """Initialize the Flask app located in the module sipa.
47+
4648 This initializes the Flask app by:
4749
4850 * calling the internal init_app() procedures of each module
@@ -51,7 +53,7 @@ def init_app(app, **kwargs) -> Flask:
5153 """
5254 # this is horribly confusing: if an app is given, we completely ignore the `app`s config,
5355 # and overwrite it with the `default` one.
54- load_config_file (app , config = kwargs . pop ( ' config' , None ) )
56+ load_config_file (app , config = config )
5557 app .wsgi_app = ProxyFix (app .wsgi_app , x_for = app .config ['NUM_PROXIES' ])
5658 init_logging (app )
5759 init_env_and_config (app )
@@ -108,7 +110,7 @@ def init_app(app, **kwargs) -> Flask:
108110 return app
109111
110112
111- def load_config_file (app , config = None ):
113+ def load_config_file (app : Flask , config : dict [ str , t . Any ] | None = None ):
112114 """Just load the config file, do nothing else"""
113115 # default configuration
114116 from .config import default
0 commit comments