diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index 542fb86..b75c854 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -606,10 +606,10 @@ def load_libraryfile( stream = io.BufferedReader(gz_stream) # type: ignore else: # noqa: PLR5501 if use_mmap: - base_stream = open(path, mode='rb', buffering=0) + base_stream = path.open(mode='rb', buffering=0) # noqa: SIM115 stream = mmap.mmap(base_stream.fileno(), 0, access=mmap.ACCESS_READ) # type: ignore else: - stream = open(path, mode='rb') + stream = path.open(mode='rb') # noqa: SIM115 return load_library(stream, full_load=full_load, postprocess=postprocess) diff --git a/masque/file/utils.py b/masque/file/utils.py index 95248ae..33f68d4 100644 --- a/masque/file/utils.py +++ b/masque/file/utils.py @@ -129,7 +129,7 @@ def clean_pattern_vertices(pat: Pattern) -> Pattern: def is_gzipped(path: pathlib.Path) -> bool: - with open(path, 'rb') as stream: + with path.open('rb') as stream: magic_bytes = stream.read(2) return magic_bytes == b'\x1f\x8b'