Skip to content

Commit

Permalink
ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Dec 19, 2023
1 parent 5a2b383 commit e0af314
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions pynxtools/dataconverter/readers/xps/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ def fill_template_with_xps_data(config_dict, xps_data_dict, template, entry_set)
xps_data_dict, key_part, dt_typ=XPS_DETECTOR_TOKEN
)

fill_detector_group(key, entries_values, config_dict, template, entry_set)
fill_detector_group(
key, entries_values, config_dict, template, entry_set
)

elif XPS_TOKEN in str(value):
token = value.split(XPS_TOKEN)[-1]
Expand All @@ -258,7 +260,9 @@ def fill_template_with_xps_data(config_dict, xps_data_dict, template, entry_set)
modified_key = key.replace("[entry]", f"[{entry}]")
template[modified_key] = ent_value
try:
template[f"{modified_key}/@units"] = config_dict[f"{key}/@units"]
template[f"{modified_key}/@units"] = config_dict[
f"{key}/@units"
]
except KeyError:
pass

Expand All @@ -272,9 +276,11 @@ def fill_template_with_xps_data(config_dict, xps_data_dict, template, entry_set)
modified_key = key.replace("[entry]", f"[{entry}]")
template[modified_key] = ent_value
try:
template[f"{modified_key}/@units"] = config_dict[f"{key}/@units"]
template[f"{modified_key}/@units"] = config_dict[
f"{key}/@units"
]
except KeyError:
pass
pass


# pylint: disable=too-many-branches
Expand Down Expand Up @@ -338,6 +344,7 @@ def _concatenate_values(value1, value2):

return concatenated


def update_dict_without_replacing(existing_dict, new_dict):
"""
Update an existing dictionary with a new dict,
Expand Down Expand Up @@ -410,15 +417,13 @@ def read(

# If there are multiple input data files of the same type,
# make sure that existing keys are not overwritten.
xps_data_dict = update_dict_without_replacing(
xps_data_dict, data_dict)
xps_data_dict = update_dict_without_replacing(xps_data_dict, data_dict)

elif file_ext in XpsDataFileParser.__prmt_metadata_file_ext__:
parser = XpsDataFileParser([file])
data_dict = parser.get_dict(**kwargs)

xps_data_dict = update_dict_without_replacing(
xps_data_dict, data_dict)
xps_data_dict = update_dict_without_replacing(xps_data_dict, data_dict)

# This code is not very robust.
elif file_ext == "json":
Expand Down

0 comments on commit e0af314

Please sign in to comment.