From 850d07b17141be0f612d900eac7541d9868d6940 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Thu, 23 Apr 2020 20:02:17 -0700 Subject: [PATCH] Remove obsolete functions --- amanuensis/config/init.py | 48 --------------------------------------- 1 file changed, 48 deletions(-) diff --git a/amanuensis/config/init.py b/amanuensis/config/init.py index 4c12b30..8189e98 100644 --- a/amanuensis/config/init.py +++ b/amanuensis/config/init.py @@ -102,51 +102,3 @@ def create_config_dir(config_dir, refresh=False): .format(dir_name, name, entry)) del index[name] - -def verify_config_dir(config_dir): - """ - Verifies that the given directory has a valid global config in it and - returns the global config if so - """ - # Check that config dir exists - if not os.path.isdir(config_dir): - raise MissingConfigError("Config directory not found: {}".format(config_dir)) - # Check that global config file exists - global_config_path = os.path.join(config_dir, "config.json") - if not os.path.isfile(global_config_path): - raise MissingConfigError("Config directory missing global config file" - ": {}".format(config_dir)) - # Check that global config file has all the default settings - def_cfg_s = get_stream("global.json") - def_cfg = json.load(def_cfg_s) - with json_ro(global_config_path) as global_config_file: - for key in def_cfg.keys(): - if key not in global_config_file.keys(): - raise MalformedConfigError("Missing '{}' in global config. If" - " you updated Amanuensis, run init --refresh to pick up n" - "ew config keys".format(key)) - # Configs verified - return True - - -def init_logging(args, logging_config): - """ - Initializes logging by using the logging section of the global config - file. - """ - # Get the logging config section - cfg = copy.deepcopy(logging_config) - # Apply any commandline settings to what was defined in the config file - handlers = cfg['loggers']['amanuensis']['handlers'] - if args.verbose: - if 'cli_basic' in handlers: - handlers.remove('cli_basic') - handlers.append('cli_verbose') - if args.log_file: - cfg['handlers']['file']['filename'] = args.log_file - handlers.append("file") - # Load the config - try: - logging.config.dictConfig(cfg) - except: - raise MalformedConfigError("Failed to load logging config")