From 09430849b9221521f533b468c9779138a8a0c6f2 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Wed, 14 Jun 2023 01:40:21 +0300 Subject: [PATCH] README: update naming conventions --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9fd6422..7284b66 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The example below shows how to override the way the dicts are traversed so that class CustomWalker(mdis.walker.Walker): @mdis.core.hook(dict) - def walk_dict(self, instance): + def dispatch_dict(self, instance): for (key, value) in instance.items(): yield (value, key) yield from self((value, key)) @@ -60,21 +60,21 @@ The example below shows how to execute some arbitrary code upon visiting an obje class CustomVisitor(mdis.visitor.Visitor): @mdis.core.hook(int) @contextlib.contextmanager - def visit_int(self, instance): + def dispatch_int(self, instance): print("entering int") yield (instance + 42) print("leaving int") @mdis.core.hook(str) @contextlib.contextmanager - def visit_str(self, instance): + def dispatch_str(self, instance): print("entering str") yield f"!!!{instance}!!!" print("leaving str") @mdis.core.hook(object) @contextlib.contextmanager - def visit_object(self, instance): + def dispatch_object(self, instance): print("entering object") yield instance print("leaving object") -- 2.30.2