Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/subscriptions/bin/generateReport.py

Issue 29670635: Issue 5844 - Remove redundant parentheses in abpssembly (Closed) Base URL: https://hg.adblockplus.org/abpssembly/
Patch Set: Created Jan. 16, 2018, 5:58 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 def loadSubscriptions(counts): 66 def loadSubscriptions(counts):
67 global interval 67 global interval
68 68
69 subscriptions = subscriptionParser.readSubscriptions() 69 subscriptions = subscriptionParser.readSubscriptions()
70 70
71 knownURLs = {} 71 knownURLs = {}
72 for subscription in subscriptions.values(): 72 for subscription in subscriptions.values():
73 for title, url, complete in subscription.variants: 73 for title, url, complete in subscription.variants:
74 knownURLs[url] = True 74 knownURLs[url] = True
75 75
76 (redirectData, goneData) = subscriptionParser.getFallbackData() 76 redirectData, goneData = subscriptionParser.getFallbackData()
77 redirects = processFile(redirectData, counts) 77 redirects = processFile(redirectData, counts)
78 gone = processFile(goneData, counts) 78 gone = processFile(goneData, counts)
79 79
80 unaccounted = filter(lambda url: counts[url] >= 10, counts.keys()) 80 unaccounted = filter(lambda url: counts[url] >= 10, counts.keys())
81 unaccounted.sort(key=lambda url: counts[url], reverse=True) 81 unaccounted.sort(key=lambda url: counts[url], reverse=True)
82 for i in range(0, len(unaccounted)): 82 for i in range(0, len(unaccounted)):
83 url = unaccounted[i] 83 url = unaccounted[i]
84 mark = ' [?]' 84 mark = ' [?]'
85 if url in knownURLs: 85 if url in knownURLs:
86 mark = '' 86 mark = ''
87 unaccounted[i] = '%5i %s%s' % (counts[url], url, mark) 87 unaccounted[i] = '%5i %s%s' % (counts[url], url, mark)
88 88
89 return (redirects, gone, unaccounted) 89 return (redirects, gone, unaccounted)
90 90
91 91
92 if __name__ == '__main__': 92 if __name__ == '__main__':
93 setupStderr() 93 setupStderr()
94 94
95 counts = {} 95 counts = {}
96 for i in range(1, 15): 96 for i in range(1, 15):
97 logPath = os.path.join(get_config().get('logs', 'dataPath'), get_config( ).get('logs', 'fileName') % i) 97 logPath = os.path.join(get_config().get('logs', 'dataPath'), get_config( ).get('logs', 'fileName') % i)
98 countSubscriptionRequests(logPath, counts) 98 countSubscriptionRequests(logPath, counts)
99 99
100 (redirects, gone, unaccounted) = loadSubscriptions(counts) 100 redirects, gone, unaccounted = loadSubscriptions(counts)
101 101
102 sendMail(get_config().get('subscriptions', 'reportTemplate'), { 102 sendMail(get_config().get('subscriptions', 'reportTemplate'), {
103 'redirects': redirects, 103 'redirects': redirects,
104 'gone': gone, 104 'gone': gone,
105 'unaccounted': unaccounted, 105 'unaccounted': unaccounted,
106 }) 106 })
OLDNEW
« no previous file with comments | « sitescripts/reports/bin/parseNewReports.py ('k') | sitescripts/subscriptions/bin/updateStatusPage.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld