from .feishu import FeishuNotifier # noqa def sanitize_and_shorten(text: str, max_length: int=2000) -> str: """Sanitize the text and shorten it if it's too long.""" if text is None: return '' text = text.replace('\n', ' ').replace('\r', ' ').replace('\t', ' ').replace('`', ' ') if len(text) > max_length: text = text[:max_length - 3] + '...' return text