# Path: lighty/db/functor.py
# class BaseField(functor.BaseFunctor):
#     '''Base field class
#     '''
#     # Declare lazy operations
#     _lazy = (operator.__lt__, operator.__gt__, operator.__le__,
#              operator.__ge__, operator.__eq__, operator.__ne__,
#              operator.__add__, )
# 
#     def __init__(self):
#         super(BaseField, self).__init__()
# 
#     def create_copy(self, operation, operand):
#         return FieldFunctor(self, operation, operand)
# 
# class NumericField(BaseField):
#     '''Base class for any numerical fields. It can be used to create:
# 
#         integers
#         floats
#         decimals
#     '''
#     _lazy = (operator.__sub__, operator.__mul__, operator.__truediv__,
#              operator.__floordiv__, operator.__mod__, operator.__pow__, )
# 
# class SequenceField(BaseField):
#     '''Class used for sequences fields creations. It can be used to create:
# 
#         strings
#         arrays
#         dictionaries
#     '''
#     _lazy = (operator.__getitem__, operator.__contains__, )
# 
#     def contains(self, operand):
#         '''Check is object contains
#         '''
#         return self.create_copy(operator.__contains__, operand)
# 
#     def __len__(self):
#         return 'len'


import lighty.validators
        import datetime
from .functor import BaseField, NumericField, SequenceField
        from ..utils import string_types
        from ..utils import string_types
            from datetime import datetime
        from time import gmtime
        options = add_validator(lighty.validators.INTEGER_VALIDATOR, options)
        super(IntegerField, self).__init__(**options)

    def __set__(self, instance, value):
        '''Set value as int
        '''
        super(IntegerField, self).__set__(instance, int(value))


class PositiveIntegerField(IntegerField):
    '''Like an IntegerField, but must be positive.
    '''

    def __init__(self, **options):
        '''Create new field. Adds validator that checks value to be greater
        than 0 into the validator's list
        '''
        options = add_validator(lighty.validators.MinValueValidator(1),
                                options)
        super(PositiveIntegerField, self).__init__(**options)


class AutoField(IntegerField):
    '''An IntegerField that automatically increments according to available
    IDs. You usually won't need to use this directly; a primary key field will
    automatically be added to your model if you don't specify otherwise. See
    Automatic primary key fields.
    '''



# Path: lighty/db/functor.py
# class BaseField(functor.BaseFunctor):
#     '''Base field class
#     '''
#     # Declare lazy operations
#     _lazy = (operator.__lt__, operator.__gt__, operator.__le__,
#              operator.__ge__, operator.__eq__, operator.__ne__,
#              operator.__add__, )
# 
#     def __init__(self):
#         super(BaseField, self).__init__()
# 
#     def create_copy(self, operation, operand):
#         return FieldFunctor(self, operation, operand)
# 
# class NumericField(BaseField):
#     '''Base class for any numerical fields. It can be used to create:
# 
#         integers
#         floats
#         decimals
#     '''
#     _lazy = (operator.__sub__, operator.__mul__, operator.__truediv__,
#              operator.__floordiv__, operator.__mod__, operator.__pow__, )
# 
# class SequenceField(BaseField):
#     '''Class used for sequences fields creations. It can be used to create:
# 
#         strings
#         arrays
#         dictionaries
#     '''
#     _lazy = (operator.__getitem__, operator.__contains__, )
# 
#     def contains(self, operand):
#         '''Check is object contains
#         '''
#         return self.create_copy(operator.__contains__, operand)
# 
#     def __len__(self):
#         return 'len'


# Path: lighty/db/fields.py
import lighty.validators
        import datetime
from .functor import BaseField, NumericField, SequenceField
        from ..utils import string_types
        from ..utils import string_types
            from datetime import datetime
        from time import gmtime

        options = add_validator(lighty.validators.INTEGER_VALIDATOR, options)
        super(IntegerField, self).__init__(**options)

    def __set__(self, instance, value):
        '''Set value as int
        '''
        super(IntegerField, self).__set__(instance, int(value))


class PositiveIntegerField(IntegerField):
    '''Like an IntegerField, but must be positive.
    '''

    def __init__(self, **options):
        '''Create new field. Adds validator that checks value to be greater
        than 0 into the validator's list
        '''
        options = add_validator(lighty.validators.MinValueValidator(1),
                                options)
        super(PositiveIntegerField, self).__init__(**options)


class AutoField(IntegerField):
    '''An IntegerField that automatically increments according to available
    IDs. You usually won't need to use this directly; a primary key field will
    automatically be added to your model if you don't specify otherwise. See
    Automatic primary key fields.
    '''



class FloatField(FieldDescriptor, NumericField):