mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-07 04:26:45 +00:00
change typing
This commit is contained in:
@ -1,13 +1,26 @@
|
||||
#!/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]]
|
||||
|
Reference in New Issue
Block a user