(
path: "StrPath",
parser: ParserFn,
dumper: DumpersFn,
fs: Optional["FileSystem"] = None,
)
| 80 | |
| 81 | @contextmanager |
| 82 | def _modify_data( |
| 83 | path: "StrPath", |
| 84 | parser: ParserFn, |
| 85 | dumper: DumpersFn, |
| 86 | fs: Optional["FileSystem"] = None, |
| 87 | ): |
| 88 | file_exists = fs.exists(os.fspath(path)) if fs else os.path.exists(path) |
| 89 | data = _load_data(path, parser=parser, fs=fs) if file_exists else {} |
| 90 | yield data |
| 91 | _dump_data(path, data, dumper=dumper, fs=fs) |
no test coverage detected