当前位置: 首页>>代码示例>>Python>>正文


Python Translation.viewcg方法代码示例

本文整理汇总了Python中pypy.translator.interactive.Translation.viewcg方法的典型用法代码示例。如果您正苦于以下问题:Python Translation.viewcg方法的具体用法?Python Translation.viewcg怎么用?Python Translation.viewcg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.translator.interactive.Translation的用法示例。


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

示例1: _makefunc_str_int

# 需要导入模块: from pypy.translator.interactive import Translation [as 别名]
# 或者: from pypy.translator.interactive.Translation import viewcg [as 别名]
    def _makefunc_str_int(cls, f):
        def main(argv):
            arg0 = argv[1]
            arg1 = int(argv[2])
            try:
                res = f(arg0, arg1)
            except MemoryError:
                print "MEMORY-ERROR"
            else:
                print res
            return 0
        
        t = Translation(main, standalone=True, gc=cls.gcpolicy,
                        policy=annpolicy.StrictAnnotatorPolicy(),
                        taggedpointers=cls.taggedpointers,
                        gcremovetypeptr=cls.removetypeptr)
        t.disable(['backendopt'])
        t.set_backend_extra_options(c_debug_defines=True)
        t.rtype()
        if conftest.option.view:
            t.viewcg()
        exename = t.compile()

        def run(s, i):
            data = py.process.cmdexec("%s %s %d" % (exename, s, i))
            data = data.strip()
            if data == 'MEMORY-ERROR':
                raise MemoryError
            return data

        return run
开发者ID:pombredanne,项目名称:pypy,代码行数:33,代码来源:test_newgc.py

示例2: NN

# 需要导入模块: from pypy.translator.interactive import Translation [as 别名]
# 或者: from pypy.translator.interactive.Translation import viewcg [as 别名]
    n = NN(2, 3, 1)
    # train it with some patterns
    n.train(pat, 2000)
    # test it
    n.test(pat)



if __name__ == '__main__':
    print 'Loading...'
    from pypy.translator.interactive import Translation
    t = Translation(demo)
    
    print 'Annotating...'
    t.annotate([])
    t.viewcg()

    print 'Specializing...'
    t.rtype()   # enable this to see (some) lower-level Cish operations
    
    print 'Compiling...'
    f = t.compile_c()

    print 'Running...'
    T = time.time()
    for i in range(10):
        f()
    t1 = time.time() - T
    print "that took", t1

    T = time.time()
开发者ID:antoine1fr,项目名称:pygirl,代码行数:33,代码来源:bpnn.py

示例3: test_annotated

# 需要导入模块: from pypy.translator.interactive import Translation [as 别名]
# 或者: from pypy.translator.interactive.Translation import viewcg [as 别名]
def test_annotated():
    from pypy.translator.interactive import Translation
    t = Translation(is_prime)
    t.annotate([int])
    t.viewcg()
开发者ID:Don-Tan,项目名称:pypy,代码行数:7,代码来源:test_translator.py


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