Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Include the child key in the summary if it is not grouped with other …
…keys.
  • Loading branch information
parthea committed May 7, 2021
commit 44c1af1d51e667f49327416c44dcd24f034f2712
20 changes: 12 additions & 8 deletions scripts/changesummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,24 @@ def _get_discovery_differences(self, filename):
# called 'Count' which indicates the number of keys that have been
# grouped together. The reason for the count column is that when keys
# have the same parent, we group them together to improve readability.
docs_diff = (
docs_diff_with_count = (
docs_diff.groupby(
["Parent", "Added", "Deleted", "Name", "Version", "ChangeType"]
)
.size()
.reset_index(name="Count")[
["Parent", "Added", "Deleted", "Name", "Version", "ChangeType", "Count"]
]
.reset_index(name="Count")
)

# Rename the Parent column to the Key Column since we are reporting
# summary information of keys with the same parent.
docs_diff.rename(columns={"Parent": "Key"}, inplace=True)
return docs_diff
# Add counts column
docs_diff = docs_diff.merge(docs_diff_with_count)

# When the count is greater than 1, update the key with the name of the
# parent since we are consolidating keys with the same parent.
docs_diff.loc[docs_diff["Count"] > 1, "Key"] = docs_diff["Parent"]

return docs_diff[
["Key", "Added", "Deleted", "Name", "Version", "ChangeType", "Count"]
].drop_duplicates()

def _build_summary_message(self, api_name, is_feature):
"""Returns a string containing the summary for a given api. The string
Expand Down