r84946 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84945‎ | r84946 | r84947 >
Date:03:52, 29 March 2011
Author:diederik
Status:deferred
Tags:
Comment:
Fixed two things:
1) name of function matches filename, fixes bug
2) improved speed by replacing regular expression with native find
Modified paths:
  • /trunk/tools/editor_trends/analyses/plugins/list_makers.py (modified) (history)

Diff [purge]

Index: trunk/tools/editor_trends/analyses/plugins/list_makers.py
@@ -12,32 +12,24 @@
1313 http://www.fsf.org/licenses/gpl.html
1414 '''
1515
16 -"""
17 -== List makers ==
18 -Any editor who makes more than 10 mainspace edits a month to articles with titles that begin with "List of..."
19 -"""
20 -
21 -import re # regular expression parsing
22 -
23 -
2416 __author__ = '''\n'''.join(['Diederik van Liere (dvanliere@gmail.com)', ])
2517 __email__ = 'dvanliere at gmail dot com'
2618 __date__ = '2011-01-25'
2719 __version__ = '0.1'
2820
29 -
30 -
31 -def burnout(var, editor, **kwargs):
32 -
 21+def list_makers(var, editor, **kwargs):
 22+ """
 23+ == List makers ==
 24+ Any editor who makes more than 10 mainspace edits a month to articles with titles that begin with "List of..."
 25+ """
3326 articles_by_year = editor['articles_by_year']
34 -
3527 count = 0
3628
3729 for year in xrange(new_wikipedian.year, var.max_year):
3830 for month in xrange(1, 13):
3931 for article in articles_by_year[year][month]:
4032 """ locate article titles containing "List of" """
41 - if re.search('List of', article):
 33+ if article.find('List of') > -1:
4234 count = count + 1
4335
4436