From aa020de4429de56032650eec34879ce634c625c7 Mon Sep 17 00:00:00 2001 From: Kane Shenton Date: Thu, 6 Feb 2025 17:12:55 +0000 Subject: [PATCH] ruff linting fixes for magres parser --- castep_outputs/parsers/magres_file_parser.py | 5 +++-- castep_outputs/utilities/castep_res.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/castep_outputs/parsers/magres_file_parser.py b/castep_outputs/parsers/magres_file_parser.py index d156f3b..d51675a 100644 --- a/castep_outputs/parsers/magres_file_parser.py +++ b/castep_outputs/parsers/magres_file_parser.py @@ -8,7 +8,7 @@ from ..utilities.datatypes import AtomIndex, ThreeByThreeMatrix, ThreeVector from ..utilities.filewrapper import Block -from ..utilities.utility import add_aliases, determine_type, to_type, atreg_to_index +from ..utilities.utility import add_aliases, atreg_to_index, determine_type, to_type MAGRES_ALIASES = { "ms": "magnetic_shielding", @@ -70,6 +70,7 @@ class UnitsInfo(TypedDict): class MagresInfo(TypedDict): """NMR Magnetic response information.""" + #: Ion (atom) coordinates. ions: dict[AtomIndex, ThreeVector] calc_code: Literal["CASTEP"] @@ -266,7 +267,7 @@ def _process_magres_old_block(block: Block) -> dict[str, str | ThreeByThreeMatri for match in coords_matches: index = atreg_to_index(match) if index not in found_atoms: - data["atoms"]["coords"][index] = to_type(match['val'].split(), float) + data["atoms"]["coords"][index] = to_type(match["val"].split(), float) found_atoms.add(index) perturbing_index = None diff --git a/castep_outputs/utilities/castep_res.py b/castep_outputs/utilities/castep_res.py index f4588e5..67b4539 100644 --- a/castep_outputs/utilities/castep_res.py +++ b/castep_outputs/utilities/castep_res.py @@ -516,12 +516,12 @@ def get_atom_parts(spec: str) -> dict[str, str]: ), # Magnetic shielding tensor "ms_tensor": re.compile( - rf"\s*(.*?) Shielding Tensor[\r\n]+{TENSOR_RE}" + rf"\s*(.*?) Shielding Tensor[\r\n]+{TENSOR_RE}", ), # Spin-Spin coupling tensor "isc_tensor": re.compile( r"\s{0,}J-coupling (.*?)[\r\n]+" - rf"{TENSOR_RE}" + rf"{TENSOR_RE}", ), # Electric field gradient tensor "efg_tensor": re.compile(