def getPaymentText(paymentDictionary, round): 'Get payment csv file.' cString = cStringIO.StringIO() recipientDictionary = account.getRecipientDictionary(round) paymentKeys = paymentDictionary.keys() paymentKeys.sort() for paymentKey in paymentKeys: cString.write('%s,%s,%s\n' % (paymentKey.capitalize(), recipientDictionary[paymentKey], paymentDictionary[paymentKey])) return cString.getvalue()
def getNewbieText(previousRecipentSet, round): 'Get the list of newbie keys, and optionally also names.' cString = cStringIO.StringIO() recipientDictionary = account.getRecipientDictionary(round) recipientKeys = recipientDictionary.keys() recipientKeys.sort() for recipientKey in recipientKeys: if recipientKey not in previousRecipentSet: cString.write('%s,%s\n' % (recipientKey, recipientDictionary[recipientKey])) return cString.getvalue()
def getPublishers(lines, round): publishers = [] workerNameSet = set(account.getRecipientDictionary(round).keys()) shareListSet = account.getShareListSet(round) for line in lines[1 :]: splitLine = line.split(',') if len(splitLine) > 1: name = splitLine[0].strip() if name != '': coinAddress = splitLine[1].strip() publisher = Publisher(coinAddress, name in shareListSet, name) if publisher.name in workerNameSet: publishers.append(publisher) else: print('%s did not work this round.' % publisher.name) return publishers
def writeOutput(arguments): 'Write output.' if '-h' in arguments or '-help' in arguments: print(__doc__) return round = int(almoner.getParameter(arguments, '27', 'round')) ratings = getRatings(round) recipientDictionary = account.getRecipientDictionary(round) earningsText = getEarningsText(ratings, recipientDictionary) ratingText = getRatingText(ratings, round) outputEarningsTo = almoner.getParameter(arguments, 'rating_earnings_%s.csv' % round, 'earnings') outputRatingTo = 'rating_%s.csv' % round if almoner.sendOutputTo(outputEarningsTo, earningsText): print('The rating earnings file has been written to:\n%s\n' % outputEarningsTo) if almoner.sendOutputTo(outputRatingTo, ratingText): print('The rating file has been written to:\n%s\n' % outputRatingTo)
def writeOutput(arguments): 'Write output.' if '-h' in arguments or '-help' in arguments: print(__doc__) return round = int(almoner.getParameter(arguments, '23', 'round')) publishersFileName = almoner.getParameter(arguments, 'devtome_%s.csv' % round, 'publishers') lines = almoner.getTextLines(almoner.getFileText(publishersFileName)) outputEarningsTo = almoner.getParameter(arguments, 'marketing_earnings_%s.csv' % round, 'earnings') outputSummaryTo = almoner.getParameter(arguments, 'marketing_summary.txt', 'summary') workerNameSet = set(account.getRecipientDictionary(round).keys()) publishers = getPublishers(lines, workerNameSet) earningsText = getEarningsText(publishers) if almoner.sendOutputTo(outputEarningsTo, earningsText): print('The marketing earnings bounty file has been written to:\n%s\n' % outputEarningsTo) if almoner.sendOutputTo(outputSummaryTo, getSummaryText(earningsText, publishers, round)): print('The summary file has been written to:\n%s\n' % outputSummaryTo)
def getPublishers(lines, round): publishers = [] workerNameSet = set(account.getRecipientDictionary(round).keys()) shareListSet = account.getShareListSet(round) for line in lines[1:]: splitLine = line.split(',') if len(splitLine) > 1: name = splitLine[0].strip().lower() if name != '': coinAddress = splitLine[1].strip() publisher = Publisher(coinAddress, name in shareListSet, name) if publisher.name in workerNameSet: publishers.append(publisher) else: print('%s did not work this round.' % publisher.name.capitalize()) return publishers