本文整理汇总了Python中pypy.annotation.model.annotation_to_lltype函数的典型用法代码示例。如果您正苦于以下问题:Python annotation_to_lltype函数的具体用法?Python annotation_to_lltype怎么用?Python annotation_to_lltype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了annotation_to_lltype函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: lowlevelspecialize
def lowlevelspecialize(funcdesc, args_s, key_for_args):
args_s, key1, ignored, builder = flatten_star_args(funcdesc, args_s)
key = []
new_args_s = []
for i, s_obj in enumerate(args_s):
if i in key_for_args:
key.append(key_for_args[i])
new_args_s.append(s_obj)
elif isinstance(s_obj, annmodel.SomePBC):
assert s_obj.is_constant(), "ambiguous low-level helper specialization"
key.append(KeyComp(s_obj.const))
new_args_s.append(s_obj)
else:
new_args_s.append(annmodel.not_const(s_obj))
try:
key.append(annmodel.annotation_to_lltype(s_obj))
except ValueError:
# passing non-low-level types to a ll_* function is allowed
# for module/ll_*
key.append(s_obj.__class__)
key = (tuple(key),)
if key1 is not None:
key += (key1,)
flowgraph = funcdesc.cachedgraph(key, builder=builder)
args_s[:] = new_args_s
return flowgraph
开发者ID:AishwaryaKM,项目名称:python-tutorial,代码行数:26,代码来源:annlowlevel.py
示例2: annotation_to_lltype
def annotation_to_lltype(cls, ann):
if isinstance(ann, SomeChar):
return ootype.Char
elif isinstance(ann, SomeString):
return ootype.String
else:
return annotation_to_lltype(ann)
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:7,代码来源:dotnet.py
示例3: default_specialize
def default_specialize(funcdesc, args_s):
key = []
new_args_s = []
for s_obj in args_s:
if isinstance(s_obj, annmodel.SomePBC):
assert s_obj.is_constant(), "ambiguous low-level helper specialization"
key.append(KeyComp(s_obj.const))
new_args_s.append(s_obj)
else:
new_args_s.append(annmodel.not_const(s_obj))
try:
key.append(annmodel.annotation_to_lltype(s_obj))
except ValueError:
# passing non-low-level types to a ll_* function is allowed
# for module/ll_*
key.append(s_obj.__class__)
flowgraph = funcdesc.cachedgraph(tuple(key))
args_s[:] = new_args_s
return flowgraph
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:19,代码来源:annlowlevel.py
示例4: cast_primitive
def cast_primitive(T, s_v):
assert T.is_constant()
return ll_to_annotation(lltype.cast_primitive(T.const, annotation_to_lltype(s_v)._defl()))
开发者ID:alkorzt,项目名称:pypy,代码行数:3,代码来源:builtin.py
示例5: typeOf
def typeOf(s_val):
lltype = annotation_to_lltype(s_val, info="in typeOf(): ")
return immutablevalue(lltype)
开发者ID:alkorzt,项目名称:pypy,代码行数:3,代码来源:builtin.py
示例6: specialize__genconst
def specialize__genconst(pol, funcdesc, args_s, i):
# XXX this is specific to the JIT
TYPE = annmodel.annotation_to_lltype(args_s[i], 'genconst')
args_s[i] = annmodel.lltype_to_annotation(TYPE)
alt_name = funcdesc.name + "__%s" % (TYPE._short_name(),)
return funcdesc.cachedgraph(TYPE, alt_name=valid_identifier(alt_name))
开发者ID:AishwaryaKM,项目名称:python-tutorial,代码行数:6,代码来源:annlowlevel.py
示例7: annotation_to_lltype
def annotation_to_lltype(cls, ann):
from pypy.annotation import model as annmodel
return annmodel.annotation_to_lltype(ann)
开发者ID:antoine1fr,项目名称:pygirl,代码行数:3,代码来源:ootype.py
示例8: annotation_to_cts
def annotation_to_cts(self, _tp):
s_tp = annotation(_tp)
TP = annotation_to_lltype(s_tp)
return self.lltype_to_cts(TP)
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:4,代码来源:database.py
示例9: simple_call
def simple_call(m, *args_s):
llargs = [annotation_to_lltype(arg_s)._example() for arg_s in args_s]
smeth = m.method._example()
v = smeth(*llargs)
return ll_to_annotation(v)
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:5,代码来源:unaryop.py
注:本文中的pypy.annotation.model.annotation_to_lltype函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论