From: Dmitry Selyutin Date: Tue, 13 Jun 2023 22:22:55 +0000 (+0300) Subject: core: simplify hooks representation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d0c18fd7d31dbcd95e4b2a8f7c734951eb36f9a9;p=mdis.git core: simplify hooks representation --- diff --git a/src/mdis/core.py b/src/mdis/core.py index 61c4fd8..7f257c8 100644 --- a/src/mdis/core.py +++ b/src/mdis/core.py @@ -10,7 +10,14 @@ class TypeidHook(object): yield from self.__typeids def __repr__(self): - return f"{self.__class__.__name__}({self.__typeids!r})" + names = [] + for typeid in self.__typeids: + name = typeid.__qualname__ + module = typeid.__module__ + if module not in ("builtins",): + name = f"{module}.{name}" + names.append(name) + return f"<{', '.join(names)}>" def __call__(self, call): if not callable(call): @@ -32,7 +39,7 @@ class CallHook(object): yield from self.__typeids def __repr__(self): - return f"{self.__class__.__name__}(call={self.__call!r}, typeids={self.__typeids!r})" + return repr(self.__typeids) def __call__(self, dispatcher, instance): return self.__call(dispatcher, instance)