# 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
        Helper to get value of a named attribute irrespective of whether it is passed
        with or without "@" prefix.
        """
        at_name = '@{}'.format(name)

        if name in kwargs:
            if at_name in kwargs:
                raise ValueError('Both {!r} and {!r} specified in kwargs'.format(name, at_name))
            return kwargs[name]

        if at_name in kwargs:
            return kwargs[at_name]

        return not_set

    def __init__(self, name=not_set, **kwargs):
        """
        Creates a config item with its attributes. 
        """

        self._section = None

        if name is not not_set:
            if not isinstance(name, six.string_types):
                raise TypeError('Item name must be a string, got {!r}'.format(type(name)))
            self.name = name

        # Type must be set first because otherwise setting value below may fail.
        type_ = self._get_kwarg('type', kwargs)
        if type_ is not not_set:

# 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

        Helper to get value of a named attribute irrespective of whether it is passed
        with or without "@" prefix.
        """
        at_name = '@{}'.format(name)

        if name in kwargs:
            if at_name in kwargs:
                raise ValueError('Both {!r} and {!r} specified in kwargs'.format(name, at_name))
            return kwargs[name]

        if at_name in kwargs:
            return kwargs[at_name]

        return not_set

    def __init__(self, name=not_set, **kwargs):
        """
        Creates a config item with its attributes. 
        """

        self._section = None

        if name is not not_set:
            if not isinstance(name, six.string_types):
                raise TypeError('Item name must be a string, got {!r}'.format(type(name)))
            self.name = name

        # Type must be set first because otherwise setting value below may fail.
        type_ = self._get_kwarg('type', kwargs)
        if type_ is not not_set:

            self.type = Types.translate(type_)