Core
KoshTransformer
Bases: KoshExecutionGraph
Source code in kosh/transformers/core.py
__init__(cache_dir=kosh_cache_dir, cache=False, verbose=False, *args, **kargs)
init function will receive the previous step's signature and the cache directory and output signature is also generated from the input args (w/o the cache_dir)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cache_dir |
str
|
directory to save cachd files |
kosh_cache_dir
|
cache |
int
|
do we use cache? 0: no, 1:yes, 2:yes but clobber if exists |
False
|
verbose |
bool
|
Turn on verbosity, by default this will turn on printing a message when results are loaded from cache. Message is sent as lone argument to |
False
|
Source code in kosh/transformers/core.py
transform(input_, format)
abstractmethod
The transform function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_ |
result returned by loader or previous transformer |
required |
transform_(input, format, signature=None)
Given input from previous loader or transformer and desired format
computes the unique signature and tries to extract from cache, calls transformer's
transform
function if no cache available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input |
object
|
set of input passed from loader or previous transformer |
required |
format |
str
|
desired output format |
required |
Returns:
Type | Description |
---|---|
object
|
The result from transform function |