From fd4241dc0db5d4ea1bda120a1f1022fb91e85cd2 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 29 May 2019 22:06:24 +0200 Subject: Settings class now accepts an already parsed config object in the constructor --- jfr_playoff/settings.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/settings.py b/jfr_playoff/settings.py index 58de66c..b12ffef 100644 --- a/jfr_playoff/settings.py +++ b/jfr_playoff/settings.py @@ -13,7 +13,7 @@ def complete_filename(text, state): class PlayoffSettings(object): - def __init__(self, config_file): + def __init__(self, config_file=None, config_obj=None): self.settings = None self.interactive = False self.settings_file = None @@ -21,7 +21,10 @@ class PlayoffSettings(object): self.settings_file = config_file.decode( sys.getfilesystemencoding()) else: - self.interactive = True + if config_obj is not None: + self.settings = config_obj + else: + self.interactive = True def __merge_config(self, base_config, new_config=None, remote_url=None, @@ -39,7 +42,7 @@ class PlayoffSettings(object): return base_config def load(self): - if self.settings_file is None: + if self.interactive: readline.set_completer_delims(' \t\n;') readline.parse_and_bind("tab: complete") readline.set_completer(complete_filename) -- cgit v1.2.3