Skip to content

Commit

Permalink
ci: :arrow-up: pre-commit autoupdate (#1707)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.4 → v0.8.3](astral-sh/ruff-pre-commit@v0.7.4...v0.8.3)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Anselm Hahn <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and Anselmoo authored Dec 19, 2024
1 parent 9f47c97 commit c2711bb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
args: ["--maxkb=1000"]
exclude: \.ipynb
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.8.3
hooks:
- id: ruff
files: spectrafit/
Expand Down
8 changes: 5 additions & 3 deletions spectrafit/plugins/pkl_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
22 changes: 15 additions & 7 deletions spectrafit/plugins/rixs_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c2711bb

Please sign in to comment.