| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from collections import defaultdict | 5 from collections import defaultdict |
| 6 import datetime | 6 import datetime |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 import httplib2 | 9 import httplib2 |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 | 23 |
| 24 def _build_crbug_service(crbug_service_account): # pragma: no cover | 24 def _build_crbug_service(crbug_service_account): # pragma: no cover |
| 25 with open(crbug_service_account) as crbug_sa_file: | 25 with open(crbug_service_account) as crbug_sa_file: |
| 26 service_account = json.load(crbug_sa_file) | 26 service_account = json.load(crbug_sa_file) |
| 27 | 27 |
| 28 creds = client.SignedJwtAssertionCredentials( | 28 creds = client.SignedJwtAssertionCredentials( |
| 29 service_account['client_email'], service_account['private_key'], | 29 service_account['client_email'], service_account['private_key'], |
| 30 PROJECT_HOSTING_SCOPE) | 30 PROJECT_HOSTING_SCOPE) |
| 31 http = creds.authorize(httplib2.Http()) | 31 http = creds.authorize(httplib2.Http()) |
| 32 return discovery.build('project_hosting', 'v2', | 32 return discovery.build('projecthosting', 'v2', |
| 33 discoveryServiceUrl=DISCOVERY_URL, http=http) | 33 discoveryServiceUrl=DISCOVERY_URL, http=http) |
| 34 | 34 |
| 35 | 35 |
| 36 def _list_issues(crbug_service_account): | 36 def _list_issues(crbug_service_account): |
| 37 service = _build_crbug_service(crbug_service_account) | 37 service = _build_crbug_service(crbug_service_account) |
| 38 issues = [] | 38 issues = [] |
| 39 seen_issue_ids = set() | 39 seen_issue_ids = set() |
| 40 for whitelisted_label in WHITELISTED_LABELS: | 40 for whitelisted_label in WHITELISTED_LABELS: |
| 41 start_index = 1 | 41 start_index = 1 |
| 42 while True: | 42 while True: |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 sheriff_issue['tags'] = sorted(tags) # converts back to list | 163 sheriff_issue['tags'] = sorted(tags) # converts back to list |
| 164 if severity is not None: | 164 if severity is not None: |
| 165 sheriff_issue['severity'] = severity | 165 sheriff_issue['severity'] = severity |
| 166 | 166 |
| 167 # We assume that a tags have 1:1 mapping to trees here. | 167 # We assume that a tags have 1:1 mapping to trees here. |
| 168 for tag in sheriff_issue['tags']: | 168 for tag in sheriff_issue['tags']: |
| 169 sheriff_issues[tag].append(sheriff_issue) | 169 sheriff_issues[tag].append(sheriff_issue) |
| 170 | 170 |
| 171 return sheriff_issues | 171 return sheriff_issues |
| OLD | NEW |