statusicon.py 文件源码

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

项目:sc-controller 作者: kozec 项目源码 文件源码
def get_status_icon(*args, **kwargs):
    # Try selecting backend based on environment variable
    if "STATUS_BACKEND" in os.environ:
        kwargs["force"] = True

        status_icon_backend_name = "StatusIcon%s" % (os.environ.get("STATUS_BACKEND"))
        if status_icon_backend_name in globals():
            try:
                status_icon = globals()[status_icon_backend_name](*args, **kwargs)
                log.info("StatusIcon: Using requested backend %s" % (status_icon_backend_name))
                return status_icon
            except NotImplementedError:
                log.error("StatusIcon: Requested backend %s is not supported" % (status_icon_backend_name))
        else:
            log.error("StatusIcon: Requested backend %s does not exist" % (status_icon_backend_name))

        return StatusIconDummy(*args, **kwargs)

    # Use proxy backend to determine the correct backend while the application is running
    return StatusIconProxy(*args, **kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号