Operation Math

async dffml.operation.math.multiply(multiplicand, multiplier)[source]

Multiply record values

Parameters:
  • multiplicand (generic) – An arithmetic type value.

  • multiplier (generic) – An arithmetic type value.

Returns:

A dict containing the product.

Return type:

dict

Examples

The following example shows how to use multiply.

>>> import asyncio
>>> from dffml import *
>>>
>>> dataflow = DataFlow.auto(multiply, GetSingle)
>>> dataflow.seed.append(
...    Input(
...        value=[multiply.op.outputs["product"].name,],
...        definition=GetSingle.op.inputs["spec"],
...    )
... )
>>> inputs = [
...    Input(
...        value=12,
...        definition=multiply.op.inputs["multiplicand"],
...    ),
...    Input(
...        value=3,
...        definition=multiply.op.inputs["multiplier"],
...    ),
... ]
>>>
>>> async def main():
...     async for ctx, results in MemoryOrchestrator.run(dataflow, inputs):
...         print(results)
>>>
>>> asyncio.run(main())
{'product': 36}