uploader.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:combine 作者: llllllllll 项目源码 文件源码
def build_app(model_cache_dir,
              token_secret,
              client,
              bot_user,
              github_url,
              email_address,
              gunicorn_options):
    """Build the app object.

    Parameters
    ----------
    model_cache_dir : path-like
        The path to the model directory.
    token_secret : bytes
        The shared secret for the uploader and irc server.
    client : Library
        The client used to fetch beatmaps.
    bot_user : str
        The username of the bot.
    github_url : str
        The url of the repo on github.
    email_address : str
        The email address for support / comments.
    gunicorn_options : dict
        Options to forward to gunicorn.

    Returns
    -------
    app : App
        The app to run.
    """
    inner_app = flask.Flask(__name__)
    inner_app.register_blueprint(
        api,
        model_cache_dir=pathlib.Path(model_cache_dir),
        token_secret=Fernet(token_secret),
        client=client,
        bot_user=bot_user,
        github_url=github_url,
        email_address=email_address,
    )

    class app(BaseApplication):
        def load(self):
            return inner_app

        def load_config(self, *, _cfg=gunicorn_options):
            for k, v in _cfg.items():
                k = k.lower()
                if k in self.cfg.settings and v is not None:
                    self.cfg.set(k.lower(), v)

    return app()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号