From 6dfa4a5520d71ffce912f8f1561c7ab338be4079 Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Mon, 30 Sep 2019 14:06:50 -0500 Subject: [PATCH] minor code fixes based on travis-ci output --- resources/lib/advanced_editor.py | 4 ++-- resources/lib/backup.py | 8 ++++---- resources/lib/extractor.py | 2 +- resources/lib/guisettings.py | 10 +++++----- resources/lib/progressbar.py | 2 +- resources/lib/vfs.py | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/resources/lib/advanced_editor.py b/resources/lib/advanced_editor.py index ee697d2..84c41ac 100644 --- a/resources/lib/advanced_editor.py +++ b/resources/lib/advanced_editor.py @@ -1,8 +1,8 @@ import json -import utils as utils import xbmcvfs import xbmc import xbmcgui +from . import utils as utils class BackupSetManager: jsonFile = xbmc.translatePath(utils.data_dir() + "custom_paths.json") @@ -38,7 +38,7 @@ class BackupSetManager: def getSets(self): #list all current sets by name - keys = self.paths.keys() + keys = list(self.paths.keys()) keys.sort() return keys diff --git a/resources/lib/backup.py b/resources/lib/backup.py index 12686f1..7d3cf9e 100644 --- a/resources/lib/backup.py +++ b/resources/lib/backup.py @@ -1,12 +1,12 @@ import xbmc import xbmcgui import xbmcvfs -import utils as utils import time import json +from . import utils as utils from datetime import datetime -from vfs import XBMCFileSystem,DropboxFileSystem,ZipFileSystem,GoogleDriveFilesystem -from progressbar import BackupProgressBar +from .vfs import XBMCFileSystem,DropboxFileSystem,ZipFileSystem,GoogleDriveFilesystem +from .progressbar import BackupProgressBar from resources.lib.guisettings import GuiSettingsManager from resources.lib.extractor import ZipExtractor @@ -141,7 +141,7 @@ class XbmcBackup: selectedDirs = self._readBackupConfig(utils.data_dir() + "/custom_paths.json") #get the set names - keys = selectedDirs.keys() + keys = list(selectedDirs.keys()) #go through the custom sets for aKey in keys: diff --git a/resources/lib/extractor.py b/resources/lib/extractor.py index 11d9dc7..e85a6cf 100644 --- a/resources/lib/extractor.py +++ b/resources/lib/extractor.py @@ -1,4 +1,4 @@ -import utils as utils +from . import utils as utils class ZipExtractor: diff --git a/resources/lib/guisettings.py b/resources/lib/guisettings.py index 09aa8e1..79ed085 100644 --- a/resources/lib/guisettings.py +++ b/resources/lib/guisettings.py @@ -1,8 +1,8 @@ -import utils as utils -from xml.dom import minidom -from xml.parsers.expat import ExpatError import json import xbmc,xbmcvfs +from . import utils as utils +from xml.dom import minidom +from xml.parsers.expat import ExpatError class GuiSettingsManager: @@ -30,11 +30,11 @@ class GuiSettingsManager: restoreSettings = self.__parseNodes(self.doc.getElementsByTagName('setting')) #get a list where the restore setting value != the current value - updateSettings = {k: v for k, v in restoreSettings.items() if (k in currentSettings and currentSettings[k] != v)} + updateSettings = {k: v for k, v in list(restoreSettings.items()) if (k in currentSettings and currentSettings[k] != v)} #go through all the found settings and update them jsonObj = {"jsonrpc":"2.0","id":1,"method":"Settings.SetSettingValue","params":{"setting":"","value":""}} - for anId, aValue in updateSettings.items(): + for anId, aValue in list(updateSettings.items()): utils.log("updating: " + anId + ", value: " + str(aValue)) jsonObj['params']['setting'] = anId diff --git a/resources/lib/progressbar.py b/resources/lib/progressbar.py index e6fd381..e68cb04 100644 --- a/resources/lib/progressbar.py +++ b/resources/lib/progressbar.py @@ -1,5 +1,5 @@ -import utils as utils import xbmcgui +from . import utils as utils class BackupProgressBar: NONE = 2 diff --git a/resources/lib/vfs.py b/resources/lib/vfs.py index 27c905b..45f9f30 100644 --- a/resources/lib/vfs.py +++ b/resources/lib/vfs.py @@ -1,4 +1,3 @@ -import utils as utils import xbmc import xbmcvfs import xbmcgui @@ -6,8 +5,9 @@ import zipfile import os.path import sys import dropbox +from . import utils as utils from dropbox.files import WriteMode,CommitInfo,UploadSessionCursor -from authorizers import DropboxAuthorizer,GoogleDriveAuthorizer +from .authorizers import DropboxAuthorizer,GoogleDriveAuthorizer class Vfs: root_path = None @@ -417,7 +417,7 @@ class GoogleDriveFilesystem(Vfs): if(file.endswith('/')): file = file[:-1] - if(self.history.has_key(file)): + if(file in self.history): result = self.history[file] else: