2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-29 13:38:55 +00:00

add optional default returns for settings

This commit is contained in:
Nick80835 2020-04-17 11:18:23 -04:00
parent 0c34c08c55
commit 8748f77a2d

View File

@ -8,11 +8,11 @@ class Settings():
self.config = SafeConfigParser()
self.config.read("settings.ini")
def get_config(self, key):
return self.config.get("DEFAULT", key, fallback=None)
def get_config(self, key, default=None):
return self.config.get("DEFAULT", key, fallback=default)
def get_bool(self, key):
return bool(self.config.get("DEFAULT", key, fallback=False) == "True")
def get_bool(self, key, default=False):
return bool(self.config.get("DEFAULT", key, fallback=default) == "True")
def set_config(self, key, value):
self.config.set("DEFAULT", key, value)