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

Side by Side Diff: Tools/Scripts/webkitpy/common/net/sheriff_calendar.py

Issue 308743011: Update FlakyTests to match current flakiness dashboard results (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/FlakyTests ('k') | Tools/Scripts/webkitpy/tool/commands/flakytests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import re
6 import urllib2
7
8 # FIXME: This probably belongs in config.py?
9 BLINK_SHERIFF_URL = (
10 'http://build.chromium.org/p/chromium.webkit/sheriff_webkit.js')
11
12
13 # Does not support unicode or special characters.
14 VALID_EMAIL_REGEXP = re.compile(r'^[A-Za-z0-9\.&\'\+-/=_]+@'
15 '[A-Za-z0-9\.-]+$')
16
17
18 def _complete_email(name):
19 """If the name does not include '@', append '@chromium.org'."""
20 if '@' not in name:
21 return name + '@chromium.org'
22 return name
23
24
25 def _names_from_sheriff_js(sheriff_js):
26 match = re.match(r'document.write\(\'(.*)\'\)', sheriff_js)
27 emails_string = match.group(1)
28 # Detect 'none (channel is sheriff)' text and ignore it.
29 if 'channel is sheriff' in emails_string.lower():
30 return []
31 return map(str.strip, emails_string.split(','))
32
33
34 def _email_is_valid(email):
35 """Determines whether the given email address is valid."""
36 return VALID_EMAIL_REGEXP.match(email) is not None
37
38
39 def _filter_emails(emails):
40 """Returns the given list with any invalid email addresses removed."""
41 rv = []
42 for email in emails:
43 if _email_is_valid(email):
44 rv.append(email)
45 else:
46 print 'WARNING: Not including %s (invalid email address)' % email
47 return rv
48
49
50 def _emails_from_url(sheriff_url):
51 sheriff_js = urllib2.urlopen(sheriff_url).read()
52 return map(_complete_email, _names_from_sheriff_js(sheriff_js))
53
54
55 def current_gardener_emails():
56 return _emails_from_url(BLINK_SHERIFF_URL)
OLDNEW
« no previous file with comments | « LayoutTests/FlakyTests ('k') | Tools/Scripts/webkitpy/tool/commands/flakytests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698