r86432 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86431‎ | r86432 | r86433 >
Date:20:28, 19 April 2011
Author:diederik
Status:deferred
Tags:
Comment:
Data competition plugin to count total number of edits in main namespace.
Modified paths:
  • /trunk/tools/editor_trends/analyses/plugins/edit_patterns.py (modified) (history)
  • /trunk/tools/editor_trends/analyses/plugins/kaggle_count_edits.py (added) (history)

Diff [purge]

Index: trunk/tools/editor_trends/analyses/plugins/kaggle_count_edits.py
@@ -0,0 +1,44 @@
 2+#!/usr/bin/python
 3+# -*- coding: utf-8 -*-
 4+'''
 5+Copyright (C) 2010 by Diederik van Liere (dvanliere@gmail.com)
 6+This program is free software; you can redistribute it and/or
 7+modify it under the terms of the GNU General Public License version 2
 8+as published by the Free Software Foundation.
 9+This program is distributed in the hope that it will be useful,
 10+but WITHOUT ANY WARRANTY; without even the implied warranty of
 11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 12+See the GNU General Public License for more details, at
 13+http://www.fsf.org/licenses/gpl.html
 14+'''
 15+
 16+__author__ = '''\n'''.join(['Diederik van Liere (dvanliere@gmail.com)', ])
 17+__email__ = 'dvanliere at gmail dot com'
 18+__date__ = '2011-04-19'
 19+__version__ = '0.1'
 20+
 21+from datetime import datetime
 22+
 23+def kaggle_count_edits(var, editor, **kwargs):
 24+ '''
 25+ This plugin counts the total number of edits made by non-bot users in
 26+ the main namespace. The key is set to an arbitrary date because we are
 27+ only interested in the final overall count.
 28+ '''
 29+
 30+ username = editor['username'].lower()
 31+ if username.endswith('bot'):
 32+ return var
 33+ else:
 34+ username = editor['username']
 35+
 36+ edits = editor['edit_count']
 37+ years = edits.keys()
 38+ count = 0
 39+ key = datetime(2011, 4, 19)
 40+ for year in years:
 41+ months = edits[year].keys()
 42+ for month in months:
 43+ count += edits[year][month].get(0, 0)
 44+ var.add(key, count, {'username': username})
 45+ return var
Property changes on: trunk/tools/editor_trends/analyses/plugins/kaggle_count_edits.py
___________________________________________________________________
Added: svn:eol-style
146 + native
Index: trunk/tools/editor_trends/analyses/plugins/edit_patterns.py
@@ -13,7 +13,7 @@
1414 '''
1515
1616 __author__ = '''\n'''.join(['Diederik van Liere (dvanliere@gmail.com)', ])
17 -__author__email = 'dvanliere at gmail dot com'
 17+__email__ = 'dvanliere at gmail dot com'
1818 __date__ = '2011-01-28'
1919 __version__ = '0.1'
2020