规范bv转av(python)示例的类型 (#960)

This commit is contained in:
Kataick 2024-02-01 14:13:56 +08:00 committed by GitHub
parent 6659958399
commit f16cfe9793
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -161,7 +161,7 @@ BASE = 58
BV_LEN = 12
PREFIX = "BV1"
def av2bv(aid):
def av2bv(aid: int) -> str:
bytes = [b'B', b'V', b'1', b'0', b'0', b'0', b'0', b'0', b'0', b'0', b'0', b'0']
bv_idx = BV_LEN - 1
tmp = (MAX_AID | aid) ^ XOR_CODE
@ -173,7 +173,7 @@ def av2bv(aid):
bytes[4], bytes[7] = bytes[7], bytes[4]
return "".join([i.decode() for i in bytes])
def bv2av(bvid: str):
def bv2av(bvid: str) -> int:
bvid = list(bvid)
bvid[3], bvid[9] = bvid[9], bvid[3]
bvid[4], bvid[7] = bvid[7], bvid[4]