From 0f430159420cb0ce4c6a990eaa9448e562d04c72 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Fri, 16 Jun 2023 23:42:45 +0300 Subject: [PATCH] all: decouple context visitor --- src/mdis/visitor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mdis/visitor.py b/src/mdis/visitor.py index f70b5c5..8eb1f22 100644 --- a/src/mdis/visitor.py +++ b/src/mdis/visitor.py @@ -8,7 +8,13 @@ class VisitorMeta(_dispatcher.DispatcherMeta): class Visitor(_dispatcher.Dispatcher, metaclass=VisitorMeta): + @_dispatcher.Hook(object) + def dispatch_object(self, instance): + return instance + + +class ContextVisitor(Visitor): @_dispatcher.Hook(object) @_contextlib.contextmanager def dispatch_object(self, instance): - yield instance + yield super().__call__(instance=instance) -- 2.30.2