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

Implement none-behavior strategies #78

Merged
merged 9 commits into from
Oct 18, 2024
Merged

Conversation

grst
Copy link
Contributor

@grst grst commented Oct 1, 2024

This PR adds a new option none_behavior that allows to specify different strategies for handling None values.
For now there are only two strategies implemented

  • NONE_BEHAVIOR_DEFAULT -> attempt to merge or fail (previous hyapyco behavior)
  • NONE_BEHAVIOR_OVERRIDE -> None overrides the existing value, independent of the merge strategy.

Other strategies could be implemented in the future such as ignoring None values.

@zerwes
Copy link
Owner

zerwes commented Oct 2, 2024

I am currently on vacation and will take care of it when I get back ...

@zerwes zerwes mentioned this pull request Oct 18, 2024
Copy link
Owner

@zerwes zerwes left a comment

Choose a reason for hiding this comment

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

Hello @grst
Thank you for the PR taking care of my FIXME: make None usage configurable notes! I never found the time (and had no urgent need to) fix this.
I just have proposed some cosmetic changes, but the functionality itself LGTM. Thank you.

@@ -366,11 +396,21 @@ def _substmerge(self, a, b):
a = copy.deepcopy(a)
b = copy.deepcopy(b)
logger.debug('>' * 30)
logger.debug('substmerge %s and %s' % (a, b,))
# FIXME: make None usage configurable
logger.debug(
Copy link
Owner

Choose a reason for hiding this comment

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

I do not think that this change is related to the topic of the PR and it does not improve readability ... pls revert this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, this was caused by the ruff autoformatter which I forgot to turn off. I like autoformatting a lot, especially because it prevents discussions like this during PR review, but I agree this change doesn't make sense in isolation.

@@ -421,11 +461,21 @@ def _deepmerge(self, a, b, context = None):
if self.dereferenceyamlanchors:
a = copy.deepcopy(a)
b = copy.deepcopy(b)
logger.debug('deepmerge %s and %s' % (a, b,))
# FIXME: make None usage configurable
logger.debug(
Copy link
Owner

Choose a reason for hiding this comment

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

I do not think that this change is related to the topic of the PR and it does not improve readability ... pls revert this change

@zerwes
Copy link
Owner

zerwes commented Oct 18, 2024

BTW: seems the pylint warnings/errors should be fixed by my proposed changes too ...

Copy link
Owner

@zerwes zerwes left a comment

Choose a reason for hiding this comment

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

sorry @grst
I assume caused by the usage of diff instead of suggest the original pass statement has been lost ...

grst and others added 3 commits October 18, 2024 09:03
Co-authored-by: Klaus Zerwes <[email protected]>
Co-authored-by: Klaus Zerwes <[email protected]>
Co-authored-by: Klaus Zerwes <[email protected]>
Copy link
Owner

@zerwes zerwes left a comment

Choose a reason for hiding this comment

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

sorry, the cli diff revealed some white spaces ...

@grst
Copy link
Contributor Author

grst commented Oct 18, 2024

good catch, seems I got too much used to autoformatting 😅

@zerwes zerwes merged commit 6645c90 into zerwes:main Oct 18, 2024
5 checks passed
@grst grst deleted the none_behavior branch October 18, 2024 08:13
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