i want to get the parameter names of a function while it is in a decorator function, I keep getting the function wrapper parameters that is inside the decorator and not the parameters of the original method
_component_name_does_not_exist_error is the decorator and create_queue_to_component is the method, i want to get at least the names component_name and queue_name
def _component_name_does_not_exist_error(func):
def function_wrapper(self, component_name):
if not self._does_component_exist(component_name):
return self._create_response(
False,
f"Component named {component_name} doesn't exist"
)
return func
return function_wrapper
@_component_name_does_not_exist_error
def create_queue_to_component(self, component_name,
queue_name, queue_size=1):
if self.components[component_name].does_queue_exist(queue_name):
return self._create_response(
False,
f"Queue named {queue_name} already exist"
)
self.components[component_name].create_queue(queue_name=queue_name,
queue_size=queue_size)
return self._create_response(
True,
f"The Queue {queue_name} has been created"
)
i tried using these methods with no luck, all return component_name without the queue_name (to make the code below more clear, pipeline_manager is an object of the class containing the methods)
def get_method_parameters(self):
print(inspect.signature(self.pipeline_manager.create_queue_to_component))
print(self.pipeline_manager.create_queue_to_component.__code__.co_varnames)
print(inspect.getfullargspec(self.pipeline_manager.create_queue_to_component))
Thank you for reading this and for your help :)