本文整理汇总了Python中Move.Move.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Move.execute方法的具体用法?Python Move.execute怎么用?Python Move.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Move.Move
的用法示例。
在下文中一共展示了Move.execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Move import Move [as 别名]
# 或者: from Move.Move import execute [as 别名]
class Remove:
trashPath = 'Operate/TrashBox'
#
# [String] targetEntries : 作成するディレクトリ名
#
def __init__(self, targetEntries):
self.targetEntries = targetEntries
self.move = None
#
# 実行
#
def execute(self):
self.move = None
pairPaths = []
for targetEntry in self.targetEntries:
entryName = targetEntry.rsplit(os.sep, 1)[1]
inTrashPath = os.path.join(Remove.trashPath, entryName)
pairPaths.append(PairPath(targetEntry, inTrashPath))
self.move = Move(pairPaths)
self.move.execute()
#
# 実行取り消し
#
def unexecute(self):
self.move.unexecute()
示例2: test
# 需要导入模块: from Move import Move [as 别名]
# 或者: from Move.Move import execute [as 别名]
def test(self):
pairPaths1 = []
pairPaths2 = []
src1 = Base.joinRootPath('OriginA.txt')
dst1 = Base.joinRootPath('OriginA_moved.txt')
pairPaths1.append(PairPath(src1, dst1))
src2 = Base.joinRootPath('OriginA')
dst2 = Base.joinRootPath('OriginA_moved')
pairPaths1.append(PairPath(src2, dst2))
src3 = Base.joinRootPath('OriginX/OriginY.txt')
dst3 = Base.joinRootPath('OriginX/OriginY_moved.txt')
pairPaths2.append(PairPath(src3, dst3))
src4 = Base.joinRootPath('OriginX/OriginY')
dst4 = Base.joinRootPath('OriginX/OriginY_moved')
pairPaths2.append(PairPath(src4, dst4))
sut1 = Move(pairPaths1)
sut2 = Move(pairPaths2)
eq_(Base.isExists(src1), True)
eq_(Base.isExists(dst1), False)
eq_(Base.isExists(src2), True)
eq_(Base.isExists(dst2), False)
eq_(Base.isExists(src3), True)
eq_(Base.isExists(dst3), False)
eq_(Base.isExists(src4), True)
eq_(Base.isExists(dst4), False)
sut1.execute()
eq_(Base.isExists(src1), False)
eq_(Base.isExists(dst1), True)
eq_(Base.isExists(src2), False)
eq_(Base.isExists(dst2), True)
eq_(Base.isExists(src3), True)
eq_(Base.isExists(dst3), False)
eq_(Base.isExists(src4), True)
eq_(Base.isExists(dst4), False)
sut2.execute()
eq_(Base.isExists(src1), False)
eq_(Base.isExists(dst1), True)
eq_(Base.isExists(src2), False)
eq_(Base.isExists(dst2), True)
eq_(Base.isExists(src3), False)
eq_(Base.isExists(dst3), True)
eq_(Base.isExists(src4), False)
eq_(Base.isExists(dst4), True)
sut2.unexecute()
eq_(Base.isExists(src1), False)
eq_(Base.isExists(dst1), True)
eq_(Base.isExists(src2), False)
eq_(Base.isExists(dst2), True)
eq_(Base.isExists(src3), True)
eq_(Base.isExists(dst3), False)
eq_(Base.isExists(src4), True)
eq_(Base.isExists(dst4), False)
sut1.unexecute()
eq_(Base.isExists(src1), True)
eq_(Base.isExists(dst1), False)
eq_(Base.isExists(src2), True)
eq_(Base.isExists(dst2), False)
eq_(Base.isExists(src3), True)
eq_(Base.isExists(dst3), False)
eq_(Base.isExists(src4), True)
eq_(Base.isExists(dst4), False)