def main(): import report analyses = report.fetchReport() options, args = parseArgs() if options.url: for analysis in analyses: if analysis["url"] == options.url: showAnalysis(analysis) return
def main(): import report analyses = report.fetchReport() _showAgeHistogram(analyses) print _showRecords(analyses) print _showAvgs(analyses) if len(analyses) > 0: print print "newest: ", analyses[0]
def produceReport(newUrls, cleanStart=False): newUrlsSet = frozenset(newUrls) newAnalyses = _getEnhancedAnalyses(newUrlsSet) if cleanStart: analyses = [] else: analyses = report.fetchReport() oldLen = len(analyses) _keepUniqueAndNewer(analyses, newUrlsSet, newAnalyses) def analysisCmp(a1, a2): c = cmp(a1["createdDate"], a2["createdDate"]) return c or -cmp(a1["unitPrice"], a2["unitPrice"]) analyses.sort(cmp=analysisCmp, reverse=True) report.storeReport(analyses) logging.info("Advanced from %s to %s analyses", oldLen, len(analyses))