From a70793b616e4f71426e8df7a55c880c863a5550c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 2 Apr 2020 09:05:40 +0000 Subject: [PATCH] flake8 style --- config.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/config.py b/config.py index fecf674e..b290797b 100644 --- a/config.py +++ b/config.py @@ -1,44 +1,45 @@ -__filename__="config.py" -__author__="Bob Mottram" -__license__="AGPL3+" -__version__="1.1.0" -__maintainer__="Bob Mottram" -__email__="bob@freedombone.net" -__status__="Production" +__filename__ = "config.py" +__author__ = "Bob Mottram" +__license__ = "AGPL3+" +__version__ = "1.1.0" +__maintainer__ = "Bob Mottram" +__email__ = "bob@freedombone.net" +__status__ = "Production" import os -import time -import json from utils import loadJson from utils import saveJson + def createConfig(baseDir: str) -> None: """Creates a configuration file """ - configFilename=baseDir+'/config.json' + configFilename = baseDir + '/config.json' if os.path.isfile(configFilename): return - configJson={ + configJson = { } - saveJson(configJson,configFilename) + saveJson(configJson, configFilename) + def setConfigParam(baseDir: str, variableName: str, variableValue) -> None: """Sets a configuration value """ createConfig(baseDir) - configFilename=baseDir+'/config.json' - configJson={} + configFilename = baseDir + '/config.json' + configJson = {} if os.path.isfile(configFilename): - configJson=loadJson(configFilename) - configJson[variableName]=variableValue - saveJson(configJson,configFilename) + configJson = loadJson(configFilename) + configJson[variableName] = variableValue + saveJson(configJson, configFilename) + def getConfigParam(baseDir: str, variableName: str): """Gets a configuration value """ createConfig(baseDir) - configFilename=baseDir+'/config.json' - configJson=loadJson(configFilename) + configFilename = baseDir + '/config.json' + configJson = loadJson(configFilename) if configJson: if configJson.get(variableName): return configJson[variableName]