更新 mypy 版本至 1.13.0,重构 marshoai-megakits 模块并添加随机数和计算功能

This commit is contained in:
2024-12-13 02:40:55 +08:00
parent 8defcfdd66
commit 5797381824
25 changed files with 101 additions and 80 deletions

View File

@@ -0,0 +1,45 @@
import random
async def random_turntable(upper: int, lower: int):
"""Random Turntable
Args:
upper (int): _description_
lower (int): _description_
Returns:
_type_: _description_
"""
return random.randint(lower, upper)
async def number_calc(a: str, b: str, op: str) -> str:
"""Number Calc
Args:
a (str): _description_
b (str): _description_
op (str): _description_
Returns:
str: _description_
"""
a, b = float(a), float(b) # type: ignore
match op:
case "+":
return str(a + b) # type: ignore
case "-":
return str(a - b) # type: ignore
case "*":
return str(a * b) # type: ignore
case "/":
return str(a / b) # type: ignore
case "**":
return str(a**b) # type: ignore
case "%":
return str(a % b)
case _:
return "未知运算符"