39 lines
859 B
Python
39 lines
859 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
VWED.util 模块 - 工具函数
|
|
"""
|
|
|
|
import asyncio
|
|
|
|
|
|
class VWEDUtilModule:
|
|
"""VWED.util 模块 - 工具函数"""
|
|
|
|
def __init__(self, script_id: str):
|
|
self.script_id = script_id
|
|
|
|
def sleep(self, seconds: float):
|
|
"""同步睡眠"""
|
|
import time
|
|
time.sleep(seconds)
|
|
|
|
async def async_sleep(self, seconds: float):
|
|
"""异步睡眠"""
|
|
await asyncio.sleep(seconds)
|
|
|
|
def now(self) -> str:
|
|
"""获取当前时间"""
|
|
from datetime import datetime
|
|
return datetime.now().isoformat()
|
|
|
|
def timestamp(self) -> float:
|
|
"""获取当前时间戳"""
|
|
import time
|
|
return time.time()
|
|
|
|
def uuid(self) -> str:
|
|
"""生成UUID"""
|
|
import uuid
|
|
return str(uuid.uuid4()) |