snooze.py 文件源码

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

项目:github-snooze-button 作者: tdsmith 项目源码 文件源码
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("config")
    args = parser.parse_args()

    config = parse_config(args.config)
    for name, repo in config.items():
        github_auth = (repo["github_username"], repo["github_password"])
        snooze_label = repo["snooze_label"]
        ignore_members_of = repo["ignore_members_of"]
        callback = lambda event, message: github_callback(event, message, github_auth,
                                                          snooze_label, ignore_members_of)
        listener = RepositoryListener(
            callbacks=[callback],
            events=LISTEN_EVENTS,
            **repo)
        t = threading.Thread(target=poll_forever, args=(listener, repo["poll_interval"]))
        t.daemon = True
        t.start()
    while True:
        # wait forever for a signal or an unusual termination
        if threading.active_count() < len(config) + 1:
            logging.error("Child polling thread quit!")
            return False
        time.sleep(1)
    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号