Last active
August 29, 2015 14:23
-
-
Save jwhitlock/43fa8de00d683a6fbc10 to your computer and use it in GitHub Desktop.
Find the most common inline_text issues for browsercompat.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| import csv | |
| import json | |
| import sys | |
| if len(sys.argv) != 2: | |
| print("Usage: {} import_issues_by_url.csv".format(sys.argv[0])) | |
| sys.exit(0) | |
| def get_data(filename): | |
| data = {} | |
| with open(filename, 'rb') as csv_file: | |
| reader = csv.reader(csv_file) | |
| for mdn_slug, import_url, issue_slug, start, end, param_raw in reader: | |
| if issue_slug == 'inline_text': | |
| params = json.loads(param_raw) | |
| data.setdefault(params['text'], []).append(import_url) | |
| return data | |
| data = get_data(sys.argv[1]) | |
| by_count = [(len(v), k, v[0]) for k, v in data.items()] | |
| by_count.sort(reverse=True) | |
| for count, text, sample_url in by_count: | |
| print("{}: {!r} {}".format(count, text.encode('utf8'), sample_url)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment