incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1187369 - /incubator/public/trunk/clutch.py
Date Fri, 21 Oct 2011 14:38:00 GMT
Author: sebb
Date: Fri Oct 21 14:38:00 2011
New Revision: 1187369

URL: http://svn.apache.org/viewvc?rev=1187369&view=rev
Log:
Extract URL 'constants'

Modified:
    incubator/public/trunk/clutch.py

Modified: incubator/public/trunk/clutch.py
URL: http://svn.apache.org/viewvc/incubator/public/trunk/clutch.py?rev=1187369&r1=1187368&r2=1187369&view=diff
==============================================================================
--- incubator/public/trunk/clutch.py (original)
+++ incubator/public/trunk/clutch.py Fri Oct 21 14:38:00 2011
@@ -107,6 +107,13 @@ import urllib.request, urllib.error, url
 import xml.dom.minidom
 import argparse
 
+# constants for external data
+REPORTING_SCHEDULE = 'http://wiki.apache.org/incubator/ReportingSchedule?action=raw'
+COMMITTERS_BY_PROJECT = "http://people.apache.org/committers-by-project.html"
+MAIL_LIST_URL = "http://incubator.apache.org/mail/"
+INCUBATOR_KEYS = 'http://people.apache.org/~crossley/incubator-keys.txt'
+INCUBATOR_RELEASES = 'http://people.apache.org/~crossley/incubator-releases.txt'
+
 parser = argparse.ArgumentParser(description='Gather details about projects currently in
incubation.')
 parser.add_argument('--ignoreState',   action='store_true', default='False', help='Ignore
state (default false)')
 parser.add_argument('-v', '--verbose', action='store_true', default='False', help='verbose
mode (default false)')
@@ -164,9 +171,7 @@ inputFile.close()
 
 print("Gather data from the ReportingSchedule ...") 
 # Parse the wiki ReportingSchedule to gather project details
-req = urllib.request.Request(
-    url='http://wiki.apache.org/incubator/ReportingSchedule?action=raw')
-text = urllib.request.urlopen(req).read().decode('utf-8')
+text = urllib.request.urlopen(REPORTING_SCHEDULE).read().decode('utf-8')
 tokens = re.findall('\*.+', text)
 for token in tokens:
   token = token.strip() # strip whitespace
@@ -497,8 +502,7 @@ class CommittersParser(HTMLParser):
         if self.rowCount > 1: # The first row is the column headers.
           self.projects[self.projectId].append(name)
 
-committersUrl = "http://people.apache.org/committers-by-project.html"
-committersInput = urllib.request.urlopen(committersUrl)
+committersInput = urllib.request.urlopen(COMMITTERS_BY_PROJECT)
 dataCommitters = committersInput.read().decode('utf-8')
 #print("dataCommitters=" + dataCommitters)
 committers = CommittersParser()
@@ -521,9 +525,8 @@ class IncubatorMailListNamesParser(HTMLP
           self.names.append(value)
           break
 
-mailListsUrl = "http://incubator.apache.org/mail/"
 mailLists = IncubatorMailListNamesParser()
-mailLists.feed(urllib.request.urlopen(mailListsUrl).read().decode('utf-8'))
+mailLists.feed(urllib.request.urlopen(MAIL_LIST_URL).read().decode('utf-8'))
 mailLists.close()
 #pprint.pprint(mailLists.names)
 del mailLists.names[0:5] # the first 5 are page navigation
@@ -567,9 +570,7 @@ if optionVerbose:
 print("Gather incubator PGP keys data ...")
 keysNamesRE = re.compile("/dist/incubator/([^/]+)/(.*)")
 keysList = {}
-req = urllib.request.Request(
-    url='http://people.apache.org/~crossley/incubator-keys.txt')
-lines = urllib.request.urlopen(req).readlines()
+lines = urllib.request.urlopen(INCUBATOR_KEYS).readlines()
 for line in lines:
   matchKey = re.search(keysNamesRE, line.decode('utf-8'))
   if matchKey:
@@ -577,9 +578,7 @@ for line in lines:
 
 print("Gather data about releases ...")
 releases = {}
-req = urllib.request.Request(
-    url='http://people.apache.org/~crossley/incubator-releases.txt')
-lines = urllib.request.urlopen(req).readlines()
+lines = urllib.request.urlopen(INCUBATOR_RELEASES).readlines()
 for line in lines:
   match = re.search(releasesRE, line.decode('utf-8'))
   if match:



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message