# Path: configmanager/base.py
# class ItemAttribute(object):
#     """
#     Class used in :class:`.Item` class to declare attributes of config items.
#     """
# 
#     def __init__(self, name, default=not_set, value=not_set, allow_dynamic_override=False):
#         self.name = name
#         self.default = default
#         self.value = value
#         self.attr_name = '_{}'.format(self.name)
# 
#         # If set to True, this becomes an expensive attribute because now when
#         # its value is requested we will check for a registered
#         # dynamic attribute with the same name and if available use the dynamic value instead of set value.
#         # Attributes that are used in majority of value calculation should avoid this.
#         # For example, envvar, which is consulted on every value request, is designed
#         # to be a cheap attribute. Users can, however, override envvar_name which is
#         # used only if envvar is set to True.
#         self.allow_dynamic_override = allow_dynamic_override
# 
#     def __set__(self, instance, value):
#         setattr(instance, self.attr_name, value)
# 
#     def __get__(self, instance, owner):
#         if self.allow_dynamic_override:
#             if instance.section:
#                 try:
#                     return instance.section.get_item_attribute(instance, self.name)
#                 except AttributeError:
#                     pass
#         return getattr(instance, self.attr_name, self.default)
# 
# class BaseItem(object):
#     is_item = True
#     is_section = False
#     is_config = False
# 
# Path: configmanager/exceptions.py
# class RequiredValueMissing(ConfigError):
#     """
#     Value was requested from an item which requires a value, but had no
#     default or custom value set.
# 
#     .. attribute:: name
# 
#         Name of the item
# 
#     .. attribute:: item
# 
#         :class:`.Item` instance
#     """
#     def __init__(self, name, item=None):
#         super(RequiredValueMissing, self).__init__(name)
#         self.name = name
#         self.item = item
# 
#     def __repr__(self):
#         return '<{} {!r} in {}>'.format(self.__class__.__name__, self.name, self.item)
# 
# Path: configmanager/item_types.py
# class _ItemType(object):
# class _NotSetType(_ItemType):
# class _StrType(_ItemType):
# class _IntType(_ItemType):
# class _BoolType(_ItemType):
# class _FloatType(_ItemType):
# class _DictType(_ItemType):
# class _ListType(_ItemType):
# class _Types(object):
#     def serialize(self, instance, **kwargs):
#     def deserialize(self, payload, **kwargs):
#     def includes(self, obj):
#     def accepts(self, obj):
#     def set_item_value(self, item, raw_value):
#     def __repr__(self):
#     def __eq__(self, other):
#     def includes(self, obj):
#     def includes(self, obj):
#     def accepts(self, obj):
#     def accepts(self, obj):
#     def deserialize(self, payload, **kwargs):
#     def serialize(self, instance, **kwargs):
#     def accepts(self, obj):
#     def __init__(self):
#     def guess(self, obj):
#     def translate(self, type_):
# 
# Path: configmanager/utils.py
# class _NotSet(object):
#     def __init__(self):
#     def __eq__(self, other):
#     def __nonzero__(self):
#     def __bool__(self):
#     def __str__(self):
#     def __repr__(self):
#     def __deepcopy__(self, memodict):
#     def __copy__(self):
# def _get_persistence_adapter_for(filename):


from builtins import str
from .base import ItemAttribute, BaseItem
from .exceptions import RequiredValueMissing
from .item_types import Types
from .utils import not_set
import copy
import os
import six
        else:
            return self.default is not not_set or self._value is not not_set

    @property
    def section(self):
        """
        Config section (an instance of :class:`.Config`) to which the item has been added or ``None`` if
        it hasn't been added to a section yet.
        """
        return self._section

    def get_path(self):
        """
        Calculate item's path in configuration tree.
        Use this sparingly -- path is calculated by going up the configuration tree.
        For a large number of items, it is more efficient to use iterators that return paths
        as keys.

        Path value is stable only once the configuration tree is completely initialised.
        """
        if self.section:
            return self.section.get_path() + (self.name,)
        else:
            return self.name,

    def validate(self):
        """
        Validate item.
        """
        if self.required and not self.has_value:

