towhee.functional.mixins.dispatcher.DispatcherMixin

class towhee.functional.mixins.dispatcher.DispatcherMixin[source]

Bases: object

Mixin for call dispatcher for data collection.

>>> import towhee
>>> from towhee import register
>>> @register(name='add_1')
... def add_1(x):
...     return x+1
>>> dc = towhee.range(5).stream()
>>> dc.add_1['a','b','c']() 
<map object at ...>

Methods

resolve

Dispatch unknown operators.

resolve(path, index, *arg, **kws)[source]

Dispatch unknown operators.

Parameters:
  • path (str) – The operator name.

  • index (str) – The index of data being called on.

Returns:

The operator that corresponds to the path.

Return type:

_OperatorLazyWrapper