mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Support passing Path objects to Summary()
This commit is contained in:
parent
28b8f9ecc5
commit
c252930c49
1 changed files with 7 additions and 1 deletions
|
|
@ -14,6 +14,11 @@ _VERSION_SUMMARY = 6
|
|||
class Summary:
|
||||
"""Summary of model used in a simulation.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
filename : str or path-like
|
||||
Path to file to load
|
||||
|
||||
Attributes
|
||||
----------
|
||||
date_and_time : str
|
||||
|
|
@ -33,8 +38,9 @@ class Summary:
|
|||
"""
|
||||
|
||||
def __init__(self, filename):
|
||||
filename = str(filename)
|
||||
if not filename.endswith(('.h5', '.hdf5')):
|
||||
msg = 'Unable to open "{0}" which is not an HDF5 summary file'
|
||||
msg = f'Unable to open "{filename}" which is not an HDF5 summary file'
|
||||
raise ValueError(msg)
|
||||
|
||||
self._f = h5py.File(filename, 'r')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue