def __call__(self, string): try: sanitized_str = unicode(string) except UnicodeDecodeError: import ast sanitized_str = unicode(ast.literal_eval("u%s" % repr(string))) return FileType.__call__(self, sanitized_str)
def __call__(self, string: str) -> None: try: sanitized_str = str(string) except UnicodeDecodeError: import ast # pylint: disable=import-outside-toplevel sanitized_str = str(ast.literal_eval("u%s" % repr(string))) return FileType.__call__(self, sanitized_str)