diff --git a/cml/shared/settings.py b/cml/shared/settings.py index 3c9dbcf8ff120e0c9e342982eda939f7a32c1697..206fff24b1f59c55a7de2684f3112e31218e854a 100644 --- a/cml/shared/settings.py +++ b/cml/shared/settings.py @@ -56,11 +56,11 @@ class Settings(metaclass=MetaSettings): LEARN_DIR: str = "" MAX_LEARN_DIR: int = 0 USE_EXISTING_MODELS: bool = False - SET_FEATURES: str = "" + KNOWLEDGE_DIR = "" + SET_TARGETS: str = "" SORT_TIME_STAMP: bool = False - CUT_TIME_STAMP: bool = False - BLOCK_SIZE: int = 0 + MAX_BLOCKS: int = 0 STACK_ITERATIONS: int = 0 LEARN_BLOCK_MINIMUM: int = 0 @@ -85,15 +85,20 @@ class PreprocessingSettings: @dataclass class BlockProcessingSettings: - block_size = int - max_blocks = int - stack_iterations = int - learn_block_minimum = int - sigma_zeta_cutoff = float + block_size: int + max_blocks: int + stack_iterations: int + learn_block_minimum: int + sigma_zeta_cutoff: float + + +@dataclass +class DeconstructionSettings: + pass def specific_settings_factory(settings_type: str): - types = { + factory = { "general": starmap( GeneralSettings, [(Settings.INPUT_FILE, Settings.LEARN_DIR, @@ -109,15 +114,19 @@ def specific_settings_factory(settings_type: str): Settings.MAX_BLOCKS, Settings.STACK_ITERATIONS, Settings.LEARN_BLOCK_MINIMUM, - Settings.SIGMA_ZETA_CUTOFF)]) + Settings.SIGMA_ZETA_CUTOFF)]), + "deconstruction": starmap( + DeconstructionSettings, [()] + ) } - return next(types[settings_type]) + return next(factory[settings_type]) def read_settings(path: str): try: - config = ConfigParser(path) + config = ConfigParser() + config.read(path) configure_main_settings_class(config) except AttributeError as e: # TODO (dmt): Implement proper error handling. @@ -126,11 +135,12 @@ def read_settings(path: str): def configure_main_settings_class(config): - default = config["DEFAULT"] + default = config["GENERAL"] Settings.INPUT_FILE = default["input_file"] Settings.LEARN_DIR = default["learn_dir"] Settings.MAX_LEARN_DIR = default["max_learn_dir"] Settings.USE_EXISTING_MODELS = default["use_existing_models"] + Settings.KNOWLEDGE_DIR = default["knowledge_dir"] preprocessing = config["PREPROCESSING"] Settings.SET_FEATURES = preprocessing["set_features"]