Filepath Or Buffer

class dataprofiler.data_readers.filepath_or_buffer.FileOrBufferHandler(filepath_or_buffer, open_method='r', encoding=None, seek_offset=None, seek_whence=0)

Bases: object

FileOrBufferHandler class to read a filepath or buffer in and always return a readable buffer.

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