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

new rpc

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