projects
/
mdis.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
22e748c
)
all: decouple context visitor
author
Dmitry Selyutin
<ghostmansd@gmail.com>
Fri, 16 Jun 2023 20:42:45 +0000
(23:42 +0300)
committer
Dmitry Selyutin
<ghostmansd@gmail.com>
Fri, 16 Jun 2023 20:42:45 +0000
(23:42 +0300)
src/mdis/visitor.py
patch
|
blob
|
history
diff --git
a/src/mdis/visitor.py
b/src/mdis/visitor.py
index f70b5c52392a8f3fe4ee9bd0056af00cc04dca2f..8eb1f2219fb6fa5114d44e7de61b5d3439e6f005 100644
(file)
--- 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)