smac.utils.io.cmd_reader module

class smac.utils.io.cmd_reader.CMDReader[source]

Bases: object

Use argparse to parse command line options

logger
Type

Logger

_add_main_options() → None[source]

Add main Options

_add_scen_options() → None[source]

Add Scenario Options

_add_smac_options() → None[source]

Add SMAC Options

static _extract_action_info(actions: List[argparse.Action]) → Tuple[Dict, Dict][source]
static _write_options_to_doc(_arguments: dict, path: str, exclude: List[str]) → None[source]
parse_main_command(main_cmd_opts: Sequence[str]) → Tuple[argparse.Namespace, List[str]][source]

Parse main options

parse_scenario_command(scenario_file: str = None, scenario_dict: dict = {}, scenario_cmd_opts: List[str] = []) → argparse.Namespace[source]

Parse scenario options :param scenario_file: str or None Path to the scenario file. :param scenario_dict: dict Mappings of scenario options to values :param scenario_cmd_opts: list[str] Scenario options from command line :return: Parsed scenario arguments

parse_smac_command(smac_dict: dict = {}, smac_cmd_opts: List[str] = []) → Tuple[argparse.Namespace, Dict, List[str]][source]

Parse SMAC options

read_cmd(commandline_arguments: Sequence[str] = ('-b', 'html', '-d', 'build/doctrees', '.', 'build/html')) → Tuple[argparse.Namespace, argparse.Namespace, argparse.Namespace][source]

Reads command line options (main, smac and scenario options)

Returns

smac_args_, scen_args_ – main, smac and scenario options parsed with corresponding ArgumentParser

Return type

parsed arguments;

read_smac_scenario_dict_cmd(dict_cmd: dict, scenario_file: str = None) → Tuple[argparse.Namespace, argparse.Namespace][source]

Reads smac and scenario options provided in a dictionary

Returns

smac_args_, scen_args_

Return type

smac and scenario options parsed with corresponding ArgumentParser

write_main_options_to_doc(path: str = 'main_options.rst') → None[source]

Writes the SMAC option-list to file for autogeneration in documentation. The list is created in doc/conf.py and read in doc/options.rst.

Parameters

path (string) – Where to write to (relative to doc-folder since executed in conf.py)

write_scenario_options_to_doc(path: str = 'scenario_options.rst') → None[source]

Writes the Scenario option-list to file for autogeneration in documentation. The list is created in doc/conf.py and read in doc/options.rst.

Parameters

path (string) – Where to write to (relative to doc-folder since executed in conf.py)

write_smac_options_to_doc(path: str = 'smac_options.rst') → None[source]

Writes the SMAC option-list to file for autogeneration in documentation. The list is created in doc/conf.py and read in doc/options.rst.

Parameters

path (string) – Where to write to (relative to doc-folder since executed in conf.py)

class smac.utils.io.cmd_reader.CheckScenarioFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Check scenario file given by user

class smac.utils.io.cmd_reader.ConfigurableHelpFormatter(*args: Any, help_type: str = 'standard', **kwargs: Any)[source]

Bases: argparse.ArgumentDefaultsHelpFormatter

Configurable Help Formatter. Can filter out developer options.

_add_item(func: Callable, args: Any) → None[source]
class smac.utils.io.cmd_reader.DevHelpAction(*args: Any, **kwargs: Any)[source]

Bases: argparse.Action

Action to show standard and developer options in help message

class smac.utils.io.cmd_reader.ParseOverallObjectiveAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Parse overall objective given by user

class smac.utils.io.cmd_reader.ParseRandomConfigurationChooserAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Parse random configuration chooser given by user

class smac.utils.io.cmd_reader.ProcessOutputDirAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Process output directory given by user

class smac.utils.io.cmd_reader.ProcessRunObjectiveAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Process run objective given by user

class smac.utils.io.cmd_reader.ReadFeatureFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read feature file given by user

class smac.utils.io.cmd_reader.ReadPCSFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read PCS (parameter configuration space) file given by user

class smac.utils.io.cmd_reader.ReadTestInstFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read test instance file given by user

class smac.utils.io.cmd_reader.ReadTrainInstFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read training instance file given by user

class smac.utils.io.cmd_reader.SMACArgumentParser(*args: Any, **kwargs: Any)[source]

Bases: argparse.ArgumentParser

ArgumentParser that can be extended by additional parsers.

_get_formatter() → argparse.HelpFormatter[source]
add_parser(additional_parser: argparse.ArgumentParser) → None[source]
format_help() → str[source]
set_help_type(help_type: str) → None[source]
class smac.utils.io.cmd_reader.StandardHelpAction(*args: Any, **kwargs: Any)[source]

Bases: argparse.Action

Action to only show standard options in help message

smac.utils.io.cmd_reader.truthy(x: Any) → bool[source]

Convert x into its truth value