tethys.core.nodes.operators.files.operator_read_file

Module Contents

class tethys.core.nodes.operators.files.operator_read_file.ReadFileOperator(path_generator: Callable = str, pack_size: int = None)[source]

Bases: tethys.core.nodes.operators.operator_base.OperatorBase

This operator reads a file (whole or part by part according to pack_size)

Parameters
  • path_generator (Callable) – a function that generate the path to the file from the data_packet (default: str)

  • pack_size (int) – argument for the file.read(n) method (default: None)

process(self, data_packet: Any, stream: ZeroStream, **kwargs)[source]

Read the file and send data to the next nodes.

Parameters
  • data_packet – any data object

  • stream (StreamBase) – Any stream

Returns

None

class tethys.core.nodes.operators.files.operator_read_file.ReadFileLinesOperator(path_generator: Callable = str)[source]

Bases: tethys.core.nodes.operators.operator_base.OperatorBase

This operator reads a file line by line

Parameters

path_generator (Callable) – a function that generate the path to the file from the data_packet (default: str)

process(self, data_packet: Any, stream: ZeroStream, **kwargs)[source]

Read the file line by line and send each line to the next nodes.

Parameters
  • data_packet – any data object

  • stream (StreamBase) – Any stream

Returns

None