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

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

Issue 1143323006: Histograms.xml python script housekeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bad_message
Patch Set: Fix imports (sadface) Created 5 years, 7 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/update_histogram_enum.py ('k') | tools/metrics/histograms/update_policies.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/histograms/update_net_error_codes.py
diff --git a/tools/metrics/histograms/update_net_error_codes.py b/tools/metrics/histograms/update_net_error_codes.py
index 3659dd1afccfc7ad61b70a738ae0ad4359795592..37e532375975d644b15fa7f20e98c89589c365a2 100755
--- a/tools/metrics/histograms/update_net_error_codes.py
+++ b/tools/metrics/histograms/update_net_error_codes.py
@@ -14,9 +14,11 @@ import re
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
-from update_histogram_enum import UpdateHistogramFromDict
+import path_util
-NET_ERROR_LIST_PATH = '../../../net/base/net_error_list.h'
+import update_histogram_enum
+
+NET_ERROR_LIST_PATH = 'net/base/net_error_list.h'
POSITIVE_ERROR_REGEX = re.compile(r'^NET_ERROR\(([\w]+), -([0-9]+)\)')
NEGATIVE_ERROR_REGEX = re.compile(r'^NET_ERROR\(([\w]+), (-[0-9]+)\)')
@@ -26,7 +28,7 @@ def ReadNetErrorCodes(filename, error_regex):
error code to error name.
"""
# Read the file as a list of lines
- with open(filename) as f:
+ with open(path_util.GetInputFile(filename)) as f:
content = f.readlines()
# Parse out lines that are net errors.
@@ -37,21 +39,22 @@ def ReadNetErrorCodes(filename, error_regex):
errors[int(m.group(2))] = m.group(1)
return errors
+
def main():
if len(sys.argv) > 1:
print >>sys.stderr, 'No arguments expected!'
sys.stderr.write(__doc__)
sys.exit(1)
- UpdateHistogramFromDict(
- 'NetErrorCodes',
- ReadNetErrorCodes(NET_ERROR_LIST_PATH, POSITIVE_ERROR_REGEX),
- NET_ERROR_LIST_PATH)
+ update_histogram_enum.UpdateHistogramFromDict(
+ 'NetErrorCodes',
+ ReadNetErrorCodes(NET_ERROR_LIST_PATH, POSITIVE_ERROR_REGEX),
+ NET_ERROR_LIST_PATH)
- UpdateHistogramFromDict(
- 'CombinedHttpResponseAndNetErrorCode',
- ReadNetErrorCodes(NET_ERROR_LIST_PATH, NEGATIVE_ERROR_REGEX),
- NET_ERROR_LIST_PATH)
+ update_histogram_enum.UpdateHistogramFromDict(
+ 'CombinedHttpResponseAndNetErrorCode',
+ ReadNetErrorCodes(NET_ERROR_LIST_PATH, NEGATIVE_ERROR_REGEX),
+ NET_ERROR_LIST_PATH)
if __name__ == '__main__':
main()
« no previous file with comments | « tools/metrics/histograms/update_histogram_enum.py ('k') | tools/metrics/histograms/update_policies.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698