Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEV Introduce abstract base class SerpentFile
Living in serpentTools/base.py, this class provides a very basic interface that will begin the transition in separating file objects and file readers [GH CORE-GATECH-GROUP#335]. Concrete classes must provide a single class method, ``fromSerpent``, that should perform the following actions: 1. Accept a string or pathlib.Path object representing the file name, or a readable stream to be read 2. Create a new instance of the SerpentFile, e.g. DetectorFile, 3. Process the data in the file or stream, and 4. Return the SerpentFile instance with the new data A helper function is also provided that can handle this flexibility in input arguments - serpentTools.base.getStream. Used as a context manager, this function ensures a readable stream is returned. Future commits will begin implementing concrete classes piecewise.
- Loading branch information