pymlconf Package

models Module

class pymlconf.models.ConfigurationNamespace(*args, **kwargs)[source]

Bases: pymlconf.models.MergableDict

Configuration node that represents the configuration namespace node.

class pymlconf.models.DeferredRoot[source]

Bases: object

initialize(init_value, context=None, force=False)[source]

Initialize the configuration manager

Parameters:force – force initialization even if it’s already initialized
Returns:
class pymlconf.models.Mergable(data=None, context=None)[source]

Bases: object

Base class for all configuration nodes, so all configuration nodes are mergable

can_merge(data)[source]

Determines whenever can merge with the passed argument or not.

Parameters:data (any) – An object to test.
Returns:bool
copy()[source]

When implemented, returns copy of current config instance.

Returns:Mergable
classmethod make_mergable_if_possible(data, context)[source]

Makes an object mergable if possible. Returns the virgin object if cannot convert it to a mergable instance.

Returns:Mergable or type(data)
merge(*args)[source]

Merges this instance with new instances, in-place.

Parameters:*args (iterable) – Configuration values to merge with current instance.
class pymlconf.models.MergableDict(*args, **kwargs)[source]

Bases: collections.OrderedDict, pymlconf.models.Mergable

Configuration node that represents python dictionary data.

can_merge(data)[source]

Determines whenever can merge with the passed argument or not.

Parameters:data (any) – An object to test.
Returns:bool
copy() → a shallow copy of od[source]
class pymlconf.models.MergableList(*args, **kwargs)[source]

Bases: list, pymlconf.models.Mergable

Configuration node that represents the python list data.

can_merge(data)[source]

Determines whenever can merge with the passed argument or not.

Parameters:data (any) – An object to test.
Returns:bool
copy() → list -- a shallow copy of L[source]
class pymlconf.models.Root(*args, **kwargs)[source]

Bases: pymlconf.models.MergableDict

The main class which exposes pymlconf package.

Example:

from pymlconf import Root
from os import path
config =  Root('''
    server:
        host: localhost
        port: 4455
''')

print config.server.host
print config.server.port
load_file(filename)[source]

load file which contains yaml configuration entries.and merge it by current instance

Parameters:files (list) – files to load and merge into existing configuration instance
pymlconf.models.isiterable(o)[source]

errors Module

exception pymlconf.errors.ConfigurationAlreadyInitializedError[source]

Bases: pymlconf.errors.ConfigurationError

exception pymlconf.errors.ConfigurationError[source]

Bases: Exception

exception pymlconf.errors.ConfigurationNotInitializedError[source]

Bases: pymlconf.errors.ConfigurationError