From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/AccountManager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/AccountManager.py') diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index 1de55effc..80441066f 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -27,6 +27,7 @@ from module.utils import chmod, lock ACC_VERSION = 1 + class AccountManager(): """manages all accounts""" @@ -47,7 +48,6 @@ class AccountManager(): self.initAccountPlugins() self.loadAccounts() - def getAccountPlugin(self, plugin): """get account instance for plugin or None if anonymous""" if plugin in self.accounts: @@ -66,6 +66,7 @@ class AccountManager(): plugins.append(self.getAccountPlugin(plugin)) return plugins + #---------------------------------------------------------------------- def loadAccounts(self): """loads all accounts available""" @@ -112,6 +113,7 @@ class AccountManager(): elif ":" in line: name, sep, pw = line.partition(":") self.accounts[plugin][name] = {"password": pw, "options": {}, "valid": True} + #---------------------------------------------------------------------- def saveAccounts(self): """save all account information""" -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/AccountManager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/AccountManager.py') diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index 80441066f..39e613c1a 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -106,7 +106,7 @@ class AccountManager(): elif line.startswith("@"): try: option = line[1:].split() - self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) + self.accounts[plugin][name]['options'][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) except: pass @@ -126,9 +126,9 @@ class AccountManager(): f.write(plugin+":\n") for name,data in accounts.iteritems(): - f.write("\n\t%s:%s\n" % (name,data["password"]) ) - if data["options"]: - for option, values in data["options"].iteritems(): + f.write("\n\t%s:%s\n" % (name,data['password']) ) + if data['options']: + for option, values in data['options'].iteritems(): f.write("\t@%s %s\n" % (option, " ".join(values))) f.close() -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/AccountManager.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'module/plugins/AccountManager.py') diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index 39e613c1a..4b8063002 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -1,22 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: RaNaN -""" - from os.path import exists from shutil import copy -- cgit v1.2.3