config_keys

Module for configuration key classes.

class config_keys.ConfigBool(name: str)[source]

Class to manage a configuration boolean option

class config_keys.ConfigCollection(name: str, val_type: str)[source]

Base class for configuration collections

class config_keys.ConfigCondition(name: str)[source]

Class to manage a configuration condition expression

class config_keys.ConfigDict(name=None, type_name=None)[source]

Class to manage a configuration dictionary

get(key, default=None)[source]

Get a value from the config dict, returning default if not found

items()[source]

Get the items in the config dict

class config_keys.ConfigFloat(name: str)[source]

Class to manage a configuration float

class config_keys.ConfigInt(name: str)[source]

Class to manage a configuration integer

class config_keys.ConfigKey(name: str)[source]

Base class for configuration keys

class config_keys.ConfigList(name: str, val_type=None)[source]

Class to manage a configuration list

append(item) None[source]

Append a new item to the list

extend(items: list) None[source]

Extend the list with new items

class config_keys.ConfigMap(name: str, val_type=None)[source]

Class to manage a configuration map

get(key, default=None)[source]

Get a value from the config map, returning default if not found

items()[source]

Get the items in the config map

keys()[source]

Get the keys in the config map

update(other)[source]

Update the config map with another dictionary or ConfigMap

values()[source]

Get the values in the config map

class config_keys.ConfigNum(name: str)[source]

Class to manage a configuration number

class config_keys.ConfigOption(name: str, options: str)[source]

Class to manage a configuration option with predefined choices

class config_keys.ConfigPath(name: str)[source]

Class to manage a configuration file path

class config_keys.ConfigSet(name: str, val_type=None)[source]

Class to manage a configuration set (of strings)

extend(other)[source]

Extend the set with another set or list

class config_keys.ConfigSizeSpec(name: str)[source]

Class to manage a configuration size prediction specification

property a: float

Coefficient for average input size term

property b: float

Constant term in bytes

property n: float

Coefficient for number of inputs term

parse_spec(spec_str: str) list[source]

Parse size specification consisting of a sum of terms of the form ‘number * param’ or ‘number param’, where param is one of PARAMS, or ‘’ for bytes. For example: ‘2*s + 0.5*n + 10mb’

Parameters:

spec_str – specification string

Returns:

tuple of coefficents for (s,n,a,b)

parse_term(term: str) tuple[float, str][source]

Parse a term of the form ‘number*param’ or ‘number param’

property s: float

Coefficient for sum of input sizes term

class config_keys.ConfigString(name: str)[source]

Class to manage a configuration string

format(*args, **kwargs)[source]

Format the string value with the given arguments

class config_keys.ConfigTuple(name: str)[source]

Class to manage a configuration tuple

class config_keys.ConfigValue(name: str)[source]

Base class for individual configuration values

set(value) None[source]

Set the value of the key

val(default=None)[source]

Get the value of the key, or a default if not set

property value

Get the raw value of the key

config_keys.check_condition(condition: str) tuple[source]

Check that a condition expression is valid.

Parameters:

condition – Condition expression string

Returns:

Tuple of (normalized condition string, list of errors)

config_keys.make_cfg_key(name: str, value=None) tuple[source]

Factory function to create appropriate ConfigKey subclass based on type name.

config_keys.parse_type(value) tuple[source]

Parse a type string into a list of type components.

Parameters:

value – Raw value or string of the form ‘<type(subtype)>value’

Returns:

Tuple of (type, subtype, value)