mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 05:06:56 +08:00
27 lines
677 B
Python
27 lines
677 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from abc import ABC
|
|
from types import ModuleType
|
|
from typing import TYPE_CHECKING
|
|
from typing import Any, Set, List, Dict, Type, Tuple, Mapping
|
|
from typing import Union, Optional, Iterable, Callable, Awaitable
|
|
|
|
# import some modules needed when checking types
|
|
if TYPE_CHECKING:
|
|
from nonebot.adapters import BaseBot as Bot
|
|
from nonebot.event import Event
|
|
|
|
|
|
def overrides(InterfaceClass: ABC):
|
|
|
|
def overrider(func):
|
|
assert func.__name__ in dir(
|
|
InterfaceClass), f"Error method: {func.__name__}"
|
|
return func
|
|
|
|
return overrider
|
|
|
|
|
|
Handler = Callable[["Bot", "Event", dict], Awaitable[None]]
|