mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-15 10:31:04 +00:00
🚧 process handler dependency
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import re
|
||||
import json
|
||||
import asyncio
|
||||
import inspect
|
||||
import dataclasses
|
||||
from functools import wraps, partial
|
||||
from typing import Any, Callable, Optional, Awaitable
|
||||
@ -51,6 +52,12 @@ def run_sync(func: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:
|
||||
return _wrapper
|
||||
|
||||
|
||||
def get_name(obj: Any) -> str:
|
||||
if inspect.isfunction(obj) or inspect.isclass(obj):
|
||||
return obj.__name__
|
||||
return obj.__class__.__name__
|
||||
|
||||
|
||||
class DataclassEncoder(json.JSONEncoder):
|
||||
"""
|
||||
:说明:
|
||||
|
Reference in New Issue
Block a user