From 74ba8465cb14b8befbc610dd5124a625be0160a7 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Fri, 23 Jun 2023 11:26:51 +0300 Subject: [PATCH] walker: prevent nested walking --- src/mdis/walker.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mdis/walker.py b/src/mdis/walker.py index 3605d0a..ecc9f3b 100644 --- a/src/mdis/walker.py +++ b/src/mdis/walker.py @@ -49,13 +49,11 @@ class Walker(dispatcher.Dispatcher, metaclass=WalkerMeta): def dispatch_ordered_sequence(self, node): for (index, item) in enumerate(node): yield (item, node, index, IndexPath) - yield from self(item) @dispatcher.Hook(set, frozenset) def dispatch_unordered_sequence(self, node): for item in node: yield (item, node, item, HashPath) - yield from self(item) @dispatcher.Hook(dataclasses.is_dataclass) def dispatch_dataclass(self, node): @@ -63,16 +61,13 @@ class Walker(dispatcher.Dispatcher, metaclass=WalkerMeta): key = field.name value = getattr(node, key) yield (value, node, key, AttributePath) - yield from self(value) @dispatcher.Hook(dict) def dispatch_mapping(self, node): for (key, value) in node.items(): yield (key, node, key, HashPath) - yield from self(key) yield (value, node, key, IndexPath) - yield from self(value) @dispatcher.Hook(object) - def dispatch_object(self, node, path=()): + def dispatch_object(self, node): yield from () -- 2.30.2