Commit c414efd0 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

Revert "tools/metrics/histograms/extract_histograms.py: Python 3 support"

This reverts commit 465e6173.

Reason for revert: Breaks build

Original change's description:
> tools/metrics/histograms/extract_histograms.py: Python 3 support
>
> Example error:
> Traceback (most recent call last):
>   File "../../tools/metrics/histograms/generate_expired_histograms_array.py", line 14, in <module>
>     import extract_histograms
>   File "C:\Google\chromium\src\tools\metrics\histograms\extract_histograms.py", line 60, in <module>
>     import HTMLParser
> ModuleNotFoundError: No module named 'HTMLParser'
>
> Also fixed deprecation warnings:
> C:\Google\chromium\src\tools\metrics\histograms\extract_histograms.py:150: DeprecationWarning: The unescape method is deprecated and will be removed in 3.5, use html.unescape() instead.
>   return HTMLParser().unescape(line)
> ...C:\Google\chromium\src\tools\metrics\histograms\extract_histograms_test.py:481: DeprecationWarning: Please use assertEqual instead.
>   self.assertEquals('This is a summary with & and " and \'',
>
> The changes are backwards compatible.
>
> Bug: 941669
> Change-Id: Ieb22e72b37ec26886f3ca1341e487be4f0ba3ab1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830657
> Auto-Submit: Raul Tambre <raul@tambre.ee>
> Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#701265}

TBR=asvitkine@chromium.org,raul@tambre.ee

Change-Id: Ie6f8b307af54bd3d0ca347efef8908d013416879
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 941669
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830287
Commit-Queue: Jon Mann <jonmann@chromium.org>
Commit-Queue: Steven Holte <holte@chromium.org>
Auto-Submit: Jon Mann <jonmann@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701319}
parent 7390822b
...@@ -57,13 +57,7 @@ XML below will generate the following five histograms: ...@@ -57,13 +57,7 @@ XML below will generate the following five histograms:
import copy import copy
import datetime import datetime
import HTMLParser
try:
import html
except ImportError: # For Py2 compatibility
import HTMLParser
html = HTMLParser.HTMLParser()
import logging import logging
import re import re
import xml.dom.minidom import xml.dom.minidom
...@@ -148,7 +142,7 @@ def NormalizeString(text): ...@@ -148,7 +142,7 @@ def NormalizeString(text):
# Unescape using default ASCII encoding. Unescapes any HTML escaped character # Unescape using default ASCII encoding. Unescapes any HTML escaped character
# like &quot; etc. # like &quot; etc.
return html.unescape(line) return HTMLParser.HTMLParser().unescape(line)
def _NormalizeAllAttributeValues(node): def _NormalizeAllAttributeValues(node):
......
...@@ -478,8 +478,8 @@ class ExtractHistogramsTest(unittest.TestCase): ...@@ -478,8 +478,8 @@ class ExtractHistogramsTest(unittest.TestCase):
self.assertFalse(have_errors) self.assertFalse(have_errors)
self.assertIn('Test.Histogram', hists) self.assertIn('Test.Histogram', hists)
self.assertIn('summary', hists['Test.Histogram']) self.assertIn('summary', hists['Test.Histogram'])
self.assertEqual('This is a summary with & and " and \'', self.assertEquals('This is a summary with & and " and \'',
hists['Test.Histogram']['summary']) hists['Test.Histogram']['summary'])
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.ERROR + 1) logging.basicConfig(level=logging.ERROR + 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment