本文整理汇总了Python中pypy.rlib.rope.multiply函数的典型用法代码示例。如果您正苦于以下问题:Python multiply函数的具体用法?Python multiply怎么用?Python multiply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了multiply函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: unicode_expandtabs__RopeUnicode_ANY
def unicode_expandtabs__RopeUnicode_ANY(space, w_self, w_tabsize):
from pypy.objspace.std.ropeobject import _tabindent
self = w_self._node
tabsize = space.int_w(w_tabsize)
splitted = rope.split(self, rope.LiteralStringNode.PREBUILT[ord('\t')])
last = splitted[0]
expanded = [last]
for i in range(1, len(splitted)):
expanded.append(rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")],
_tabindent(last, tabsize)))
last = splitted[i]
expanded.append(last)
return W_RopeUnicodeObject(rope.rebalance(expanded))
开发者ID:antoine1fr,项目名称:pygirl,代码行数:13,代码来源:ropeunicodeobject.py
示例2: unicode_expandtabs__RopeUnicode_ANY
def unicode_expandtabs__RopeUnicode_ANY(space, w_self, w_tabsize):
from pypy.objspace.std.ropeobject import _tabindent
self = w_self._node
tabsize = space.int_w(w_tabsize)
splitted = rope.split(self, rope.LiteralStringNode.PREBUILT[ord("\t")])
last = splitted[0]
expanded = [last]
for i in range(1, len(splitted)):
expanded.append(rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")], _tabindent(last, tabsize)))
last = splitted[i]
expanded.append(last)
try:
return W_RopeUnicodeObject(rope.rebalance(expanded))
except OverflowError:
raise OperationError(space.w_OverflowError, space.wrap("string too long"))
开发者ID:alkorzt,项目名称:pypy,代码行数:16,代码来源:ropeunicodeobject.py
示例3: str_expandtabs__Rope_ANY
def str_expandtabs__Rope_ANY(space, w_self, w_tabsize):
node = w_self._node
length = node.length()
if length == 0:
return W_RopeObject.EMPTY
tabsize = space.int_w(w_tabsize)
splitted = rope.split(node, rope.LiteralStringNode.PREBUILT[ord("\t")])
last = splitted[0]
expanded = [last]
for i in range(1, len(splitted)):
expanded.append(rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")],
_tabindent(last, tabsize)))
last = splitted[i]
expanded.append(last)
return W_RopeObject(rope.rebalance(expanded))
开发者ID:antoine1fr,项目名称:pygirl,代码行数:16,代码来源:ropeobject.py
示例4: W_RopeObject
if sl == 0:
return W_RopeObject.EMPTY
return W_RopeObject(rope.getslice(node, start, stop, 1, sl))
def mul_string_times(space, w_str, w_times):
try:
mul = space.getindex_w(w_times, space.w_OverflowError)
except OperationError, e:
if e.match(space, space.w_TypeError):
raise FailedToImplement
raise
if mul <= 0:
return W_RopeObject.EMPTY
node = w_str._node
try:
return W_RopeObject(rope.multiply(node, mul))
except OverflowError:
raise OperationError(space.w_OverflowError,
space.wrap("string too long"))
def mul__Rope_ANY(space, w_str, w_times):
return mul_string_times(space, w_str, w_times)
def mul__ANY_Rope(space, w_times, w_str):
return mul_string_times(space, w_str, w_times)
def add__Rope_Rope(space, w_left, w_right):
right = w_right._node
left = w_left._node
try:
return W_RopeObject(rope.concatenate(left, right))
开发者ID:gorakhargosh,项目名称:pypy,代码行数:31,代码来源:ropeobject.py
注:本文中的pypy.rlib.rope.multiply函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论