From 9327b55e147d95b5865f23788f980c7268ea03e3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 20 Apr 2015 21:38:42 +0200 Subject: Spare code cosmetics (7) --- pyload/manager/Plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pyload/manager/Plugin.py') diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py index a081a643e..9417a6935 100644 --- a/pyload/manager/Plugin.py +++ b/pyload/manager/Plugin.py @@ -126,7 +126,7 @@ class PluginManager(object): module = f.replace(".pyc", "").replace(".py", "") # the plugin is loaded from user directory - plugins[name]['user'] = True if rootplugins else False + plugins[name]['user'] = bool(rootplugins) plugins[name]['name'] = module pattern = self.PATTERN.findall(content) @@ -162,7 +162,7 @@ class PluginManager(object): config = [list(config)] if folder not in ("account", "internal") and not [True for item in config if item[0] == "activated"]: - config.insert(0, ["activated", "bool", "Activated", False if folder in ("addon", "hook") else True]) + config.insert(0, ["activated", "bool", "Activated", not folder in ("addon", "hook")]) self.core.config.addPluginConfig("%s_%s" % (name, folder), config, desc) except Exception: @@ -398,4 +398,4 @@ class PluginManager(object): def reloadPlugin(self, type_plugin): """ reload and reindex ONE plugin """ - return True if self.reloadPlugins(type_plugin) else False + return bool(self.reloadPlugins(type_plugin)) -- cgit v1.2.3 From 892b7cbd4981b764bed30b2ccc5ca73d791c39f2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 20 Apr 2015 22:56:34 +0200 Subject: Spare code cosmetics (9) --- pyload/manager/Plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pyload/manager/Plugin.py') diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py index 9417a6935..118dea8f0 100644 --- a/pyload/manager/Plugin.py +++ b/pyload/manager/Plugin.py @@ -168,7 +168,7 @@ class PluginManager(object): except Exception: self.core.log.error("Invalid config in %s: %s" % (name, config)) - elif folder in ("addon", "hook"): # force config creation + elif folder in ("addon", "hook"): #: force config creation desc = self.DESC.findall(content) desc = desc[0][1] if desc else "" config = (["activated", "bool", "Activated", False],) @@ -310,9 +310,9 @@ class PluginManager(object): def find_module(self, fullname, path=None): # redirecting imports if necesarry - if fullname.startswith(self.ROOT) or fullname.startswith(self.USERROOT): # seperate pyload plugins + if fullname.startswith(self.ROOT) or fullname.startswith(self.USERROOT): #: seperate pyload plugins if fullname.startswith(self.USERROOT): user = 1 - else: user = 0 # used as bool and int + else: user = 0 #: used as bool and int split = fullname.split(".") if len(split) != 4 - user: @@ -329,7 +329,7 @@ class PluginManager(object): def load_module(self, name, replace=True): - if name not in sys.modules: # could be already in modules + if name not in sys.modules: #: could be already in modules if replace: if self.ROOT in name: newname = name.replace(self.ROOT, self.USERROOT) -- cgit v1.2.3