Coverage for sparkle/configurator/implementations/__init__.py: 89%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-07 15:22 +0000

1"""This package provides specific Configurator class implementations for Sparkle.""" 

2from sparkle.configurator.configurator import Configurator 

3from sparkle.configurator.implementations.irace import IRACE, IRACEScenario 

4from sparkle.configurator.implementations.smac2 import SMAC2, SMAC2Scenario 

5from sparkle.configurator.implementations.smac3 import SMAC3, SMAC3Scenario 

6 

7 

8def resolve_configurator(configurator_name: str) -> Configurator: 

9 """Returns the Configurator subclass by name.""" 

10 subclass_names = [IRACE.__name__, SMAC2.__name__, SMAC3.__name__] 

11 if configurator_name in subclass_names: 

12 return eval(configurator_name) 

13 return None