filters.py 文件源码

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

项目:QualquerMerdaAPI 作者: tiagovizoto 项目源码 文件源码
def __call__(self, tokens):
        from itertools import tee

        count = len(self.filters)
        # Tee the token iterator and wrap each teed iterator with the
        # corresponding filter
        gens = [filter(t.copy() for t in gen) for filter, gen
                in zip(self.filters, tee(tokens, count))]
        # Keep a count of the number of running iterators
        running = count
        while running:
            for i, gen in enumerate(gens):
                if gen is not None:
                    try:
                        yield next(gen)
                    except StopIteration:
                        gens[i] = None
                        running -= 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号