from typing import List

import nh3

from ._Sanitizer import Sanitizer, T


class Nh3Sanitizer(Sanitizer):

    def _types_to_sanitize(self) -> List[type]:
        return [str]

    def _sanitize(self, value: T) -> T:
        if isinstance(value, str):
            return nh3.clean(value, tags=set())
        return value
