コード例 #1
0
	def __init__(self, projectFile, keywordsFile, databaseFile):
		cmd.Cmd.__init__(self)
		# define command-line prompt
		self.prompt = 'sfr > '

		# define list data
		self.projectList = []
		self.keywordsList = []
		self.databaseList = []
		self.projectFile = projectFile
		self.keywordsFile = keywordsFile
		self.databaseFile = databaseFile

		# define search period
		self.startDate = date(1995,1,1)
		self.endDate = date.fromtimestamp(time.time())
		print "setting search range from %s to %s" % (self.startDate.isoformat(), self.endDate.isoformat())
		print " "

		# read projectFile
		with open(projectFile, 'rb') as csvfile:
			projectReader = csv.reader(csvfile, delimiter=',')
			for row in projectReader:
				projectEntry = SfProject(row[0], 0)
				projectEntry.setRemoteUrl(row[1])
				projectEntry.setLocalUrl(row[2])
				projectEntry.setRcs(row[3])
				self.projectList.append(projectEntry)
				print "added project %s" % (projectEntry.getProjectName())

		# print status message
		print "loaded %i projects" % (len(self.projectList))
		print " "

		# read keywords
		self.keywordsList = open(keywordsFile).readlines()

		# print status message
		for keyword in self.keywordsList:
			print "added keyword %s " % (keyword)
		print "loaded %i keywords" % (len(self.keywordsList))
		print " "

		# read database file
		self.readDatabase()

		# print status message
		print "loaded %i database entries" % (len(self.databaseList))
コード例 #2
0
	def do_addproject(self, line):
		"add the project to the list of projects"
		if line:
			elements = line.split()
			projectName, projectRemoteUrl, projectLocalUrl, projectRcs = "", "", "", ""
			
			projectName = elements[0]
			if len(elements) > 1:
				projectRemoteUrl = elements[1]
			if len(elements) > 2:
				projectLocalUrl = elements[2]
			if len(elements) > 3:
				projectRcs = elements[3]
			
			projectEntry = SfProject(projectName, 0)
			projectEntry.setRemoteUrl(projectRemoteUrl)
			projectEntry.setLocalUrl(projectLocalUrl)
			projectEntry.setRcs(projectRcs)
			self.projectList.append(projectEntry)
			
			print "added project %s (%s, %s, %s) to the list" % (projectName, projectRemoteUrl, projectLocalUrl, projectRcs)
		return 
コード例 #3
0
ファイル: dbx.py プロジェクト: hofmannedv/sourceforge-stats
# set command line parameters
projectFile, databaseFile, relationsFile, quiet, verbose = retVal

# define list data
projectList = []
databaseList = []
relationsList = []
hashList = {}

# read projectFile
with open(projectFile, 'rb') as csvfile:
	projectReader = csv.reader(csvfile, delimiter=',')
	for row in projectReader:
		projectEntry = SfProject(row[0], 0)
		projectEntry.setRemoteUrl(row[1])
		projectEntry.setLocalUrl(row[2])
		projectEntry.setRcs(row[3])
		projectList.append(projectEntry)
		print "added project %s" % (projectEntry.getProjectName())

# print status message
print "loaded %i projects" % (len(projectList))
print " "

# read database file
databaseList = readDatabase(databaseFile)

# print status message
print "loaded %i database entries" % (len(databaseList))

# analyze database entries