Skip to content

Commit

Permalink
Added PR template
Browse files Browse the repository at this point in the history
  • Loading branch information
amirziai committed Feb 1, 2017
1 parent 49e9cd2 commit 8016688
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
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>
17 changes: 17 additions & 0 deletions flatten_json.py
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

0 comments on commit 8016688

Please sign in to comment.