2024-03-07 15:51:06 +08:00
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
2025-07-17 17:18:44 +08:00
|
|
|
def is_valid_uuid(uuid_str: str | None) -> bool:
|
|
|
|
if uuid_str is None or len(uuid_str) == 0:
|
|
|
|
return False
|
2024-03-07 15:51:06 +08:00
|
|
|
try:
|
|
|
|
uuid.UUID(uuid_str)
|
|
|
|
return True
|
|
|
|
except Exception:
|
|
|
|
return False
|