state.py 文件源码

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

项目:constantina 作者: wwoast 项目源码 文件源码
def out_of_content(self, card_count):
        """
        Count the number of cards that are part of our page counting. If we've
        already displayed this number of cards, we are out of content.
        """
        card_limit = 0
        for application in self.config.get("applications", "enabled").replace(" ", "").split(","):
            app_state = getattr(self, application)
            for ctype in app_state.config.get("card_properties", "pagecount").replace(" ", "").split(","):
                if ctype in app_state.config.get("card_properties", "randomize"):
                    card_limit += self.page * app_state.config.getint("card_counts", ctype)
                else:
                    card_limit = card_limit + getattr(app_state, ctype).file_count
        syslog.syslog("card_limit: " + str(card_limit) + "   card_count: " + str(card_count))
        if card_count >= card_limit:
            return True
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号