From: Dmitry Selyutin Date: Tue, 13 Jun 2023 22:40:21 +0000 (+0300) Subject: README: update naming conventions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=09430849b9221521f533b468c9779138a8a0c6f2;p=mdis.git README: update naming conventions --- 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")