<commit_before>from datetime import datetime


class Filter(object):
    '''
    Provides casting and validation functions for Fields.
    '''
    @staticmethod
    def to_python(value):
        return value

    @staticmethod
    def from_python(value):
        return value


class _CastFilter(Filter):
    def to_python(self, value):
        return self.type_class(value)


class IntegerFilter(_CastFilter):
    type_class = int


class FloatFilter(_CastFilter):
    type_class = float


class TimeFilter(object):
    @staticmethod
    def to_python(value):
        datetime.strptime(value, '%H:%M:%S').time()

    @staticmethod
    def from_python(value):
        return value.isoformat()


class DateFilter(object):
    @staticmethod
    def to_python(value):
        datetime.strptime(value, '%Y-%m-%d').date()

    @staticmethod
    def from_python(value):
        return value.isoformat()


class DateTimeFilter(object):
    @staticmethod
    def to_python(value):
        datetime.strptime(value, '%Y-%m-%d %H:%M:%S')

    @staticmethod
    def from_python(value):
        return value.isoformat(' ')<commit_msg>Ignore None values in filters Return the converted values in date/time filters<commit_after>from datetime import datetime


class Filter(object):
    '''
    Provides casting and validation functions for Fields.
    '''
    @staticmethod
    def to_python(value):
        return value

    @staticmethod
    def from_python(value):
        return value


class _CastFilter(Filter):
    def to_python(self, value):
        if value is None:
            return value
        return self.type_class(value)


class IntegerFilter(_CastFilter):
    type_class = int


class FloatFilter(_CastFilter):
    type_class = float


class TimeFilter(object):
    @staticmethod
    def to_python(value):
        return datetime.strptime(value, '%H:%M:%S').time()

    @staticmethod
    def from_python(value):
        if value is None:
            return value
        return value.isoformat()


class DateFilter(object):
    @staticmethod
    def to_python(value):
        return datetime.strptime(value, '%Y-%m-%d').date()

    @staticmethod
    def from_python(value):
        if value is None:
            return value
        return value.isoformat()


class DateTimeFilter(object):
    @staticmethod
    def to_python(value):
        return datetime.strptime(value, '%Y-%m-%d %H:%M:%S')

    @staticmethod
    def from_python(value):
        if value is None:
            return value
        return value.isoformat(' ')
{'fraction_non_alphanumeric': 0.10229067930489731, 'fraction_numerical': 0.0, 'mean_word_length': 2.826283987915408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1746435', 'n_tokens_mistral': 743, 'n_tokens_neox': 718, 'n_words': 188}