Skip to content

Commit

Permalink
fixed checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudz committed Jan 18, 2024
1 parent 8b4cfdf commit 72c5422
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions atomisticparsers/h5md/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import logging
import h5py

from typing import List, Dict
from typing import List, Dict, Union, Any
from h5py import Group

from nomad.datamodel import EntryArchive
Expand Down Expand Up @@ -72,9 +72,9 @@ def apply_unit(self, quantity, unit: str, unit_factor: float):
if quantity is None:
return
if unit:
unit = ureg(unit)
unit *= unit_factor
quantity *= unit
unit_val = ureg(unit)
unit_val *= unit_factor
quantity *= unit_val

return quantity

Expand Down Expand Up @@ -400,7 +400,7 @@ def get_observable_paths(observable_group: Dict, current_path: str) -> List:

def parse_atomsgroup(
self,
nomad_sec: System or AtomsGroup,
nomad_sec: Union[System, AtomsGroup],
h5md_sec_particlesgroup: Group,
path_particlesgroup: str,
):
Expand Down Expand Up @@ -454,7 +454,7 @@ def parse_parameter_info(self):
self._parameter_info = {"force_calculations": {}, "workflow": {}}

def get_parameters(parameter_group: Group, path: str) -> Dict:
param_dict = {}
param_dict: Dict[Any, Any] = {}
for key, val in parameter_group.items():
path_key = f"{path}.{key}"
if isinstance(val, h5py.Group):
Expand Down Expand Up @@ -713,14 +713,14 @@ def populate_property_dict(
)
property_dict[f"{val_name}_magnitude"] = value_magnitude

workflow_properties_dict = {}
workflow_properties_dict: Dict[Any, Any] = {}
for observable_type, observable_dict in observables.items():
flag_known_property = False
if observable_type in properties_known:
property_type_key = observable_type
property_type_value_key = properties_known[observable_type]
flag_known_property = True
property_dict = {property_type_value_key: []}
property_dict: Dict[Any, Any] = {property_type_value_key: []}
property_dict["label"] = observable_type
for key, observable in observable_dict.items():
property_values_dict = {"label": key}
Expand Down

0 comments on commit 72c5422

Please sign in to comment.