databay.inlets.file_inlet¶
Contents:
Enum defining the mode in which the FileInlet should read the file. |
|
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
-
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.