From 9be1035b2945f82b269487a009c02bd5a83028b0 Mon Sep 17 00:00:00 2001 From: Stefano Date: Wed, 24 Jul 2013 14:24:51 +0200 Subject: Fixed PEP 8 violations in Hooks (cherry picked from commit 669b1e0ec048e1ed8aeb842b2570376e9ad96863) Conflicts: pyload/plugins/addons/CaptchaTrader.py pyload/plugins/addons/ClickAndLoad.py pyload/plugins/addons/Ev0InFetcher.py pyload/plugins/addons/ExternalScripts.py pyload/plugins/addons/ExtractArchive.py pyload/plugins/addons/HotFolder.py pyload/plugins/addons/MergeFiles.py pyload/plugins/addons/MultiHome.py pyload/plugins/addons/XMPPInterface.py --- pyload/plugins/addons/UpdateManager.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'pyload/plugins/addons/UpdateManager.py') diff --git a/pyload/plugins/addons/UpdateManager.py b/pyload/plugins/addons/UpdateManager.py index b30289287..62031e6a4 100644 --- a/pyload/plugins/addons/UpdateManager.py +++ b/pyload/plugins/addons/UpdateManager.py @@ -27,18 +27,19 @@ from module.ConfigParser import IGNORE from module.network.RequestFactory import getURL from module.plugins.Hook import threaded, Expose, Hook + class UpdateManager(Hook): __name__ = "UpdateManager" __version__ = "0.15" __description__ = """checks for updates""" __config__ = [("activated", "bool", "Activated", "True"), - ("interval", "int", "Check interval in minutes", "480"), - ("debug", "bool", "Check for plugin changes when in debug mode", False)] + ("interval", "int", "Check interval in minutes", "480"), + ("debug", "bool", "Check for plugin changes when in debug mode", False)] __author_name__ = ("RaNaN") __author_mail__ = ("ranan@pyload.org") URL = "http://get.pyload.org/check2/%s/" - MIN_TIME = 3 * 60 * 60 # 3h minimum check interval + MIN_TIME = 3 * 60 * 60 # 3h minimum check interval @property def debug(self): @@ -48,10 +49,10 @@ class UpdateManager(Hook): if self.debug: self.logDebug("Monitoring file changes") self.interval = 4 - self.last_check = 0 #timestamp of updatecheck + self.last_check = 0 # timestamp of updatecheck self.old_periodical = self.periodical self.periodical = self.checkChanges - self.mtimes = {} #recordes times + self.mtimes = {} # recordes times else: self.interval = max(self.getConfig("interval") * 60, self.MIN_TIME) @@ -86,7 +87,7 @@ class UpdateManager(Hook): """checks if an update is available, return result""" try: - if self.version == "None": # No updated known + if self.version == "None": # No updated known version_check = getURL(self.URL % self.core.api.getServerVersion()).splitlines() self.version = version_check[0] @@ -95,7 +96,6 @@ class UpdateManager(Hook): self.logInfo(_("No Updates for pyLoad")) return version_check[1:] - self.info["pyload"] = True self.logInfo(_("*** New pyLoad Version %s available ***") % self.version) self.logInfo(_("*** Get it here: http://pyload.org/download ***")) @@ -103,14 +103,14 @@ class UpdateManager(Hook): except: self.logWarning(_("Not able to connect server for updates")) - return None # Nothing will be done - + return None # Nothing will be done def checkPlugins(self, updates): """ checks for plugins updates""" # plugins were already updated - if self.info["plugins"]: return + if self.info["plugins"]: + return reloads = [] @@ -178,8 +178,8 @@ class UpdateManager(Hook): self.last_check = time() modules = filter( - lambda m: m and (m.__name__.startswith("module.plugins.") or m.__name__.startswith("userplugins.")) and m.__name__.count(".") >= 2, - sys.modules.itervalues()) + lambda m: m and (m.__name__.startswith("module.plugins.") or m.__name__.startswith( + "userplugins.")) and m.__name__.count(".") >= 2, sys.modules.itervalues()) reloads = [] @@ -188,7 +188,8 @@ class UpdateManager(Hook): id = (type, name) if type in self.core.pluginManager.plugins: f = m.__file__.replace(".pyc", ".py") - if not exists(f): continue + if not exists(f): + continue mtime = stat(f).st_mtime -- cgit v1.2.3