Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Jan 17, 2025
1 parent efe1486 commit bf7aa7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion electronicparsers/quantumespresso/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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', {})
Expand All @@ -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]
Expand Down

0 comments on commit bf7aa7c

Please sign in to comment.