From d0c18fd7d31dbcd95e4b2a8f7c734951eb36f9a9 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 14 Jun 2023 01:22:55 +0300 Subject: [PATCH] core: simplify hooks representation --- src/mdis/core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) -- 2.30.2