chore: 显式返回None

This commit is contained in:
春河晴
2025-04-21 14:42:33 +09:00
parent 1dd3c62c55
commit 13e05adf80
8 changed files with 35 additions and 24 deletions

View File

@@ -2,7 +2,7 @@ import random
import time
import re
from collections import Counter
from typing import Dict, List
from typing import Dict, List, Optional
import jieba
import numpy as np
@@ -688,7 +688,7 @@ def count_messages_between(start_time: float, end_time: float, stream_id: str) -
return 0, 0
def translate_timestamp_to_human_readable(timestamp: float, mode: str = "normal") -> str:
def translate_timestamp_to_human_readable(timestamp: float, mode: str = "normal") -> Optional[str]:
"""将时间戳转换为人类可读的时间格式
Args:
@@ -716,6 +716,7 @@ def translate_timestamp_to_human_readable(timestamp: float, mode: str = "normal"
return f"{int(diff / 86400)}天前:\n"
else:
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp)) + ":\n"
return None
def parse_text_timestamps(text: str, mode: str = "normal") -> str: