From bf7aa7ce18d1482fab1d39a0baaffd30f82eb03e Mon Sep 17 00:00:00 2001 From: ndaelman Date: Fri, 17 Jan 2025 21:01:04 +0100 Subject: [PATCH] Fix mypy --- electronicparsers/quantumespresso/parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electronicparsers/quantumespresso/parser.py b/electronicparsers/quantumespresso/parser.py index ba97cff4..c973e3d2 100644 --- a/electronicparsers/quantumespresso/parser.py +++ b/electronicparsers/quantumespresso/parser.py @@ -21,6 +21,7 @@ import re from datetime import datetime import os +from typing import Optional from nomad.units import ureg from nomad.parsing.file_parser.text_parser import TextParser, Quantity, DataTextParser @@ -2800,7 +2801,7 @@ def __init__(self): } self._re_label = re.compile(r'([A-Z][a-z]?)') - def get_n_electrons_safe(self) -> float: + def get_n_electrons_safe(self) -> Optional[float]: n_electrons = self.out_parser.get('run', []) if n_electrons: n_electrons = n_electrons[0].get_header('number_of_electrons', {}) @@ -2811,6 +2812,7 @@ def get_n_electrons_safe(self) -> float: 'Number of electrons not found. Using spin up + down.' ) return up + down + return None def parse_scc(self, run, calculation): sec_run = self.archive.run[-1]