feat: 完善类型注释,增加 mypy 类型检测

This commit is contained in:
Nanmi
2023-07-16 17:57:18 +08:00
parent e5bdc63323
commit 745e59c875
18 changed files with 116 additions and 90 deletions

View File

@@ -2,6 +2,7 @@
import re
import json
import asyncio
from typing import List
import aioredis
import tornado.web
@@ -14,7 +15,7 @@ def extract_verification_code(message) -> str:
Extract verification code of 6 digits from the SMS.
"""
pattern = re.compile(r'\b[0-9]{6}\b')
codes = pattern.findall(message)
codes: List[str]= pattern.findall(message)
return codes[0] if codes and len(codes) > 0 else ""