AFL.double_agent.util module#

A collection of helper methods/classes

AFL.double_agent.util.extract_parameters(op: PipelineOp, method: str = '__init__') Dict#

Attempt to reconstruct the input parameters for a object’s constructor

Parameters:
  • op (Any) – Technically any Python object but targeted at PipelineOps

  • method (str) – While method to try to reconstruct. Typically, __init__

AFL.double_agent.util.listify(obj)#

Make any input an iterable list

The primary use case is to handle inputs that are sometimes length=1 and not always passed as lists. In particular, this method handles string inputs which we do not want to iterate over.

Example

```python def my_func(input):

for i in listify(input):

print(i)

In[1]: my_func(1) Out[2]: 1

In[1]: my_func([1,2]) Out[2]: 1 2

In[1]: my_func(‘test’) Out[2]: ‘test’ ```

In the last example, without listify the result would have been t,e,s,t on newlines.