Stream Factories
shtk.StreamFactory subclasses are templates used to define the properties of shtk.Stream instances. shtk.Stream instances are pairs of file-like objects (one for reading data from the process, one for writing data to the process) used for communication with running processes.
shtk.StreamFactory instances are typically constructed via calls to shtk.PipelineNodeFactory.stdin(), shtk.PipelineNodeFactory.stdout(), and shtk.PipelineNodeFactory.stderr().
shtk.StreamFactory
- class shtk.StreamFactory
Bases:
ABC
Base class for templates creating associated Stream instances
shtk.FileStreamFactory
- class shtk.FileStreamFactory(partial_path, mode)
Bases:
StreamFactory
Creates a template for FileStream instances
- Parameters
partial_path (str or pathlib.Path) – The absolute or job.cwd relative path to the file.
mode (str) – The mode to pass to open() when instantiating the FileStream.
- partial_path
The absolute or job.cwd relative path to the file.
- Type
pathlib.Path
- mode
The mode to pass to open() when instantiating the FileStream.
- Type
str
shtk.ManualStreamFactory
- class shtk.ManualStreamFactory(fileobj_r=None, fileobj_w=None)
Bases:
StreamFactory
Creates a template for ManualStream instances
- Parameters
fileobj_r (file-like or None) – A file-like object suitable for reading. None implies os.devnull should be used (Default value = None).
fileobj_w (file-like or None) – A file-like object suitable for writing. None implies os.devnull should be used (Default value = None).
- fileobj_r
A file-like object suitable for reading. None implies os.devnull should be used.
- Type
file-like or None
- fileobj_w
A file-like object suitable for writing. None implies os.devnull should be used.
- Type
file-like or None
shtk.NullStreamFactory
- class shtk.NullStreamFactory
Bases:
StreamFactory
Creates a template for NullStream instances
shtk.PipeStreamFactory
- class shtk.PipeStreamFactory(flags=0)
Bases:
StreamFactory
Creates a template for PipeStream instances
- Parameters
flags (int) – flags to pass to PipeStream constructor (Default value = 0).
- flags
flags to pass to PipeStream constructor
- Type
int