Commit a355842e authored by Tom Niget's avatar Tom Niget

style: stop using deprecated getargspec for rpc

parent 742525b0
...@@ -35,13 +35,11 @@ RENEW_PERIOD = 30 * 86400 ...@@ -35,13 +35,11 @@ RENEW_PERIOD = 30 * 86400
BABEL_HMAC = 'babel_hmac0', 'babel_hmac1', 'babel_hmac2' BABEL_HMAC = 'babel_hmac0', 'babel_hmac1', 'babel_hmac2'
def rpc(f): def rpc(f):
args, varargs, varkw, defaults = inspect.getargspec(f) argspec = inspect.getfullargspec(f)
assert not (varargs or varkw), f assert not (argspec.varargs or argspec.varkw), f
if not defaults: sig = inspect.signature(f)
defaults = () sig = sig.replace(parameters=[v.replace(annotation=inspect.Parameter.empty) for v in sig.parameters.values()][1:], return_annotation=inspect.Signature.empty)
i = len(args) - len(defaults) f.getcallargs = eval("lambda %s: locals()" % str(sig)[1:-1])
f.getcallargs = eval("lambda %s: locals()" % ','.join(args[1:i]
+ list(map("%s=%r".__mod__, list(zip(args[i:], defaults))))))
return f return f
def rpc_private(f): def rpc_private(f):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment