From 7809eb3dd24ddfc3a0378846db017a421e175ec5 Mon Sep 17 00:00:00 2001 From: Fares Abawi Date: Mon, 22 Aug 2022 12:58:08 +0200 Subject: [PATCH] Bug fixed with double calling of function --- wrapify/connect/wrapper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrapify/connect/wrapper.py b/wrapify/connect/wrapper.py index 12f5e58..183fdbe 100644 --- a/wrapify/connect/wrapper.py +++ b/wrapify/connect/wrapper.py @@ -60,7 +60,7 @@ def encapsulate(func): def wrapper(*wds, **kwds): # Triggers on calling the function # execute the function as usual if cls._MiddlewareCommunicator__registry[func.__qualname__]["mode"] is None: - return func(*wds, **kwds) + return func.__wrapped__(*wds, **kwds) instance_address = hex(id(wds[0])) instance_id = cls._MiddlewareCommunicator__registry[func.__qualname__]["__WRAPIFY_INSTANCES"].index(instance_address) + 1 @@ -90,7 +90,7 @@ def wrapper(*wds, **kwds): # Triggers on calling the function new_args, new_kwargs = match_args( communicator["return_func_args"][comm_idx], communicator["return_func_kwargs"][comm_idx], wds[1:], kwd) communicator["wrapped_executor"].append(pub.Publishers.registry[communicator["return_func_type"][comm_idx]](*new_args, **new_kwargs)) - returns = func(*wds, **kwds) + returns = func.__wrapped__(*wds, **kwds) for ret_idx, ret in enumerate(returns): wrp_exec = cls._MiddlewareCommunicator__registry[func.__qualname__ + instance_id]["communicator"][ret_idx]["wrapped_executor"] # single element