本文整理汇总了Python中block.Block.append方法的典型用法代码示例。如果您正苦于以下问题:Python Block.append方法的具体用法?Python Block.append怎么用?Python Block.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block.Block
的用法示例。
在下文中一共展示了Block.append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __merge
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import append [as 别名]
def __merge(self,ns_list):
block_li = [] # 文本块列表
block = Block() # 文本块
for i in range(len(ns_list)):
if ns_list[i]['offset'] >= 1:#thr:
# 大于或等于阈值,保存上一个块,划给新块
if not block.is_empty():
block_li.append( block )
block = Block() # 新增文本块
if ns_list[i]['node'] and ns_list[i]['node'].string.strip():
block.append( ns_list[i]['node'] )
return block_li
示例2: polarArray
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import append [as 别名]
def polarArray(geom,numberOfCopies,totalAngle=2*pi,center=Point(0,0)):
'''
array geometric entity in a polar pattern
'''
b = Block()
theta_step = totalAngle / numberOfCopies
theta = 0.0
for i in range(numberOfCopies):
g = rotateAboutPoint(geom,center,theta)
b.append(g)
theta += theta_step
return b
示例3: rectArray
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import append [as 别名]
def rectArray(geom,xNum,xStep,yNum=1,yStep=None):
'''
array geometric entity in a rectangular pattern
'''
b = Block()
y = 0.0
for j in range(yNum):
x = 0.0
for i in range(xNum):
t = AffineMatrix().translation(Vector(x,y,0.0))
b.append(t * geom)
x += xStep
y += yStep
return b
示例4: split_blocks
# 需要导入模块: from block import Block [as 别名]
# 或者: from block.Block import append [as 别名]
def split_blocks(lines):
block = None
for line in lines:
line = line.strip()
idx = line.find(';') # comment
if idx != -1:
line = line[:idx]
tokens = line.split()
if len(tokens) == 0:
continue
label = inst = None
if tokens[0][-1:] == ':':
label = tokens.pop(0)[:-1]
if len(tokens) > 0:
opcode = tokens.pop(0)
oprands = tokens
inst = Instruction(opcode, oprands)
if label:
if block is None: # the first run
block = Block(label)
else:
block.set_passthru(Block.NEXT_BLOCK)
if len(block.instructions) == 0:
block.relabel(label)
else:
block = Block(label)
elif block is None:
block = Block(label)
if inst and inst.opcode[:1] != '.':
block.append(inst)
if inst.opcode[:1] == 'b': # branch
block.set_branch(inst.oprands[0])
block.set_passthru(Block.NEXT_BLOCK)
block = None
elif inst.opcode == 'jmp': # jump
block.set_passthru(inst.oprands[0])
block = None
elif inst.opcode == 'rts': # return subroutine
block.set_return(True)
block = None