本文整理汇总了Python中pypy.rpython.ootypesystem.ootype.oostring函数的典型用法代码示例。如果您正苦于以下问题:Python oostring函数的具体用法?Python oostring怎么用?Python oostring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了oostring函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: f
def f(n):
obj1 = ootype.new(A)
obj2 = ootype.new(B)
s1 = ootype.oostring(obj1, -1)
s2 = ootype.oostring(obj2, -1)
ch1 = s1.ll_stritem_nonneg(1)
ch2 = s2.ll_stritem_nonneg(1)
return ord(ch1) + ord(ch2)
示例2: ll_int2oct
def ll_int2oct(i, addPrefix):
if not addPrefix or i==0:
return oostring(i, 8)
buf = new(StringBuilder)
if i<0:
if i == SPECIAL_VALUE:
return SPECIAL_VALUE_OCT
i = -i
buf.ll_append_char('-')
buf.ll_append_char('0')
buf.ll_append(oostring(i, 8))
return buf.ll_build()
示例3: ll_int2hex
def ll_int2hex(i, addPrefix):
if not addPrefix:
return oostring(i, 16)
buf = new(StringBuilder)
if i<0:
if i == SPECIAL_VALUE:
return SPECIAL_VALUE_HEX
i = -i
buf.ll_append_char('-')
buf.ll_append_char('0')
buf.ll_append_char('x')
buf.ll_append(oostring(i, 16))
return buf.ll_build()
示例4: ll_str
def ll_str(self, val):
return ootype.oostring(self.name, -1)
示例5: oof
def oof():
return ootype.oostring(42, -1)
示例6: fn
def fn(c):
s1 = ootype.oostring("xy", -1)
s2 = ootype.oostring("x" + chr(c), -1)
assert (hash_whatever(ootype.typeOf(s1), s1) ==
hash_whatever(ootype.typeOf(s2), s2))
assert equal_whatever(ootype.typeOf(s1), s1, s2)
示例7: ll_float_str
def ll_float_str(repr, f):
return oostring(f, -1)
示例8: op_oostring
def op_oostring(self, obj, base):
return ootype.oostring(obj, base)
示例9: to_rstr
def to_rstr(s):
return ootype.oostring(s, -1)
示例10: oofakeimpl
def oofakeimpl(x, code, precision, flags):
return ootype.oostring(rfloat.formatd(x, code, precision, flags), -1)
示例11: fn
def fn(i):
s = ootype.oostring(42, -1)
meth = s.ll_stritem_nonneg
args = (i,)
return meth(*args)
示例12: to_rstr
def to_rstr(s):
if s is None:
return ootype.null(ootype.String)
return ootype.oostring(s, -1)
示例13: ll_int2dec
def ll_int2dec(i):
return oostring(i, 10)
示例14: test_oohash
def test_oohash(self):
def f(n):
s = ootype.oostring(n, -1)
return s.ll_hash()
res = self.interp_operations(f, [5])
assert res == ootype.oostring(5, -1).ll_hash()
示例15: ll_str
def ll_str(self, instance):
return ootype.oostring(instance, -1)