From bd5fd6a6596dd7625019c6c0f0ff043597cda837 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 31 Jul 2017 20:45:13 +0200 Subject: Renaming module to avoid ambiguity --- playoff/settings.py | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 playoff/settings.py (limited to 'playoff/settings.py') diff --git a/playoff/settings.py b/playoff/settings.py deleted file mode 100644 index dd7399d..0000000 --- a/playoff/settings.py +++ /dev/null @@ -1,31 +0,0 @@ -import glob, json, os, readline, sys - -def complete_filename(text, state): - return (glob.glob(text+'*')+[None])[state] - -class PlayoffSettings: - - def __init__(self): - self.interactive = False - if len(sys.argv) > 1: - settings_file = sys.argv[1] - else: - self.interactive = True - readline.set_completer_delims(' \t\n;') - readline.parse_and_bind("tab: complete") - readline.set_completer(complete_filename) - settings_file = raw_input('JSON settings file: ') - - if not os.path.exists(settings_file): - raise IOError('Settings file %s not found' % settings_file) - - self.settings = json.load(open(settings_file)) - - def has_section(self, key): - return key in self.settings - - def get(self, *keys): - section = self.settings - for key in keys: - section = section[key] - return section -- cgit v1.2.3