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

fix some keys will be ignored! #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sudor
Copy link

@sudor sudor commented Sep 9, 2019

eg: list_keys[i] = a.b.c and list_keys[i + 1]=a.b.cx, the key 'a.b.c' would be ignored!

Summary

The summary should expand on the title of the pull request. What is the expected effect of the
pull request? Specifically, indicate how the behavior will be different than before the pull
request.

Bug Fixes/New Features

  • Bullet list overview of bug fixes or new features added.

How to Verify

How can reviewers verify the request has the intended effect? This should include descriptions of
any new tests that are added or old tests that are updated. It should also indicate how the code
was tested.

Side Effects

Does the pull request contain any side effects? This should list non-obvious things that have
changed in the request.

Resolves

Fixes RID-1234
Fixes AMG-1234

Tests

What tests were created or changed for this feature or fix? Do all tests pass, and if not, why?

Code Reviewer(s)

@, @

eg: list_keys[i] = a.b.c and list_keys[i + 1]=a.b.cx, the key 'a.b.c' would be ignored!
@amirziai
Copy link
Owner

amirziai commented Oct 5, 2019

thanks for the PR @sudor , do you mind writing a test to show the intended behavior?

@@ -335,7 +335,7 @@ def _unflatten(dic, keys, value):
list_keys = sorted(flat_dict.keys())
for i, item in enumerate(list_keys):
if i != len(list_keys) - 1:
if not list_keys[i + 1].startswith(list_keys[i]):
if not list_keys[i + 1].startswith(list_keys[i]+'.'):

Choose a reason for hiding this comment

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

This only accounts when separator=.. I think it should be if not list_keys[i + 1].startswith(list_keys[i]+separator):

Copy link
Owner

@amirziai amirziai left a comment

Choose a reason for hiding this comment

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

needs a test to show the intended behavior

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.

3 participants