# encoding: utf-8

"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""

from __future__ import absolute_import, unicode_literals

import abc

from ._common import validate_null_string
from ._six import add_metaclass


@add_metaclass(abc.ABCMeta)
class NameSanitizer(object):
    @abc.abstractproperty
    def reserved_keywords(self):  # pragma: no cover
        pass

    @abc.abstractmethod
    def validate(self, value):  # pragma: no cover
        pass

    @abc.abstractmethod
    def sanitize(self, value, replacement_text=""):  # pragma: no cover
        pass

    def _is_reserved_keyword(self, value):
        return value in self.reserved_keywords

    @staticmethod
    def _validate_null_string(text):
        validate_null_string(text, error_msg="null name")

@@ -229,16 +229,51 @@
 taclass%0A
+from .error import ValidationError%0A
 %0A%0A@add_m
@@ -497,32 +497,201 @@
 r%0A        pass%0A%0A
+    def is_valid(self, value):%0A        try:%0A            self.validate(value)%0A        except (TypeError, ValidationError):%0A            return False%0A%0A        return True%0A%0A
     @abc.abstrac

Add is_valid method for file sanitizer classes