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

8 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-05 14:48 +0000

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

2from sparkle.configurator.configurator import Configurator 

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

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

5 

6 

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

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

9 subclass_names = [SMAC2.__name__, IRACE.__name__] 

10 if configurator_name in subclass_names: 

11 return eval(configurator_name) 

12 return None