extract has_space to Hyperopt-Tools

This commit is contained in:
Matthias
2021-05-01 16:36:35 +02:00
parent e050ea8dfa
commit e381df9098
3 changed files with 33 additions and 30 deletions

View File

@@ -4,7 +4,7 @@ import logging
from collections import OrderedDict
from pathlib import Path
from pprint import pformat
from typing import Dict, List
from typing import Any, Dict, List
import rapidjson
import tabulate
@@ -21,6 +21,17 @@ logger = logging.getLogger(__name__)
class HyperoptTools():
@staticmethod
def has_space(config: Dict[str, Any], space: str) -> bool:
"""
Tell if the space value is contained in the configuration
"""
# The 'trailing' space is not included in the 'default' set of spaces
if space == 'trailing':
return any(s in config['spaces'] for s in [space, 'all'])
else:
return any(s in config['spaces'] for s in [space, 'all', 'default'])
@staticmethod
def _read_results(results_file: Path) -> List:
"""