Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow lists of possible values in config file #390

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

lukaspie
Copy link
Collaborator

This allows to write "['@attrs:<text>', '@eln', 'no title']" in the config file, which gets parse into the prefixes as a list of tuples [('@attrs', 'text'), ('@eln', ''), ('', 'no title')]. For each of these, it is checked if a value can be returned (whatever that means for the reader solution) and if so, the value is written. If not, "no title" is written. I think this is much cleaner implementation of having these multiple options than before.

I also changed the parent_key in FlattenSettings to "/ENTRY" to match our previous discussion. Finally, I removed the link handling in the flatten_json as this shall be handled by the link callback. Are there any issues with this?

@domna there were some problems with the handling of ! for the required fields in optional groups while I was implementing this solution. I think it works now, but I didn't have a good example for this, can you check with your example if it still works?

@lukaspie lukaspie requested a review from domna July 24, 2024 14:26
Copy link
Collaborator

@domna domna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works with the mpes example. I made some suggestions to simplify the code.

src/pynxtools/dataconverter/readers/multi/reader.py Outdated Show resolved Hide resolved
src/pynxtools/dataconverter/readers/multi/reader.py Outdated Show resolved Hide resolved
src/pynxtools/dataconverter/readers/utils.py Show resolved Hide resolved
src/pynxtools/dataconverter/readers/multi/reader.py Outdated Show resolved Hide resolved
@lukaspie lukaspie force-pushed the lists-in-config-file branch from a1f3698 to 724d450 Compare July 25, 2024 07:16
@lukaspie lukaspie merged commit 3e15848 into multi-format-reader Jul 25, 2024
1 check passed
@lukaspie lukaspie deleted the lists-in-config-file branch July 25, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants