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

Python model.SomeObject类代码示例

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

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



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

示例1: union

 def union((obj1, obj2)):
     if obj1 == obj2:
         return obj1
     else:
         result = SomeObject()
         if obj1.knowntype == obj2.knowntype and obj1.knowntype != object:
             result.knowntype = obj1.knowntype
         is_type_of1 = getattr(obj1, 'is_type_of', None)
         is_type_of2 = getattr(obj2, 'is_type_of', None)
         if obj1.is_immutable_constant() and obj2.is_immutable_constant() and obj1.const == obj2.const:
             result.const = obj1.const
             is_type_of = {}
             if is_type_of1:
                 for v in is_type_of1:
                     is_type_of[v] = True
             if is_type_of2:
                 for v in is_type_of2:
                     is_type_of[v] = True
             if is_type_of:
                 result.is_type_of = is_type_of.keys()
         else:
             if is_type_of1 and is_type_of1 == is_type_of2:
                 result.is_type_of = is_type_of1
         # try to preserve the origin of SomeObjects
         if obj1 == result:
             result = obj1
         elif obj2 == result:
             result = obj2
         unioncheck(result)
         return result
开发者ID:alkorzt,项目名称:pypy,代码行数:30,代码来源:binaryop.py


示例2: newtuple

 def newtuple(self, items_s):
     if len(items_s) == 1 and items_s[0] is Ellipsis:
         res = SomeObject()   # hack to get a SomeObject as the *arg
         res.from_ellipsis = True
         return res
     else:
         return SomeTuple(items_s)
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:7,代码来源:bookkeeper.py


示例3: annotationoftype

def annotationoftype(t, bookkeeper=False):
    from pypy.rpython import extregistry

    """The most precise SomeValue instance that contains all
    objects of type t."""
    assert isinstance(t, (type, types.ClassType))
    if t is bool:
        return SomeBool()
    elif t is int:
        return SomeInteger()
    elif t is float:
        return SomeFloat()
    elif issubclass(t, str): # py.lib uses annotated str subclasses
        return SomeString()
    elif t is unicode:
        return SomeUnicodeString()
    elif t is list:
        return SomeList(MOST_GENERAL_LISTDEF)
    elif t is dict:
        return SomeDict(MOST_GENERAL_DICTDEF)
    # can't do tuple
    elif t is types.NoneType:
        return s_None
    elif bookkeeper and extregistry.is_registered_type(t, bookkeeper.policy):
        entry = extregistry.lookup_type(t, bookkeeper.policy)
        return entry.compute_annotation_bk(bookkeeper)
    elif bookkeeper and t.__module__ != '__builtin__' and t not in bookkeeper.pbctypes:
        classdef = bookkeeper.getuniqueclassdef(t)
        return SomeInstance(classdef)
    else:
        o = SomeObject()
        if t != object:
            o.knowntype = t
        return o
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:34,代码来源:signature.py


示例4: newtuple

 def newtuple(self, items_s):
     if items_s == [Ellipsis]:
         res = SomeObject()   # hack to get a SomeObject as the *arg
         res.from_ellipsis = True
         return res
     else:
         return SomeTuple(items_s)
开发者ID:alkorzt,项目名称:pypy,代码行数:7,代码来源:bookkeeper.py


示例5: find_method

 def find_method(obj, name):
     "Look for a special-case implementation for the named method."
     type_analyser = builtin.EXTERNAL_TYPE_ANALYZERS[obj.knowntype]
     if name in type_analyser:
         analyser = type_analyser[name]
         return SomeBuiltin(analyser, obj, name)
     return SomeObject.find_method(obj, name)
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:7,代码来源:unaryop.py


示例6: simple_call

 def simple_call(self, *s_args):
     from pypy.translator.cli.query import get_cli_class
     DELEGATE = get_cli_class('System.Delegate')._INSTANCE
     if ootype.isSubclass(self.ootype, DELEGATE):
         s_invoke = self.getattr(immutablevalue('Invoke'))
         return s_invoke.simple_call(*s_args)
     else:
         # cannot call a non-delegate
         return SomeObject.simple_call(self, *s_args)
开发者ID:alkorzt,项目名称:pypy,代码行数:9,代码来源:dotnet.py


示例7: compute_result_annotation

 def compute_result_annotation(self, s_obj):
     if s_None.contains(s_obj):
         return s_obj
     assert isinstance(s_obj, (SomeString, SomeUnicodeString))
     if s_obj.no_nul:
         return s_obj
     new_s_obj = SomeObject.__new__(s_obj.__class__)
     new_s_obj.__dict__ = s_obj.__dict__.copy()
     new_s_obj.no_nul = True
     return new_s_obj
开发者ID:,项目名称:,代码行数:10,代码来源:


示例8: getattr

 def getattr(p, s_attr):
     if s_attr.is_constant() and isinstance(s_attr.const, str):
         # XXX kill with extfunctable.py
         if p.knowntype in builtin.EXTERNAL_TYPE_ANALYZERS:
             return SomeObject.getattr(p, s_attr)
         
         attr = s_attr.const
         entry = extregistry.lookup_type(p.knowntype)
         s_value = entry.get_field_annotation(p.knowntype, attr)
         return s_value
     else:
         return SomeObject()
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:12,代码来源:unaryop.py


示例9: getattr

 def getattr(s_array, s_attr):
     s = None
     if s_attr.is_constant() and isinstance(s_attr.const, str):
         attr = s_attr.const
         if attr == 'shape':
             s = SomeTuple([SomeInteger()]*s_array.ndim)
         elif attr == 'ndim':
             s = SomeInteger()
         elif attr == 'dtype':
             s = SomeChar()
     if s is None:
         return SomeObject.getattr(s_array, s_attr)
     return s
开发者ID:alkorzt,项目名称:pypy,代码行数:13,代码来源:aarray.py


示例10: len

 def len(p):
     length = p.ll_ptrtype._example()._fixedlength()
     if length is None:
         return SomeObject.len(p)
     else:
         return immutablevalue(length)
开发者ID:,项目名称:,代码行数:6,代码来源:


示例11: len

 def len(dct):
     s_key = dct.dictdef.read_key()
     s_value = dct.dictdef.read_value()
     if isinstance(s_key, SomeImpossibleValue) or isinstance(s_value, SomeImpossibleValue):
         return immutablevalue(0)
     return SomeObject.len(dct)
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:6,代码来源:unaryop.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python policy.AnnotatorPolicy类代码示例发布时间:2022-05-27
下一篇:
Python model.SomeBool类代码示例发布时间: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