databay.inlets.file_inlet

Contents:

FileInletMode

Enum defining the mode in which the FileInlet should read the file.

FileInlet

Inlet producing data by reading a file.

class databay.inlets.file_inlet.FileInletMode[source]

databay.inlets.file_inlet.FileInletMode

Enum defining the mode in which the FileInlet should read the file.

Create and return a new object. See help(type) for accurate signature.

Bases: enum.Enum

LINE :str = line[source]

Read file one line per transfer. This will open the file and hold it open for as long as the planner is running.

FILE :str = file[source]

Read the entire file on each transfer. This will only open the file briefly during the transfer.

class databay.inlets.file_inlet.FileInlet(filepath: str, read_mode: FileInletMode = FileInletMode.LINE, *args, **kwargs)[source]

databay.inlets.file_inlet.FileInlet

Inlet producing data by reading a file.

Parameters
  • filepath (str) – Path to the file.

  • read_mode (FileInletMode) – Mode in which the file is to be read.

Bases: databay.Inlet

pull(self, update)[source]

Produce data by reading a file in the mode specified.

Raises

FileNotFoundError if file does not exists.

Returns

contents of the file.

on_start(self)[source]

If read mode is FileInletMode.LINE, open the file and hold it open for reading.

Raises

FileNotFoundError if file does not exists.

on_shutdown(self)[source]

If read mode is FileInletMode.LINE, close the file.