From 445c5690e179cfe24528a872a0252f5e79c5b1ff Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 28 Jul 2024 20:30:15 -0700 Subject: [PATCH] use path.open --- masque/file/gdsii.py | 4 ++-- masque/file/utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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'