Commit b7cb4eeb authored by Joanne Hugé's avatar Joanne Hugé

new rpc

parent 2263c33a
...@@ -36,14 +36,14 @@ RENEW_PERIOD = 30 * 86400 ...@@ -36,14 +36,14 @@ 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) sig = inspect.signature(f)
assert not (varargs or varkw), f sig = sig.replace(parameters=[*sig.parameters.values()][1:])
if not defaults: def getcallargs(**kw):
defaults = () ba = sig.bind(**kw)
i = len(args) - len(defaults) ba.apply_defaults()
f.getcallargs = eval("lambda %s: locals()" % ','.join(args[1:i] return ba.arguments
+ list(map("%s=%r".__mod__, list(zip(args[i:], defaults)))))) f.getcallargs = getcallargs
return f return f
def rpc_private(f): def rpc_private(f):
f._private = None f._private = None
......
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