change typing

This commit is contained in:
yanyongyu
2020-08-07 17:51:57 +08:00
parent f2b6f08599
commit 332aac6497
5 changed files with 56 additions and 19 deletions

View File

@ -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]]