-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
### 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) | ||
@<name of code reviewer>, @<additional code reviewer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def _join_all(*x): | ||
return "".join(map(str, x)) if x[0] else x[-1] | ||
|
||
|
||
def flatten_json(input_, separator="_"): | ||
output = {} | ||
|
||
def flatten(object_, name): | ||
if isinstance(object_, dict): | ||
[flatten(object_[key], _join_all(name, separator, key)) for key in object_] | ||
elif isinstance(object_, list): | ||
[flatten(item, _join_all(name, separator, index)) for index, item in enumerate(object_)] | ||
else: | ||
output[name] = object_ | ||
|
||
flatten(input_, None) | ||
return output |