Skip to content

Commit

Permalink
Merge pull request #95 from FAIRmat-NFDI/replace-plus-in-entry-name
Browse files Browse the repository at this point in the history
Replace `+` in entry name
  • Loading branch information
lukaspie authored Nov 11, 2024
2 parents ded6b3d + 0d8d476 commit a2d18b6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/pynxtools_xps/reader_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,18 +429,18 @@ def construct_data_key(spectrum: Dict[str, Any]) -> str:

def align_name_part(name_part: str):
"""Make one part of the entry name compliant with NeXus standards."""
replacements = {
" ": "_",
",": "",
".": "_",
"-": "_",
":": "_",
}

for original, replacement in replacements.items():
name_part = name_part.replace(original, replacement)

return name_part
translation_table = str.maketrans(
{
" ": "_",
",": "",
".": "_",
"-": "_",
":": "_",
"+": "_",
}
)

return name_part.translate(translation_table)


def construct_entry_name(parts: List[str]) -> str:
Expand Down

0 comments on commit a2d18b6

Please sign in to comment.