argclz.dispatch.annotations.dispatch#

argclz.dispatch.annotations.dispatch(command, *alias, group=None, order=5, usage=None, hidden=False)[source]#

A decorator that mark a function as a dispatch target function.

All functions decorated in same dispatch group should have save function signature (at least for non-default parameters). For example:

Example

>>> class D(Dispatch):
...     @dispatch('A')
...     def function_a(self, a, b, c=None):
...         pass
...     @dispatch('B')
...     def function_b(self, a, b, d=None):
...         pass
...     def run_function(self):
...         self.invoke_command(self, 'A', a, b)
Parameters:
Return type:

Callable[[F], F]