Repository: intel/dffml

Issue:
operations: io: Fixup example
https://github.com/intel/dffml/blob/c0946b2d212239cfe4e470e63ab3da22c9cd97c4/dffml/operation/io.py#L116

copy the code here into a Python file and format it with black, then copy it back.

We also want to change

```python
    ...         definition=dataflow.definitions["DataToPrint"],
    ...         parents=None,)]
```

to

```python
    ...         definition=print_output.inputs["data"],
    ...     )
    ... ]
```


Discussion:
@pdxjohnny, the problem in this issue also seems to be- 
on line 17, we define an operation by name of `AcceptUserInput` and again on line 37, we define a class by the same name of `AcceptUserInput`.

Resolving patch:
diff --git a/dffml/operation/io.py b/dffml/operation/io.py
--- a/dffml/operation/io.py
+++ b/dffml/operation/io.py
@@ -12,7 +12,7 @@
 
 # Definitions
 UserInput = Definition(name="UserInput", primitive="str")
-DataToPrint = Definition(name="DataToPrint", primitive="str")
+DataToPrint = Definition(name="DataToPrint", primitive="generic")
 
 AcceptUserInput = Operation(
     name="AcceptUserInput",
@@ -39,11 +39,6 @@ class AcceptUserInput(OperationImplementation):
     """
     Accept input from stdin using python input()
 
-    Parameters
-    ++++++++++
-    inputs : dict
-        A dictionary with a key and empty list as value.
-
     Returns
     +++++++
     dict
@@ -59,12 +54,12 @@ class AcceptUserInput(OperationImplementation):
     >>> dataflow.seed.append(
     ...     Input(
     ...         value=[AcceptUserInput.op.outputs["InputData"].name],
-    ...         definition=GetSingle.op.inputs["spec"]
+    ...         definition=GetSingle.op.inputs["spec"],
     ...     )
     ... )
     >>>
     >>> async def main():
-    ...     async for ctx, results in MemoryOrchestrator.run(dataflow, {"input":[]}):
+    ...     async for ctx, results in MemoryOrchestrator.run(dataflow, {"input": []}):
     ...         print(results)
     >>>
     >>> asyncio.run(main())
@@ -94,33 +89,32 @@ async def __aexit__(self, exc_type, exc_value, traceback):
 
 
 @op(inputs={"data": DataToPrint}, outputs={}, conditions=[])
-async def print_output(data: str):
+async def print_output(data: Any):
     """
     Print the output on stdout using python print()
 
     Parameters
     ++++++++++
-    inputs : list
-        A list of Inputs whose value is to be printed.
+    data : Any
+        A python literal to be printed.
 
     Examples
     ++++++++
 
     The following example shows how to use print_output.
 
-    >>> dataflow = DataFlow.auto(print_output, GetSingle)
+    >>> dataflow = DataFlow.auto(print_output)
     >>> inputs = [
     ...     Input(
-    ...         value="print_output example",
-    ...         definition=dataflow.definitions["DataToPrint"],
-    ...         parents=None,)]
+    ...         value="print_output example", definition=print_output.op.inputs["data"]
+    ...     )
+    ... ]
     >>>
     >>> async def main():
     ...     async for ctx, results in MemoryOrchestrator.run(dataflow, inputs):
-    ...         print("String to be printed is 'print_output example'")
+    ...         pass
     >>>
     >>> asyncio.run(main())
     print_output example
-    String to be printed is 'print_output example'
     """
     print(data)
diff --git a/dffml/operation/preprocess.py b/dffml/operation/preprocess.py
--- a/dffml/operation/preprocess.py
+++ b/dffml/operation/preprocess.py
@@ -19,12 +19,13 @@ async def literal_eval(str_to_eval: str):
 
     Parameters
     ++++++++++
-    inputs : str
+    str_to_eval : str
         A string to be evaluated.
 
     Returns
     +++++++
-    A python literal.
+    dict
+        A dict containing python literal.
 
     Examples
     ++++++++


Test patch: