all: rename instance to node
[mdis.git] / src / mdis / dispatcher.py
index 7add02773109ff52ffc880dedf4a779ef56abc18..c956e0c9e283b3c9eac78e13eb77fe179a6137b1 100644 (file)
@@ -33,9 +33,8 @@ class Hook(object):
 
     def __call__(self, call):
         class ConcreteHook(Hook):
-            def __call__(self, dispatcher, instance, *args, **kwargs):
-                return call(self=dispatcher, instance=instance,
-                    *args, **kwargs)
+            def __call__(self, dispatcher, node, *args, **kwargs):
+                return call(dispatcher, node, *args, **kwargs)
 
         return ConcreteHook(*tuple(self))
 
@@ -82,15 +81,15 @@ class DispatcherMeta(type):
 
 
 class Dispatcher(metaclass=DispatcherMeta):
-    def __call__(self, instance, *args, **kwargs):
-        for typeid in instance.__class__.__mro__:
+    def __call__(self, node, *args, **kwargs):
+        for typeid in node.__class__.__mro__:
             hook = self.__class__.dispatch(typeid=typeid)
             if hook is not None:
                 break
         if hook is None:
             hook = self.__class__.dispatch()
-        return hook(dispatcher=self, instance=instance, *args, **kwargs)
+        return hook(self, node, *args, **kwargs)
 
     @Hook(object)
-    def dispatch_object(self, instance, *args, **kwargs):
+    def dispatch_object(self, node, *args, **kwargs):
         raise NotImplementedError()