feat: enhance typing

This commit is contained in:
-LAN-
2025-08-29 13:17:02 +08:00
parent bfbb36756a
commit 3dee8064ba
3 changed files with 50 additions and 23 deletions

9
api/libs/typing.py Normal file
View File

@ -0,0 +1,9 @@
from typing import TypeGuard
def is_str_dict(v: object) -> TypeGuard[dict[str, object]]:
return isinstance(v, dict)
def is_str(v: object) -> TypeGuard[str]:
return isinstance(v, str)