|
|
|
@ -27,7 +27,7 @@ import fatamorgana
|
|
|
|
|
import fatamorgana.records as fatrec
|
|
|
|
|
from fatamorgana.basic import PathExtensionScheme, AString, NString, PropStringReference
|
|
|
|
|
|
|
|
|
|
from .utils import mangle_name, make_dose_table, clean_pattern_vertices
|
|
|
|
|
from .utils import mangle_name, make_dose_table, clean_pattern_vertices, is_gzipped
|
|
|
|
|
from .. import Pattern, SubPattern, PatternError, Label, Shape
|
|
|
|
|
from ..shapes import Polygon, Path, Circle
|
|
|
|
|
from ..repetition import Grid, Arbitrary, Repetition
|
|
|
|
@ -207,7 +207,7 @@ def readfile(filename: Union[str, pathlib.Path],
|
|
|
|
|
"""
|
|
|
|
|
Wrapper for `oasis.read()` that takes a filename or path instead of a stream.
|
|
|
|
|
|
|
|
|
|
Will automatically decompress files with a .gz suffix.
|
|
|
|
|
Will automatically decompress gzipped files.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
filename: Filename to save to.
|
|
|
|
@ -215,7 +215,7 @@ def readfile(filename: Union[str, pathlib.Path],
|
|
|
|
|
**kwargs: passed to `oasis.read`
|
|
|
|
|
"""
|
|
|
|
|
path = pathlib.Path(filename)
|
|
|
|
|
if path.suffix == '.gz':
|
|
|
|
|
if is_gzipped(path):
|
|
|
|
|
open_func: Callable = gzip.open
|
|
|
|
|
else:
|
|
|
|
|
open_func = open
|
|
|
|
|