From 49bfd97d7fa11ada6dfb95747206f5985c1773d7 Mon Sep 17 00:00:00 2001 From: ndaelman Date: Wed, 16 Oct 2024 10:27:01 +0200 Subject: [PATCH] Add safeguard to operators --- src/nomad_parser_vasp/parsers/xml_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nomad_parser_vasp/parsers/xml_parser.py b/src/nomad_parser_vasp/parsers/xml_parser.py index 00982e7..44523c5 100644 --- a/src/nomad_parser_vasp/parsers/xml_parser.py +++ b/src/nomad_parser_vasp/parsers/xml_parser.py @@ -22,12 +22,12 @@ class RunXMLParser(XMLParser): @staticmethod - def mix_alpha(mix, cond): + def mix_alpha(mix: float, cond: bool) -> float: return mix if cond else 0 @staticmethod - def get_eigenvalues(array): - return np.array(array).T[1] + def get_eigenvalues(array: list) -> np.ndarray: + return np.array(array).T[1] if array is not None else np.array([]) class VasprunXMLParser: