# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):
# 
# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):


import datetime
import uuid
import muninn.geometry as geometry
from muninn._compat import long
from muninn._compat import string_types as basestring


class Sequence(Container):
    sub_type = None

    @classmethod
    def validate(cls, value, partial=False, path=""):
        path = "%s:" % cls.name() if not path else path

        try:
            iterator = iter(value)
        except TypeError:
            raise ValueError(prefix_message_with_path(path, "expected a sequence"))

        for index, sub_value in enumerate(iterator):
            if issubclass(cls.sub_type, Container):
                cls.sub_type.validate(sub_value, partial, path + "[%d]" % index)
            else:
                try:
                    cls.sub_type.validate(sub_value)
                except ValueError as _error:
                    raise ValueError(prefix_message_with_path(path + "[%d]" % index, str(_error)))


class MetaMapping(type):
    def __new__(meta, name, bases, dct):
        class_dct = {}
        items = {}
        for key, value in dct.items():
            # class: not optional, no index

# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):
# 
# Path: muninn/_compat.py
# PY3 = sys.version_info[0] == 3
#     def is_python2_unicode(x):
#     def dictkeys(d):
#     def dictvalues(d):
#     def path_utf8(path):
#     def encode(s):
#     def decode(s):
#     def is_python2_unicode(x):
#     def path_utf8(path):
#     def decode(s):
#     def encode(s):


# Path: muninn/schema.py
import datetime
import uuid
import muninn.geometry as geometry
from muninn._compat import long
from muninn._compat import string_types as basestring



class Sequence(Container):
    sub_type = None

    @classmethod
    def validate(cls, value, partial=False, path=""):
        path = "%s:" % cls.name() if not path else path

        try:
            iterator = iter(value)
        except TypeError:
            raise ValueError(prefix_message_with_path(path, "expected a sequence"))

        for index, sub_value in enumerate(iterator):
            if issubclass(cls.sub_type, Container):
                cls.sub_type.validate(sub_value, partial, path + "[%d]" % index)
            else:
                try:
                    cls.sub_type.validate(sub_value)
                except ValueError as _error:
                    raise ValueError(prefix_message_with_path(path + "[%d]" % index, str(_error)))


class MetaMapping(type):
    def __new__(meta, name, bases, dct):
        class_dct = {}
        items = {}
        for key, value in dct.items():
            # class: not optional, no index

            if isinstance(value, type) and issubclass(value, Type):