I have the following code in python2.7 where the decorator is a third party code and shall not be changed:
# tasks.py
def test(val):
print val
@app.task
def add(a, b):
return a + b
#main.py:
import mypackage.tasks as tasks
for method in tasks.__dict__.values():
if hasattr(method, '_decorated') and method._decorated:
print method.name.split('.')[-1]
### here I want to get the method arguments
The problem is that I cannot get the method arguments of a decorated method. I've already tried:
inspect.getargspec(method)
#and
tasks.test.func_code.co_varnames
they do not work for decorated methods. Any ideas?