Source code for xmm.pipeline.readers.base



[docs]class Reader: """ Base reader class. Read raw data from a file or other data source. """ def __init__(self, **options): """ Set options for this reader. Common options are a file path and name, as well as authentication credentials for logging on to remote systems. """ self.options = options
[docs] def begin(self, context=None): """Hook to be triggered before reading starts.""" pass
[docs] def read(self): """ Read in raw data from our source. :return: a lazy iterable that yields the file's contents """ raise NotImplementedError('Implement {}.read()'.format(self.__class__.__name__))
[docs] def end(self, context=None): """Hook to be triggered after reading finished.""" pass