убрал неиспользуемый класс
This commit is contained in:
@@ -2,16 +2,17 @@ import os
|
||||
|
||||
|
||||
class BaseBackupCommand:
|
||||
def __init__(self, backupArguments):
|
||||
assert backupArguments is not None
|
||||
def __init__(self, folderPath):
|
||||
assert folderPath is not None
|
||||
|
||||
self.backupArguments = backupArguments
|
||||
self.folderPath = folderPath
|
||||
|
||||
def getAbsSrc(self):
|
||||
return self.getAbs(self.backupArguments.getSourceFolderName())
|
||||
return self.getAbs(self.folderPath)
|
||||
|
||||
def getAbsDst(self):
|
||||
return self.getAbs(self.backupArguments.getBackupFolderName())
|
||||
srcDirName = os.path.dirname(self.folderPath)
|
||||
return self.getAbs('backup'.format(srcDirName))
|
||||
|
||||
def getAbs(self, path):
|
||||
return os.path.abspath(path)
|
||||
@@ -3,12 +3,14 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
|
||||
|
||||
|
||||
class CreateBackupCommand(BaseBackupCommand):
|
||||
def __init__(self, backupArguments):
|
||||
BaseBackupCommand.__init__(self, backupArguments)
|
||||
def __init__(self, folderPath):
|
||||
BaseBackupCommand.__init__(self, folderPath)
|
||||
|
||||
def execute(self):
|
||||
src = self.getAbsSrc()
|
||||
backupDir = self.getAbsDst()
|
||||
|
||||
print src, backupDir
|
||||
|
||||
shutil.rmtree(backupDir, ignore_errors=True)
|
||||
shutil.copytree(src, backupDir, symlinks=False)
|
||||
|
||||
@@ -3,8 +3,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
|
||||
|
||||
|
||||
class RestoreBackupCommand(BaseBackupCommand):
|
||||
def __init__(self, backupArguments):
|
||||
BaseBackupCommand.__init__(self, backupArguments)
|
||||
def __init__(self, folderPath):
|
||||
BaseBackupCommand.__init__(self, folderPath)
|
||||
|
||||
def execute(self):
|
||||
src = self.getAbsSrc()
|
||||
|
||||
Reference in New Issue
Block a user