OLD | NEW |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 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 import cgi | 5 import cgi |
6 import ConfigParser | 6 import ConfigParser |
7 import json | 7 import json |
8 import os | 8 import os |
9 import time | 9 import time |
10 | 10 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 Returns: | 225 Returns: |
226 None if the data retrieval fails, or the raw data. | 226 None if the data retrieval fails, or the raw data. |
227 """ | 227 """ |
228 count = 0 | 228 count = 0 |
229 while True: | 229 while True: |
230 count += 1 | 230 count += 1 |
231 # Retrieves data from URL. | 231 # Retrieves data from URL. |
232 try: | 232 try: |
233 status_code, data = utils.GetHttpClient().Get(url, timeout=timeout) | 233 status_code, data = utils.GetHttpClient().Get(url, timeout=timeout) |
234 except IOError: | 234 except IOError as e: |
235 status_code = -1 | 235 status_code = -1 |
236 data = None | 236 data = None |
237 | 237 |
238 if status_code == 200: | 238 if status_code == 200: |
239 return data | 239 return data |
240 | 240 |
241 if count < retries: | 241 if count < retries: |
242 # If retrieval fails, try after sleep_time second. | 242 # If retrieval fails, try after sleep_time second. |
243 time.sleep(sleep_time) | 243 time.sleep(sleep_time) |
244 else: | 244 else: |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 Returns: | 363 Returns: |
364 A string representation of the list. | 364 A string representation of the list. |
365 """ | 365 """ |
366 return ', '.join(map(str, items)) | 366 return ', '.join(map(str, items)) |
367 | 367 |
368 | 368 |
369 def PrettifyFrameInfo(frame_indices, functions): | 369 def PrettifyFrameInfo(frame_indices, functions): |
370 """Return a string to represent the frames with functions.""" | 370 """Return a string to represent the frames with functions.""" |
371 frames = [] | 371 frames = [] |
372 for frame_index, function in zip(frame_indices, functions): | 372 for frame_index, function in zip(frame_indices, functions): |
373 frames.append('frame #%s, function "%s"' % (frame_index, function)) | 373 frames.append('frame #%s, "%s"' % (frame_index, function.split('(')[0])) |
374 return '; '.join(frames) | 374 return '; '.join(frames) |
375 | 375 |
376 | 376 |
377 def PrettifyFiles(file_list): | 377 def PrettifyFiles(file_list): |
378 """Returns a string representation of a list of file names. | 378 """Returns a string representation of a list of file names. |
379 | 379 |
380 Args: | 380 Args: |
381 file_list: A list of tuple, (file_name, file_url). | 381 file_list: A list of tuple, (file_name, file_url). |
382 Returns: | 382 Returns: |
383 A string representation of file names with their urls. | 383 A string representation of file names with their urls. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 review_url = None | 502 review_url = None |
503 reviewers = None | 503 reviewers = None |
504 line_content = blame.line_content | 504 line_content = blame.line_content |
505 message = blame.message | 505 message = blame.message |
506 | 506 |
507 result = Result(suspected_cl, revision_url, component_name, author, reason, | 507 result = Result(suspected_cl, revision_url, component_name, author, reason, |
508 review_url, reviewers, line_content, message) | 508 review_url, reviewers, line_content, message) |
509 result_list.append(result) | 509 result_list.append(result) |
510 | 510 |
511 return result_list | 511 return result_list |
OLD | NEW |