# Path: configmanager/base.py
# class ItemAttribute(object):
#     """
#     Class used in :class:`.Item` class to declare attributes of config items.
#     """
# 
#     def __init__(self, name, default=not_set, value=not_set, allow_dynamic_override=False):
#         self.name = name
#         self.default = default
#         self.value = value
#         self.attr_name = '_{}'.format(self.name)
# 
#         # If set to True, this becomes an expensive attribute because now when
#         # its value is requested we will check for a registered
#         # dynamic attribute with the same name and if available use the dynamic value instead of set value.
#         # Attributes that are used in majority of value calculation should avoid this.
#         # For example, envvar, which is consulted on every value request, is designed
#         # to be a cheap attribute. Users can, however, override envvar_name which is
#         # used only if envvar is set to True.
#         self.allow_dynamic_override = allow_dynamic_override
# 
#     def __set__(self, instance, value):
#         setattr(instance, self.attr_name, value)
# 
#     def __get__(self, instance, owner):
#         if self.allow_dynamic_override:
#             if instance.section:
#                 try:
#                     return instance.section.get_item_attribute(instance, self.name)
#                 except AttributeError:
#                     pass
#         return getattr(instance, self.attr_name, self.default)
# 
# class BaseItem(object):
#     is_item = True
#     is_section = False
#     is_config = False
# 
# Path: configmanager/exceptions.py
# class RequiredValueMissing(ConfigError):
#     """
#     Value was requested from an item which requires a value, but had no
#     default or custom value set.
# 
#     .. attribute:: name
# 
#         Name of the item
# 
#     .. attribute:: item
# 
#         :class:`.Item` instance
#     """
#     def __init__(self, name, item=None):
#         super(RequiredValueMissing, self).__init__(name)
#         self.name = name
#         self.item = item
# 
#     def __repr__(self):
#         return '<{} {!r} in {}>'.format(self.__class__.__name__, self.name, self.item)
# 
# Path: configmanager/item_types.py
# class _ItemType(object):
# class _NotSetType(_ItemType):
# class _StrType(_ItemType):
# class _IntType(_ItemType):
# class _BoolType(_ItemType):
# class _FloatType(_ItemType):
# class _DictType(_ItemType):
# class _ListType(_ItemType):
# class _Types(object):
#     def serialize(self, instance, **kwargs):
#     def deserialize(self, payload, **kwargs):
#     def includes(self, obj):
#     def accepts(self, obj):
#     def set_item_value(self, item, raw_value):
#     def __repr__(self):
#     def __eq__(self, other):
#     def includes(self, obj):
#     def includes(self, obj):
#     def accepts(self, obj):
#     def accepts(self, obj):
#     def deserialize(self, payload, **kwargs):
#     def serialize(self, instance, **kwargs):
#     def accepts(self, obj):
#     def __init__(self):
#     def guess(self, obj):
#     def translate(self, type_):
# 
# Path: configmanager/utils.py
# class _NotSet(object):
#     def __init__(self):
#     def __eq__(self, other):
#     def __nonzero__(self):
#     def __bool__(self):
#     def __str__(self):
#     def __repr__(self):
#     def __deepcopy__(self, memodict):
#     def __copy__(self):
# def _get_persistence_adapter_for(filename):


# Path: configmanager/items.py
from builtins import str
from .base import ItemAttribute, BaseItem
from .exceptions import RequiredValueMissing
from .item_types import Types
from .utils import not_set
import copy
import os
import six

        else:
            return self.default is not not_set or self._value is not not_set

    @property
    def section(self):
        """
        Config section (an instance of :class:`.Config`) to which the item has been added or ``None`` if
        it hasn't been added to a section yet.
        """
        return self._section

    def get_path(self):
        """
        Calculate item's path in configuration tree.
        Use this sparingly -- path is calculated by going up the configuration tree.
        For a large number of items, it is more efficient to use iterators that return paths
        as keys.

        Path value is stable only once the configuration tree is completely initialised.
        """
        if self.section:
            return self.section.get_path() + (self.name,)
        else:
            return self.name,

    def validate(self):
        """
        Validate item.
        """
        if self.required and not self.has_value:

            raise RequiredValueMissing(name=self.name, item=self)