Skip to content

Commit 12d760f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a1fa515 commit 12d760f

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

spectrafit/plugins/pkl_visualizer.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ def save(self, data: Any, fname: Path, export_format: str) -> None:
111111
format=export_format,
112112
)
113113

114-
with pure_fname(fname).with_suffix(".json").open(
115-
"w+", encoding="utf-8"
116-
) as outfile:
114+
with (
115+
pure_fname(fname)
116+
.with_suffix(".json")
117+
.open("w+", encoding="utf-8") as outfile
118+
):
117119
json.dump(data, outfile, indent=4)
118120

119121
def get_type(self, value: Any) -> Union[Dict[str, Any], str]:

spectrafit/plugins/rixs_converter.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,23 @@ def save(self, data: Any, fname: Path, export_format: str) -> None:
179179
)
180180

181181
if export_format == "json":
182-
with pure_fname(fname).with_suffix(f".{export_format}").open(
183-
"w",
184-
encoding="utf-8",
185-
) as f:
182+
with (
183+
pure_fname(fname)
184+
.with_suffix(f".{export_format}")
185+
.open(
186+
"w",
187+
encoding="utf-8",
188+
) as f
189+
):
186190
json.dump(self.numpydict2listdict(data), f, indent=4)
187191
elif export_format in {"toml", "lock"}:
188-
with pure_fname(fname).with_suffix(f".{export_format}").open(
189-
"wb",
190-
) as f:
192+
with (
193+
pure_fname(fname)
194+
.with_suffix(f".{export_format}")
195+
.open(
196+
"wb",
197+
) as f
198+
):
191199
tomli_w.dump(self.numpydict2listdict(data), f, multiline_strings=False)
192200
elif export_format == "npy":
193201
np.save(pure_fname(fname).with_suffix(f".{export_format}"), data)

0 commit comments

Comments
 (0)