|
1 | 1 |
|
2 | 2 | __author__ = "desultory" |
3 | | -__version__ = "1.0.2" |
| 3 | +__version__ = "1.1.0" |
4 | 4 |
|
5 | 5 | from tomllib import load, TOMLDecodeError |
6 | 6 | from pathlib import Path |
@@ -75,7 +75,7 @@ def __setitem__(self, key: str, value) -> None: |
75 | 75 | self.logger.debug("[%s] Custom types: %s" % (key, self['custom_parameters'].keys())) |
76 | 76 | # for anything but the logger, add to the processing queue |
77 | 77 | if key != 'logger': |
78 | | - self.logger.warning("Adding unknown internal parameter to processing queue: %s" % key) |
| 78 | + self.logger.debug("Adding unknown internal parameter to processing queue: %s" % key) |
79 | 79 | if key not in self['_processing']: |
80 | 80 | self['_processing'][key] = Queue() |
81 | 81 | self['_processing'][key].put(value) |
@@ -105,10 +105,10 @@ def _process_custom_parameters(self, parameter_name: str, parameter_type: type) |
105 | 105 | self.logger.debug("Leaving '%s' as None" % parameter_name) |
106 | 106 |
|
107 | 107 | if parameter_name in self['_processing']: |
108 | | - self.logger.info("Processing queued values for '%s'" % parameter_name) |
| 108 | + self.logger.debug("Processing queued values for '%s'" % parameter_name) |
109 | 109 | while not self['_processing'][parameter_name].empty(): |
110 | 110 | value = self['_processing'][parameter_name].get() |
111 | | - self.logger.info("Processing queued value for '%s': %s" % (parameter_name, value)) |
| 111 | + self.logger.debug("Processing queued value for '%s': %s" % (parameter_name, value)) |
112 | 112 | self[parameter_name] = value |
113 | 113 | self['_processing'].pop(parameter_name) |
114 | 114 |
|
@@ -206,20 +206,20 @@ def _process_modules(self, module: str) -> None: |
206 | 206 | except TOMLDecodeError as e: |
207 | 207 | raise TOMLDecodeError("Unable to load module config: %s" % module) from e |
208 | 208 |
|
209 | | - # Import these first, as they affect how the rest of the config is processed |
210 | | - early_imports = ['imports', 'custom_parameters'] |
211 | | - for import_type in early_imports: |
212 | | - if import_type in module_config: |
213 | | - self[import_type] = module_config[import_type] |
214 | | - self.logger.debug("[%s] Registered %s: %s" % (module, import_type, self[import_type])) |
215 | | - |
| 209 | + # First import all variabled, then import processing functions/imports in order |
| 210 | + processing_imports = ['imports', 'custom_parameters'] |
216 | 211 | for name, value in module_config.items(): |
217 | | - if name in early_imports: |
| 212 | + if name in processing_imports: |
218 | 213 | self.logger.log(5, "[%s] Skipping '%s'" % (module, name)) |
219 | 214 | continue |
220 | 215 | self.logger.debug("[%s] Setting '%s' to: %s" % (module, name, value)) |
221 | 216 | self[name] = value |
222 | 217 |
|
| 218 | + for import_type in processing_imports: |
| 219 | + if import_type in module_config: |
| 220 | + self[import_type] = module_config[import_type] |
| 221 | + self.logger.debug("[%s] Registered %s: %s" % (module, import_type, self[import_type])) |
| 222 | + |
223 | 223 | # Append the module to the list of loaded modules, avoid recursion |
224 | 224 | self['modules'].append(module) |
225 | 225 |
|
|
0 commit comments