@@ -52,6 +52,19 @@ def _argspec_py3(func):
5252else :
5353 _argspec = _argspec_py2
5454
55+ try :
56+ from inspect import signature
57+ from collections import OrderedDict
58+ def doc_signature (func ):
59+ sig = signature (func )
60+ sig ._parameters = OrderedDict (list (sig ._parameters .items ())[1 :])
61+ return str (sig )
62+ except ImportError :
63+ from inspect import formatargspec
64+ def doc_signature (func ):
65+ args , varargs , keywords , defaults = _argspec (func )
66+ return formatargspec (args [1 :], varargs , keywords , defaults )
67+
5568from newrelic .core .agent import agent_instance
5669from newrelic .core .config import global_settings , flatten_settings
5770from newrelic .api .transaction import Transaction
@@ -81,8 +94,8 @@ def wrapper(self, line):
8194 return wrapped (self , * args , ** kwargs )
8295
8396 if wrapper .__name__ .startswith ('do_' ):
84- prototype = wrapper .__name__ [3 :] + ' ' + inspect . formatargspec (
85- args [ 1 :], varargs , keywords , defaults )
97+ prototype = wrapper .__name__ [3 :] + ' ' + doc_signature ( wrapped )
98+
8699 if hasattr (wrapper , '__doc__' ) and wrapper .__doc__ is not None :
87100 wrapper .__doc__ = '\n ' .join ((prototype ,
88101 wrapper .__doc__ .lstrip ('\n ' )))
0 commit comments