# Path: elasticmagic/compat.py
# PY2 = sys.version_info[0] == 2
# def force_unicode(value):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
#     class metaclass(meta):


import base64
import datetime
import inspect
import re
import copy
import dateutil.parser
    import geohash
from .compat import binary_type, text_type, string_types
    pass


class Type(object):
    python_type = None

    def __init__(self):
        self.sub_type = None
        self.doc_cls = None

    def to_python(self, value):
        if value is None:
            return None
        if self.python_type is not None:
            return self.python_type(value)
        return value

    def to_python_single(self, value):
        return self.to_python(value)

    def from_python(self, value, compiler, validate=False):
        return value


class String(Type):
    __visit_name__ = 'string'

    python_type = text_type

    def from_python(self, value, compiler, validate=False):

# Path: elasticmagic/compat.py
# PY2 = sys.version_info[0] == 2
# def force_unicode(value):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
#     class metaclass(meta):


# Path: elasticmagic/types.py
import base64
import datetime
import inspect
import re
import copy
import dateutil.parser
    import geohash
from .compat import binary_type, text_type, string_types

    pass


class Type(object):
    python_type = None

    def __init__(self):
        self.sub_type = None
        self.doc_cls = None

    def to_python(self, value):
        if value is None:
            return None
        if self.python_type is not None:
            return self.python_type(value)
        return value

    def to_python_single(self, value):
        return self.to_python(value)

    def from_python(self, value, compiler, validate=False):
        return value


class String(Type):
    __visit_name__ = 'string'

    python_type = text_type

    def from_python(self, value, compiler, validate=False):

        return text_type(value)