pep8 - round 3

This commit is contained in:
Rob Weber 2019-11-26 10:49:17 -06:00
parent 95649c2b3f
commit 88341d9e1f
4 changed files with 12 additions and 9 deletions

View File

@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- call isdigit() method on the string directly instead of str.isdigit() (results in unicode error) - call isdigit() method on the string directly instead of str.isdigit() (results in unicode error)
- added flake8 testing to travis-ci - added flake8 testing to travis-ci
- updated code to make python3 compatible - updated code to make python3 compatible
- updated code for pep9 styling
### Removed ### Removed

View File

@ -16,7 +16,7 @@ class BackupSetManager:
self._readFile() self._readFile()
def addSet(self, aSet): def addSet(self, aSet):
self.paths[aSet['name']] = {'root': aSet['root'], 'dirs': [{"type":"include", "path": aSet['root'], 'recurse': True}]} self.paths[aSet['name']] = {'root': aSet['root'], 'dirs': [{"type": "include", "path": aSet['root'], 'recurse': True}]}
# save the file # save the file
self._writeFile() self._writeFile()
@ -60,7 +60,7 @@ class BackupSetManager:
aFile.close() aFile.close()
def _readFile(self): def _readFile(self):
if(xbmcvfs.exists(self.jsonFile)): if(xbmcvfs.exists(self.jsonFile)):
# read in the custom file # read in the custom file
@ -73,6 +73,7 @@ class BackupSetManager:
# write a blank file # write a blank file
self._writeFile() self._writeFile()
class AdvancedBackupEditor: class AdvancedBackupEditor:
dialog = None dialog = None
@ -128,7 +129,7 @@ class AdvancedBackupEditor:
elif(aDir['type'] == 'include'): elif(aDir['type'] == 'include'):
options.append(xbmcgui.ListItem(self._cleanPath(rootPath, aDir['path']), "%s: %s | %s: %s" % ("Type", utils.getString(30134), "Include Sub Folders", str(aDir['recurse'])))) options.append(xbmcgui.ListItem(self._cleanPath(rootPath, aDir['path']), "%s: %s | %s: %s" % ("Type", utils.getString(30134), "Include Sub Folders", str(aDir['recurse']))))
optionSelected = self.dialog.select(utils.getString(30122) + ' ' + name, options, useDetails=True) optionSelected = self.dialog.select(utils.getString(30122) + ' ' + name, options, useDetails=True)
if(optionSelected == 0 or optionSelected == 1): if(optionSelected == 0 or optionSelected == 1):
# add a folder, will equal root if cancel is hit # add a folder, will equal root if cancel is hit

View File

@ -33,7 +33,7 @@ class DropboxAuthorizer:
def isAuthorized(self): def isAuthorized(self):
user_token = self._getToken() user_token = self._getToken()
return user_token != '' return user_token != ''
def authorize(self): def authorize(self):
result = True result = True
@ -66,7 +66,7 @@ class DropboxAuthorizer:
utils.log("Error: %s" % (e,)) utils.log("Error: %s" % (e,))
result = False result = False
return result; return result
# return the DropboxClient, or None if can't be created # return the DropboxClient, or None if can't be created
def getClient(self): def getClient(self):

View File

@ -11,6 +11,7 @@ from . progressbar import BackupProgressBar
from resources.lib.guisettings import GuiSettingsManager from resources.lib.guisettings import GuiSettingsManager
from resources.lib.extractor import ZipExtractor from resources.lib.extractor import ZipExtractor
def folderSort(aKey): def folderSort(aKey):
result = aKey[0] result = aKey[0]
@ -56,7 +57,7 @@ class XbmcBackup:
self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2')) self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
utils.setSetting("remote_path", "") utils.setSetting("remote_path", "")
elif(utils.getSetting('remote_selection') == '0'): elif(utils.getSetting('remote_selection') == '0'):
self.remote_base_path = utils.getSetting('remote_path'); self.remote_base_path = utils.getSetting('remote_path')
self.remote_vfs = XBMCFileSystem(utils.getSetting("remote_path")) self.remote_vfs = XBMCFileSystem(utils.getSetting("remote_path"))
elif(utils.getSetting('remote_selection') == '2'): elif(utils.getSetting('remote_selection') == '2'):
self.remote_base_path = "/" self.remote_base_path = "/"
@ -252,7 +253,7 @@ class XbmcBackup:
return return
valFile = self._checkValidationFile(self.remote_vfs.root_path) valFile = self._checkValidationFile(self.remote_vfs.root_path)
if(valFile == None): if(valFile is None):
# don't continue # don't continue
return return
@ -274,7 +275,7 @@ class XbmcBackup:
self._createResumeBackupFile() self._createResumeBackupFile()
# do not continue running # do not continue running
xbmcgui.Dialog().ok(utils.getString(30077), utils.getString(30078)) xbmcgui.Dialog().ok(utils.getString(30077), utils.getString(30078))
return return
# use a multiselect dialog to select sets to restore # use a multiselect dialog to select sets to restore
@ -346,7 +347,7 @@ class XbmcBackup:
self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d%H%M") + "/") self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d%H%M") + "/")
progressBarTitle = progressBarTitle + utils.getString(30023) + ": " + utils.getString(30016) progressBarTitle = progressBarTitle + utils.getString(30023) + ": " + utils.getString(30016)
elif(mode == self.Restore and self.restore_point != None and self.remote_vfs.root_path != ''): elif(mode == self.Restore and self.restore_point is not None and self.remote_vfs.root_path != ''):
if(self.restore_point.split('.')[-1] != 'zip'): if(self.restore_point.split('.')[-1] != 'zip'):
self.remote_vfs.set_root(self.remote_vfs.root_path + self.restore_point + "/") self.remote_vfs.set_root(self.remote_vfs.root_path + self.restore_point + "/")
progressBarTitle = progressBarTitle + utils.getString(30023) + ": " + utils.getString(30017) progressBarTitle = progressBarTitle + utils.getString(30023) + ": " + utils.getString(30017)