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)
def len(self): from rpython.annotator.bookkeeper import getbookkeeper length = self.ll_ptrtype._example()._fixedlength() if length is None: return SomeObject.len(self) else: return getbookkeeper().immutablevalue(length)
def simple_call(self, *s_args): from rpython.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)
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
def op_contains(self, s_element): if s_element.is_constant() and s_element.const == "\0": r = SomeBool() bk = getbookkeeper() op = bk._find_current_op(opname="contains", arity=2, pos=0, s_type=self) knowntypedata = {} add_knowntypedata(knowntypedata, False, [op.args[0]], self.nonnulify()) r.set_knowntypedata(knowntypedata) return r else: return SomeObject.op_contains(self, s_element)
def len(self): position = getbookkeeper().position_key s_item = self.listdef.read_item(position) if isinstance(s_item, SomeImpossibleValue): return immutablevalue(0) return SomeObject.len(self)
def len(self): s_item = self.listdef.read_item() if isinstance(s_item, SomeImpossibleValue): return immutablevalue(0) return SomeObject.len(self)
def len(self): if self._is_empty(): return immutablevalue(0) return SomeObject.len(self)
def len(p): length = p.ll_ptrtype._example()._fixedlength() if length is None: return SomeObject.len(p) else: return immutablevalue(length)
def len(self): position = getbookkeeper().position_key if self._is_empty(position): return immutablevalue(0) return SomeObject.len(self)
def len(dct): if dct._is_empty(): return immutablevalue(0) return SomeObject.len(dct)