From 22a0dbb31271df568cf6b21d2a968ad86be8b837 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell <janosh.riebesell@gmail.com> Date: Thu, 27 Jun 2024 11:43:26 -0400 Subject: [PATCH] fix examples/fine_tuning.ipynb:cell 13:7:20: F821 Undefined name result_dict include jupyter in ruff lint and format --- .pre-commit-config.yaml | 2 ++ examples/fine_tuning.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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" ] }, {