• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.itervalues函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numba.utils.itervalues函数的典型用法代码示例。如果您正苦于以下问题:Python itervalues函数的具体用法?Python itervalues怎么用?Python itervalues使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了itervalues函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: seed_return

 def seed_return(self, typ):
     """Seeding of return value is optional.
     """
     for blk in utils.itervalues(self.blocks):
         inst = blk.terminator
         if isinstance(inst, ir.Return):
             self.typevars[inst.value.name].lock(typ)
开发者ID:CaptainAL,项目名称:Spyder,代码行数:7,代码来源:typeinfer.py


示例2: _get_return_vars

 def _get_return_vars(self):
     rets = []
     for blk in utils.itervalues(self.blocks):
         inst = blk.terminator
         if isinstance(inst, ir.Return):
             rets.append(inst.value)
     return rets
开发者ID:MPOWER4RU,项目名称:numba,代码行数:7,代码来源:typeinfer.py


示例3: run

    def run(self):
        for inst in self._iter_inst():
            fname = "op_%s" % inst.opname
            fn = getattr(self, fname, None)
            if fn is not None:
                fn(inst)
            else:
                # this catches e.g. try... except
                if inst.is_jump:
                    l = Loc(self.bytecode.func_id.filename, inst.lineno)
                    msg = "Use of unsupported opcode (%s) found" % inst.opname
                    raise UnsupportedError(msg, loc=l)

        # Close all blocks
        for cur, nxt in zip(self.blockseq, self.blockseq[1:]):
            blk = self.blocks[cur]
            if not blk.outgoing_jumps and not blk.terminating:
                blk.outgoing_jumps[nxt] = 0

        graph = CFGraph()
        for b in self.blocks:
            graph.add_node(b)
        for b in self.blocks.values():
            for out, pops in b.outgoing_jumps.items():
                graph.add_edge(b.offset, out, pops)
        graph.set_entry_point(min(self.blocks))
        graph.process()
        self.graph = graph

        # Fill incoming
        for b in utils.itervalues(self.blocks):
            for out, pops in b.outgoing_jumps.items():
                self.blocks[out].incoming_jumps[b.offset] = pops

        # Find liveblocks
        self.liveblocks = dict((i, self.blocks[i])
                               for i in self.graph.nodes())

        for lastblk in reversed(self.blockseq):
            if lastblk in self.liveblocks:
                break
        else:
            raise AssertionError("No live block that exits!?")

        # Find backbone
        backbone = self.graph.backbone()
        # Filter out in loop blocks (Assuming no other cyclic control blocks)
        # This is to unavoid variable defined in loops to be considered as
        # function scope.
        inloopblocks = set()

        for b in self.blocks.keys():
            for s, e in self._loops:
                if s <= b < e:
                    inloopblocks.add(b)

        self.backbone = backbone - inloopblocks
开发者ID:numba,项目名称:numba,代码行数:57,代码来源:controlflow.py


示例4: get_return_type

    def get_return_type(self, typemap):
        rettypes = set()
        for blk in utils.itervalues(self.blocks):
            term = blk.terminator
            if isinstance(term, ir.Return):
                rettypes.add(typemap[term.value.name])

        if rettypes:
            return self.context.unify_types(*rettypes)
        else:
            return types.none
开发者ID:ibtawfik,项目名称:numba,代码行数:11,代码来源:typeinfer.py


示例5: get_return_type

    def get_return_type(self, typemap):
        rettypes = set()
        for blk in utils.itervalues(self.blocks):
            term = blk.terminator
            if isinstance(term, ir.Return):
                rettypes.add(typemap[term.value.name])

        if rettypes:
            unified = self.context.unify_types(*rettypes)
            if unified is types.pyobject:
                raise TypingError("Can't unify return type from the "
                                  "following types: %s"
                                  % ", ".join(sorted(map(str, rettypes))))
            return unified
        else:
            return types.none
开发者ID:CaptainAL,项目名称:Spyder,代码行数:16,代码来源:typeinfer.py


示例6: get_return_type

    def get_return_type(self, typemap):
        rettypes = set()
        for blk in utils.itervalues(self.blocks):
            term = blk.terminator
            if isinstance(term, ir.Return):
                rettypes.add(typemap[term.value.name])

        if types.none in rettypes:
            # Special case None return
            rettypes = rettypes - set([types.none])
            if rettypes:
                unified = self.context.unify_types(*rettypes)
                return types.Optional(unified)
            else:
                return types.none
        elif rettypes:
            unified = self.context.unify_types(*rettypes)
            return unified
        else:
            return types.none
开发者ID:ymarfoq,项目名称:outilACVDesagregation,代码行数:20,代码来源:typeinfer.py


示例7: run_block

    def run_block(self, blk):
        tempassign = {}
        removeset = set()

        for offset, inst in enumerate(blk.body):
            self.mark_asssignment(tempassign, offset, inst)

        for bag in utils.itervalues(tempassign):
            if len(bag) == 2:
                off1, off2 = bag
                first = blk.body[off1]
                second = blk.body[off2]
                inst = ir.Assign(value=first.value, target=second.target,
                                 loc=first.loc)
                # Replacement the second instruction
                blk.body[off2] = inst
                # Remove the first
                removeset.add(off1)

        # Remove from the highest offset to the lowest to preserve order
        for off in reversed(sorted(removeset)):
            del blk.body[off]
开发者ID:CaptainAL,项目名称:Spyder,代码行数:22,代码来源:irpasses.py


示例8: get_state_token

 def get_state_token(self):
     """The algorithm is monotonic.  It can only grow the typesets.
     The sum of all lengths of type sets is a cheap and accurate
     description of our progress.
     """
     return sum(len(tv) for tv in utils.itervalues(self.typevars))
开发者ID:CaptainAL,项目名称:Spyder,代码行数:6,代码来源:typeinfer.py


示例9: build_constrain

 def build_constrain(self):
     for blk in utils.itervalues(self.blocks):
         for inst in blk.body:
             self.constrain_statement(inst)
开发者ID:CaptainAL,项目名称:Spyder,代码行数:4,代码来源:typeinfer.py


示例10: dump

 def dump(self):
     for blk in utils.itervalues(self.infos):
         blk.dump()
开发者ID:esc,项目名称:numba,代码行数:3,代码来源:dataflow.py


示例11: __iter__

 def __iter__(self):
     return utils.itervalues(self.table)
开发者ID:sklam,项目名称:numba,代码行数:2,代码来源:bytecode.py



注:本文中的numba.utils.itervalues函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.pysignature函数代码示例发布时间:2022-05-27
下一篇:
Python utils.iteritems函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap