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

data: adds ignore_none options into dict_to_dnode #114

Closed
wants to merge 1 commit into from

Conversation

steweg
Copy link
Contributor

@steweg steweg commented Apr 5, 2024

This patch adds new option, which will skip creation of dnodes, when the value in dict is set to None

This patch adds new option, which will skip creation of dnodes, when
the value in dict is set to None

Signed-off-by: Stefan Gula <[email protected]>
@steweg steweg force-pushed the feature/ignore-none branch from d7b4bae to 985bbc0 Compare April 6, 2024 10:21
@samuel-gauthier
Copy link
Collaborator

I don't think it is a good idea to ignore DNodes with the None value, because it is how the empty type is represented. Closing.

@steweg
Copy link
Contributor Author

steweg commented Aug 2, 2024

That's exactly why it is an option and up to caller to say. I do think it is worthy to have, otherwise if you have complex nested dictionary, you need to traverse it by yourself and remove the keys manually before calling this function.

@samuel-gauthier
Copy link
Collaborator

I don't agree. It is up to the model to say, not the caller. As I said, by convention in libyang-python, building a dict containing {"a": None} means setting data associated with a leaf "a" of type empty. Having a flag that changes this convention is too misleading.

@steweg steweg deleted the feature/ignore-none branch December 16, 2024 13:33
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