multiconf.decorators module

multiconf.decorators.named_as(insert_as_name)[source]

Determine the name used to insert item in parent

multiconf.decorators.nested_repeatables(*attr_names)[source]

Specify which nested (child) items will be repeatable.

multiconf.decorators.repeatable_key(**name_value)[source]

Set name and default value for the mc_key repeatable item __init__ argument.

Parameters:**name_value (dict[name, val]) –

There must be exactly one name/value pair. E.g.:

Use ‘name’ argument as the mc_key.:

@named_as('xses')
@repeatable_key(name=None)
class X1(RepeatableConfigItem):
    def __init__(name, ...)

Only a single item of the following class can be created in the ‘xses’ repeatable. Use ‘name’ argument as the mc_key for the parent class, use value ‘xxx’ as the mc_key.:

@repeatable_key(name='xxx')
class X2(X1):
    def __init__(...)  # No 'name' argument
        super(X2, self)._init__(name=None, ...)

Only a single item of the following class can be created in the ‘ys’ repeatable. Use value ‘nicekey’ as the mc_key.:

@named_as('ys')
@repeatable_key(mc_key='nicekey')
class X2(X1):
    def __init__(...)  # No 'mc_key' argument
        super(X2, self)._init__(...)
multiconf.decorators.required(*attr_names)[source]

Specify nested (child) items that must be defined.