diff --git a/spectrafit/plugins/pkl_visualizer.py b/spectrafit/plugins/pkl_visualizer.py index 5732c6558..42951a37b 100644 --- a/spectrafit/plugins/pkl_visualizer.py +++ b/spectrafit/plugins/pkl_visualizer.py @@ -111,9 +111,11 @@ def save(self, data: Any, fname: Path, export_format: str) -> None: format=export_format, ) - with pure_fname(fname).with_suffix(".json").open( - "w+", encoding="utf-8" - ) as outfile: + with ( + pure_fname(fname) + .with_suffix(".json") + .open("w+", encoding="utf-8") as outfile + ): json.dump(data, outfile, indent=4) def get_type(self, value: Any) -> Union[Dict[str, Any], str]: diff --git a/spectrafit/plugins/rixs_converter.py b/spectrafit/plugins/rixs_converter.py index 34b18466f..605eeb964 100644 --- a/spectrafit/plugins/rixs_converter.py +++ b/spectrafit/plugins/rixs_converter.py @@ -179,15 +179,23 @@ def save(self, data: Any, fname: Path, export_format: str) -> None: ) if export_format == "json": - with pure_fname(fname).with_suffix(f".{export_format}").open( - "w", - encoding="utf-8", - ) as f: + with ( + pure_fname(fname) + .with_suffix(f".{export_format}") + .open( + "w", + encoding="utf-8", + ) as f + ): json.dump(self.numpydict2listdict(data), f, indent=4) elif export_format in {"toml", "lock"}: - with pure_fname(fname).with_suffix(f".{export_format}").open( - "wb", - ) as f: + with ( + pure_fname(fname) + .with_suffix(f".{export_format}") + .open( + "wb", + ) as f + ): tomli_w.dump(self.numpydict2listdict(data), f, multiline_strings=False) elif export_format == "npy": np.save(pure_fname(fname).with_suffix(f".{export_format}"), data)