各种 Anti-warning 合规性改动

This commit is contained in:
Remik1r3n
2025-02-03 03:00:26 +08:00
parent d194556eee
commit a11d5b1246
17 changed files with 59 additions and 91 deletions

View File

@@ -1,4 +1,6 @@
# 100% Standalone 的国服 AimeDB 通讯实现
# 100% Standalone 的舞萌国服 AimeDB 通讯实现
# Ver.CN1.41
# Mainline 20250203
import hashlib
import time
@@ -60,7 +62,7 @@ def apiAimeDB(qrCode):
def isSGWCFormat(input_string: str) -> bool:
'''简单检查二维码字符串是否符合格式'''
"""简单检查二维码字符串是否符合格式"""
if (
len(input_string) != 84 #长度
or not input_string.startswith("SGWCMAID") #识别字
@@ -72,10 +74,10 @@ def isSGWCFormat(input_string: str) -> bool:
def implAimeDB(qrCode:str, isAlreadyFinal:bool=False) -> str:
'''
"""
Aime DB 的请求的参考实现。
提供完整 QRCode 内容返回响应的字符串Json格式
'''
"""
if isAlreadyFinal:
qr_code_final = qrCode
else:
@@ -88,15 +90,15 @@ def implAimeDB(qrCode:str, isAlreadyFinal:bool=False) -> str:
# 获得结果
print("implAimeDB: StatusCode is ", response.status_code)
print("implAimeDB: Response Body is:", response.text)
return(response.text)
return response.text
def implGetUID(qr_content:str) -> dict:
'''
"""
包装后的 UID 扫码器实现。
此函数会返回 AimeDB 传回的 Json 转成 Python 字典的结果。
主要特点是添加了几个新的错误码(6000x)用来应对程序的错误。
'''
"""
# 检查格式
if not isSGWCFormat(qr_content):
return {'errorID': 60001} # 二维码内容明显无效