From b3ae615b34b02ce013766fade4684570d4d9ce54 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 3 Sep 2023 07:24:40 +0300 Subject: [PATCH] all: fix args and kwargs --- src/mdis/dispatcher.py | 2 +- src/mdis/visitor.py | 4 ++-- src/mdis/walker.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mdis/dispatcher.py b/src/mdis/dispatcher.py index a80d3af..a8794d4 100644 --- a/src/mdis/dispatcher.py +++ b/src/mdis/dispatcher.py @@ -125,5 +125,5 @@ class Dispatcher(metaclass=DispatcherMeta): return hook(self, node, *args, **kwargs) @Hook(object) - def dispatch_object(self, node): + def dispatch_object(self, node, *_, **__): raise NotImplementedError() diff --git a/src/mdis/visitor.py b/src/mdis/visitor.py index b9c2056..3342684 100644 --- a/src/mdis/visitor.py +++ b/src/mdis/visitor.py @@ -15,12 +15,12 @@ class VisitorMeta(dispatcher.DispatcherMeta): class Visitor(dispatcher.Dispatcher, metaclass=VisitorMeta): @dispatcher.Hook(object) - def dispatch_object(self, node): + def dispatch_object(self, node, *_, **__): return node class ContextVisitor(Visitor): @dispatcher.Hook(object) @contextlib.contextmanager - def dispatch_object(self, node): + def dispatch_object(self, node, *_, **__): yield node diff --git a/src/mdis/walker.py b/src/mdis/walker.py index ecc9f3b..b98644a 100644 --- a/src/mdis/walker.py +++ b/src/mdis/walker.py @@ -46,28 +46,28 @@ class HashPath(GenericPath): class Walker(dispatcher.Dispatcher, metaclass=WalkerMeta): @dispatcher.Hook(tuple, list) - def dispatch_ordered_sequence(self, node): + def dispatch_ordered_sequence(self, node, *_, **__): for (index, item) in enumerate(node): yield (item, node, index, IndexPath) @dispatcher.Hook(set, frozenset) - def dispatch_unordered_sequence(self, node): + def dispatch_unordered_sequence(self, node, *_, **__): for item in node: yield (item, node, item, HashPath) @dispatcher.Hook(dataclasses.is_dataclass) - def dispatch_dataclass(self, node): + def dispatch_dataclass(self, node, *_, **__): for field in dataclasses.fields(node): key = field.name value = getattr(node, key) yield (value, node, key, AttributePath) @dispatcher.Hook(dict) - def dispatch_mapping(self, node): + def dispatch_mapping(self, node, *_, **__): for (key, value) in node.items(): yield (key, node, key, HashPath) yield (value, node, key, IndexPath) @dispatcher.Hook(object) - def dispatch_object(self, node): + def dispatch_object(self, node, *_, **__): yield from () -- 2.30.2