dataprofiler.data_readers.filepath_or_buffer module¶
Contains functions and classes for handling filepaths and buffers.
- dataprofiler.data_readers.filepath_or_buffer.is_stream_buffer(filepath_or_buffer: Any) typing_extensions.TypeGuard[StringIO | BytesIO] ¶
Determine whether a given argument is a filepath or buffer.
- Parameters:
filepath_or_buffer (str) – path to the file or buffer
- Returns:
true if string is a buffer or false if string is a filepath
- Return type:
boolean
- class dataprofiler.data_readers.filepath_or_buffer.FileOrBufferHandler(filepath_or_buffer: str | StringIO | BytesIO, open_method: str = 'r', encoding: str | None = None, seek_offset: int | None = None, seek_whence: int = 0)¶
Bases:
object
FileOrBufferHandler class to read a filepath or buffer in.
Always returns a readable buffer.
Initialize Context manager class.
Used for inputting a file or buffer and returning a structure that is always a buffer.
- Parameters:
filepath_or_buffer (Union[str, StringIO, BytesIO]) – path to the file being loaded or buffer
open_method (string) – value describes the mode the file is opened in
seek_offset (int) – offset from start of the stream
- Returns:
TextIOBase or BufferedIOBase class/subclass