Skip to content

Instantly share code, notes, and snippets.

@shauns
Created July 28, 2014 16:41
Show Gist options
  • Save shauns/96a613aba981e48f0562 to your computer and use it in GitHub Desktop.
Save shauns/96a613aba981e48f0562 to your computer and use it in GitHub Desktop.
Entrypoints with two functions
# rpc_factory is what used to be rpc
@entrypoint
def rpc_factory(expected_exceptions=None):
return DependencyFactory(NovaRpcProvider, expected_exceptions)
def rpc(service_fn=None, expected_exceptions=None):
if service_fn is None:
return partial(rpc, expected_exceptions=expected_exceptions)
rpc_factory(expected_exceptions=expected_exceptions)(service_fn)
@wrapt.decorator
def wrapper(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)
return wrapper(service_fn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment