Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: tools/metrics/histograms/update_policies.py

Issue 2667373003: Change Enterprise.Policies histogram bucket descriptions to policy names (Closed)
Patch Set: Rebase. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/histograms/update_policies.py
diff --git a/tools/metrics/histograms/update_policies.py b/tools/metrics/histograms/update_policies.py
index 346dcab18b55868cfc39ac1166328f51c8f3f505..362abf71ced76753cd1c666734c9cbc47c182549 100644
--- a/tools/metrics/histograms/update_policies.py
+++ b/tools/metrics/histograms/update_policies.py
@@ -51,24 +51,6 @@ def FlattenPolicies(policy_definitions, policy_list):
policy_list.append(policy)
-def ParsePlaceholders(text):
- """Parse placeholders in |text|, making it more human-readable. The format of
- |text| is exactly the same as in captions in policy_templates.json: it can
- contain XML tags (ph, ex) and $1-like substitutions. Note that this function
- does only a very simple parsing that is not fully correct, but should be
- enough for all practical situations.
-
- Args:
- text: A string containing placeholders.
-
- Returns:
- |text| with placeholders removed or replaced by readable text.
- """
- text = re.sub(r'\$\d+', '', text) # Remove $1-like substitutions.
- text = re.sub(r'<[^>]+>', '', text) # Remove XML tags.
- return text
-
-
def UpdateHistogramDefinitions(policy_templates, doc):
"""Sets the children of <enum name="EnterprisePolicies" ...> node in |doc| to
values generated from policy ids contained in |policy_templates|.
@@ -103,7 +85,7 @@ def UpdateHistogramDefinitions(policy_templates, doc):
for policy in ordered_policies:
node = doc.createElement('int')
node.attributes['value'] = str(policy['id'])
- node.attributes['label'] = ParsePlaceholders(policy['caption'])
+ node.attributes['label'] = policy['name']
policy_enum_node.appendChild(node)
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698