towhee.runtime.node_repr.OperatorRepr

class towhee.runtime.node_repr.OperatorRepr(operator: Union[str, Callable], type: str, init_args: Tuple, init_kws: Dict[str, any], tag: str = 'main')[source]

Bases: object

OperatorRepr for operator representations.

Parameters:
  • operator (Union[str, Callable]) – The operator, such as a callable (lambda, function) or the name of an op on the hub.

  • type (str) – The type of operator, such as ‘hub’, ‘lambda’ and ‘callable’.

  • init_args (Tuple) – The args to initialize the operator.

  • init_kws (Dict[str, any]) – The kwargs to initialize the operator.

  • tag (str) – The tag for The function, defaults to ‘main’.

Methods

from_dict

Return a OperatorRepr from a description dict.

Attributes

init_args

init_kws

operator

tag

type

__init__(operator: Union[str, Callable], type: str, init_args: Tuple, init_kws: Dict[str, any], tag: str = 'main')[source]
static from_dict(op_info: Dict[str, Any]) OperatorRepr[source]

Return a OperatorRepr from a description dict.

Parameters:

op_info (Dict[str, Any]) – Dictionary about operator information.

Returns:

OperatorRepr object.