r85694 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85693‎ | r85694 | r85695 >
Date:21:37, 8 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Fixed mistake
Modified paths:
  • /trunk/tools/editor_trends/etl/enricher.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/etl/enricher.py
@@ -141,7 +141,7 @@
142142 hashes[file_id].append(editor)
143143 return hashes
144144
145 - def group_revisions_by_fileid(self, revisions):
 145+ def group_revisions_by_fileid(self):
146146 '''
147147 This function groups observation by editor id and then by file_id,
148148 this way we have to make fewer file opening calls and should reduce
@@ -151,7 +151,7 @@
152152 editors = {}
153153 #first, we group all revisions by editor
154154
155 - for revision in revisions:
 155+ for revision in self.revisions:
156156 row = []
157157 #strip away the keys and make sure that the values are always in the same sequence
158158 for key in self.keys:
@@ -163,12 +163,11 @@
164164
165165 #now, we are going to group all editors by file_id
166166 file_ids = self.invert_dictionary(editors)
167 - revisions = {}
 167+ self.revisions = {}
168168 for file_id, editors in file_ids:
169169 for editor in editors:
170 - revisions.setdefault(file_id, [])
171 - revisions[file_id].extend(data[editor])
172 - return revisions
 170+ self.revisions.setdefault(file_id, [])
 171+ self.revisions[file_id].extend(data[editor])
173172
174173 def add(self, revision):
175174 self.stringify(revision)
@@ -240,7 +239,7 @@
241240
242241 def write_revisions(self):
243242 #t0 = datetime.datetime.now()
244 - revisions = self.group_revisions_by_fileid()
 243+ self.group_revisions_by_fileid()
245244 file_ids = self.revisions.keys()
246245 while len(self.revisions.keys()) > 0:
247246 print len(self.revisions.keys())