|
25 | 25 | from curies import Converter, ReferenceTuple |
26 | 26 | from curies import vocabulary as _cv |
27 | 27 | from more_click import force_option, verbose_option |
| 28 | +from pystow.utils import safe_open |
28 | 29 | from tqdm.auto import tqdm |
29 | 30 | from typing_extensions import Self |
30 | 31 |
|
|
70 | 71 | TARGET_PREFIX, |
71 | 72 | ) |
72 | 73 | from ..utils.cache import write_gzipped_graph |
73 | | -from ..utils.io import multidict, safe_open, write_iterable_tsv |
| 74 | +from ..utils.io import multidict, write_iterable_tsv |
74 | 75 | from ..utils.path import ( |
75 | 76 | CacheArtifact, |
76 | 77 | get_cache_path, |
@@ -997,7 +998,7 @@ def write_obo( |
997 | 998 | unit="line", |
998 | 999 | ) |
999 | 1000 | if isinstance(file, str | Path | os.PathLike): |
1000 | | - with safe_open(file, read=False) as fh: |
| 1001 | + with safe_open(file, operation="write") as fh: |
1001 | 1002 | self._write_lines(it, fh) |
1002 | 1003 | else: |
1003 | 1004 | self._write_lines(it, file) |
@@ -1173,7 +1174,7 @@ def write_metadata(self) -> None: |
1173 | 1174 | metadata = self.get_metadata() |
1174 | 1175 | for path in (self._root_metadata_path, self._get_cache_path(CacheArtifact.metadata)): |
1175 | 1176 | logger.debug("[%s] caching metadata to %s", self._prefix_version, path) |
1176 | | - with safe_open(path, read=False) as file: |
| 1177 | + with safe_open(path, operation="write") as file: |
1177 | 1178 | json.dump(metadata, file, indent=2) |
1178 | 1179 |
|
1179 | 1180 | def write_prefix_map(self) -> None: |
|
0 commit comments