diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e1c1922d..68f35ae0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,9 @@ repos: hooks: - id: ruff args: [--fix] + types_or: [python, jupyter] - id: ruff-format + types_or: [python, jupyter] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 diff --git a/examples/fine_tuning.ipynb b/examples/fine_tuning.ipynb index 40482ade..9f99ff73 100644 --- a/examples/fine_tuning.ipynb +++ b/examples/fine_tuning.ipynb @@ -182,8 +182,8 @@ "structures = [Structure.from_dict(struct) for struct in dataset_dict[\"structure\"]]\n", "energies = dataset_dict[\"energy_per_atom\"]\n", "forces = dataset_dict[\"force\"]\n", - "stresses = None if result_dict[\"stress\"] in [None, []] else result_dict[\"stress\"]\n", - "magmoms = None if result_dict[\"magmom\"] in [None, []] else result_dict[\"magmom\"]" + "stresses = dataset_dict.get(\"stress\") or None\n", + "magmoms = dataset_dict.get(\"magmom\") or None" ] }, {