main.py 文件源码

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

项目:thunderbolt100k 作者: cuyu 项目源码 文件源码
def polling():
    for m in sys.modules['thunderbolt100k.widgets'].modules:
        if m.endswith('__init__.py'):
            continue

        widget_name = os.path.basename(m).replace('.py', '')
        widget = getattr(sys.modules['thunderbolt100k.widgets'], widget_name)
        if constants.CONFIG.get('{0}_INTERVAL'.format(widget.__name__.upper())):
            interval = int(constants.CONFIG.get('{0}_INTERVAL'.format(widget_name.upper())))
        else:
            interval = 5  # Default is 5 min if not specified
        schedule.every(interval).minutes.do(widget_main, widget)
        widget_main(widget)  # Run the function instantly and then schedule
    while True:
        schedule.run_pending()
        time.sleep(60)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号