langtree.operators

Submodules

Package Contents

Classes

Operator

A class to represent and process custom call and parse operations.

Parallel

Sequential

Functions

chainable(func)

Decorator that makes a function chainable with its arguments.

class langtree.operators.Operator(call=default_call, parse=default_parse)[source]

Bases: object

A class to represent and process custom call and parse operations.

__call__(*args, **kwargs)[source]

Call the Operator’s call function and parse its result.

Parameters:
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

The parsed result of the call function.

freeze_call(**kwargs)[source]

Freeze specific arguments for the Operator’s call function.

Parameters:

**kwargs – Keyword arguments to freeze.

freeze_parse(**kwargs)[source]

Freeze specific arguments for the Operator’s parse function.

Parameters:

**kwargs – Keyword arguments to freeze.

langtree.operators.chainable(func)[source]

Decorator that makes a function chainable with its arguments.

Parameters:

func (callable) – The function to make chainable.

Returns:

The chainable function.

Return type:

callable

class langtree.operators.Parallel(operations)[source]
__iadd__(other)[source]
__add__(other)[source]
add(other)[source]
__call__(*args, **kwargs)[source]
class langtree.operators.Sequential(operations)[source]
__iadd__(other)[source]
__add__(other)[source]
__call__(*args, **kwargs)[source]
add(other)[source]