hespas.estimator.config_option

Classes

ConfigOption(validation_func, *[, default, ...])

Container class for configuration options that are defined within each estimator.

Exceptions

InvalidConfigOptionError

Custom exception to throw if config validation fails

exception hespas.estimator.config_option.InvalidConfigOptionError

Bases: Exception

Custom exception to throw if config validation fails

class hespas.estimator.config_option.ConfigOption(validation_func, *, default=None, optional=False, name='unnamed', post_validate_func=None, description=None, top_level=False, is_dict=False)

Bases: object

Container class for configuration options that are defined within each estimator. These should be declared as class variables, and at instantiation time, the Estimator base class will iterate over every config option and set every one as an instance variable. Using these, the Estimator base class also automatically generates the __init__ arguments, the commandline arguments, and builds the structure of the hardware configuration dictionary.

Parameters:
  • validation_func – Method to call to convert and validate the option value given, similar to ‘int()’

  • default – Default value for this option. If None, no default.

  • optional – Whether this value must be set. If default is not None, this becomes True

  • name – Default name. Shouldn’t be set by the user, will be changed by the EstimateMeta metaclass in Estimator class creation

  • description – User-readable description of this configuration option. Use in the production of the command line arguments

  • top_level – Whether this configuration option is placed in a subdictionary on inheritance, or kept at the top level.

  • is_dict – Treat this configuration option as a dict (don’t descend in configuration)

__init__(validation_func, *, default=None, optional=False, name='unnamed', post_validate_func=None, description=None, top_level=False, is_dict=False)