15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
18
__all__ = ['needs_read_lock',
22
19
'needs_write_lock',
23
20
'use_fast_decorators',
28
25
def _get_parameters(func):
29
26
"""Recreate the parameters for a function using introspection.
31
:return: (function_params, passed_params)
32
function_params is the list of parameters to the original function.
33
This is something like "a, b, c=None, d=1"
34
passed_params is how you would pass the parameters to a new function.
35
This is something like "a=a, b=b, c=c, d=d"
28
:return: (function_params, calling_params)
29
function_params: is a string representing the parameters of the
30
function. (such as "a, b, c=None, d=1")
31
This is used in the function declaration.
32
calling_params: is another string representing how you would call the
33
function with the correct parameters. (such as "a, b, c=c, d=d")
34
Assuming you sued function_params in the function declaration, this
35
is the parameters to put in the function call.
39
def wrapper(%(function_params)s):
40
return original(%(calling_params)s)
41
args, varargs, varkw, defaults = _inspect.getargspec(func)
42
formatted = _inspect.formatargspec(args, varargs=varargs,
42
# "import inspect" should stay in local scope. 'inspect' takes a long time
43
# to import the first time. And since we don't always need it, don't import
46
args, varargs, varkw, defaults = inspect.getargspec(func)
47
formatted = inspect.formatargspec(args, varargs=varargs,
45
50
if defaults is None: