From e0e23283c15bc7fa58132b7d7bbcf6c75458ee20 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sat, 29 Aug 2020 22:32:40 +0800 Subject: [PATCH] :building_construction: store plugin info as dataclass --- nonebot/plugin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nonebot/plugin.py b/nonebot/plugin.py index 6241687d..ba526fcf 100644 --- a/nonebot/plugin.py +++ b/nonebot/plugin.py @@ -5,6 +5,7 @@ import re import sys import pkgutil import importlib +from dataclasses import dataclass from importlib._bootstrap import _load from nonebot.log import logger @@ -19,13 +20,11 @@ plugins: Dict[str, "Plugin"] = {} _tmp_matchers: Set[Type[Matcher]] = set() +@dataclass(eq=False) class Plugin(object): - - def __init__(self, name: str, module: ModuleType, - matchers: Set[Type[Matcher]]): - self.name = name - self.module = module - self.matchers = matchers + name: str + module: ModuleType + matcher: Set[Type[Matcher]] def on(rule: Union[Rule, RuleChecker] = Rule(),