[MediaWiki-commits] [Gerrit] Add tox.ini file - change (pywikibot...xqbot)

2016-02-22 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: Add tox.ini file
..


Add tox.ini file

Change-Id: I7c5e14f6b1f3f3a365100ba5e9defd5ffdd16e82
---
A tox.ini
1 file changed, 28 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/tox.ini b/tox.ini
new file mode 100644
index 000..b6aa3c0
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,28 @@
+[tox]
+minversion = 1.6
+skipsdist = True
+envlist = flake8,flake8-py3,flake8-docstrings,py26,py27,py34
+
+[testenv:flake8]
+commands = flake8 --ignore=D102,D103,E122,E127,E241,E402,E731 {posargs}
+basepython = python2.7
+deps = flake8
+
+[testenv:flake8-py3]
+commands = flake8 --ignore=D102,D103,E122,E127,E241,E402,E731 {posargs}
+basepython = python3
+deps = flake8
+
+[testenv:venv]
+commands = {posargs}
+
+[flake8]
+ignore = 
D105,D211,E402,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101
+exclude = .tox,.git,./*.egg,ez_setup.py,build
+max_line_length = 80
+
+[pep8]
+ignore = E402
+exclude = .tox,.git,./*.egg,ez_setup.py,build
+max_line_length = 80
+

-- 
To view, visit https://gerrit.wikimedia.org/r/272467
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c5e14f6b1f3f3a365100ba5e9defd5ffdd16e82
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Ladsgroup 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add init file, add parent folder to sys.path - change (pywikibot...xqbot)

2016-02-22 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: Add init file, add parent folder to sys.path
..


Add init file, add parent folder to sys.path

Change-Id: I677794d18a835dde1c0897362125fd464d2f6d69
---
A tests/__init__.py
M tests/vandalism_tests.py
2 files changed, 13 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 000..959f75d
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8  -*-
+"""Package tests."""
diff --git a/tests/vandalism_tests.py b/tests/vandalism_tests.py
index 0502e16..32ae84a 100644
--- a/tests/vandalism_tests.py
+++ b/tests/vandalism_tests.py
@@ -9,12 +9,20 @@
 
 __version__ = '$Id$'
 
+import inspect
+import os
+import sys
+import unittest
+
+currentdir = os.path.dirname(
+os.path.abspath(inspect.getfile(inspect.currentframe(
+parentdir = os.path.dirname(currentdir)
+sys.path.insert(0, parentdir)
+
 from vandalism import getAccuser
 
-from tests.aspects import unittest, TestCase
 
-
-class TestVandalismMethods(TestCase):
+class TestVandalismMethods(unittest.TestCase):
 
 """Test vandalism modules."""
 

-- 
To view, visit https://gerrit.wikimedia.org/r/272470
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I677794d18a835dde1c0897362125fd464d2f6d69
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add init file - change (pywikibot...xqbot)

2016-02-22 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272470

Change subject: Add init file
..

Add init file

Change-Id: I677794d18a835dde1c0897362125fd464d2f6d69
---
A tests/__init__.py
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/70/272470/1

diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 000..959f75d
--- /dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,2 @@
+# -*- coding: utf-8  -*-
+"""Package tests."""

-- 
To view, visit https://gerrit.wikimedia.org/r/272470
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I677794d18a835dde1c0897362125fd464d2f6d69
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add tox.ini file - change (pywikibot...xqbot)

2016-02-22 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272467

Change subject: Add tox.ini file
..

Add tox.ini file

Change-Id: I7c5e14f6b1f3f3a365100ba5e9defd5ffdd16e82
---
A tox.ini
1 file changed, 50 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/67/272467/1

diff --git a/tox.ini b/tox.ini
new file mode 100644
index 000..00d567b
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,50 @@
+[tox]
+minversion = 1.6
+skipsdist = True
+envlist = flake8,flake8-py3,flake8-docstrings,py26,py27,py34
+
+[testenv]
+setenv = VIRTUAL_ENV={envdir}
+usedevelop = True
+commands = python setup.py test
+install_command = pip install --process-dependency-links --pre {opts} 
{packages}
+
+[testenv:flake8]
+commands = flake8 --ignore=D102,D103,E122,E127,E241,E402,E731 {posargs}
+basepython = python2.7
+deps = flake8
+
+[testenv:flake8-py3]
+commands = flake8 --ignore=D102,D103,E122,E127,E241,E402,E731 {posargs}
+basepython = python3
+deps = flake8
+
+[testenv:nose]
+commands =
+nosetests --version
+nosetests -v -a "!net" tests
+deps =
+nose
+
+[testenv:nose34]
+basepython = python3
+commands =
+nosetests --version
+nosetests -v -a "!net" tests
+deps =
+nose
+six
+
+[testenv:venv]
+commands = {posargs}
+
+[flake8]
+ignore = 
D105,D211,E402,FI10,FI12,FI13,FI15,FI5,H101,H201,H236,H301,H404,H405,I100,I101
+exclude = .tox,.git,./*.egg,ez_setup.py,build
+max_line_length = 80
+
+[pep8]
+ignore = E402
+exclude = .tox,.git,./*.egg,ez_setup.py,build
+max_line_length = 80
+

-- 
To view, visit https://gerrit.wikimedia.org/r/272467
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c5e14f6b1f3f3a365100ba5e9defd5ffdd16e82
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Don't preload pages to be touched. - change (pywikibot/core)

2016-02-22 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272454

Change subject: [IMPR] Don't preload pages to be touched.
..

[IMPR] Don't preload pages to be touched.

There is no reason (anymore) to preload pages because they are always
reloaded.

Change-Id: I3d1cf6be4124f525566ed2fd74350fa9c57a6661
---
M scripts/touch.py
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/54/272454/1

diff --git a/scripts/touch.py b/scripts/touch.py
index cc59ca7..47ba19e 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -15,7 +15,7 @@
 
 """
 #
-# (C) Pywikibot team, 2009-2015
+# (C) Pywikibot team, 2009-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -99,8 +99,7 @@
 
 gen = genFactory.getCombinedGenerator()
 if gen:
-preloadingGen = pagegenerators.PreloadingGenerator(gen)
-bot = bot_class(generator=preloadingGen, **options)
+bot = bot_class(generator=gen, **options)
 pywikibot.Site().login()
 bot.run()
 return True

-- 
To view, visit https://gerrit.wikimedia.org/r/272454
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d1cf6be4124f525566ed2fd74350fa9c57a6661
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] compat --> core - change (pywikibot...CommonsDelinker)

2016-02-22 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: compat --> core
..


compat --> core

Change-Id: Ie3f9f502f0ba8c301f5d2beb47c620e6b5f983c4
---
M checkusage.py
M delinker.py
M image_replacer.py
3 files changed, 74 insertions(+), 53 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/checkusage.py b/checkusage.py
index 6e557bf..64f12d0 100644
--- a/checkusage.py
+++ b/checkusage.py
@@ -32,18 +32,24 @@
 """
 #
 # (C) Bryan Tong Minh, 2007
+# (C) Pywikibot team, 2014-2016
 #
 # Distributed under the terms of the MIT license.
 #
+from __future__ import absolute_import, unicode_literals
 __version__ = '$Id: checkusage.py 11540 2013-05-17 17:23:42Z drtrigon $'
 #
 
-import httplib, urlparse, socket, time
+import httplib
+import json
+import socket
+import time
+import urlparse
 from urllib import urlencode
 
-import wikipedia, family
+import pywikibot
+from pywikibot.data import api
 
-import simplejson   # after 'wikipedia' because of externals path
 
 try:
 import MySQLdb
@@ -141,14 +147,14 @@
 self._conn.close()
 self.__init__(self.host)
 try:
-data = simplejson.load(res)
+data = json.load(res)
 finally:
 res.close()
 
 if 'error' in data:
 if data['error']['code'] == 
u'internal_api_error_DBConnectionError':
 return self.query_api(host, path, **kwargs)
-raise wikipedia.Error(data['error']['code'],
+raise api.APIError(data['error']['code'],
 data['error']['info'])
 
 return data
@@ -270,7 +276,7 @@
 try:
 lang, fam = family(domain)
 if fam not in self.known_families:
-self.known_families[fam] = wikipedia.Family(fam, fatal = 
False)
+self.known_families[fam] = pywikibot.site.Family(fam, 
fatal=False)
 except (RuntimeError, ValueError, SyntaxError):
 self.unknown_families.append(domain)
 else:
@@ -324,6 +330,7 @@
 for page_namespace, page_title in self.databases[dbname][1]:
 stripped_title = page_title.decode('utf-8', 'ignore')
 if page_namespace != 0:
+# FIXME Family.namespace doesn't exist in core
 title = family.namespace(lang, page_namespace) + u':' + 
stripped_title
 else:
 title = stripped_title
diff --git a/delinker.py b/delinker.py
index 1a2556c..1b4418c 100644
--- a/delinker.py
+++ b/delinker.py
@@ -19,13 +19,13 @@
 # (C) Kyle/Orgullomoore, 2006-2007
 # (C) Siebrand Mazeland, 2006-2007
 # (C) Bryan Tong Minh, 2007-2008, 2012
+# (C) Pywikibot team, 2014-2016
 #
 # Distributed under the terms of the MIT license.
 #
+from __future__ import absolute_import, unicode_literals
 __version__ = '$Id$'
-# This script requires MySQLdb and simplejson. Tested with:
-# * Python 2.4.4, MySQLdb 1.2.1_p, simplejson 1.3
-# * Python 2.5, MySQLdb 1.2.2, simplejson 1.5 (recommended)
+# This script requires MySQLdb
 # TODO:
 # * Don't replace within  tags
 # * Make as many config settings site dependend
@@ -37,16 +37,19 @@
 # before_delink, simple_replace, gallery_replace, complex_replace, before_save,
 # after_delink
 
-import sys, os, threading, time
+import cgitb
+import os
+import re
+import sys
+import time
 import traceback
-import re, cgitb
 import threading
-
 import threadpool
-import checkusage
 
-import wikipedia
-import config
+import pywikibot
+from pywikibot import config
+
+import checkusage
 
 # FIXME: They should be defined *somewhere* in the Python library, not?
 WHITESPACE = u' \r\n\t\u200e\u200f\u202a\u202a\u202b\u202c\u202d\u202e'
@@ -137,9 +140,9 @@
 try:
 try:
 result = self.replace_image(image, site, 
title, summary, replacement)
-except wikipedia.UserBlocked, e:
+except pywikibot.UserBlocked, e:
 output(u'Warning! Blocked %s.' % tuple(e))
-except wikipedia.CaptchaError, e:
+except pywikibot.CaptchaError, e:
 output(u'%s Warning! Captcha encountered at 
%s.' % (self, site))
 if (lang, family) not in skipped_images:
 skipped_images[(lang, family)] = []
@@ -173,14 +176,14 @@
 """ The actual replacement. Giving None as argument for replacement
 will delink instead of replace."""
 
-page = wikipedia.Page(site, page_title)
+page = pywikibot.Page(site, page_title)
 hook = None
 
 # TODO: Per site config.
 if page.namespace() in 
self.CommonsDelinker.config['delink_namespaces']:
 try:
 text = page.get(get_redirect 

[MediaWiki-commits] [Gerrit] new tests folder - change (pywikibot...xqbot)

2016-02-22 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: new tests folder
..


new tests folder

Change-Id: I8d483e05886d6a9f99c12565c4099e470b6dfaee
---
R tests/vandalism_tests.py
1 file changed, 0 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/vandalism_tests.py b/tests/vandalism_tests.py
similarity index 100%
rename from vandalism_tests.py
rename to tests/vandalism_tests.py

-- 
To view, visit https://gerrit.wikimedia.org/r/272451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8d483e05886d6a9f99c12565c4099e470b6dfaee
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] new tests folder - change (pywikibot...xqbot)

2016-02-22 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272451

Change subject: new tests folder
..

new tests folder

Change-Id: I8d483e05886d6a9f99c12565c4099e470b6dfaee
---
R tests/vandalism_tests.py
1 file changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/51/272451/1

diff --git a/vandalism_tests.py b/tests/vandalism_tests.py
similarity index 100%
rename from vandalism_tests.py
rename to tests/vandalism_tests.py

-- 
To view, visit https://gerrit.wikimedia.org/r/272451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d483e05886d6a9f99c12565c4099e470b6dfaee
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Improvements for redirect.py - change (pywikibot/core)

2016-02-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272327

Change subject: [IMPR] Improvements for redirect.py
..

[IMPR] Improvements for redirect.py

- Enable direct iteration for RedirectGenerator class using action parameter
- derive RedirectRobot from SingleSiteBot
- overwrite super class' init_page, just pass
- use super class' run method
- treat pages or page titles and call the right mehtod to handle it
- implement -total option for all actions

Change-Id: I94e3b920d4086ebf22fd8a8f41c2a0b33c6605fa
---
M scripts/redirect.py
1 file changed, 31 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/27/272327/1

diff --git a/scripts/redirect.py b/scripts/redirect.py
index 12118f6..18e8490 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -87,7 +87,7 @@
 import pywikibot
 
 from pywikibot import i18n, xmlreader, Bot
-from pywikibot.bot import OptionHandler
+from pywikibot.bot import OptionHandler, SingleSiteBot
 from pywikibot.tools.formatter import color_format
 
 if sys.version_info[0] > 2:
@@ -117,7 +117,7 @@
 'xml': None,
 }
 
-def __init__(self, **kwargs):
+def __init__(self, action, **kwargs):
 super(RedirectGenerator, self).__init__(**kwargs)
 self.site = pywikibot.Site()
 self.use_api = self.getOption('fullscan')
@@ -130,6 +130,16 @@
 self.api_number = self.getOption('total')
 self.api_until = self.getOption('until')
 self.xmlFilename = self.getOption('xml')
+self.action = action
+
+def __iter__(self):
+"""Run the generator selected by 'action' parameter."""
+if self.action == 'double':
+return self.retrieve_double_redirects()
+elif self.action == 'broken':
+return self.retrieve_broken_redirects()
+elif self.action == 'both':
+return self.get_redirects_via_api(maxlen=2)
 
 def get_redirects_from_dump(self, alsoGetPageTitles=False):
 """
@@ -390,7 +400,7 @@
 continue
 
 
-class RedirectRobot(Bot):
+class RedirectRobot(SingleSiteBot):
 
 """Redirect bot."""
 
@@ -406,10 +416,9 @@
 self.action = args[0]
 self.exiting = False
 
-def delete_broken_redirects(self):
-# get reason for deletion text
-for redir_name in self.generator.retrieve_broken_redirects():
-self.delete_1_broken_redirect(redir_name)
+def init_page(self, page):
+"""Overwrite super class method."""
+pass
 
 def delete_1_broken_redirect(self, redir_name):
 if isinstance(redir_name, basestring):
@@ -532,10 +541,6 @@
 targetPage.title(asLink=True),
 "Won't delete anything."
 if self.getOption('delete') else "Skipping."))
-
-def fix_double_redirects(self):
-for redir_name in self.generator.retrieve_double_redirects():
-self.fix_1_double_redirect(redir_name)
 
 def fix_1_double_redirect(self, redir_name):
 if isinstance(redir_name, basestring):
@@ -691,33 +696,25 @@
 % (redir.title(), error))
 break
 
-def fix_double_or_delete_broken_redirects(self):
-# TODO: part of this should be moved to generator, the rest merged into
-# self.run()
-count = 0
-for (redir_name, code, target, final)\
-in self.generator.get_redirects_via_api(maxlen=2):
+def treat(self, page):
+"""Run the script method selected by 'action' parameter."""
+if self.action == 'double':
+self.fix_1_double_redirect(page)
+elif self.action == 'broken':
+self.delete_1_broken_redirect(page)
+elif self.action == 'both':
+redir_name, code, target, final = page
 if code == 1:
-continue
+return
 elif code == 0:
 self.delete_1_broken_redirect(redir_name)
-count += 1
 else:
 self.fix_1_double_redirect(redir_name)
-count += 1
-if self.getOption('total') and count >= self.getOption('total'):
-break
-
-def run(self):
-"""Run the script method selected by 'action' parameter."""
-# TODO: make all generators return a redirect type indicator,
-#   thus make them usable with 'both'
-if self.action == 'double':
-self.fix_double_redirects()
-elif self.action == 'broken':
-self.delete_broken_redirects()
-elif self.action == 'both':
-self.fix_double_or_delete_broken_redirects()
+if (self.getOption('total') and
+self._treat_counter >= self.getOption('total')):
+pywikibot.output('\nTotal amount of pages exceeded. '
+ 

[MediaWiki-commits] [Gerrit] [IMPR] Improve pagefromfile.py - change (pywikibot/core)

2016-02-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272325

Change subject: [IMPR] Improve pagefromfile.py
..

[IMPR] Improve pagefromfile.py

- rename run method of generator class and enable direct iteration
- derive PageFromFileRobot from SingleSiteBot and  CurrentPageBot
- use instance site attribute
- use run() mehtod from super class
- overwrite super class' init_page, just pass
- overwrite treat: create a page and save the content to page instance
- rename save method to treat_page
- user put_current instead of userPut

Change-Id: I2e293f19850abe216f8fe96a21ebe2183da847b8
---
M scripts/pagefromfile.py
1 file changed, 28 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/25/272325/1

diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index f5fbd9d..63b66ae 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -74,7 +74,8 @@
 
 import pywikibot
 
-from pywikibot import config, Bot, i18n
+from pywikibot import config, i18n
+from pywikibot.bot import SingleSiteBot, AutomaticTWSummaryBot
 from pywikibot.exceptions import ArgumentDeprecationWarning
 
 
@@ -87,7 +88,7 @@
 self.offset = offset
 
 
-class PageFromFileRobot(Bot):
+class PageFromFileRobot(SingleSiteBot, CurrentPageBot):
 
 """
 Responsible for writing pages to the wiki.
@@ -96,7 +97,7 @@
 
 """
 
-def __init__(self, reader, **kwargs):
+def __init__(self, **kwargs):
 """Constructor."""
 self.availableOptions.update({
 'always': True,
@@ -113,34 +114,35 @@
 super(PageFromFileRobot, self).__init__(**kwargs)
 self.availableOptions.update(
 {'always': False if self.getOption('showdiff') else True})
-self.reader = reader
 
-def run(self):
-"""Start file processing and upload content."""
-for title, contents in self.reader.run():
-self.save(title, contents)
+def init_page(self, page):
+"""Do not try to update site before calling treat."""
+pass
 
-def save(self, title, contents):
+def treat(self, page_tuple):
+"""Process page tuple, set page to current page and treat it."""
+title, content = page_tuple
+page = pywikibot.Page(self.site, title)
+page.text = content.strip()
+super(PageFromFileRobot, self).treat(page)
+
+def treat_page(self):
 """Upload page content."""
-mysite = pywikibot.Site()
-
-page = pywikibot.Page(mysite, title)
-self.current_page = page
+page = self.current_page
+title = page.title()
+contents = page.text
 
 if self.getOption('summary'):
 comment = self.getOption('summary')
 else:
-comment = i18n.twtranslate(mysite, 'pagefromfile-msg')
+comment = i18n.twtranslate(self.site, 'pagefromfile-msg')
 
 comment_top = comment + " - " + i18n.twtranslate(
-mysite, 'pagefromfile-msg_top')
+self.site, 'pagefromfile-msg_top')
 comment_bottom = comment + " - " + i18n.twtranslate(
-mysite, 'pagefromfile-msg_bottom')
+self.site, 'pagefromfile-msg_bottom')
 comment_force = "%s *** %s ***" % (
-comment, i18n.twtranslate(mysite, 'pagefromfile-msg_force'))
-
-# Remove trailing newlines (cause troubles when creating redirects)
-contents = re.sub('^[\r\n]*', '', contents)
+comment, i18n.twtranslate(self.site, 'pagefromfile-msg_force'))
 
 if page.exists():
 if not self.getOption('redirect') and page.isRedirectPage():
@@ -175,14 +177,11 @@
 return
 else:
 if self.getOption('autosummary'):
-comment = ''
-config.default_edit_summary = ''
+comment = config.default_edit_summary = ''
 
-self.userPut(page, page.text, contents,
- summary=comment,
- minor=self.getOption('minor'),
- show_diff=self.getOption('showdiff'),
- ignore_save_related_errors=True)
+self.put_current(contents, summary=comment,
+ minor=self.getOption('minor'),
+ show_diff=self.getOption('showdiff'))
 
 
 class PageFromFileReader(object):
@@ -210,7 +209,7 @@
 self.include = include
 self.notitle = notitle
 
-def run(self):
+def __iter__(self):
 """Read file and yield page title and content."""
 pywikibot.output('\n\nReading \'%s\'...' % self.filename)
 try:
@@ -351,7 +350,7 @@
 reader = PageFromFileReader(filename, pageStartMarker, pageEndMarker,
 titleStartMarker, titleEndMarker, include,
 notitle)
-bot = PageFromFileRobot(reader, 

[MediaWiki-commits] [Gerrit] [IMPR] use OptionHandler class for PageFromFileReader. - change (pywikibot/core)

2016-02-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272317

Change subject: [IMPR] use OptionHandler class for PageFromFileReader.
..

[IMPR] use OptionHandler class for PageFromFileReader.

- derive PageFromFileReader from OptionHandler class
- simplify arg parsing in handle_args method

Change-Id: I42ea2ff0d368217c2e30f9249cec2a8f7cb3381d
---
M scripts/pagefromfile.py
1 file changed, 49 insertions(+), 59 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/17/272317/1

diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index f5fbd9d..7d9bffe 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -18,7 +18,6 @@
 Specific arguments:
 
 -begin:xxx  Specify the text that marks the beginning of a page
--start:xxx  (deprecated)
 -end:xxxSpecify the text that marks the end of a page
 -file:xxx   Give the filename we are getting our material from
 (default: dict.txt)
@@ -75,6 +74,7 @@
 import pywikibot
 
 from pywikibot import config, Bot, i18n
+from pywikibot.bot import OptionHandler
 from pywikibot.exceptions import ArgumentDeprecationWarning
 
 
@@ -185,7 +185,7 @@
  ignore_save_related_errors=True)
 
 
-class PageFromFileReader(object):
+class PageFromFileReader(OptionHandler):
 
 """
 Responsible for reading the file.
@@ -194,21 +194,35 @@
 
 """
 
-def __init__(self, filename, pageStartMarker, pageEndMarker,
- titleStartMarker, titleEndMarker, include, notitle):
+# Adapt these to the file you are using. 'begin' and
+# 'end' are the beginning and end of each entry. Take text that
+# should be included and does not occur elsewhere in the text.
+
+# TODO: make config variables for these.
+availableOptions = {
+'begin': '{{-start-}}',
+'end': '{{-stop-}}',
+'titlestart': "'''",
+'titleend': "'''",
+'include': False,
+'notitle': False
+}
+
+def __init__(self, filename, **kwargs):
 """Constructor.
 
 Check if self.file name exists. If not, ask for a new filename.
 User can quit.
 
 """
+super(PageFromFileReader, self).__init__(**kwargs)
 self.filename = filename
-self.pageStartMarker = pageStartMarker
-self.pageEndMarker = pageEndMarker
-self.titleStartMarker = titleStartMarker
-self.titleEndMarker = titleEndMarker
-self.include = include
-self.notitle = notitle
+self.pageStartMarker = self.getOption('begin')
+self.pageEndMarker = self.getOption('end')
+self.titleStartMarker = self.getOption('titlestart')
+self.titleEndMarker = self.getOption('titleend')
+self.include = self.getOption('include')
+self.notitle = self.getOption('notitle')
 
 def run(self):
 """Read file and yield page title and content."""
@@ -273,61 +287,39 @@
 @param args: command line arguments
 @type args: list of unicode
 """
-# Adapt these to the file you are using. 'pageStartMarker' and
-# 'pageEndMarker' are the beginning and end of each entry. Take text that
-# should be included and does not occur elsewhere in the text.
-
-# TODO: make config variables for these.
 filename = "dict.txt"
-pageStartMarker = "{{-start-}}"
-pageEndMarker = "{{-stop-}}"
-titleStartMarker = u"'''"
-titleEndMarker = u"'''"
 options = {}
-include = False
-notitle = False
+r_options = {}
 
 for arg in pywikibot.handle_args(args):
-if arg.startswith('-start:'):
-pageStartMarker = arg[7:]
-warn('-start param (text that marks the beginning) of a page has 
been '
- 'deprecated in favor of begin; make sure to use the updated 
param.',
- ArgumentDeprecationWarning)
-elif arg.startswith('-begin:'):
-pageStartMarker = arg[len('-begin:'):]
-elif arg.startswith("-end:"):
-pageEndMarker = arg[5:]
-elif arg.startswith("-file:"):
-filename = arg[6:]
-elif arg == "-include":
-include = True
-elif arg.startswith('-appendbottom'):
-options['append'] = ('bottom', arg[len('-appendbottom:'):])
-elif arg.startswith('-appendtop'):
-options['append'] = ('top', arg[len('-appendtop:'):])
-elif arg == "-force":
-options['force'] = True
+arg, sep, value = arg.partition(':')
+option = arg[1:]
+# reader options
+if arg == '-start':
+r_option['begin'] = value
+warn('-start param (text that marks the beginning) of a page has '
+ 'been deprecated in favor of begin; make sure to use the '
+ 'updated param.', ArgumentDeprecationWarning)
+elif arg in ('-begin', '-end', 

[MediaWiki-commits] [Gerrit] [IMPR] Provide options by a separate handler class - change (pywikibot/core)

2016-02-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272316

Change subject: [IMPR] Provide options by a separate handler class
..

[IMPR] Provide options by a separate handler class

- provide an option handler class
- derive BaseBot from OptionHandler class
- derive RedirectGenerator from OptionHandler class
- rewirte arg parsing for generator and bot in redirect.py
- rewrite help message

Change-Id: Ib281147d38f3d6eaf34f1a1ad0c7c920513f0d79
---
M pywikibot/bot.py
M scripts/redirect.py
2 files changed, 104 insertions(+), 92 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/16/272316/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 18436db..85575f8 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -48,7 +48,7 @@
 used.
 """
 #
-# (C) Pywikibot team, 2008-2015
+# (C) Pywikibot team, 2008-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1114,31 +1114,18 @@
 i18n.input('pywikibot-enter-finished-browser')
 
 
-class BaseBot(object):
-
+class OptionHandler(object):
 """
 Generic Bot to be subclassed.
 
-This class provides a run() method for basic processing of a
-generator one page at a time.
-
-If the subclass places a page generator in self.generator,
-Bot will process each page in the generator, invoking the method treat()
-which must then be implemented by subclasses.
-
-If the subclass does not set a generator, or does not override
-treat() or run(), NotImplementedError is raised.
+This class provides methods to get and set options.
 """
 
-# Bot configuration.
+# Handler configuration.
 # Only the keys of the dict can be passed as init options
 # The values are the default values
 # Extend this in subclasses!
-availableOptions = {
-'always': False,  # ask for confirmation when putting a page?
-}
-
-_current_page = None
+availableOptions = {}
 
 def __init__(self, **kwargs):
 """
@@ -1147,13 +1134,7 @@
 @param kwargs: bot options
 @type kwargs: dict
 """
-if 'generator' in kwargs:
-self.generator = kwargs.pop('generator')
-
 self.setOptions(**kwargs)
-
-self._treat_counter = 0
-self._save_counter = 0
 
 def setOptions(self, **kwargs):
 """
@@ -1186,6 +1167,43 @@
 except KeyError:
 raise pywikibot.Error(u'%s is not a valid bot option.' % option)
 
+
+class BaseBot(OptionHandler):
+
+"""
+Generic Bot to be subclassed.
+
+This class provides a run() method for basic processing of a
+generator one page at a time.
+
+If the subclass places a page generator in self.generator,
+Bot will process each page in the generator, invoking the method treat()
+which must then be implemented by subclasses.
+
+If the subclass does not set a generator, or does not override
+treat() or run(), NotImplementedError is raised.
+"""
+
+_current_page = None
+
+def __init__(self, **kwargs):
+"""
+Only accept options defined in availableOptions.
+
+@param kwargs: bot options
+@type kwargs: dict
+"""
+self.availableOptions.update({
+'always': False,  # ask for confirmation when putting a page?
+})
+if 'generator' in kwargs:
+self.generator = kwargs.pop('generator')
+
+super(BaseBot, self).__init__(**kwargs)
+
+self._treat_counter = 0
+self._save_counter = 0
+
 @property
 def current_page(self):
 """Return the current working page as a property."""
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 75a60a3..0c46290 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -71,8 +71,8 @@
 #
 # (C) Daniel Herding, 2004
 # (C) Purodha Blissenbach, 2009
-# (C) xqt, 2009-2015
-# (C) Pywikibot team, 2004-2015
+# (C) xqt, 2009-2016
+# (C) Pywikibot team, 2004-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -87,6 +87,7 @@
 import pywikibot
 
 from pywikibot import i18n, xmlreader, Bot
+from pywikibot.bot import OptionHandler
 from pywikibot.tools.formatter import color_format
 
 if sys.version_info[0] > 2:
@@ -99,26 +100,36 @@
 return link.canonical_title().replace(' ', '_')
 
 
-class RedirectGenerator(object):
+class RedirectGenerator(OptionHandler):
 
 """Redirect generator."""
 
-def __init__(self, xmlFilename=None, namespaces=[], offset=-1,
- use_move_log=False, use_api=False, start=None, until=None,
- number=None, step=None, page_title=None):
+availableOptions = {
+'fullscan': False,
+'moves': False,
+'namespaces': [0],
+'offset': -1,
+'page': None,
+'start': None,
+'step': None,
+'total': None,
+'until': None,
+'xml': None,
+}
+
+def 

[MediaWiki-commits] [Gerrit] [doc] Add doctrings to methods (D102, D103) - change (pywikibot/core)

2016-02-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271950

Change subject: [doc] Add doctrings to methods (D102, D103)
..

[doc] Add doctrings to methods (D102, D103)

Change-Id: Idd1db70bd3315edb3bc0105bc175407f8e3393c9
---
M generate_family_file.py
M pywikibot/cosmetic_changes.py
M tests/deprecation_tests.py
M tests/pagegenerators_tests.py
M tox.ini
5 files changed, 85 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/50/271950/1

diff --git a/generate_family_file.py b/generate_family_file.py
index b4675f8..81013ef 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -47,6 +47,7 @@
 """Family file creator."""
 
 def __init__(self, url=None, name=None, dointerwiki=None):
+"""Constructor."""
 if url is None:
 url = raw_input("Please insert URL to wiki: ")
 if name is None:
@@ -59,6 +60,7 @@
 self.langs = []  # [Wiki('https://wiki/$1'), ...]
 
 def run(self):
+"""Main method, generate family file."""
 print("Generating family file from %s" % self.base_url)
 
 w = Wiki(self.base_url)
@@ -75,6 +77,7 @@
 self.writefile()
 
 def getlangs(self, w):
+"""Determine language of a site."""
 print("Determining other languages...", end="")
 try:
 self.langs = w.langs
@@ -113,6 +116,7 @@
   if wiki[u'url'] == w.iwpath]
 
 def getapis(self):
+"""Load other language pages."""
 print("Loading wikis... ")
 for lang in self.langs:
 print("  * %s... " % (lang[u'prefix']), end="")
@@ -126,6 +130,7 @@
 print("in cache")
 
 def writefile(self):
+"""Write the family file."""
 fn = "pywikibot/families/%s_family.py" % self.name
 print("Writing %s... " % fn)
 try:
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index bf16474..eeedbe1 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -695,6 +695,7 @@
 return text
 
 def replaceDeprecatedTemplates(self, text):
+"""Replace deprecated templates."""
 exceptions = ['comment', 'math', 'nowiki', 'pre']
 builder = _MultiTemplateMatchBuilder(self.site)
 
@@ -718,7 +719,9 @@
 
 # from fixes.py
 def fixSyntaxSave(self, text):
+"""Convert weblinks to wikilink, fix link syntax."""
 def replace_link(match):
+"""Create a string to replace a single link."""
 replacement = '[[' + match.group('link')
 if match.group('title'):
 replacement += '|' + match.group('title')
@@ -779,7 +782,9 @@
 return text
 
 def fixHtml(self, text):
+"""Relace html markups with wikitext markups."""
 def replace_header(match):
+"""Create a header string for replacing."""
 depth = int(match.group(1))
 return r'{0} {1} {0}'.format('=' * depth, match.group(2))
 
@@ -809,6 +814,7 @@
 return text
 
 def fixReferences(self, text):
+"""Fix references tags."""
 # See also 
https://en.wikipedia.org/wiki/User:AnomieBOT/source/tasks/OrphanReferenceFixer.pm
 exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
   'startspace']
@@ -825,9 +831,9 @@
 return text
 
 def fixStyle(self, text):
+"""Convert prettytable to wikitable class."""
 exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
   'startspace']
-# convert prettytable to wikitable class
 if self.site.code in ('de', 'en'):
 text = textlib.replaceExcept(text,
  r'(class="[^"]*)prettytable([^"]*")',
@@ -835,6 +841,7 @@
 return text
 
 def fixTypo(self, text):
+"""Fix units."""
 exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
   'startspace', 'gallery', 'hyperlink', 'interwiki', 
'link']
 # change  ccm ->  cm³
@@ -853,6 +860,7 @@
 return text
 
 def fixArabicLetters(self, text):
+"""Fix arabic and persian letters."""
 if self.site.code not in ['ckb', 'fa']:
 return text
 exceptions = [
diff --git a/tests/deprecation_tests.py b/tests/deprecation_tests.py
index cd25d38..63fc463 100644
--- a/tests/deprecation_tests.py
+++ b/tests/deprecation_tests.py
@@ -62,6 +62,7 @@
 net = False
 
 def test_add_full_name_decorator(self):
+"""Test add_decorated_full_name() method."""
 self.assertRaisesRegex(
 Exception,
 __name__ + '.decorated_func',
@@ -171,28 +172,34 @@
 @classmethod
 @deprecated()
 def class_method(cls, foo=None):
+"""Deprecated class method."""
 return foo
 
 

[MediaWiki-commits] [Gerrit] [FEAT] Delete redirect loops if 'double' action is selected. - change (pywikibot/core)

2016-02-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271752

Change subject: [FEAT] Delete redirect loops if 'double' action is selected.
..

[FEAT] Delete redirect loops if 'double' action is selected.

With -delete option, redirect loops can be deleted or tagged for speedy 
deletion.

Change-Id: Id5176c9e126a8ab29c5ed683a8e9752108e60bd6
---
M scripts/redirect.py
1 file changed, 36 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/52/271752/1

diff --git a/scripts/redirect.py b/scripts/redirect.py
index edfa28d..10c9093 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -63,7 +63,8 @@
 
 -deletePrompt the user whether broken redirects should be deleted (or
marked for deletion if the account has no admin rights) instead
-   of just skipping them.
+   of just skipping them. Also delete redirect loops if double
+   redirects action is selected.
 
 -alwaysDon't prompt you for each replacement.
 
@@ -71,7 +72,7 @@
 #
 # (C) Daniel Herding, 2004
 # (C) Purodha Blissenbach, 2009
-# (C) xqt, 2009-2015
+# (C) xqt, 2009-2016
 # (C) Pywikibot team, 2004-2015
 #
 # Distributed under the terms of the MIT license.
@@ -396,6 +397,31 @@
 self.generator = generator
 self.exiting = False
 
+def delete_redirect(self, page, summary_key):
+"""Delete the redirect page."""
+reason = i18n.twtranslate(self.site, summary_key)
+if self.site.logged_in(sysop=True):
+page.delete(reason, prompt=False)
+else:
+assert page.site == self.site, (
+'target page is on different site %s' % page.site)
+if i18n.twhas_key(page.site, 'redirect-broken-redirect-template'):
+pywikibot.output(
+'No sysop in user-config.py, put page to speedy deletion.')
+content = page.get(get_redirect=True)
+content = i18n.twtranslate(
+page.site,
+'redirect-broken-redirect-template') + '\n' + content
+# TODO: Add bot's signature if needed
+#   Not supported via TW yet
+try:
+page.put(content, reason)
+except pywikibot.PageSaveRelatedError as e:
+pywikibot.error(e)
+# redir.put(content, summ)
+else:
+pywikibot.output('No speedy deletion template available')
+
 def delete_broken_redirects(self):
 # get reason for deletion text
 for redir_name in self.generator.retrieve_broken_redirects():
@@ -480,32 +506,7 @@
 u'Do you want to delete %s?'
 % (targetPage.title(asLink=True),
redir_page.title(asLink=True))):
-reason = i18n.twtranslate(self.site,
-  'redirect-remove-broken')
-if self.site.logged_in(sysop=True):
-redir_page.delete(reason, prompt=False)
-else:
-assert targetPage.site == self.site, (
-u'target page is on different site %s'
-% targetPage.site)
-if i18n.twhas_key(self.site,
-  'redirect-broken-redirect-template'):
-pywikibot.output(u"No sysop in user-config.py, "
- u"put page to speedy deletion.")
-content = redir_page.get(get_redirect=True)
-# TODO: Add bot's signature if needed
-#   Not supported via TW yet
-content = i18n.twtranslate(
-targetPage.site,
-'redirect-broken-redirect-template'
-) + "\n" + content
-try:
-redir_page.put(content, reason)
-except pywikibot.PageSaveRelatedError as e:
-pywikibot.error(e)
-else:
-pywikibot.output(
-u'No speedy deletion template available')
+delete_redirect(redir_page, 'redirect-remove-broken')
 elif not (self.getOption('delete') or movedTarget):
 pywikibot.output(u'Cannot fix or delete the broken 
redirect')
 except pywikibot.IsRedirectPage:
@@ -562,7 +563,10 @@
 except (pywikibot.CircularRedirect,
 pywikibot.InterwikiRedirectPage) as e:
 pywikibot.exception(e)
-

[MediaWiki-commits] [Gerrit] interwiki cleanup - change (pywikibot/core)

2016-02-18 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271742

Change subject: interwiki cleanup
..

interwiki cleanup

interlanguage links are hold by wikidata. interwiki_putfirst dictionary is
not used anymore for most of mw sites and it's content is outdated since more
than 4 years.

Change-Id: I79ccd6b82f341b424cb7d7b43a642d1b62ff0ca9
---
M pywikibot/families/wikibooks_family.py
M pywikibot/families/wikinews_family.py
M pywikibot/families/wikipedia_family.py
M pywikibot/families/wikiquote_family.py
M pywikibot/families/wikisource_family.py
5 files changed, 0 insertions(+), 131 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/42/271742/1

diff --git a/pywikibot/families/wikibooks_family.py 
b/pywikibot/families/wikibooks_family.py
index b2972ae..4b9ac23 100644
--- a/pywikibot/families/wikibooks_family.py
+++ b/pywikibot/families/wikibooks_family.py
@@ -126,22 +126,6 @@
 'af', 'ang', 'ca', 'fa', 'fy', 'it', 'nl', 'ru', 'th', 'zh',
 ]
 
-# Which languages have a special order for putting interlanguage links,
-# and what order is it? If a language is not in interwiki_putfirst,
-# alphabetical order on language code is used. For languages that are 
in
-# interwiki_putfirst, interwiki_putfirst is checked first, and
-# languages are put in the order given there. All other languages are
-# put after those, in code-alphabetical order.
-self.interwiki_putfirst = {
-'en': self.alphabetic,
-'fi': self.alphabetic,
-'fr': self.alphabetic,
-'he': ['en'],
-'hu': ['en'],
-'pl': self.alphabetic,
-'simple': self.alphabetic
-}
-
 # Subpages for documentation.
 # TODO: List is incomplete, to be completed for missing languages.
 self.doc_subpages = {
diff --git a/pywikibot/families/wikinews_family.py 
b/pywikibot/families/wikinews_family.py
index a80743a..e6a94d6 100644
--- a/pywikibot/families/wikinews_family.py
+++ b/pywikibot/families/wikinews_family.py
@@ -39,20 +39,5 @@
 # 
https://meta.wikimedia.org/wiki/Bot_policy/Implementation#Current_implementation
 self.cross_allowed = ['ca', 'cs', 'en', 'fa', 'ko', ]
 
-# Which languages have a special order for putting interlanguage links,
-# and what order is it? If a language is not in interwiki_putfirst,
-# alphabetical order on language code is used. For languages that are 
in
-# interwiki_putfirst, interwiki_putfirst is checked first, and
-# languages are put in the order given there. All other languages are
-# put after those, in code-alphabetical order.
-self.interwiki_putfirst = {
-'en': self.alphabetic,
-'fi': self.alphabetic,
-'fr': self.alphabetic,
-'he': ['en'],
-'hu': ['en'],
-'pl': self.alphabetic,
-}
-
 # TODO:
 # Change site_tests.py when wikinews will have doc_subpage.
diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index 576b5d6..6c11b45 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -288,73 +288,6 @@
 # but some languages don't use this.
 self.nocapitalize = ['jbo']
 
-# Which languages have a special order for putting interlanguage links,
-# and what order is it? If a language is not in interwiki_putfirst,
-# alphabetical order on language code is used. For languages that are 
in
-# interwiki_putfirst, interwiki_putfirst is checked first, and
-# languages are put in the order given there. All other languages are
-# put after those, in code-alphabetical order.
-
-self.alphabetic_sr = [
-'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab', 'ar', 'an',
-'arc', 'roa-rup', 'frp', 'arz', 'as', 'ast', 'gn', 'av', 'ay', 
'az',
-'bjn', 'id', 'ms', 'bg', 'bm', 'zh-min-nan', 'nan', 'map-bms', 
'jv',
-'su', 'ba', 'be', 'be-tarask', 'bh', 'bcl', 'bi', 'bn', 'bo', 
'bar',
-'bs', 'bpy', 'br', 'bug', 'bxr', 'ca', 'ceb', 'ch', 'cbk-zam', 
'sn',
-'tum', 'ny', 'cho', 'chr', 'co', 'cy', 'cv', 'cs', 'da', 'dk',
-'pdc', 'de', 'nv', 'dsb', 'na', 'dv', 'dz', 'mh', 'et', 'el', 
'eml',
-'en', 'myv', 'es', 'eo', 'ext', 'eu', 'ee', 'fa', 'hif', 'fo', 
'fr',
-'fy', 'ff', 'fur', 'ga', 'gv', 'sm', 'gag', 'gd', 'gl', 'gan', 
'ki',
-'glk', 'got', 'gu', 'ha', 'hak', 'xal', 'haw', 'he', 'hi', 'ho',
-'hsb', 'hr', 'hy', 'io', 'ig', 'ii', 'ilo', 'ia', 'ie', 'iu', 'ik',
-'os', 'xh', 'zu', 'is', 'it', 'ja', 'ka', 'kl', 'kr', 'pam', 'krc',
-'csb', 'kk', 'kw', 'rw', 'ky', 'mrj', 'rn', 'sw', 'km', 

[MediaWiki-commits] [Gerrit] Block "wbcreateredirect" action when -simulate option is given - change (pywikibot/core)

2016-02-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270698

Change subject: Block "wbcreateredirect" action when -simulate option is given
..

Block "wbcreateredirect" action when -simulate option is given

Bug: T126958
Change-Id: Ida658235189cb0ecc3f13ebee32214e2db0d1134
---
M pywikibot/data/api.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/98/270698/1

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c6f2f0c..0881e62 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1438,6 +1438,7 @@
 "wbsetaliases", "wblinktitles", "wbsetsitelink",
 "wbcreateclaim", "wbremoveclaims", "wbsetclaimvalue",
 "wbsetreference", "wbremovereferences", "wbsetclaim",
+'wbcreateredirect',
 )
 # Client side verification that the request is being performed
 # by a logged in user, and warn if it isn't a config username.

-- 
To view, visit https://gerrit.wikimedia.org/r/270698
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida658235189cb0ecc3f13ebee32214e2db0d1134
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Confirm whether dictionary already has entries. - change (pywikibot/core)

2016-02-14 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270589

Change subject: Confirm whether dictionary already has entries.
..

Confirm whether dictionary already has entries.

Change-Id: Ib31e750f240776df150387a78ca6dfb9e9dfc648
---
M scripts/maintenance/make_i18n_dict.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/89/270589/1

diff --git a/scripts/maintenance/make_i18n_dict.py 
b/scripts/maintenance/make_i18n_dict.py
index 2025bbc..16edd6a 100755
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -67,6 +67,10 @@
 
 def print_all(self):
 """Pretty print the dict as a file content to screen."""
+if not self.dict:
+print('No messages found, read them first.\n'
+  'Use "run" or "to_json" methods')
+return
 keys = list(self.dict.keys())
 keys.remove('qqq')
 keys.sort()

-- 
To view, visit https://gerrit.wikimedia.org/r/270589
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib31e750f240776df150387a78ca6dfb9e9dfc648
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Explain sort_ignore_case setting - change (pywikibot/core)

2016-02-14 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270592

Change subject: Explain sort_ignore_case setting
..

Explain sort_ignore_case setting

Change-Id: I53c84a5517892344a507b433d387b7361dd44681
---
M pywikibot/config2.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/92/270592/1

diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 8bad32c..0c7cd50 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -564,6 +564,7 @@
 # disambiguation_comment['wikipedia']['en'] = \
 #"Robot-assisted disambiguation ([[WP:DPL|you can help!]]): %s"
 
+# Sorting order for alternatives. Set to True to ignore case for sorting order.
 sort_ignore_case = False
 
 # # IMAGE RELATED SETTINGS ##

-- 
To view, visit https://gerrit.wikimedia.org/r/270592
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53c84a5517892344a507b433d387b7361dd44681
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Workarround for overwrite conflict. - change (pywikibot...xqbot)

2016-02-14 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: Workarround for overwrite conflict.
..


Workarround for overwrite conflict.

bug: T93364
Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
---
M checkvotes.py
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/checkvotes.py b/checkvotes.py
index 5c7c09f..6404e4c 100644
--- a/checkvotes.py
+++ b/checkvotes.py
@@ -516,8 +516,8 @@
 def load(self, page):
 """Load the given page, does some changes, and save it."""
 try:
-# Load the page
-text = page.get()
+# Load the preloaded page
+page.get()
 except pywikibot.NoPage:
 pywikibot.output('\nPage %s does not exist; skipping.'
  % page.title(asLink=True))
@@ -525,6 +525,8 @@
 pywikibot.output('\nPage %s is a redirect; skipping.'
  % page.title(asLink=True))
 else:
+# page.getRestrictions() may delete the content
+# if revision ID has been changed (bug: T93364)
 restrictions = page.getRestrictions()  # TODO: für Prüfung hier 
ausschließen
 if restrictions:
 if 'edit' in restrictions and restrictions['edit']:
@@ -532,7 +534,8 @@
 pywikibot.output('\nPage %s is locked; skipping.'
  % page.title(asLink=True))
 return
-return text
+# return the text - may be reloaded after getRestrictions()
+return page.text
 
 def save(self, text, page, comment, minorEdit=True, botflag=True):
 # only save if something was changed

-- 
To view, visit https://gerrit.wikimedia.org/r/270598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Workarround for overwrite conflict. - change (pywikibot...xqbot)

2016-02-14 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270598

Change subject: Workarround for overwrite conflict.
..

Workarround for overwrite conflict.

bug: T793364
Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
---
M checkvotes.py
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/98/270598/1

diff --git a/checkvotes.py b/checkvotes.py
index 5c7c09f..6404e4c 100644
--- a/checkvotes.py
+++ b/checkvotes.py
@@ -516,8 +516,8 @@
 def load(self, page):
 """Load the given page, does some changes, and save it."""
 try:
-# Load the page
-text = page.get()
+# Load the preloaded page
+page.get()
 except pywikibot.NoPage:
 pywikibot.output('\nPage %s does not exist; skipping.'
  % page.title(asLink=True))
@@ -525,6 +525,8 @@
 pywikibot.output('\nPage %s is a redirect; skipping.'
  % page.title(asLink=True))
 else:
+# page.getRestrictions() may delete the content
+# if revision ID has been changed (bug: T93364)
 restrictions = page.getRestrictions()  # TODO: für Prüfung hier 
ausschließen
 if restrictions:
 if 'edit' in restrictions and restrictions['edit']:
@@ -532,7 +534,8 @@
 pywikibot.output('\nPage %s is locked; skipping.'
  % page.title(asLink=True))
 return
-return text
+# return the text - may be reloaded after getRestrictions()
+return page.text
 
 def save(self, text, page, comment, minorEdit=True, botflag=True):
 # only save if something was changed

-- 
To view, visit https://gerrit.wikimedia.org/r/270598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I485d9fab83f6e9daec7ca38e8573eca5e37fd1cc
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Provide a private user script path to be used by pwb.py - change (pywikibot/core)

2016-02-14 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270577

Change subject: [IMPR] Provide a private user script path to be used by pwb.py
..

[IMPR] Provide a private user script path to be used by pwb.py

A privat script path must be located inside the framework folder.
The user_script_path will searched first.

Change-Id: I3191a91b32c15cb69b77e3d0c9ccfd402cc3f948
---
M pwb.py
M pywikibot/config2.py
2 files changed, 27 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/77/270577/1

diff --git a/pwb.py b/pwb.py
index 68bb796..06c08b4 100755
--- a/pwb.py
+++ b/pwb.py
@@ -198,16 +198,23 @@
 def main():
 """Command line entry point."""
 global filename
-if filename:
+if not filename:
+return
+else:
 file_package = None
 tryimport_pwb()
 argvu = pwb.argvu[1:]
 if not filename.endswith('.py'):
 filename += '.py'
 if not os.path.exists(filename):
-for file_package in ('scripts',
- 'scripts.maintenance',
- 'scripts.archive'):
+from pywikibot import config  # noqa
+script_paths = ['scripts',
+'scripts.maintenance',
+'scripts.archive']
+if config.user_script_paths and isinstance(
+config.user_script_paths, list):
+script_paths = config.user_script_paths + script_paths
+for file_package in script_paths:
 paths = file_package.split('.') + [filename]
 testpath = os.path.join(_pwb_dir, *paths)
 if os.path.exists(testpath):
@@ -243,8 +250,6 @@
 
 run_python_file(filename, [filename] + args, argvu, file_package)
 return True
-else:
-return False
 
 if __name__ == '__main__':
 if not main():
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 9b73444..768bcd4 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -506,6 +506,22 @@
 # (overrides log setting above)
 debug_log = []
 
+# # EXTERNAL SCRIPT PATH SETTING ##
+# set your own script path to lookup for your script files.
+# your privat script path must be located inside the
+# framework folder, subfolders must be delimited by '.'.
+# every folder must contain an (empty) __init__.py file.
+#
+# The search order is
+# 1. user_script_paths in the given order
+# 2. scripts
+# 3. scripts/maintenance
+# 4. scripts/archive
+#
+# sample:
+# user_script_paths = ['scripts.myscripts']
+user_script_paths = []
+
 # # INTERWIKI SETTINGS ##
 
 # Should interwiki.py report warnings for missing links between foreign

-- 
To view, visit https://gerrit.wikimedia.org/r/270577
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3191a91b32c15cb69b77e3d0c9ccfd402cc3f948
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Restrictions of python versions - change (pywikibot/core)

2016-02-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270475

Change subject: Restrictions of python versions
..

Restrictions of python versions

see https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation

Change-Id: I24be80c696ea9790df70bffc4f7b6d54946c0898
---
M docs/index.rst
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/75/270475/1

diff --git a/docs/index.rst b/docs/index.rst
index 81e7ad6..c9e3763 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -12,7 +12,7 @@
 
 Pywikibot is a full-stack framework for editing `MediaWiki 
`_ wiki's. (more intro)
 
-Pywikibot supports Python 2.6.5, 2.7 and 3.2+.
+Pywikibot supports Python 2.6.5+, 2.7.2+ and 3.3+.
 
 Pywikibot and this documentation are licensed under the :ref:`MIT license 
`;
 manual pages on mediawiki.org are licensed under the `CC-BY-SA 3.0`_ license.

-- 
To view, visit https://gerrit.wikimedia.org/r/270475
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24be80c696ea9790df70bffc4f7b6d54946c0898
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Improve epydoc formatting - change (pywikibot/core)

2016-02-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270477

Change subject: Improve epydoc formatting
..

Improve epydoc formatting

Change-Id: I888e606054a0afec65f9ada8f997e7bb18376b0e
---
M scripts/maintenance/make_i18n_dict.py
1 file changed, 9 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/77/270477/1

diff --git a/scripts/maintenance/make_i18n_dict.py 
b/scripts/maintenance/make_i18n_dict.py
index 2283bdf..81d80ea 100755
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -5,29 +5,34 @@
 
 usage:
 
-run IDLE at topmost level
+run IDLE at topmost level:
+
 >>> import pwb
 >>> from scripts.maintenance.make_i18n_dict import i18nBot
 >>> bot = i18nBot('', '')
 >>> bot.run()
 
 If you have more than one message dictionary, give all these names to the bot:
+
 >>> bot = i18nBot('', '', '', '')
 
 If you want to rename the message index use keyword arguments. This may be
 mixed with preleading positonal argumens:
+
 >>> bot = i18nBot('', '', the_other_msg='')
 
 If you have the messages as instance constants you may call the bot as follows:
+
 >>> bot = i18nBot('.', '', '>> dict2>')
 
 It's also possible to make json files too by using to_json method after
-instantiating the bot. It also calls bot.run() to create the dictionaries.
+instantiating the bot. It also calls C{bot.run()} to create the dictionaries:
+
 >>> bot.to_json()
 """
 #
-# (C) xqt, 2013-2015
-# (C) Pywikibot team, 2013-2015
+# (C) xqt, 2013-2016
+# (C) Pywikibot team, 2013-2016
 #
 # Distributed under the terms of the MIT license.
 #

-- 
To view, visit https://gerrit.wikimedia.org/r/270477
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I888e606054a0afec65f9ada8f997e7bb18376b0e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] update CREDITS - change (pywikibot/core)

2016-02-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270480

Change subject: update CREDITS
..

update CREDITS

git log --pretty=format:"%an%x09" | sort | uniq

Change-Id: Ic66c828e7406e443e395284165b157780858ec6e
---
M CREDITS
1 file changed, 82 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/80/270480/1

diff --git a/CREDITS b/CREDITS
index 93af68e..6e8c618 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2,81 +2,163 @@
 contributions. We would therefore like to thank everyone who has
 contributed:
 
+Aaron Hill
+adiyetichaves
 Ævar Arnfjörð Bjarmason
+akashagarwal
+AkshitKumar
 Alex Shih-Han Lin
+Alexander Jones
+Alexander Shtyrov
+Allen Guo
 Amir Sarabadani
+André Costa
 Andre Engels
 André Malafaya Baptista
+Andrei Cipu
+Andrew Harris
+Anirudh GP
+Anshoe
 Antoine Musso
 Anton
+Avicennasis
 balasyum
 bananeweizen
+Bartosz Dziewoński
+bep
+Benjamín Valero Espinosa
+Betacommand
 Bináris
 borgo
 Brion Vibber
 Bryan Tong Minh
+CodeCat
 Christian List
 Cyde Weys
+dalba
+Dan Miachel O. Heggø
 Daniel Friesen
 Daniel Herding
+darkoneko
+daviskr
+David Wood
+dennisroczek
 DMaggot
+Dmytro Dziuma
 DrTrigon
+Ebrahim Byagowi
 Egon
 Eranroz
 Erwin
 Fabian Neundorf
+Federico Leva
 Felix Reimann
 Filnik
 Francesco Cosoleto
+Gallaecio
+Geoffrey Mon
+georggi
 Gerard Meijssen
 Gerrit Holl
+gladoscc
+grunny
 Hazard-SJ
 Huji
+Inductiveload
+James Michael DuPont
+Jamison Lofthouse
+Jan Zerebecki
+Jared
 jeedo
+jeroendedauw
+Jesús Martínez Novo
 Jeroen de Dauw
 Jitse Niesen
 John Vandenberg
 Jon Harald Søby
 Jo Simoens
+Justin Du
 Karl Eichwalder
+kenrick95
 Kim Bruning
 Kunal Mehta
+Kyle
+Legoktm
 Leonardo Gregianin
 Lewis Cawte
 Linedwell
+m4tx
 Maarten Dammers
 Marcin Cieslak
 Matanya
+marineznovo
+maurelio
+Maverick
+mayankmadan
 Maxim Razin
+mehtab98
 Meno25
 Merlijn van Deen
+mhutti1
 Misza13
+mjbmr
+mloc-gci
 Mohamed Magdy
 Mpaa
+murfel
 Nicolas Dumazet
+Nikiwiki
 notconfusing
+Nullzero
+opensourceware
+pere prlpz
 Philip Tzou
+pietrodn
 Platonides
+Priyanka
 Purodha B Blissenbach
+Pyfisch
+Reza
+RichardL
 ricordisamoa
 Rik Wade
 Robert Leverington
 Rob W.W. Hooft
 Rotem Liss
 Russell Blau
+Serio Santoro
 Scot Wilcoxon
+Shardul C
 Shinjiman
 Shi Zhao
 Siebrand Mazeland
+Sn1per
 Sorawee Porncharoenwase
+SpyTec
+Stanislav Malyshev
+Stefan Oderbolz
 Steve Sanbeg
+Strainu
 Sumana Harihareswara
+Tacsipacsi
+theopolisme
 Thomas R. Koll
 ThomasV
+Timo Tijhof
+Tony Thomas
 Toto Azéro
+Vadiraja K
+VcamX
 Victor Vasiliev
+Vldandrew
+Vojtech Jelinek
 Warddr
 Wieland Hoffmann
 WikiWichtel
+withoutaname
 xqt
+Yongmin Hong
 Yuri Astrakhan
+Yusuke Matsubara
+Zaher Kadour
+zhuyifei1999
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/270480
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic66c828e7406e443e395284165b157780858ec6e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] use common __main__ script handling - change (pywikibot/core)

2016-02-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270469

Change subject: use common __main__ script handling
..

use common __main__ script handling

Change-Id: I937793bc839f7a045e3694f0d16210f216b950b5
---
M scripts/version.py
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/69/270469/1

diff --git a/scripts/version.py b/scripts/version.py
index dbb1dd4..b76450c 100755
--- a/scripts/version.py
+++ b/scripts/version.py
@@ -3,8 +3,8 @@
 """Script to determine the Pywikibot version (tag, revision and date)."""
 #
 # (C) Merlijn 'valhallasw' van Deen, 2007-2008
-# (C) xqt, 2010-2014
-# (C) Pywikibot team, 2007-2014
+# (C) xqt, 2010-2016
+# (C) Pywikibot team, 2007-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -40,7 +40,8 @@
 pywikibot.output('{0}: {1}'.format(environ_name, 
os.environ.get(environ_name, 'Not set')))
 
 
-if __name__ == '__main__':
+def main(*args):
+"""Print pywikibot version and important settings."""
 pywikibot.output('Pywikibot: %s' % getversion())
 pywikibot.output('Release version: %s' % pywikibot.__release__)
 pywikibot.output('requests version: %s' % requests.__version__)
@@ -81,3 +82,6 @@
 elif sysop_name == username:
 sysop_name = 'also sysop'
 pywikibot.output('\t{0}: {1} ({2})'.format(lang, username, 
sysop_name))
+
+if __name__ == '__main__':
+main()

-- 
To view, visit https://gerrit.wikimedia.org/r/270469
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I937793bc839f7a045e3694f0d16210f216b950b5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] use wikistats lib to update languages_by_size - change (pywikibot/core)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270269

Change subject: [IMPR] use wikistats lib to update languages_by_size
..

[IMPR] use wikistats lib to update languages_by_size

Change-Id: Iad218316ccd439c38106a1def29c2284c68356f1
---
M scripts/maintenance/wikimedia_sites.py
1 file changed, 9 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/69/270269/1

diff --git a/scripts/maintenance/wikimedia_sites.py 
b/scripts/maintenance/wikimedia_sites.py
index 8f0fcc6..fa096ba 100755
--- a/scripts/maintenance/wikimedia_sites.py
+++ b/scripts/maintenance/wikimedia_sites.py
@@ -2,8 +2,8 @@
 # -*- coding: utf-8  -*-
 """Script that updates the language lists in Wikimedia family files."""
 #
-# (C) xqt, 2009-2014
-# (C) Pywikibot team, 2008-2014
+# (C) xqt, 2009-2016
+# (C) Pywikibot team, 2008-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -16,10 +16,9 @@
 import re
 import sys
 
-from xml.etree import cElementTree
-
 import pywikibot
 
+from pywikibot.data import wikistats
 from pywikibot.family import Family
 
 if sys.version_info[0] > 2:
@@ -51,16 +50,12 @@
 original = Family.load(family).languages_by_size
 obsolete = Family.load(family).obsolete
 
-feed = urlopen(URL % familiesDict[family])
-tree = cElementTree.parse(feed)
-
 new = []
-for field in tree.findall('row/field'):
-if field.get('name') == 'prefix':
-code = field.text
-if not (code in obsolete or code in exceptions):
-new.append(code)
-continue
+ws = wikistats.WikiStats()
+table = ws.languages_by_size(family)
+for code in table:
+if not (code in obsolete or code in exceptions):
+new.append(code)
 
 # put the missing languages to the right place
 missing = original != new and set(original) - set(new)
@@ -104,7 +99,7 @@
 
 if __name__ == '__main__':
 fam = []
-for arg in pywikibot.handleArgs():
+for arg in pywikibot.handle_args():
 if arg in familiesDict.keys() and arg not in fam:
 fam.append(arg)
 update_family(fam)

-- 
To view, visit https://gerrit.wikimedia.org/r/270269
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad218316ccd439c38106a1def29c2284c68356f1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update languages_by_size from core - change (pywikibot/compat)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270272

Change subject: Update languages_by_size from core
..

Update languages_by_size from core

Change-Id: I469fe784520511d40298cdb74449602756d40b7d
---
M families/wikipedia_family.py
M families/wikiquote_family.py
M families/wikisource_family.py
M families/wiktionary_family.py
4 files changed, 21 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/72/270272/1

diff --git a/families/wikipedia_family.py b/families/wikipedia_family.py
index aee512a..1624a46 100644
--- a/families/wikipedia_family.py
+++ b/families/wikipedia_family.py
@@ -21,30 +21,30 @@
 'vi', 'ja', 'pt', 'zh', 'uk', 'ca', 'fa', 'no', 'sh', 'ar', 'fi',
 'hu', 'id', 'ro', 'cs', 'ko', 'sr', 'ms', 'tr', 'eu', 'eo', 'min',
 'da', 'kk', 'bg', 'sk', 'hy', 'he', 'lt', 'hr', 'sl', 'et', 'uz',
-'gl', 'nn', 'la', 'zh-min-nan', 'vo', 'ce', 'simple', 'el', 'be',
+'gl', 'zh-min-nan', 'nn', 'la', 'vo', 'ce', 'simple', 'el', 'be',
 'ka', 'az', 'ur', 'hi', 'th', 'oc', 'mk', 'ta', 'mg', 'new', 'cy',
 'tt', 'bs', 'lv', 'te', 'tl', 'pms', 'be-tarask', 'br', 'ky', 'ht',
-'sq', 'jv', 'ast', 'lb', 'mr', 'zh-yue', 'ml', 'bn', 'tg', 'is',
-'pnb', 'af', 'ga', 'sco', 'ba', 'cv', 'fy', 'lmo', 'my', 'sw', 
'an',
+'sq', 'jv', 'ast', 'lb', 'mr', 'zh-yue', 'ml', 'bn', 'tg', 'pnb',
+'is', 'af', 'ga', 'sco', 'ba', 'cv', 'fy', 'lmo', 'my', 'sw', 'an',
 'yo', 'ne', 'io', 'gu', 'scn', 'bpy', 'nds', 'ku', 'pa', 'als',
 'kn', 'qu', 'ia', 'su', 'bar', 'ckb', 'mn', 'arz', 'bat-smg', 
'nap',
 'bug', 'wa', 'gd', 'yi', 'am', 'map-bms', 'mzn', 'fo', 'si', 'nah',
-'li', 'sah', 'vec', 'hsb', 'or', 'os', 'mrj', 'sa', 'roa-tara',
-'mhr', 'pam', 'azb', 'ilo', 'se', 'mi', 'ps', 'bcl', 'hif', 'eml',
-'gan', 'hak', 'diq', 'bh', 'glk', 'vls', 'nds-nl', 'rue', 'bo',
-'xmf', 'fiu-vro', 'co', 'sc', 'tk', 'vep', 'lrc', 'csb', 'sd', 
'gv',
-'km', 'crh', 'kv', 'szl', 'wuu', 'frr', 'zea', 'zh-classical', 
'as',
-'so', 'stq', 'udm', 'ay', 'kw', 'cdo', 'nrm', 'koi', 'lad', 'rm',
-'ie', 'mt', 'fur', 'pcd', 'gn', 'lij', 'dsb', 'dv', 'cbk-zam',
+'li', 'vec', 'sah', 'hsb', 'or', 'os', 'mrj', 'sa', 'mhr',
+'roa-tara', 'pam', 'azb', 'ilo', 'se', 'mi', 'ps', 'bcl', 'hif',
+'eml', 'gan', 'hak', 'diq', 'bh', 'glk', 'vls', 'nds-nl', 'rue',
+'bo', 'xmf', 'fiu-vro', 'co', 'sc', 'tk', 'vep', 'lrc', 'csb', 
'sd',
+'gv', 'km', 'crh', 'szl', 'kv', 'wuu', 'frr', 'zea', 
'zh-classical',
+'as', 'so', 'stq', 'udm', 'ay', 'kw', 'cdo', 'nrm', 'koi', 'lad',
+'ie', 'rm', 'mt', 'fur', 'pcd', 'gn', 'dsb', 'lij', 'dv', 
'cbk-zam',
 'myv', 'nso', 'ksh', 'ext', 'ang', 'gag', 'mwl', 'lez', 'ace', 
'ug',
 'kab', 'pi', 'pag', 'nv', 'sn', 'frp', 'av', 'ln', 'pfl', 'haw',
-'xal', 'krc', 'gom', 'kaa', 'mai', 'rw', 'pdc', 'to', 'bxr', 'kl',
+'xal', 'krc', 'gom', 'mai', 'kaa', 'rw', 'pdc', 'to', 'bxr', 'kl',
 'nov', 'arc', 'kbd', 'bjn', 'lo', 'ha', 'tet', 'pap', 'tpi', 'tyv',
-'na', 'lbe', 'jbo', 'roa-rup', 'mdf', 'ty', 'kg', 'za', 'ig', 'wo',
+'na', 'lbe', 'jbo', 'roa-rup', 'ty', 'mdf', 'kg', 'za', 'ig', 'wo',
 'srn', 'ki', 'ab', 'ltg', 'zu', 'lg', 'om', 'rmy', 'chy', 'cu',
 'tw', 'tn', 'chr', 'rn', 'bi', 'pih', 'xh', 'tum', 'got', 'sm',
 'ss', 'pnt', 'ch', 'bm', 'iu', 'ee', 'st', 'ts', 'ks', 'fj', 'ak',
-'sg', 'ik', 've', 'ff', 'ti', 'ny', 'dz', 'cr',
+'sg', 'ik', 've', 'ff', 'ny', 'ti', 'dz', 'cr',
 ]
 
 self.langs = dict([(lang, '%s.wikipedia.org' % lang)
diff --git a/families/wikiquote_family.py b/families/wikiquote_family.py
index 543f076..9d48df4 100644
--- a/families/wikiquote_family.py
+++ b/families/wikiquote_family.py
@@ -21,8 +21,8 @@
 'bs', 'uk', 'tr', 'lt', 'bg', 'he', 'ca', 'sl', 'eo', 'el', 'nn',
 'id', 'zh', 'hr', 'hy', 'th', 'hu', 'li', 'nl', 'su', 'ko', 'ja',
 'sv', 'ur', 'te', 'ar', 'fi', 'cy', 'az', 'la', 'no', 'gl', 'ml',
-'et', 'ku', 'kn', 'sr', 'eu', 'ro', 'ta', 'ka', 'sa', 'da', 'is',
-'vi', 'be', 'hi', 'sq', 'gu', 'mr', 'br', 'uz', 'af', 'zh-min-nan',
+'et', 'ku', 'kn', 'sr', 'eu', 'ro', 'ta', 'ka', 'da', 'sa', 'is',
+'gu', 'vi', 'be', 'hi', 'sq', 'mr', 'br', 'uz', 'af', 'zh-min-nan',
 'am', 'wo', 'ky',
 ]
 
diff --git a/families/wikisource_family.py b/families/wikisource_family.py
index 498b62a..cfd5390 100644
--- a/families/wikisource_family.py
+++ b/families/wikisource_family.py
@@ -18,9 +18,9 @@
 

[MediaWiki-commits] [Gerrit] Update languages_by_size - change (pywikibot/core)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270268

Change subject: Update languages_by_size
..

Update languages_by_size

Change-Id: I4faa53dfa261dc8656d7f92d2e40c21dd39b7a86
---
M pywikibot/families/wikipedia_family.py
M pywikibot/families/wikiquote_family.py
M pywikibot/families/wikisource_family.py
M pywikibot/families/wiktionary_family.py
4 files changed, 22 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/68/270268/1

diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index b8a1801..6d8eb43 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -55,30 +55,30 @@
 'vi', 'ja', 'pt', 'zh', 'uk', 'ca', 'fa', 'no', 'sh', 'ar', 'fi',
 'hu', 'id', 'ro', 'cs', 'ko', 'sr', 'ms', 'tr', 'eu', 'eo', 'min',
 'da', 'kk', 'bg', 'sk', 'hy', 'he', 'lt', 'hr', 'sl', 'et', 'uz',
-'gl', 'nn', 'la', 'zh-min-nan', 'vo', 'ce', 'simple', 'el', 'be',
+'gl', 'zh-min-nan', 'nn', 'la', 'vo', 'ce', 'simple', 'el', 'be',
 'ka', 'az', 'ur', 'hi', 'th', 'oc', 'mk', 'ta', 'mg', 'new', 'cy',
 'tt', 'bs', 'lv', 'te', 'tl', 'pms', 'be-tarask', 'br', 'ky', 'ht',
-'sq', 'jv', 'ast', 'lb', 'mr', 'zh-yue', 'ml', 'bn', 'tg', 'is',
-'pnb', 'af', 'ga', 'sco', 'ba', 'cv', 'fy', 'lmo', 'my', 'sw', 
'an',
+'sq', 'jv', 'ast', 'lb', 'mr', 'zh-yue', 'ml', 'bn', 'tg', 'pnb',
+'is', 'af', 'ga', 'sco', 'ba', 'cv', 'fy', 'lmo', 'my', 'sw', 'an',
 'yo', 'ne', 'io', 'gu', 'scn', 'bpy', 'nds', 'ku', 'pa', 'als',
 'kn', 'qu', 'ia', 'su', 'bar', 'ckb', 'mn', 'arz', 'bat-smg', 
'nap',
 'bug', 'wa', 'gd', 'yi', 'am', 'map-bms', 'mzn', 'fo', 'si', 'nah',
-'li', 'sah', 'vec', 'hsb', 'or', 'os', 'mrj', 'sa', 'roa-tara',
-'mhr', 'pam', 'azb', 'ilo', 'se', 'mi', 'ps', 'bcl', 'hif', 'eml',
-'gan', 'hak', 'diq', 'bh', 'glk', 'vls', 'nds-nl', 'rue', 'bo',
-'xmf', 'fiu-vro', 'co', 'sc', 'tk', 'vep', 'lrc', 'csb', 'sd', 
'gv',
-'km', 'crh', 'kv', 'szl', 'wuu', 'frr', 'zea', 'zh-classical', 
'as',
-'so', 'stq', 'udm', 'ay', 'kw', 'cdo', 'nrm', 'koi', 'lad', 'rm',
-'ie', 'mt', 'fur', 'pcd', 'gn', 'lij', 'dsb', 'dv', 'cbk-zam',
+'li', 'vec', 'sah', 'hsb', 'or', 'os', 'mrj', 'sa', 'mhr',
+'roa-tara', 'pam', 'azb', 'ilo', 'se', 'mi', 'ps', 'bcl', 'hif',
+'eml', 'gan', 'hak', 'diq', 'bh', 'glk', 'vls', 'nds-nl', 'rue',
+'bo', 'xmf', 'fiu-vro', 'co', 'sc', 'tk', 'vep', 'lrc', 'csb', 
'sd',
+'gv', 'km', 'crh', 'szl', 'kv', 'wuu', 'frr', 'zea', 
'zh-classical',
+'as', 'so', 'stq', 'udm', 'ay', 'kw', 'cdo', 'nrm', 'koi', 'lad',
+'ie', 'rm', 'mt', 'fur', 'pcd', 'gn', 'dsb', 'lij', 'dv', 
'cbk-zam',
 'myv', 'nso', 'ksh', 'ext', 'ang', 'gag', 'mwl', 'lez', 'ace', 
'ug',
 'kab', 'pi', 'pag', 'nv', 'sn', 'frp', 'av', 'ln', 'pfl', 'haw',
-'xal', 'krc', 'gom', 'kaa', 'mai', 'rw', 'pdc', 'to', 'bxr', 'kl',
+'xal', 'krc', 'gom', 'mai', 'kaa', 'rw', 'pdc', 'to', 'bxr', 'kl',
 'nov', 'arc', 'kbd', 'bjn', 'lo', 'ha', 'tet', 'pap', 'tpi', 'tyv',
-'na', 'lbe', 'jbo', 'roa-rup', 'mdf', 'ty', 'kg', 'za', 'ig', 'wo',
+'na', 'lbe', 'jbo', 'roa-rup', 'ty', 'mdf', 'kg', 'za', 'ig', 'wo',
 'srn', 'ki', 'ab', 'ltg', 'zu', 'lg', 'om', 'rmy', 'chy', 'cu',
 'tw', 'tn', 'chr', 'rn', 'bi', 'pih', 'xh', 'tum', 'got', 'sm',
 'ss', 'pnt', 'ch', 'bm', 'iu', 'ee', 'st', 'ts', 'ks', 'fj', 'ak',
-'sg', 'ik', 've', 'ff', 'ti', 'ny', 'dz', 'cr',
+'sg', 'ik', 've', 'ff', 'ny', 'ti', 'dz', 'cr',
 ]
 
 # Sites we want to edit but not count as real languages
diff --git a/pywikibot/families/wikiquote_family.py 
b/pywikibot/families/wikiquote_family.py
index 019ed3e..fc50f85 100644
--- a/pywikibot/families/wikiquote_family.py
+++ b/pywikibot/families/wikiquote_family.py
@@ -70,8 +70,8 @@
 'bs', 'uk', 'tr', 'lt', 'bg', 'he', 'ca', 'sl', 'eo', 'el', 'nn',
 'id', 'zh', 'hr', 'hy', 'th', 'hu', 'li', 'nl', 'su', 'ko', 'ja',
 'sv', 'ur', 'te', 'ar', 'fi', 'cy', 'az', 'la', 'no', 'gl', 'ml',
-'et', 'ku', 'kn', 'sr', 'eu', 'ro', 'ta', 'ka', 'sa', 'da', 'is',
-'vi', 'be', 'hi', 'sq', 'gu', 'mr', 'br', 'uz', 'af', 'zh-min-nan',
+'et', 'ku', 'kn', 'sr', 'eu', 'ro', 'ta', 'ka', 'da', 'sa', 'is',
+'gu', 'vi', 'be', 'hi', 'sq', 'mr', 'br', 'uz', 'af', 'zh-min-nan',
 'am', 'wo', 'ky',
 ]
 
diff --git a/pywikibot/families/wikisource_family.py 
b/pywikibot/families/wikisource_family.py
index 6a24705..1faefe9 

[MediaWiki-commits] [Gerrit] Search for scripts in maintenance folder too. - change (pywikibot/core)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270279

Change subject: Search for scripts in maintenance folder too.
..

Search for scripts in maintenance folder too.

- with I3143241f64e scripts can be found in an archive folder but mainenance
  scripts must be startet with preleading "maintenance/"
- join paths in the right way; otherwise we could have mixed separators
  on windows os.

Change-Id: I02ed7a5e533eaa33c32cbd77a2c2bdcba567413c
---
M pwb.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/79/270279/1

diff --git a/pwb.py b/pwb.py
index a630c5f..e2ed051 100755
--- a/pwb.py
+++ b/pwb.py
@@ -211,7 +211,11 @@
 file_package = 'scripts'
 if not os.path.exists(testpath):
 testpath = os.path.join(
-os.path.split(__file__)[0], 'scripts/archive', filename)
+os.path.split(__file__)[0], 'scripts', 'maintenance', 
filename)
+file_package = 'scripts.maintenance'
+if not os.path.exists(testpath):
+testpath = os.path.join(
+os.path.split(__file__)[0], 'scripts', 'archive', filename)
 file_package = 'scripts.archive'
 
 if os.path.exists(testpath):

-- 
To view, visit https://gerrit.wikimedia.org/r/270279
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02ed7a5e533eaa33c32cbd77a2c2bdcba567413c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Simplify arg parsing in handle_args method - change (pywikibot/core)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270290

Change subject: [IMPR] Simplify arg parsing in handle_args method
..

[IMPR] Simplify arg parsing in handle_args method

- avoid length checking logic per argument

Change-Id: I5e517d7add5e3659fe797801bf9e129e258c610a
---
M scripts/casechecker.py
1 file changed, 17 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/90/270290/1

diff --git a/scripts/casechecker.py b/scripts/casechecker.py
index 06ee014..23adaa4 100755
--- a/scripts/casechecker.py
+++ b/scripts/casechecker.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8  -*-
 """Bot to find all pages on the wiki with mixed latin and cyrilic alphabets."""
 #
-# (C) Pywikibot team, 2006-2015
+# (C) Pywikibot team, 2006-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -145,13 +145,12 @@
 def __init__(self):
 
 for arg in pywikibot.handle_args():
-if arg.startswith('-from'):
-if arg.startswith('-from:'):
-self.apfrom = arg[6:]
-else:
-self.apfrom = pywikibot.input(u'Which page to start from: 
')
-elif arg.startswith('-reqsize:'):
-self.aplimit = int(arg[9:])
+arg, sep, value = arg.partition(':')
+if arg == '-from':
+self.apfrom = value or pywikibot.input(
+'Which page to start from: ')
+elif arg == '-reqsize':
+self.aplimit = int(value)
 elif arg == '-links':
 self.links = True
 elif arg == '-linksonly':
@@ -163,16 +162,16 @@
 self.filterredir = 'all'
 elif arg == '-redironly':
 self.filterredir = 'redirects'
-elif arg.startswith('-limit:'):
-self.stopAfter = int(arg[7:])
-elif arg == '-autonomous' or arg == '-a':
+elif == '-limit':
+self.stopAfter = int(value)
+elif arg in ('-autonomous', '-a'):
 self.autonomous = True
-elif arg.startswith('-ns:'):
-self.namespaces.append(int(arg[4:]))
-elif arg.startswith('-wikilog:'):
-self.wikilogfile = arg[9:]
-elif arg.startswith('-failedlog:'):
-self.failedTitles = arg[11:]
+elif arg == '-ns:':
+self.namespaces.append(int(value))
+elif arg == '-wikilog':
+self.wikilogfile = value
+elif arg == '-failedlog':
+self.failedTitles = value
 elif arg == '-failed':
 self.doFailed = True
 else:
@@ -261,7 +260,7 @@
 
 # TODO: handle "continue"
 if self.site.code in self.whitelists:
-wlpage = self.whitelists[self.site.code]
+wlpage = pywikibot.Page(self.site, self.whitelists[self.site.code])
 pywikibot.output(u'Loading whitelist from %s' % wlpage)
 wlparams = {
 'action': 'query',

-- 
To view, visit https://gerrit.wikimedia.org/r/270290
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e517d7add5e3659fe797801bf9e129e258c610a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] use Bot.user_confirm() - change (pywikibot/core)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270311

Change subject: [IMPR] use Bot.user_confirm()
..

[IMPR] use Bot.user_confirm()

- input_choice never returns a key not passed to the method.
  Checking undefined key is obsolete
- Also it is not necessary to pass 'n' key because it is passed
  with the end of the if statement

Change-Id: Ib3b22caefde66becf116d8cc97deef5c28fbc212
---
M scripts/movepages.py
1 file changed, 2 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/11/270311/1

diff --git a/scripts/movepages.py b/scripts/movepages.py
index b276b9c..c2e3046 100755
--- a/scripts/movepages.py
+++ b/scripts/movepages.py
@@ -109,20 +109,8 @@
 if self.getOption('prefix'):
 newPageTitle = (u'%s%s' % (self.getOption('prefix'), pagetitle))
 if self.getOption('prefix') or self.appendAll or self.regexAll:
-if not self.getOption('always'):
-choice2 = pywikibot.input_choice(
-u'Change the page title to "%s"?' % newPageTitle,
-[('yes', 'y'), ('no', 'n'), ('all', 'a')])
-if choice2 == 'y':
-self.moveOne(page, newPageTitle)
-elif choice2 == 'a':
-self.options['always'] = True
-self.moveOne(page, newPageTitle)
-elif choice2 == 'n':
-pass
-else:
-self.treat(page)
-else:
+if self.user_confirm('Change the page title to "%s"?'
+ % newPageTitle):
 self.moveOne(page, newPageTitle)
 else:
 choice = pywikibot.input_choice(u'What do you want to do?',
@@ -153,10 +141,6 @@
 elif choice2 == 'a':
 self.appendAll = True
 self.moveOne(page, newPageTitle)
-elif choice2 == 'n':
-pass
-else:
-self.treat(page)
 elif choice == 'r':
 searchPattern = pywikibot.input(u'Enter the search pattern:')
 self.replacePattern = pywikibot.input(
@@ -183,14 +167,6 @@
 elif choice2 == 'a':
 self.regexAll = True
 self.moveOne(page, newPageTitle)
-elif choice2 == 'n':
-pass
-else:
-self.treat(page)
-elif choice == 'n':
-pass
-else:
-self.treat(page)
 
 
 def main(*args):

-- 
To view, visit https://gerrit.wikimedia.org/r/270311
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3b22caefde66becf116d8cc97deef5c28fbc212
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] use Bot.user_confirm() - change (pywikibot/core)

2016-02-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270304

Change subject: [IMPR] use Bot.user_confirm()
..

[IMPR] use Bot.user_confirm()

Change-Id: I66e8742fa4c214a4ada0db3801c9f2e1dc5e9a20
---
M scripts/capitalize_redirects.py
1 file changed, 1 insertion(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/04/270304/1

diff --git a/scripts/capitalize_redirects.py b/scripts/capitalize_redirects.py
index 42af542..8b629ac 100755
--- a/scripts/capitalize_redirects.py
+++ b/scripts/capitalize_redirects.py
@@ -80,13 +80,7 @@
 else:
 pywikibot.output(u'%s doesn\'t exist'
  % page_cap.title(asLink=True))
-if not self.getOption('always'):
-choice = pywikibot.input_choice(
-u'Do you want to create a redirect?',
-[('Yes', 'y'), ('No', 'n'), ('All', 'a')], 'n')
-if choice == 'a':
-self.options['always'] = True
-if self.getOption('always') or choice == 'y':
+if user_confirm('Do you want to create a redirect?'):
 comment = i18n.twtranslate(
 site,
 'capitalize_redirects-create-redirect',

-- 
To view, visit https://gerrit.wikimedia.org/r/270304
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66e8742fa4c214a4ada0db3801c9f2e1dc5e9a20
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [fix] test_detect_failure is no longer valid, - change (pywikibot/core)

2016-02-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269929

Change subject: [fix] test_detect_failure is no longer valid,
..

[fix] test_detect_failure is no longer valid,

marked ist with @unittest.expectedFailure until we find another wiki.

Change-Id: Ib9eb16b0222e0182c234e7b1e7b0e28b84f17bc5
---
M tests/site_detect_tests.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/29/269929/1

diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 6a8ea4a..beef3b5 100644
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8  -*-
 """Test for site detection."""
 #
-# (C) Pywikibot team, 2014-2015
+# (C) Pywikibot team, 2014-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -210,6 +210,7 @@
 self.assertSite('http://tfwiki.net/wiki/$1')
 self.assertAllPass()
 
+@unittest.expectedFailure  # Test no longer valid
 def test_detect_failure(self):
 """Test detection failure for MediaWiki sites with an API."""
 # SSL certificate verification fails

-- 
To view, visit https://gerrit.wikimedia.org/r/269929
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9eb16b0222e0182c234e7b1e7b0e28b84f17bc5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [fix] enable WikibaseKnownTypesTests.test_datatypes - change (pywikibot/core)

2016-02-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269936

Change subject: [fix] enable WikibaseKnownTypesTests.test_datatypes
..

[fix] enable WikibaseKnownTypesTests.test_datatypes

* 'monolingualtext' is supportet since I88be5687f7df9
* 'external-id' is not known yet

Change-Id: I929e6e2c9e35e4b6198bbe138914a3c7263c546c
---
M tests/paraminfo_tests.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/36/269936/1

diff --git a/tests/paraminfo_tests.py b/tests/paraminfo_tests.py
index e4b98fb..eab6ce7 100644
--- a/tests/paraminfo_tests.py
+++ b/tests/paraminfo_tests.py
@@ -217,8 +217,9 @@
 
 def test_datatypes(self):
 """Test known datatypes."""
-unsupported = set(['monolingualtext', 'wikibase-property'])
-known = set(Property.types) | unsupported
+unsupported = set(['wikibase-property'])
+unknown = set(['external-id'])
+known = (set(Property.types) | unsupported) - unknown
 self._check_param_values(self.repo, 'wbformatvalue', 'datatype', known)
 
 def test_snaktype(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/269936
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I929e6e2c9e35e4b6198bbe138914a3c7263c546c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] Deprecate -quick option - change (pywikibot/core)

2016-02-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269945

Change subject: [bugfix] Deprecate -quick option
..

[bugfix] Deprecate -quick option

Also remove known issue which is related to old screen scraping code

Bug: T75019
Change-Id: Id1572614294640f25fd6db5ed15fa7ae50245fe2
---
M scripts/welcome.py
1 file changed, 9 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/45/269945/1

diff --git a/scripts/welcome.py b/scripts/welcome.py
index 7ebcfa6..48e627d 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -89,8 +89,6 @@
 
-quiet  Prevents users without contributions are displayed
 
-   -quick  Provide quick check by API bulk-retrieve user datas
-
 * GUIDE ***
 
 Report, Bad and white list guide:
@@ -147,12 +145,6 @@
 NOTE: The white space and  aren't required but I suggest you to
   use them.
 
-*** Known issues/FIXMEs 
-*  *
-* The regex to load the user might be slightly different from project to   *
-* project. (In this case, write to Filnik or the PWRF for help...) *
-* Use a class to group together the functions used.*
-*  *
  Badwords **
 
 The list of Badwords of the code is opened. If you think that a word is
@@ -173,8 +165,8 @@
 # (C) Filnik, 2007-2011
 # (C) Daniel Herding, 2007
 # (C) Alex Shih-Han Lin, 2009-2010
-# (C) xqt, 2009-2015
-# (C) Pywikibot team, 2008-2015
+# (C) xqt, 2009-2016
+# (C) Pywikibot team, 2008-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -195,6 +187,7 @@
 
 from pywikibot import config
 from pywikibot import i18n
+from pywikibot.tools import issue_deprecation_warning
 from pywikibot.tools.formatter import color_format
 
 if sys.version_info[0] > 2:
@@ -206,16 +199,11 @@
 # page/user/summary/etc so the need to specify language and project have
 # been eliminated.
 # FIXME: Not all language/project combinations have been defined yet.
-#   Add the following strings to customise for a language:
-#   logbook, talk_page, netext, user, con, report_page
-#   bad_pag, report_text, logt, random_sign and whitelist_pg.
+#Add the following strings to customise for a language:
+#logbook, talk_page, netext, user, con, report_page
+#bad_pag, report_text, logt, random_sign and whitelist_pg.
 
 
-
-
-
-# The text below are dictionaries. Copy the 'en' line, change 'en' in your
-# language (e.g. 'de') and modify/translate the text.
 
 # The page where the bot will save the log (e.g. Wikipedia:Welcome log).
 #
@@ -442,7 +430,6 @@
 defaultSign = '--'  # default signature
 queryLimit = 50 # number of users that the bot load to check
 quiet = False   # Prevents users without contributions are 
displayed
-quick = False   # Provide quick check by API bulk-retrieve user 
datas
 
 
 class WelcomeBot(object):
@@ -732,12 +719,8 @@
 def run(self):
 while True:
 welcomed_count = 0
-if globalvar.quick and self.site.has_api():
-us = [x for x in self.parseNewUserLog()]
-showStatus()
-pywikibot.User.getall(self.site, us)
-else:
-us = (pywikibot.User(self.site, users.user()) for users in 
self.parseNewUserLog())
+us = (pywikibot.User(self.site, users.user())
+  for users in self.parseNewUserLog())
 for users in us:
 if users.isBlocked():
 showStatus(3)
@@ -982,7 +965,7 @@
 elif arg == '-quiet':
 globalvar.quiet = True
 elif arg == '-quick':
-globalvar.quick = True
+issue_deprecation_warning('The usage of "-quick" option', None, 2)
 
 # Filename and Pywikibot path
 # file where is stored the random signature index

-- 
To view, visit https://gerrit.wikimedia.org/r/269945
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1572614294640f25fd6db5ed15fa7ae50245fe2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Simplify arg parsing in handle_args method - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269682

Change subject: [IMPR] Simplify arg parsing in handle_args method
..

[IMPR] Simplify arg parsing in handle_args method

- avoid length checking logic per argument

Change-Id: If4ab0092f4542c341a3515b530360cf048b29572
---
M scripts/blockpageschecker.py
1 file changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/82/269682/1

diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index 66824e5..00d2c08 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -228,21 +228,19 @@
 
 # Process local args
 for arg in local_args:
-if arg == '-always':
+option, sep, value = arg.partition(':')
+if option == '-always':
 always = True
-elif arg == '-move':
+elif option == '-move':
 moveBlockCheck = True
-elif arg == '-show':
+elif option == '-show':
 show = True
-elif arg.startswith('-protectedpages'):
+elif option in ('-protectedpages', '-moveprotected'):
 protectedpages = True
-if len(arg) > 15:
-namespace = int(arg[16:])
-elif arg.startswith('-moveprotected'):
-protectedpages = True
-protectType = 'move'
-if len(arg) > 14:
-namespace = int(arg[15:])
+if option == '-moveprotected':
+protectType = 'move' 
+if value:
+namespace = int(value)
 else:
 genFactory.handleArg(arg)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/269682
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4ab0092f4542c341a3515b530360cf048b29572
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] * [IMPR] Simplify arg parsing in handle_args method - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269680

Change subject: * [IMPR] Simplify arg parsing in handle_args method
..

* [IMPR] Simplify arg parsing in handle_args method

- avoid length checking logic per argument
- simplify logic for default values
- logic and variable names are uniform for all args

Change-Id: I30818d229b1462f084faa1dc42945f11083f5e7a
---
M scripts/add_text.py
1 file changed, 19 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/80/269680/1

diff --git a/scripts/add_text.py b/scripts/add_text.py
index f6049f5..4aad637 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -64,7 +64,7 @@
 
 #
 # (C) Filnik, 2007-2010
-# (C) Pywikibot team, 2007-2015
+# (C) Pywikibot team, 2007-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -305,42 +305,30 @@
 
 # Loading the arguments
 for arg in local_args:
-if arg.startswith('-textfile'):
-if len(arg) == 9:
-textfile = pywikibot.input(
-u'Which textfile do you want to add?')
-else:
-textfile = arg[10:]
-elif arg.startswith('-text'):
-if len(arg) == 5:
-addText = pywikibot.input(u'What text do you want to add?')
-else:
-addText = arg[6:]
-elif arg.startswith('-summary'):
-if len(arg) == 8:
-summary = pywikibot.input(u'What summary do you want to use?')
-else:
-summary = arg[9:]
-elif arg.startswith('-excepturl'):
-if len(arg) == 10:
-regexSkipUrl = pywikibot.input(u'What text should I skip?')
-else:
-regexSkipUrl = arg[11:]
-elif arg.startswith('-except'):
-if len(arg) == 7:
-regexSkip = pywikibot.input(u'What text should I skip?')
-else:
-regexSkip = arg[8:]
-elif arg == '-up':
+option, sep, value = arg.partition(':')
+if option == '-textfile':
+textfile = value or pywikibot.input(
+'Which textfile do you want to add?')
+elif option == '-text':
+addText = value or pywikibot.input('What text do you want to add?')
+elif option == '-summary':
+summary = value or pywikibot.input(
+'What summary do you want to use?')
+elif option == '-excepturl':
+regexSkipUrl = value or pywikibot.input('What text should I skip?')
+elif option == '-except':
+regexSkip = value or pywikibot.input('What text should I skip?')
+elif option == '-up':
 up = True
-elif arg == '-noreorder':
+elif option == '-noreorder':
 reorderEnabled = False
-elif arg == '-always':
+elif option == '-always':
 always = True
-elif arg == '-talk' or arg == '-talkpage':
+elif option in ('-talk', '-talkpage'):
 talkPage = True
 else:
 genFactory.handleArg(arg)
+
 if textfile and not addText:
 with codecs.open(textfile, 'r', config.textfile_encoding) as f:
 addText = f.read()

-- 
To view, visit https://gerrit.wikimedia.org/r/269680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30818d229b1462f084faa1dc42945f11083f5e7a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Simplify arg parsing in handle_args method - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269699

Change subject: [IMPR] Simplify arg parsing in handle_args method
..

[IMPR] Simplify arg parsing in handle_args method

- avoid length checking logic per argument

Change-Id: I026df731ebd78f7fa8aa7bef3a3f2f473e0c84fe
---
M scripts/redirect.py
1 file changed, 25 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/99/269699/1

diff --git a/scripts/redirect.py b/scripts/redirect.py
index edfa28d..9f29b9d 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -742,26 +742,22 @@
 pagename = None
 
 for arg in pywikibot.handle_args(args):
-if arg == 'double' or arg == 'do':
+option, sep, value = arg.partition(':')
+if option in ('double', 'do'):
 action = 'double'
-elif arg == 'broken' or arg == 'br':
+elif option in ('broken', 'br'):
 action = 'broken'
-elif arg == 'both':
+elif option == 'both':
 action = 'both'
-elif arg == '-fullscan':
+elif option == '-fullscan':
 fullscan = True
-elif arg.startswith('-xml'):
-if len(arg) == 4:
-xmlFilename = i18n.input('pywikibot-enter-xml-filename')
-else:
-xmlFilename = arg[5:]
-elif arg.startswith('-moves'):
+elif option == '-xml':
+xmlFilename = value or i18n.input('pywikibot-enter-xml-filename')
+elif option == '-moves':
 moved_pages = True
-elif arg.startswith('-namespace:'):
-ns = arg[11:]
-if ns == '':
-# "-namespace:" does NOT yield -namespace:0 further down the 
road!
-ns = i18n.input('pywikibot-enter-namespace-number')
+elif option == '-namespace':
+# "-namespace:" does NOT yield -namespace:0 further down the road!
+ns = value or i18n.input('pywikibot-enter-namespace-number')
 # TODO: at least for some generators enter a namespace by its name
 # or number
 if ns == '':
@@ -774,21 +770,21 @@
 pass
 if ns not in namespaces:
 namespaces.append(ns)
-elif arg.startswith('-offset:'):
-offset = int(arg[8:])
-elif arg.startswith('-start:'):
-start = arg[7:]
-elif arg.startswith('-until:'):
-until = arg[7:]
-elif arg.startswith('-total:'):
-number = int(arg[7:])
-elif arg.startswith('-step:'):
-step = int(arg[6:])
-elif arg.startswith('-page:'):
-pagename = arg[6:]
-elif arg == '-always':
+elif option == '-offset:':
+offset = int(value)
+elif option == '-start:':
+start = value
+elif option == '-until:':
+until = value
+elif option == '-total:':
+number = int(value)
+elif option == '-step:':
+step = int(value)
+elif option == '-page:':
+pagename = value
+elif option == '-always':
 options['always'] = True
-elif arg == '-delete':
+elif option == '-delete':
 options['delete'] = True
 else:
 pywikibot.output(u'Unknown argument: %s' % arg)

-- 
To view, visit https://gerrit.wikimedia.org/r/269699
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I026df731ebd78f7fa8aa7bef3a3f2f473e0c84fe
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] takesettings is not a function, take settings from... - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269717

Change subject: [bugfix] takesettings is not a function, take  settings from 
instance
..

[bugfix] takesettings is not a function, take  settings from instance

Change-Id: I53425c8c8f348f57ed5525eb362d0eab7b023c3a
---
M tests/checkimages_tests.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/17/269717/1

diff --git a/tests/checkimages_tests.py b/tests/checkimages_tests.py
index 978547b..2a173e9 100644
--- a/tests/checkimages_tests.py
+++ b/tests/checkimages_tests.py
@@ -19,7 +19,8 @@
 def test_load(self):
 """Test loading settings."""
 b = checkimages.checkImagesBot(self.get_site())
-rv = b.takesettings()
+b.takesettings()
+rv = b.settingsData
 item1 = rv[0]
 self.assertEqual(item1[0], 1)
 self.assertEqual(item1[1], 'a deprecated template')

-- 
To view, visit https://gerrit.wikimedia.org/r/269717
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53425c8c8f348f57ed5525eb362d0eab7b023c3a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] top['total'] item is basestring not unicode - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269730

Change subject: [bugfix] top['total'] item is basestring not unicode
..

[bugfix] top['total'] item is basestring not unicode

* also fix entry index for fr-wikisource

Change-Id: Iff6266e4bcbebe2f859bcba4feb326fa8be26091
---
M tests/wikistats_tests.py
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/30/269730/1

diff --git a/tests/wikistats_tests.py b/tests/wikistats_tests.py
index 4d59623..d3f00fe 100644
--- a/tests/wikistats_tests.py
+++ b/tests/wikistats_tests.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8  -*-
 """Test cases for the WikiStats dataset."""
 #
-# (C) Pywikibot team, 2014
+# (C) Pywikibot team, 2014-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -11,7 +11,7 @@
 #
 
 from pywikibot.data.wikistats import WikiStats, csv
-from pywikibot.tools import UnicodeType
+from pywikibot.tools import StringTypes
 
 from tests.aspects import unittest, TestCase
 
@@ -30,9 +30,9 @@
 self.assertIn('prefix', top)
 self.assertIn('total', top)
 self.assertEqual(top['prefix'], 'en')
-self.assertIsInstance(top['total'], UnicodeType)
+self.assertIsInstance(top['total'], StringTypes)
 self.assertEqual(ws.languages_by_size('wikipedia')[0], 'en')
-self.assertEqual(ws.languages_by_size('wikisource')[0], 'fr')
+self.assertEqual(ws.languages_by_size('wikisource')[3], 'fr')
 
 def test_csv(self):
 """Test CSV."""

-- 
To view, visit https://gerrit.wikimedia.org/r/269730
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff6266e4bcbebe2f859bcba4feb326fa8be26091
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] category parameter for getCategory may be None - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269855

Change subject: [bugfix] category parameter for getCategory may be None
..

[bugfix] category parameter for getCategory may be None

Change-Id: Id7f2d51b5e368e19f891e4a5e88163917b42d63e
---
M pywikibot/pagegenerators.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/55/269855/1

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 521dd98..c0a64f8 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -486,7 +486,7 @@
 @type category: str
 @rtype: tuple
 """
-if category.startswith('-'):  # old arg parameter
+if category and category.startswith('-'):  # old arg parameter
 categoryname = category.partition(':')[2]
 issue_deprecation_warning(
 'The usage of "{0}" as actual parameter of '

-- 
To view, visit https://gerrit.wikimedia.org/r/269855
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7f2d51b5e368e19f891e4a5e88163917b42d63e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] Fix argument parsing for logevents - change (pywikibot/core)

2016-02-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269858

Change subject: [bugfix] Fix argument parsing for logevents
..

[bugfix] Fix argument parsing for logevents

Change-Id: Iaf0621567af9ab874f6311864d90362d9a2c438a
---
M pywikibot/pagegenerators.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/58/269858/1

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 521dd98..57c7be2 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -823,7 +823,7 @@
 'Maximum subpage depth:')
 self.subpage_max_depth = int(value)
 return True
-elif arg == '-logevents:':
+elif arg == '-logevents':
 gen = self._parse_log_events(*value.split(','))
 elif arg.startswith('-'):
 mode, log, user = arg.partition('log')

-- 
To view, visit https://gerrit.wikimedia.org/r/269858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf0621567af9ab874f6311864d90362d9a2c438a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Also use reblocks to be processed - change (pywikibot...xqbot)

2016-02-08 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: Also use reblocks to be processed
..


Also use reblocks to be processed

Change-Id: Ibcb8b3dcab3af6599745551a0ef860889e7d1123
---
M vandalism.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/vandalism.py b/vandalism.py
index cc70b87..5ce4cb6 100644
--- a/vandalism.py
+++ b/vandalism.py
@@ -234,7 +234,7 @@
 for block in self.site.logevents(logtype='block',
  end=self.nexttimestamp,
  total=self.total):
-if block.action() != 'block':
+if block.action() not in  ['block', 'reblock']:
 continue
 try:
 blockedusername = block.page().title(withNamespace=False)

-- 
To view, visit https://gerrit.wikimedia.org/r/269125
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcb8b3dcab3af6599745551a0ef860889e7d1123
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] update linktrails - change (pywikibot/core)

2016-02-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269121

Change subject: update linktrails
..

update linktrails

Change-Id: I3c738e834975547e90226066d34b2092d77f40b1
---
M pywikibot/family.py
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/21/269121/1

diff --git a/pywikibot/family.py b/pywikibot/family.py
index 0faff3c..bdfaca3 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -144,7 +144,9 @@
 'als': u'[äöüßa-z]*',
 'an': u'[a-záéíóúñ]*',
 'ar': u'[a-zء-ي]*',
+'ast': u'[a-záéíóúñ]*',
 'arz': u'[a-zء-ي]*',
+'azb': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
 'av': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
 'ay': u'[a-záéíóúñ]*',
 'bar': u'[äöüßa-z]*',
@@ -172,6 +174,7 @@
 'eml': u'[a-zàéèíîìóòúù]*',
 'es': u'[a-záéíóúñ]*',
 'et': u'[äöõšüža-z]*',
+'ext': u'[a-záéíóúñ]*',
 'fa': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
 'ff': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'fi': u'[a-zäö]*',
@@ -211,6 +214,9 @@
 'lij': u'[a-zàéèíîìóòúù]*',
 'lmo': u'[a-zàéèíîìóòúù]*',
 'ln': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
+'lrc': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
+'ltg': u'[a-zA-ZĀāČčĒēĢģĪīĶķĻļŅņŠšŪūŽž]*',
+'lv': u'[a-zA-ZĀāČčĒēĢģĪīĶķĻļŅņŠšŪūŽž]*',
 'mg': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'mhr': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
 'mk': u'[a-zабвгдѓежзѕијклљмнњопрстќуфхцчџш]*',
@@ -262,7 +268,7 @@
 'tt': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюяӘәӨөҮүҖҗҢңҺһ]*',
 'ty': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'tyv': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
-'udm': u'[a-zа-яёӝӟӥӧӵ“»]*',
+'udm': u'[a-zа-яёӝӟӥӧӵ]*',
 'uk': u'[a-zабвгґдеєжзиіїйклмнопрстуфхцчшщьєюяёъы“»]*',
 'uz': u'[a-zʻʼ“»]*',
 'vec': u'[a-zàéèíîìóòúù]*',

-- 
To view, visit https://gerrit.wikimedia.org/r/269121
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c738e834975547e90226066d34b2092d77f40b1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] update linktrails from core - change (pywikibot/compat)

2016-02-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269123

Change subject: update linktrails from core
..

update linktrails from core

Change-Id: I685bf19df82998bf0485947ff19726507ace8321
---
M family.py
1 file changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/23/269123/1

diff --git a/family.py b/family.py
index cbf8bad..e3daff3 100644
--- a/family.py
+++ b/family.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8  -*-
 
 #
-# (C) Pywikibot team, 2004-2015
+# (C) Pywikibot team, 2004-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -3351,12 +3351,14 @@
 'als': u'[äöüßa-z]*',
 'an': u'[a-záéíóúñ]*',
 'ar': u'[a-zء-ي]*',
+'ast': u'[a-záéíóúñ]*',
 'arz': u'[a-zء-ي]*',
+'azb': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
 'av': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
 'ay': u'[a-záéíóúñ]*',
 'bar': u'[äöüßa-z]*',
 'be': u'[абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]*',
-'be-x-old': u'[абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]*',
+'be-tarask': u'[абвгґджзеёжзійклмнопрстуўфхцчшыьэюяćčłńśšŭźža-z]*',
 'bg': u'[a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]*',
 'bm': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'bs': u'[a-zćčžšđž]*',
@@ -3379,6 +3381,7 @@
 'eml': u'[a-zàéèíîìóòúù]*',
 'es': u'[a-záéíóúñ]*',
 'et': u'[äöõšüža-z]*',
+'ext': u'[a-záéíóúñ]*',
 'fa': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
 'ff': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'fi': u'[a-zäö]*',
@@ -3418,6 +3421,9 @@
 'lij': u'[a-zàéèíîìóòúù]*',
 'lmo': u'[a-zàéèíîìóòúù]*',
 'ln': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
+'lrc': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
+'ltg': u'[a-zA-ZĀāČčĒēĢģĪīĶķĻļŅņŠšŪūŽž]*',
+'lv': u'[a-zA-ZĀāČčĒēĢģĪīĶķĻļŅņŠšŪūŽž]*',
 'mg': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'mhr': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
 'mk': u'[a-zабвгдѓежзѕијклљмнњопрстќуфхцчџш]*',
@@ -3469,7 +3475,7 @@
 'tt': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюяӘәӨөҮүҖҗҢңҺһ]*',
 'ty': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'tyv': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
-'udm': u'[a-zа-яёӝӟӥӧӵ“»]*',
+'udm': u'[a-zа-яёӝӟӥӧӵ]*',
 'uk': u'[a-zабвгґдеєжзиіїйклмнопрстуфхцчшщьєюяёъы“»]*',
 'uz': u'[a-zʻʼ“»]*',
 'vec': u'[a-zàéèíîìóòúù]*',
@@ -4000,7 +4006,7 @@
 ],
 # languages that use the cyrillic alphabet
 'cyril': [
-'ab', 'av', 'ba', 'be', 'be-x-old', 'bg', 'bxr', 'ce', 'cu',
+'ab', 'av', 'ba', 'be', 'be-tarask', 'bg', 'bxr', 'ce', 'cu',
 'cv', 'kbd', 'koi', 'kv', 'ky', 'mk', 'lbe', 'mdf', 'mn', 'mo',
 'myv', 'mhr', 'mrj', 'os', 'ru', 'rue', 'sah', 'tg', 'tk',
 'udm', 'uk', 'xal',

-- 
To view, visit https://gerrit.wikimedia.org/r/269123
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I685bf19df82998bf0485947ff19726507ace8321
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Also use reblocks to be processed - change (pywikibot...xqbot)

2016-02-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269125

Change subject: Also use reblocks to be processed
..

Also use reblocks to be processed

Change-Id: Ibcb8b3dcab3af6599745551a0ef860889e7d1123
---
M vandalism.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/25/269125/1

diff --git a/vandalism.py b/vandalism.py
index cc70b87..5ce4cb6 100644
--- a/vandalism.py
+++ b/vandalism.py
@@ -234,7 +234,7 @@
 for block in self.site.logevents(logtype='block',
  end=self.nexttimestamp,
  total=self.total):
-if block.action() != 'block':
+if block.action() not in  ['block', 'reblock']:
 continue
 try:
 blockedusername = block.page().title(withNamespace=False)

-- 
To view, visit https://gerrit.wikimedia.org/r/269125
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibcb8b3dcab3af6599745551a0ef860889e7d1123
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Some improvements done. - remove unused load method -... - change (pywikibot...xqbot)

2016-02-07 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: [IMPR] Some improvements done. - remove unused load method - 
increase self._treat_counter - use userPut instead of own save method - add doc 
strings
..


[IMPR] Some improvements done.
- remove unused load method
- increase self._treat_counter
- use userPut instead of own save method
- add doc strings

Change-Id: I24b6aad7761be1bb2ca65a492ee705cf13da0765
---
M afd-notice.py
1 file changed, 46 insertions(+), 63 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/afd-notice.py b/afd-notice.py
index 3843fca..be25b12 100644
--- a/afd-notice.py
+++ b/afd-notice.py
@@ -14,11 +14,11 @@
 
 """
 #
-# (C) xqt, 2013-2015
+# (C) xqt, 2013-2016
 #
 # Distributed under the terms of the MIT license.
 #
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 __version__ = '$Id: b8b58400a557856fe9df819978e4b30036e4a643 $'
 #
@@ -42,6 +42,7 @@
 summary = "Bot: Benachrichtigung über Löschdiskussion zum Artikel 
[[%(page)s]]"
 
 def __init__(self, **kwargs):
+"""Constructor."""
 self.availableOptions.update({
 'init': False,
 })
@@ -52,6 +53,14 @@
 self._start_ts = pywikibot.Timestamp.now()
 
 def moved_page(self, source):
+"""
+Find the move target for a given page.
+
+@param source: page title
+@type source: str or pywikibot.Link
+@return: target page title
+@rtype: str
+"""
 page = pywikibot.Page(pywikibot.Link(source))
 gen = iter(self.site.logevents(logtype='move', page=page, total=1))
 try:
@@ -107,6 +116,7 @@
 pywikibot.output(u'\n>>> %s <<< is tagged for deleting'
  % article)
 self.treat(article)
+self._treat_counter += 1
 writelist.add(article)
 # all of them are done, delete the old entries
 else:
@@ -115,6 +125,12 @@
 self.init = False
 
 def readfile(self):
+"""
+Read page titles from file.
+
+@return: set of page titles
+@rtype: set
+"""
 pywikibot.output(u'\nReading old article list...')
 filename = pywikibot.config.datafilepath("data", 'la.data')
 try:
@@ -127,6 +143,12 @@
 return data
 
 def writefile(self, data):
+"""
+Write page titles to file.
+
+@param data: set of page titles
+@type data: set
+"""
 if not config.simulate or self.init:
 pywikibot.output(u'Writing %d article names to file'
  % len(data))
@@ -139,7 +161,14 @@
 raise
 
 def treat(self, pagename):
-""" Loads the given page, does some changes, and saves it. """
+"""
+Process a given page.
+
+Get the creator of the page and calculate the main authors.
+
+@param pagename: page title
+@type pagename: str
+"""
 page = pywikibot.Page(pywikibot.Link(pagename))
 if not page.exists():
 return
@@ -201,6 +230,16 @@
 action=u'stark überarbeitete')
 
 def inform(self, user, **param):
+"""
+Inform user about deletion request.
+
+@param user: user to be informed
+@type user: pywikibot.User
+@keyword page: page title
+@type page: str
+@keyword action: action done by editor
+@type action: str
+"""
 talk = user.getUserTalkPage()
 while talk.isRedirectPage():
 talk = talk.getRedirectTarget()
@@ -222,68 +261,12 @@
 text = u''
 param['user'] = user.name()
 text += msg % param
-if not self.save(text, talk, self.summary % param, minorEdit=False):
+if not self.userPut(talk, talk.text, text, minor=False,
+summary=self.summary % param,
+ignore_save_related_errors=True,
+ignore_server_errors=True):
 pywikibot.output(u'WARNING: Page %s not saved.'
  % talk.title(asLink=True))
-
-def load(self, page):
-"""
-Loads the given page, does some changes, and saves it.
-"""
-try:
-# Load the page
-text = page.text
-except pywikibot.NoPage:
-pywikibot.output(u"Page %s does not exist; skipping."
- % page.title(asLink=True))
-except pywikibot.IsRedirectPage:
-pywikibot.output(u"Page %s is a redirect; skipping."
- % page.title(asLink=True))
-else:
-return text
-
-def save(self, text, page, comment=None, minorEdit=True,
- botflag=True):
-old = u''
-if 

[MediaWiki-commits] [Gerrit] [IMPR] exceptions is no longer needed since stats are retrie... - change (pywikibot/core)

2016-02-07 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268942

Change subject: [IMPR] exceptions is no longer needed since stats are retrieved 
as xml data set
..

[IMPR] exceptions is no longer needed since stats are retrieved as xml data set

exception was previously used for the screen scraping regex and is no longer
required. On the other hand wikisource appends a '-' language at the end of
the language_by_size list this must be excluded from processing. Otherwise
we get that entry twice.

Change-Id: I05bab72fa24ef13346aee2d7b50aaa2179b4
---
M scripts/maintenance/wikimedia_sites.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/42/268942/1

diff --git a/scripts/maintenance/wikimedia_sites.py 
b/scripts/maintenance/wikimedia_sites.py
index d26c958..8f0fcc6 100755
--- a/scripts/maintenance/wikimedia_sites.py
+++ b/scripts/maintenance/wikimedia_sites.py
@@ -41,7 +41,7 @@
 'wiktionary':   'wiktionaries',
 }
 
-exceptions = ['www']
+exceptions = ['-']
 
 
 def update_family(families):

-- 
To view, visit https://gerrit.wikimedia.org/r/268942
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05bab72fa24ef13346aee2d7b50aaa2179b4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] update language_by_size - change (pywikibot/core)

2016-02-07 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268941

Change subject: update language_by_size
..

update language_by_size

Change-Id: I927b13d51f6d24738caa05216a104c623e6382fc
---
M pywikibot/families/wikibooks_family.py
M pywikibot/families/wikinews_family.py
M pywikibot/families/wikipedia_family.py
M pywikibot/families/wikiquote_family.py
M pywikibot/families/wikisource_family.py
M pywikibot/families/wikivoyage_family.py
M pywikibot/families/wiktionary_family.py
7 files changed, 67 insertions(+), 68 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/41/268941/1

diff --git a/pywikibot/families/wikibooks_family.py 
b/pywikibot/families/wikibooks_family.py
index 5de6e1d..b2972ae 100644
--- a/pywikibot/families/wikibooks_family.py
+++ b/pywikibot/families/wikibooks_family.py
@@ -108,14 +108,14 @@
 def __init__(self):
 """Constructor."""
 self.languages_by_size = [
-'en', 'de', 'fr', 'hu', 'ja', 'it', 'es', 'pt', 'nl', 'pl', 'he',
-'vi', 'ca', 'id', 'sq', 'fi', 'ru', 'fa', 'cs', 'zh', 'sv', 'hr',
-'tr', 'ro', 'sr', 'ar', 'no', 'th', 'ko', 'gl', 'da', 'ta', 'mk',
-'az', 'tl', 'is', 'ka', 'lt', 'tt', 'uk', 'eo', 'bg', 'sk', 'sl',
-'el', 'hy', 'ms', 'sa', 'si', 'li', 'la', 'ml', 'ur', 'bn', 'ang',
-'ia', 'cv', 'et', 'hi', 'km', 'mr', 'eu', 'oc', 'kk', 'fy', 'ne',
-'ie', 'te', 'af', 'tg', 'ky', 'bs', 'pa', 'be', 'mg', 'cy',
-'zh-min-nan', 'ku', 'uz',
+'en', 'de', 'hu', 'fr', 'ja', 'it', 'es', 'pt', 'nl', 'pl', 'vi',
+'he', 'ca', 'id', 'fi', 'sq', 'fa', 'ru', 'cs', 'zh', 'az', 'sv',
+'th', 'hr', 'tr', 'sr', 'ar', 'no', 'ko', 'gl', 'da', 'ta', 'ro',
+'mk', 'tl', 'is', 'uk', 'ka', 'lt', 'tt', 'sa', 'eo', 'sk', 'bg',
+'el', 'hy', 'si', 'ms', 'sl', 'bn', 'hi', 'li', 'la', 'ur', 'ml',
+'ang', 'ia', 'cv', 'et', 'km', 'mr', 'eu', 'oc', 'kk', 'ne', 'fy',
+'pa', 'ie', 'te', 'af', 'tg', 'ku', 'ky', 'bs', 'be', 'mg', 'cy',
+'zh-min-nan', 'uz',
 ]
 
 super(Family, self).__init__()
diff --git a/pywikibot/families/wikinews_family.py 
b/pywikibot/families/wikinews_family.py
index e551b1e..a80743a 100644
--- a/pywikibot/families/wikinews_family.py
+++ b/pywikibot/families/wikinews_family.py
@@ -28,9 +28,9 @@
 def __init__(self):
 """Constructor."""
 self.languages_by_size = [
-'sr', 'en', 'fr', 'de', 'pl', 'es', 'pt', 'ru', 'it', 'zh', 'ta',
-'el', 'ca', 'cs', 'sv', 'ar', 'fa', 'ro', 'uk', 'tr', 'ja', 'sq',
-'no', 'ko', 'eo', 'fi', 'bs', 'he', 'bg',
+'sr', 'en', 'fr', 'de', 'pl', 'pt', 'es', 'ru', 'it', 'zh', 'ca',
+'ta', 'cs', 'el', 'sv', 'ar', 'fa', 'ro', 'uk', 'tr', 'ja', 'sq',
+'no', 'eo', 'ko', 'fi', 'bs', 'he', 'bg',
 ]
 
 super(Family, self).__init__()
diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index fc85045..b8a1801 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -51,35 +51,34 @@
 def __init__(self):
 """Constructor."""
 self.languages_by_size = [
-'en', 'sv', 'nl', 'de', 'fr', 'war', 'ru', 'ceb', 'it', 'es', 'vi',
-'pl', 'ja', 'pt', 'zh', 'uk', 'ca', 'fa', 'no', 'sh', 'fi', 'ar',
-'id', 'cs', 'sr', 'ro', 'ko', 'hu', 'ms', 'tr', 'min', 'eo', 'kk',
-'eu', 'sk', 'da', 'bg', 'he', 'lt', 'hy', 'hr', 'sl', 'et', 'uz',
-'gl', 'nn', 'vo', 'la', 'simple', 'el', 'hi', 'az', 'th', 'ka',
-'ce', 'oc', 'be', 'mk', 'mg', 'new', 'ur', 'tt', 'ta', 'pms', 'cy',
-'tl', 'lv', 'bs', 'te', 'be-tarask', 'br', 'ht', 'sq', 'jv', 'lb',
-'mr', 'is', 'ml', 'zh-yue', 'bn', 'af', 'ba', 'ga', 'pnb', 'cv',
-'fy', 'lmo', 'tg', 'sco', 'my', 'yo', 'an', 'ky', 'sw', 'io', 'ne',
-'gu', 'scn', 'bpy', 'nds', 'ku', 'ast', 'qu', 'als', 'su', 'pa',
-'kn', 'ckb', 'ia', 'mn', 'nap', 'bug', 'arz', 'bat-smg', 'wa',
-'zh-min-nan', 'am', 'map-bms', 'gd', 'yi', 'mzn', 'si', 'fo', 
'bar',
-'vec', 'nah', 'sah', 'os', 'sa', 'roa-tara', 'li', 'hsb', 'or',
-'pam', 'mrj', 'mhr', 'se', 'mi', 'ilo', 'hif', 'bcl', 'gan', 'rue',
-'ps', 'glk', 'nds-nl', 'bo', 'vls', 'diq', 'fiu-vro', 'bh', 'xmf',
-'tk', 'gv', 'sc', 'co', 'csb', 'hak', 'km', 'kv', 'vep', 'zea',
-'crh', 'zh-classical', 'frr', 'eml', 'ay', 'stq', 'udm', 'wuu',
-'nrm', 'kw', 'rm', 'szl', 'so', 'koi', 'as', 'lad', 'fur', 'mt',
-'dv', 'gn', 'dsb', 'ie', 'pcd', 'sd', 'lij', 'cbk-zam', 'cdo',
-'ksh', 'ext', 'mwl', 'gag', 'ang', 'ug', 'ace', 'pi', 'pag', 'nv',
-'lez', 'frp', 'sn', 'kab', 

[MediaWiki-commits] [Gerrit] Update language_by_size - change (pywikibot/compat)

2016-02-07 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268940

Change subject: Update language_by_size
..

Update language_by_size

Change-Id: I63599d560204e593432760efb526cb210aba2e80
---
M families/wikibooks_family.py
M families/wikinews_family.py
M families/wikipedia_family.py
M families/wikiquote_family.py
M families/wikisource_family.py
M families/wikivoyage_family.py
M families/wiktionary_family.py
7 files changed, 67 insertions(+), 67 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/40/268940/1

diff --git a/families/wikibooks_family.py b/families/wikibooks_family.py
index bcc2f89..0db03a1 100644
--- a/families/wikibooks_family.py
+++ b/families/wikibooks_family.py
@@ -15,14 +15,14 @@
 self.name = 'wikibooks'
 
 self.languages_by_size = [
-'en', 'de', 'fr', 'hu', 'ja', 'it', 'es', 'pt', 'nl', 'pl', 'he',
-'vi', 'ca', 'id', 'sq', 'fi', 'ru', 'fa', 'cs', 'zh', 'sv', 'hr',
-'tr', 'ro', 'sr', 'ar', 'no', 'th', 'ko', 'gl', 'da', 'ta', 'mk',
-'az', 'tl', 'is', 'ka', 'lt', 'tt', 'uk', 'eo', 'bg', 'sk', 'sl',
-'el', 'hy', 'ms', 'sa', 'si', 'li', 'la', 'ml', 'ur', 'bn', 'ang',
-'ia', 'cv', 'et', 'hi', 'km', 'mr', 'eu', 'oc', 'kk', 'fy', 'ne',
-'ie', 'te', 'af', 'tg', 'ky', 'bs', 'pa', 'be', 'mg', 'cy',
-'zh-min-nan', 'ku', 'uz',
+'en', 'de', 'hu', 'fr', 'ja', 'it', 'es', 'pt', 'nl', 'pl', 'vi',
+'he', 'ca', 'id', 'fi', 'sq', 'fa', 'ru', 'cs', 'zh', 'az', 'sv',
+'th', 'hr', 'tr', 'sr', 'ar', 'no', 'ko', 'gl', 'da', 'ta', 'ro',
+'mk', 'tl', 'is', 'uk', 'ka', 'lt', 'tt', 'sa', 'eo', 'sk', 'bg',
+'el', 'hy', 'si', 'ms', 'sl', 'bn', 'hi', 'li', 'la', 'ur', 'ml',
+'ang', 'ia', 'cv', 'et', 'km', 'mr', 'eu', 'oc', 'kk', 'ne', 'fy',
+'pa', 'ie', 'te', 'af', 'tg', 'ku', 'ky', 'bs', 'be', 'mg', 'cy',
+'zh-min-nan', 'uz',
 ]
 
 self.langs = dict([(lang, '%s.wikibooks.org' % lang)
diff --git a/families/wikinews_family.py b/families/wikinews_family.py
index fa0cbf5..6b6ee98 100644
--- a/families/wikinews_family.py
+++ b/families/wikinews_family.py
@@ -17,9 +17,9 @@
 self.name = 'wikinews'
 
 self.languages_by_size = [
-'sr', 'en', 'fr', 'de', 'pl', 'es', 'pt', 'ru', 'it', 'zh', 'ta',
-'el', 'ca', 'cs', 'sv', 'ar', 'fa', 'ro', 'uk', 'tr', 'ja', 'sq',
-'no', 'ko', 'eo', 'fi', 'bs', 'he', 'bg',
+'sr', 'en', 'fr', 'de', 'pl', 'pt', 'es', 'ru', 'it', 'zh', 'ca',
+'ta', 'cs', 'el', 'sv', 'ar', 'fa', 'ro', 'uk', 'tr', 'ja', 'sq',
+'no', 'eo', 'ko', 'fi', 'bs', 'he', 'bg',
 ]
 
 self.langs = dict([(lang, '%s.wikinews.org' % lang)
diff --git a/families/wikipedia_family.py b/families/wikipedia_family.py
index 6f4883b..bf79af6 100644
--- a/families/wikipedia_family.py
+++ b/families/wikipedia_family.py
@@ -17,34 +17,34 @@
 self.name = 'wikipedia'
 
 self.languages_by_size = [
-'en', 'sv', 'nl', 'de', 'fr', 'war', 'ru', 'ceb', 'it', 'es', 'vi',
-'pl', 'ja', 'pt', 'zh', 'uk', 'ca', 'fa', 'no', 'sh', 'fi', 'ar',
-'id', 'cs', 'sr', 'ro', 'ko', 'hu', 'ms', 'tr', 'min', 'eo', 'kk',
-'eu', 'sk', 'da', 'bg', 'he', 'lt', 'hy', 'hr', 'sl', 'et', 'uz',
-'gl', 'nn', 'vo', 'la', 'simple', 'el', 'hi', 'az', 'th', 'ka',
-'ce', 'oc', 'be', 'mk', 'mg', 'new', 'ur', 'tt', 'ta', 'pms', 'cy',
-'tl', 'lv', 'bs', 'te', 'be-x-old', 'br', 'ht', 'sq', 'jv', 'lb',
-'mr', 'is', 'ml', 'zh-yue', 'bn', 'af', 'ba', 'ga', 'pnb', 'cv',
-'fy', 'lmo', 'tg', 'sco', 'my', 'yo', 'an', 'ky', 'sw', 'io', 'ne',
-'gu', 'scn', 'bpy', 'nds', 'ku', 'ast', 'qu', 'als', 'su', 'pa',
-'kn', 'ckb', 'ia', 'mn', 'nap', 'bug', 'arz', 'bat-smg', 'wa',
-'zh-min-nan', 'am', 'map-bms', 'gd', 'yi', 'mzn', 'si', 'fo', 
'bar',
-'vec', 'nah', 'sah', 'os', 'sa', 'roa-tara', 'li', 'hsb', 'or',
-'pam', 'mrj', 'mhr', 'se', 'mi', 'ilo', 'hif', 'bcl', 'gan', 'rue',
-'ps', 'glk', 'nds-nl', 'bo', 'vls', 'diq', 'fiu-vro', 'bh', 'xmf',
-'tk', 'gv', 'sc', 'co', 'csb', 'hak', 'km', 'kv', 'vep', 'zea',
-'crh', 'zh-classical', 'frr', 'eml', 'ay', 'stq', 'udm', 'wuu',
-'nrm', 'kw', 'rm', 'szl', 'so', 'koi', 'as', 'lad', 'fur', 'mt',
-'dv', 'gn', 'dsb', 'ie', 'pcd', 'sd', 'lij', 'cbk-zam', 'cdo',
-'ksh', 'ext', 'mwl', 'gag', 'ang', 'ug', 'ace', 'pi', 'pag', 'nv',
-'lez', 'frp', 'sn', 'kab', 'ln', 'myv', 'pfl', 'xal', 'krc', 'haw',
-'rw', 'pdc', 'kaa', 'to', 'kl', 'arc', 'nov', 'kbd', 'av', 'bxr',
-'lo', 'bjn', 'ha', 'tet', 'tpi', 'na', 'pap', 'lbe', 'jbo', 'ty',
- 

[MediaWiki-commits] [Gerrit] [bugfix] re-enable 'Quit' option for BaseBot.user_confirm me... - change (pywikibot/core)

2016-02-07 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268945

Change subject: [bugfix] re-enable 'Quit' option for BaseBot.user_confirm 
method.
..

[bugfix] re-enable 'Quit' option for BaseBot.user_confirm method.

'Quit' option was lost in I3d4ea6461 but still needed.
This patch re-enables this option, discarding automatic_quit and
call the corresponding regular BaseBot.quit method instead of
raising an exception which could crop out elsewhere.

Bug: T126154
Change-Id: I0cbc61eb23194a29a5a1e85864ceb0d48305e20b
---
M pywikibot/bot.py
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/45/268945/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 18436db..eed8f6e 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1222,8 +1222,10 @@
 choice = pywikibot.input_choice(question,
 [('Yes', 'y'),
  ('No', 'N'),
- ('All', 'a')],
-default='N')
+ ('All', 'a'),
+ ('Quit', 'q')],
+default='N',
+automatic_quit=False)
 
 if choice == 'n':
 return False

-- 
To view, visit https://gerrit.wikimedia.org/r/268945
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cbc61eb23194a29a5a1e85864ceb0d48305e20b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Simplify arg parsing in handle_args method - change (pywikibot/core)

2016-02-07 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268962

Change subject: [IMPR] Simplify arg parsing in handle_args method
..

[IMPR] Simplify arg parsing in handle_args method

- avoid length checking logic per argument
- simplify logic for default values
- logic and variable names are uniform for all args
- redurce local variables

Change-Id: Id3bf4041dcd4a525269457c29ad887108c4f5a54
---
M pywikibot/bot.py
1 file changed, 27 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/62/268962/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 18436db..4fb3a13 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -841,35 +841,32 @@
 username = None
 do_help = None if do_help else False
 for arg in args:
-if do_help is not False and arg == '-help':
+option, sep, value = arg.partition(':')
+if do_help is not False and option == '-help':
 do_help = True
-elif arg.startswith('-dir:'):
+elif option == '-dir':
 pass
-elif arg.startswith('-family:'):
-config.family = arg[len("-family:"):]
-elif arg.startswith('-lang:'):
-config.mylang = arg[len("-lang:"):]
-elif arg.startswith("-user:"):
-username = arg[len("-user:"):]
-elif arg.startswith('-putthrottle:'):
-config.put_throttle = int(arg[len("-putthrottle:"):])
-elif arg.startswith('-pt:'):
-config.put_throttle = int(arg[len("-pt:"):])
-elif arg == '-log':
+elif option == '-family':
+config.family = value
+elif option == '-lang'):
+config.mylang = value
+elif option == '-user:':
+username = value
+elif option in ('-putthrottle', '-pt'):
+config.put_throttle = int(value)
+elif option == '-log':
 if moduleName not in config.log:
 config.log.append(moduleName)
-elif arg.startswith('-log:'):
-if moduleName not in config.log:
-config.log.append(moduleName)
-config.logfilename = arg[len("-log:"):]
-elif arg == '-nolog':
+if value:
+config.logfilename = value
+elif option == '-nolog':
 if moduleName in config.log:
 config.log.remove(moduleName)
-elif arg in ('-cosmeticchanges', '-cc'):
+elif option in ('-cosmeticchanges', '-cc'):
 config.cosmetic_changes = not config.cosmetic_changes
 output(u'NOTE: option cosmetic_changes is %s\n'
% config.cosmetic_changes)
-elif arg == '-simulate':
+elif option == '-simulate':
 config.simulate = True
 #
 #  DEBUG control:
@@ -896,31 +893,28 @@
 #If used, "-debug" turns on file logging, regardless of any
 #other settings.
 #
-elif arg == '-debug':
+elif option == '-debug':
 if moduleName not in config.log:
 config.log.append(moduleName)
-if "" not in config.debug_log:
+if value:
+if value not in config.debug_log:
+config.debug_log.append(value)
+elif '' not in config.debug_log:
 config.debug_log.append("")
-elif arg.startswith("-debug:"):
-if moduleName not in config.log:
-config.log.append(moduleName)
-component = arg[len("-debug:"):]
-if component not in config.debug_log:
-config.debug_log.append(component)
-elif arg in ('-verbose', '-v'):
+elif option in ('-verbose', '-v'):
 config.verbose_output += 1
-elif arg.startswith('-daemonize'):
-redirect_std = arg[len('-daemonize:'):] if ':' in arg else None
+elif option == '-daemonize':
+redirect_std = value if value else None
 daemonize.daemonize(redirect_std=redirect_std)
 else:
 # the argument depends on numerical config settings
 # e.g. -maxlag:
 try:
-_arg, _val = arg[1:].split(':')
+_arg = option[1:]
 # explicitly check for int (so bool doesn't match)
 if not isinstance(getattr(config, _arg), int):
 raise TypeError
-setattr(config, _arg, int(_val))
+setattr(config, _arg, int(value))
 except (ValueError, TypeError, AttributeError):
 # argument not global -> specific bot script will take care
 nonGlobalArgs.append(arg)

-- 
To view, visit https://gerrit.wikimedia.org/r/268962
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: 

[MediaWiki-commits] [Gerrit] remove manual ignoring list - change (pywikibot...xqbot)

2016-02-06 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268882

Change subject: remove manual ignoring list
..

remove manual ignoring list

Change-Id: I6160c327482723947353b8c3674553199d1d9daf
---
M afd-notice.py
1 file changed, 0 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/82/268882/1

diff --git a/afd-notice.py b/afd-notice.py
index 14d1916..3843fca 100644
--- a/afd-notice.py
+++ b/afd-notice.py
@@ -81,8 +81,6 @@
 if page.namespace() in (2, 3):
 self.ignoreUser.add(page.title(withNamespace=False,

withSection=False).split('/')[0])
-# ignore some other people
-self.ignoreUser.add('Liesel')
 
 pywikibot.output(u'%d users found to opt-out' % len(self.ignoreUser))
 cat1 = pywikibot.Category(self.site,

-- 
To view, visit https://gerrit.wikimedia.org/r/268882
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6160c327482723947353b8c3674553199d1d9daf
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] remove manual ignoring list - change (pywikibot...xqbot)

2016-02-06 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: remove manual ignoring list
..


remove manual ignoring list

Change-Id: I6160c327482723947353b8c3674553199d1d9daf
---
M afd-notice.py
1 file changed, 0 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/afd-notice.py b/afd-notice.py
index 14d1916..3843fca 100644
--- a/afd-notice.py
+++ b/afd-notice.py
@@ -81,8 +81,6 @@
 if page.namespace() in (2, 3):
 self.ignoreUser.add(page.title(withNamespace=False,

withSection=False).split('/')[0])
-# ignore some other people
-self.ignoreUser.add('Liesel')
 
 pywikibot.output(u'%d users found to opt-out' % len(self.ignoreUser))
 cat1 = pywikibot.Category(self.site,

-- 
To view, visit https://gerrit.wikimedia.org/r/268882
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6160c327482723947353b8c3674553199d1d9daf
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] use target title property instead of deprecated new... - change (pywikibot...xqbot)

2016-02-06 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268881

Change subject: [bugfix] use target title property instead of deprecated 
new_title method
..

[bugfix] use target title property instead of deprecated new_title method

lastmove.target_title gives the title of the moved target
whereas new_title() gives a Page object and could not compared with the
new page titles.

Change-Id: I38e00eeceebd2e7c06f08230e39830ea2e41d041
---
M afd-notice.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/81/268881/1

diff --git a/afd-notice.py b/afd-notice.py
index d8d7265..14d1916 100644
--- a/afd-notice.py
+++ b/afd-notice.py
@@ -57,9 +57,9 @@
 try:
 lastmove = next(gen)
 except StopIteration:
-return
+pass
 else:
-return lastmove.new_title()
+return lastmove.target_title
 
 def run(self):
 """Run the bot."""

-- 
To view, visit https://gerrit.wikimedia.org/r/268881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38e00eeceebd2e7c06f08230e39830ea2e41d041
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] use target title property instead of deprecated new... - change (pywikibot...xqbot)

2016-02-06 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: [bugfix] use target title property instead of deprecated 
new_title method
..


[bugfix] use target title property instead of deprecated new_title method

lastmove.target_title gives the title of the moved target
whereas new_title() gives a Page object and could not compared with the
new page titles.

Change-Id: I38e00eeceebd2e7c06f08230e39830ea2e41d041
---
M afd-notice.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved



diff --git a/afd-notice.py b/afd-notice.py
index d8d7265..14d1916 100644
--- a/afd-notice.py
+++ b/afd-notice.py
@@ -57,9 +57,9 @@
 try:
 lastmove = next(gen)
 except StopIteration:
-return
+pass
 else:
-return lastmove.new_title()
+return lastmove.target_title
 
 def run(self):
 """Run the bot."""

-- 
To view, visit https://gerrit.wikimedia.org/r/268881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I38e00eeceebd2e7c06f08230e39830ea2e41d041
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] remove unused save method - change (pywikibot...xqbot)

2016-02-06 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268885

Change subject: [IMPR] remove unused save method
..

[IMPR] remove unused save method

Change-Id: I24b6aad7761be1bb2ca65a492ee705cf13da0765
---
M afd-notice.py
1 file changed, 0 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/85/268885/1

diff --git a/afd-notice.py b/afd-notice.py
index 3843fca..96fb718 100644
--- a/afd-notice.py
+++ b/afd-notice.py
@@ -226,22 +226,6 @@
 pywikibot.output(u'WARNING: Page %s not saved.'
  % talk.title(asLink=True))
 
-def load(self, page):
-"""
-Loads the given page, does some changes, and saves it.
-"""
-try:
-# Load the page
-text = page.text
-except pywikibot.NoPage:
-pywikibot.output(u"Page %s does not exist; skipping."
- % page.title(asLink=True))
-except pywikibot.IsRedirectPage:
-pywikibot.output(u"Page %s is a redirect; skipping."
- % page.title(asLink=True))
-else:
-return text
-
 def save(self, text, page, comment=None, minorEdit=True,
  botflag=True):
 old = u''

-- 
To view, visit https://gerrit.wikimedia.org/r/268885
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24b6aad7761be1bb2ca65a492ee705cf13da0765
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add some functionality from compat apispec to core - change (pywikibot/core)

2016-01-30 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267435

Change subject: Add some functionality from compat apispec to core
..

Add some functionality from compat apispec to core

apispec.py is not used in compat bur some methods are usable for core too.
Below a list where you find the old apispec functionality (left)
in core (right)

iso -> Timestamp.isoformat
uniso -> Timestamp.pretty_format (* new *)
dt -> Timestamp.totimestampformat
duration -> BlockEntry.duration

Blocks.__init__ -> (* obsolete constructor *)
Blocks.empty -> (* obsolete parameter cleanup *)
Blocks.query -> site.blocks or site.logevents('block')
Blocks.IPsortkey -> (* sort key, not needed * )
Blocks.allblocks ->  site.blocks or site.logevents('block')
Blocks.user -> site.blocks(user=user)
Blocks.IP -> site.blocks(iprange=IP)

Bug: T66835
Change-Id: I310d2b28389d143051afcef5137e60ba20e535ae
---
M pywikibot/__init__.py
M pywikibot/site.py
2 files changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/35/267435/1

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index a5ff2d6..0b58046 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -154,6 +154,7 @@
 
 mediawikiTSFormat = "%Y%m%d%H%M%S"
 ISO8601Format = "%Y-%m-%dT%H:%M:%SZ"
+prettyFormat =  '%Y-%m-%d %H:%M:%S'
 
 def clone(self):
 """Clone this instance."""
@@ -190,6 +191,16 @@
 toISOformat = redirect_func(isoformat, old_name='toISOformat',
 class_name='Timestamp')
 
+def pretty_format(self):
+"""
+Convert object to an pretty timestamp string.
+
+This is the same as ISO 8601 except 'T' and 'Z' are left for better
+readability.
+@note: similar to compat's apispec.uniso()
+"""
+return self.strftime(self.prettyFormat)
+
 def totimestampformat(self):
 """Convert object to a MediaWiki internal timestamp."""
 return self.strftime(self.mediawikiTSFormat)
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 4032896..eaecfbc 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4122,7 +4122,7 @@
blockids=None, users=None, iprange=None, step=None, total=None):
 """Iterate all current blocks, in order of creation.
 
-Note that logevents only logs user blocks, while this method
+@note: logevents only logs user blocks, while this method
 iterates all blocks including IP ranges.  The iterator yields dicts
 containing keys corresponding to the block properties
 (see L{https://www.mediawiki.org/wiki/API:Blocks}).
@@ -4228,6 +4228,9 @@
   step=None, total=None):
 """Iterate all log entries.
 
+@note: logevents with logtype='block' only logs user blocks whereas
+site.blocks iterates all blocks including IP ranges.
+
 @param logtype: only iterate entries of this type (see wiki
 documentation for available types, which will include "block",
 "protect", "rights", "delete", "upload", "move", "import",

-- 
To view, visit https://gerrit.wikimedia.org/r/267435
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I310d2b28389d143051afcef5137e60ba20e535ae
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [FEAT] Enable iprange with site.blocks generator. - change (pywikibot/core)

2016-01-30 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267434

Change subject: [FEAT] Enable iprange with site.blocks generator.
..

[FEAT] Enable iprange with site.blocks generator.

mw API provides bkip parameter to filter an ip address or an ip range block.
Enable this feature with pwb.

Also add some additional documentations.

Bug: T125303
Change-Id: I9f4698a0b8319f8fb869c46c7d82e8d25a189822
---
M pywikibot/site.py
1 file changed, 17 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/34/267434/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 369972c..4032896 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4119,7 +4119,7 @@
 return aigen
 
 def blocks(self, starttime=None, endtime=None, reverse=False,
-   blockids=None, users=None, step=None, total=None):
+   blockids=None, users=None, iprange=None, step=None, total=None):
 """Iterate all current blocks, in order of creation.
 
 Note that logevents only logs user blocks, while this method
@@ -4128,10 +4128,21 @@
 (see L{https://www.mediawiki.org/wiki/API:Blocks}).
 
 @param starttime: start iterating at this Timestamp
+@type starttime: pywikibot.Timestamp
 @param endtime: stop iterating at this Timestamp
+@type endtime: pywikibot.Timestamp
 @param reverse: if True, iterate oldest blocks first (default: newest)
-@param blockids: only iterate blocks with these id numbers
+@type reverse: bool
+@param blockids: only iterate blocks with these id numbers. Numbers
+must be separated by '|' if given by a basestring.
+@type params: basestring, tuple or list
 @param users: only iterate blocks affecting these usernames or IPs
+@type params: basestring, tuple or list
+@param iprange: a single IP or an IP range. ranges broader than
+IPv4/16 or IPv6/19 are not accepted.
+@note: Cannot be used together with users. 
+@param total: total amount of block entries
+@type total: int
 """
 if starttime and endtime:
 if reverse:
@@ -4146,7 +4157,8 @@
 "endtime must be before starttime with reverse=False")
 bkgen = self._generator(api.ListGenerator, type_arg="blocks",
 step=step, total=total)
-bkgen.request["bkprop"] = 
"id|user|by|timestamp|expiry|reason|range|flags"
+bkgen.request['bkprop'] = (
+'id|user|userid|by|timestamp|expiry|reason|range|flags')
 if starttime:
 bkgen.request["bkstart"] = starttime
 if endtime:
@@ -4163,6 +4175,8 @@
 users = [user.upper() if is_IP(user) and '::' not in user else user
  for user in users]
 bkgen.request["bkusers"] = users
+elif iprange:
+bkgen.requests['bkip'] = iprange
 return bkgen
 
 def exturlusage(self, url=None, protocol="http", namespaces=None,

-- 
To view, visit https://gerrit.wikimedia.org/r/267434
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f4698a0b8319f8fb869c46c7d82e8d25a189822
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] socketIO_client 0.5.6 is needed for socket-io 0.9 protokoll - change (pywikibot/core)

2016-01-29 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267220

Change subject: socketIO_client 0.5.6 is needed for socket-io 0.9 protokoll
..

socketIO_client 0.5.6 is needed for socket-io 0.9 protokoll

See T91393, T68232, T125059

Change-Id: Ic3ed52ccdae65dc44f4f5f495f4fc2f6e2d413c2
---
M pywikibot/comms/rcstream.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/20/267220/1

diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py
index 95056fd..02cbd6b 100644
--- a/pywikibot/comms/rcstream.py
+++ b/pywikibot/comms/rcstream.py
@@ -171,8 +171,8 @@
 
 """
 if isinstance(socketIO_client, Exception):
-raise ImportError('socketIO_client is required for the rc stream; '
-  'install it with pip install socketIO_client')
+raise ImportError('socketIO_client is required for the rc stream;\n'
+  'install it with pip install 
"socketIO_client==0.5.6"')
 
 rc_thread = RcListenerThread(
 wikihost=wikihost,

-- 
To view, visit https://gerrit.wikimedia.org/r/267220
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3ed52ccdae65dc44f4f5f495f4fc2f6e2d413c2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [BREAK][bugfix] Bot class arguments for constructor - change (pywikibot/core)

2016-01-28 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266998

Change subject: [BREAK][bugfix] Bot class arguments for constructor
..

[BREAK][bugfix] Bot class arguments for constructor

Bot class arguments for constructor should be called as keyword argument

Bot class handles 'site' and ' always' as keyword arguments. In replace.py
instantiating the bot uses postional argument which breaks this rule and
derived bots may be break if not all (positional) arguments are given.

- instantiate ReplaceRobot with keyword arguments for 'always' and 'site'
  handled by bot class to allow other bots to use this special bot.
- catch them with **kwargs
- remove unused and deprecated acceptall variable
- this also solves the 2nd warning issue of 
https://gerrit.wikimedia.org/r/#/c/266321/

Bug T125046
Bug:T125049

Change-Id: I23570783fda9f497a6f57aaa8f5e17895534af50
---
M scripts/replace.py
1 file changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/98/266998/1

diff --git a/scripts/replace.py b/scripts/replace.py
index 0941a59..7c5bd72 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -479,8 +479,8 @@
 
 @deprecated_args(acceptall='always')
 def __init__(self, generator, replacements, exceptions={},
- always=False, allowoverlap=False, recursive=False,
- addedCat=None, sleep=None, summary='', site=None, **kwargs):
+ allowoverlap=False, recursive=False, addedCat=None,
+ sleep=None, summary='', **kwargs):
 """
 Constructor.
 
@@ -520,8 +520,6 @@
 
 """
 super(ReplaceRobot, self).__init__(generator=generator,
-   always=always,
-   site=site,
**kwargs)
 
 for i, replacement in enumerate(replacements):
@@ -535,7 +533,6 @@
 replacement[1])
 self.replacements = replacements
 self.exceptions = exceptions
-self.acceptall = always  # deprecated
 self.allowoverlap = allowoverlap
 self.recursive = recursive
 
@@ -1108,9 +1105,9 @@
 return False
 
 preloadingGen = pagegenerators.PreloadingGenerator(gen)
-bot = ReplaceRobot(preloadingGen, replacements, exceptions, acceptall,
+bot = ReplaceRobot(preloadingGen, replacements, exceptions,
allowoverlap, recursive, add_cat, sleep, edit_summary,
-   site)
+   allways=acceptall, site=site)
 site.login()
 bot.run()
 

-- 
To view, visit https://gerrit.wikimedia.org/r/266998
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23570783fda9f497a6f57aaa8f5e17895534af50
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use common copyright string, keep lines beneath 80 chars - change (pywikibot/core)

2016-01-28 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267003

Change subject: Use common copyright string, keep lines beneath 80 chars
..

Use common copyright string, keep lines beneath 80 chars

Change-Id: Iede65d5d893499a74ac49911c7d9383adbf07919
---
M pywikibot/comms/rcstream.py
1 file changed, 20 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/03/267003/1

diff --git a/pywikibot/comms/rcstream.py b/pywikibot/comms/rcstream.py
index 95056fd..bead5ee 100644
--- a/pywikibot/comms/rcstream.py
+++ b/pywikibot/comms/rcstream.py
@@ -2,14 +2,21 @@
 """
 SocketIO-based rcstream client.
 
-(c) 2014 Merlijn van Deen
 
-This file is part of the Pywikibot framework, and is licensed under the MIT 
license.
+This file is part of the Pywikibot framework.
 
 This module requires socketIO_client to be installed:
 pip install socketIO_client
 """
 from __future__ import absolute_import, unicode_literals
+#
+# (C) 2014 Merlijn van Deen
+# (C) Pywikibot team, 2015-2016
+#
+# Distributed under the terms of the MIT license.
+#
+
+__version__ = '$Id$'
 
 import sys
 import threading
@@ -62,7 +69,7 @@
  'server_url': 'http://en.wikipedia.org', 'id': 703158386,
  'revision': {'new': 640271171, 'old': 468264850},
  'type': 'edit', 'namespace': 0}
->>> t.stop()  # optional, the thread will shut down on exiting python as 
well
+>>> t.stop()  # optional, the thread will shut down on exiting python
 """
 
 def __init__(self, wikihost, rchost, rcport=80, rcpath='/rc', total=None):
@@ -132,7 +139,11 @@
 )
 
 def run(self):
-"""Threaded function. Runs insided the thread when started with 
.start()."""
+"""
+Threaded function.
+
+Runs insided the thread when started with .start().
+"""
 self.running = True
 while self.running:
 self.client.wait(seconds=0.1)
@@ -160,15 +171,15 @@
 @param total: the maximum number of entries to return. The underlying 
thread
   is shut down then this number is reached.
 
-@yields dict: dict as formatted by MediaWiki's 
MachineReadableRCFeedFormatter[1],
-  which consists of at least id (recent changes id), type 
('edit',
-  'new', 'log' or 'external'), namespace, title, comment, 
timestamp,
-  user and bot (bot flag for the change). See [1] for more 
details.
+@yields dict: dict as formatted by MediaWiki's
+MachineReadableRCFeedFormatter[1], which consists of at least id
+(recent changes id), type ('edit', 'new', 'log' or 'external'),
+namespace, title, comment, timestamp, user and bot (bot flag for the
+change). See [1] for more details.
 
 @raises ImportError
 
 [1]: See mediawiki/includes/rcfeed/MachineReadableRCFeedFormatter.php
-
 """
 if isinstance(socketIO_client, Exception):
 raise ImportError('socketIO_client is required for the rc stream; '

-- 
To view, visit https://gerrit.wikimedia.org/r/267003
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iede65d5d893499a74ac49911c7d9383adbf07919
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Simplify option init - change (pywikibot/core)

2016-01-28 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266999

Change subject: Simplify option init
..

Simplify option init

options are already initialized. A second call of constructor resets them.
Therefore reset them be it's own.

Change-Id: I98672d6b2773eba7526510fa83223f472b736be1
---
M scripts/template.py
1 file changed, 1 insertion(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/99/266999/1

diff --git a/scripts/template.py b/scripts/template.py
index 783da18..9e0cb85 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -247,10 +247,7 @@
  r'{{%s\g}}' % new))
 
 super(TemplateRobot, self).__init__(
-generator, replacements, exceptions,
-always=self.getOption('always'),
-addedCat=self.getOption('addedCat'),
-summary=self.getOption('summary'))
+generator, replacements, exceptions, **self.options)
 
 
 def main(*args):

-- 
To view, visit https://gerrit.wikimedia.org/r/266999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98672d6b2773eba7526510fa83223f472b736be1
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] Don't reset Bot._site to None if we have already a ... - change (pywikibot/core)

2016-01-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266994

Change subject: [bugfix] Don't reset Bot._site to None if we have already a 
site object
..

[bugfix] Don't reset Bot._site to None if we have already a site object

Bug: T125046
Change-Id: Id900d93b6235ea4ec60a0db97d7b7da2828fcaad
---
M pywikibot/bot.py
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/94/266994/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 18436db..f47f0fc 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1447,7 +1447,12 @@
 """Create a Bot instance and initalize cached sites."""
 # TODO: add warning if site is specified and generator
 # contains pages from a different site.
-self._site = kwargs.pop('site', None)
+site = kwargs.pop('site', None)
+# Do not set self._site to None if we already have it
+if site is not None:
+self._site = site
+elif not hasattr(self, '_site'):
+self._site = None
 self._sites = set([self._site] if self._site else [])
 
 super(Bot, self).__init__(**kwargs)

-- 
To view, visit https://gerrit.wikimedia.org/r/266994
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id900d93b6235ea4ec60a0db97d7b7da2828fcaad
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [FEAT] Introduce a new site method page_from_repository() - change (pywikibot/core)

2016-01-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266702

Change subject: [FEAT] Introduce a new site method page_from_repository()
..

[FEAT] Introduce a new site method page_from_repository()

This method returns a page object for a given site and item number.
This could easily used to localize scripts for several sites.

A sample for de-wiki looks like:

>>> import pwb, pywikibot as py
>>> s = py.Site()
>>> p = s.page_from_repository('Q131303')
>>> p
Page(Hallo-Welt-Programm)

- use this method for several scripts
- L10N for clean_sandbox.py
- some tests added
- remove explicit "return None" which is implicit done while leaving a method

Change-Id: If2c4b0e8d0b8499c4df1879a63d0dbad7643ff82
---
M pywikibot/site.py
M scripts/category_redirect.py
M scripts/clean_sandbox.py
M scripts/featured.py
M scripts/fixing_redirects.py
M tests/site_tests.py
6 files changed, 71 insertions(+), 64 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/02/266702/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 369972c..04e7c0d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -2739,10 +2739,8 @@
 except SiteDefinitionError as e:
 pywikibot.warning('Site "{0}" supports wikibase at "{1}", but '
   'creation failed: {2}.'.format(self, url, e))
-return None
 else:
 assert 'warnings' in data
-return None
 
 def is_image_repository(self):
 """Return True if Site object is the image repository."""
@@ -2752,6 +2750,26 @@
 """Return True if its data repository is itself."""
 return self is self.data_repository()
 
+def page_from_repository(self, item):
+"""
+Return a Page for this site object specified by wikibase item.
+
+@param item: id number of item, "Q###",
+@type item: str
+@return: pywikibot.Page given by wikibase item number for this site
+object.
+@rtype: pywikibot.Page or None
+"""
+if self.has_data_repository:
+repo = self.data_repository()
+dp = pywikibot.ItemPage(repo, item)
+try:
+page_title = dp.getSitelink(self)
+except pywikibot.NoPage:
+pass
+else:
+return pywikibot.Page(self, page_title)
+
 def nice_get_address(self, title):
 """Return shorter URL path to retrieve page titled 'title'."""
 # 'title' is expected to be URL-encoded already
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 51e3159..ac0c0d3 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -109,12 +109,8 @@
 def get_cat_title(self):
 """Specify the category title."""
 if self.getOption('tiny'):
-repo = self.site.data_repository()
-dp = pywikibot.ItemPage(repo, self.tiny_cat_redirect_cat)
-try:
-self.cat_title = dp.getSitelink(self.site)
-except pywikibot.NoPage:
-self.cat_title = None
+page = self.site.page_from_repository(self.tiny_cat_redirect_cat)
+self.cat_title = page.title() if page is not None else None
 else:
 self.cat_title = pywikibot.translate(self.site,
  self.cat_redirect_cat,
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 6dfe4e1..79edaa3 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -99,42 +99,7 @@
 'zh': u'{{subst:User:Sz-iwbot/sandbox}}\r\n',
 }
 
-sandboxTitle = {
-'commons': u'Project:Sandbox',
-'als': u'Project:Sandchaschte',
-'ar': u'Project:ملعب',
-'arz': u'Project:السبوره',
-'az': u'Vikipediya:Qaralama dəftəri',
-'bar': u'Project:Spuiwiesn',
-'cs': u'Project:Pískoviště',
-'da': u'Project:Sandkassen',
-'de': u'Project:Spielwiese',
-'en': u'Project:Sandbox',
-'eo': 'Project:Provejo',
-'fa': [u'Project:صفحه تمرین', u'Project:آشنایی با ویرایش'],
-'fi': u'Project:Hiekkalaatikko',
-'fr': u'Project:Bac à sable',
-'he': u'Project:ארגז חול',
-'id': u'Project:Bak pasir',
-'it': u'Project:Pagina delle prove',
-'ja': u'Project:サンドボックス',
-'ko': u'Project:연습장',
-'ksh': u'Project:Shpillplaz',
-'mzn': u'Project:چنگ‌مویی صفحه',
-'nds': u'Project:Speelwisch',
-'nl': u'Project:Zandbak',
-'no': u'Project:Sandkasse',
-'pl': u'Project:Brudnopis',
-'pt': u'Project:Página de testes',
-'ru': u'Project:Песочница',
-'simple': u'Project:Sandbox',
-'sco': u'Project:Saundbox',
-'sr': u'Project:Песак',
-'sv': u'Project:Sandlådan',
-'th': u'Project:ทดลองเขียน',
-'tr': u'Vikipedi:Deneme tahtası',
-'zh': u'Project:沙盒',
-}
+sandboxTitle = 

[MediaWiki-commits] [Gerrit] [bugfix] -nolog option must also disable general '*' setting - change (pywikibot/core)

2016-01-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266735

Change subject: [bugfix] -nolog option must also disable general '*' setting
..

[bugfix] -nolog option must also disable general '*' setting

- update changes from master
- also synchronize trivial changes mainly documentations

Bug: T56897
Change-Id: I76987e591bba166ccc2ac9c5d93f6b1be002d89f
---
M pywikibot/bot.py
1 file changed, 58 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/35/266735/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index feaa3d5..12585ce 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1,7 +1,36 @@
 # -*- coding: utf-8  -*-
-"""User-interface related functions for building bots."""
+"""
+User-interface related functions for building bots.
+
+This module supports several different bot classes which could be used in
+conjunction. Each bot should subclass Bot class:
+
+* L{Bot}: The previous base class which should be avoided. This class is mainly
+  used for bots which work with wikibase or together with an image repository.
+
+Additionally there is the L{CurrentPageBot} class which automatically sets the
+current page to the page treated. It is recommended to use this class and to
+use C{treat_page} instead of C{treat} and C{put_current} instead of C{userPut}.
+It by default subclasses the C{BaseBot} class.
+
+With L{CurrentPageBot} it's possible to subclass one of the following classes 
to
+filter the pages which are ultimately handled by C{treat_page}:
+
+* L{ExistingPageBot}: Only handle pages which do exist.
+* L{CreatingPageBot}: Only handle pages which do not exist.
+* L{RedirectPageBot}: Only handle pages which are redirect pages.
+* L{NoRedirectPageBot}: Only handle pages which are not redirect pages.
+* L{FollowRedirectPageBot}: If the generator returns a redirect page it'll
+  follow the redirect and instead work on the redirected class.
+
+It is possible to combine filters by subclassing multiple of them. They are
+new-style classes so when a class is first subclassing L{ExistingPageBot} and
+then L{FollowRedirectPageBot} it will also work on pages which do not exist 
when
+a redirect pointed to that. If the order is inversed it'll first follow them 
and
+then check whether they exist.
+"""
 #
-# (C) Pywikibot team, 2008-2015
+# (C) Pywikibot team, 2008-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -203,9 +232,10 @@
 user interfaces (GUIs) without modifying the core bot code.
 
 The following output levels are defined:
+
  - DEBUG: only for file logging; debugging messages.
  - STDOUT: output that must be sent to sys.stdout (for bots that may
- have their output redirected to a file or other destination).
+   have their output redirected to a file or other destination).
  - VERBOSE: optional progress information for display to user.
  - INFO: normal (non-optional) progress information for display to user.
  - INPUT: prompts requiring user response.
@@ -213,7 +243,7 @@
  - ERROR: user error messages.
  - CRITICAL: fatal error messages.
 
-Accordingly, do ''not'' use print statements in bot code; instead,
+Accordingly, do **not** use print statements in bot code; instead,
 use pywikibot.output function.
 
 @param strm: Output stream. If None, re-uses the last stream if one
@@ -334,7 +364,10 @@
 all_modules = sys.modules.keys()
 
 # These are the main dependencies of pywikibot.
-check_package_list = ['httplib2', 'mwparserfromhell']
+check_package_list = [
+'httplib2',
+'mwparserfromhell',
+]
 
 # report all imported packages
 if config.verbose_output:
@@ -566,7 +599,7 @@
 @type question: basestring
 @param answers: The valid answers each containing a full length answer and
 a shortcut. Each value must be unique.
-@type answers: Iterable containing an iterable of length two
+@type answers: Iterable containing a sequence of length two
 @param default: The result if no answer was entered. It must not be in the
 valid answers and can be disabled by setting it to None. If it should
 be linked with the valid answers it must be its shortcut.
@@ -575,7 +608,7 @@
 returned.
 @type return_shortcut: bool
 @param automatic_quit: Adds the option 'Quit' ('q') and throw a
-L{QuitKeyboardInterrupt} if selected.
+L{QuitKeyboardInterrupt} if selected.
 @type automatic_quit: bool
 @param force: Automatically use the default
 @type force: bool
@@ -594,7 +627,7 @@
 
 def input_yn(question, default=None, automatic_quit=True, force=False):
 """
-Ask the user a yes/no question and returns the answer as a bool.
+Ask the user a yes/no question and return the answer as a bool.
 
 @param question: The question asked without trailing spaces.
 @type 

[MediaWiki-commits] [Gerrit] [bugfix] -nolog option must also disable general '*' setting - change (pywikibot/core)

2016-01-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266720

Change subject: [bugfix] -nolog option must also disable general '*' setting
..

[bugfix] -nolog option must also disable general '*' setting

Bug: T56897
Change-Id: Iab5e3b2271796db99345139769704500f407a4e0
---
M pywikibot/bot.py
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/20/266720/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 18436db..df771e8 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -865,6 +865,8 @@
 elif arg == '-nolog':
 if moduleName in config.log:
 config.log.remove(moduleName)
+if '*' in config.log:
+config.log.remove('*')
 elif arg in ('-cosmeticchanges', '-cc'):
 config.cosmetic_changes = not config.cosmetic_changes
 output(u'NOTE: option cosmetic_changes is %s\n'

-- 
To view, visit https://gerrit.wikimedia.org/r/266720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab5e3b2271796db99345139769704500f407a4e0
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [L10N] use category_with_licenses from wikibase (item 'Q4481... - change (pywikibot/core)

2016-01-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266706

Change subject: [L10N] use category_with_licenses from wikibase (item 
'Q4481876')
..

[L10N] use category_with_licenses from wikibase (item 'Q4481876')

Change-Id: I5655d2dacf18aebb9b8451b8c0c96c794b395779
---
M scripts/checkimages.py
1 file changed, 6 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/06/266706/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index f478b9b..3d36ad1 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -462,20 +462,7 @@
 
 # Category with the licenses and / or with subcategories with the other
 # licenses.
-category_with_licenses = {
-'commons': u'Category:License tags',
-'ar': u'تصنيف:قوالب حقوق الصور',
-'de': u'Kategorie:Vorlage:Lizenz für Bilder',
-'en': u'Category:Wikipedia image copyright templates',
-'fa': u'رده:الگو:حق تکثیر پرونده',
-'ga': u'Catagóir:Clibeanna cóipchirt d\'íomhánna',
-'it': u'Categoria:Template Licenze copyright',
-'ja': u'Category:画像の著作権表示テンプレート',
-'ko': u'분류:위키백과 그림 저작권 틀',
-'ta': u'Category:காப்புரிமை வார்ப்புருக்கள்',
-'ur': u'زمرہ:ویکیپیڈیا سانچہ جات حقوق تصاویر',
-'zh': u'Category:版權申告模板',
-}
+category_with_licenses = 'Q4481876'
 
 # Page where is stored the message to send as email to the users
 emailPageWithText = {
@@ -1157,13 +1144,13 @@
 
 def load_licenses(self):
 """Load the list of the licenses."""
-catName = i18n.translate(self.site, category_with_licenses)
-if not catName:
+cat = self.site.page_from_repository(category_with_licenses)
+if not cat:
 raise pywikibot.Error(
-u'No licenses allowed provided, add that option to the code to 
'
-u'make the script working correctly')
+'No licenses allowed provided. Add that category to wikibase '
+'make the script working correctly')
 pywikibot.output(u'\nLoading the allowed licenses...\n')
-cat = pywikibot.Category(self.site, catName)
+cat = pywikibot.Category(cat)
 list_licenses = list(cat.articles())
 if self.site.code == 'commons':
 no_licenses_to_skip = pywikibot.Category(self.site,

-- 
To view, visit https://gerrit.wikimedia.org/r/266706
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5655d2dacf18aebb9b8451b8c0c96c794b395779
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove "step" parameter from site, page and pagegenerators m... - change (pywikibot/core)

2016-01-26 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266476

Change subject: Remove "step" parameter from site, page and pagegenerators 
methods.
..

Remove "step" parameter from site, page and pagegenerators methods.

- deprecate formal "step" parameter
- rename "step" parameter of preloading generators to "groupsize"
- kept for site.loadrevisions
- for generators set_query_increment may be used when needed

Bug: T109208
Change-Id: Iac0afb6479f2c73e08c39412903d1a8d6d5092b9
---
M pywikibot/bot.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/site.py
M scripts/blockpageschecker.py
M scripts/category_redirect.py
M scripts/patrol.py
M scripts/redirect.py
M scripts/reflinks.py
M scripts/weblinkchecker.py
M tests/isbn_tests.py
M tests/pagegenerators_tests.py
M tests/site_tests.py
13 files changed, 339 insertions(+), 374 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/76/266476/1

diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 18436db..27f4006 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -48,7 +48,7 @@
 used.
 """
 #
-# (C) Pywikibot team, 2008-2015
+# (C) Pywikibot team, 2008-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1821,8 +1821,7 @@
 @type property_name: str
 """
 ns = self.site.data_repository().property_namespace
-for page in self.site.search(property_name, step=1, total=1,
- namespaces=ns):
+for page in self.site.search(property_name, total=1, namespaces=ns):
 page = pywikibot.PropertyPage(self.site.data_repository(),
   page.title())
 pywikibot.output(u"Assuming that %s property is %s." %
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 82a9028..217de9b 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -902,9 +902,10 @@
 disambigInPage = disambigs.intersection(templates)
 return self.namespace() != 10 and len(disambigInPage) > 0
 
+@deprecated_args(step=None)
 def getReferences(self, follow_redirects=True, withTemplateInclusion=True,
   onlyTemplateInclusion=False, redirectsOnly=False,
-  namespaces=None, step=None, total=None, content=False):
+  namespaces=None, total=None, content=False):
 """
 Return an iterator all pages that refer to or embed the page.
 
@@ -919,7 +920,6 @@
 is used as a template.
 @param redirectsOnly: if True, only iterate redirects to self.
 @param namespaces: only iterate pages in these namespaces
-@param step: limit each API call to this number of pages
 @param total: iterate no more than this number of pages in total
 @param content: if True, retrieve the content of the current version
 of each referring page (default False)
@@ -936,13 +936,13 @@
 withTemplateInclusion=withTemplateInclusion,
 onlyTemplateInclusion=onlyTemplateInclusion,
 namespaces=namespaces,
-step=step,
 total=total,
 content=content
 )
 
+@deprecated_args(step=None)
 def backlinks(self, followRedirects=True, filterRedirects=None,
-  namespaces=None, step=None, total=None, content=False):
+  namespaces=None, total=None, content=False):
 """
 Return an iterator for pages that link to this page.
 
@@ -951,7 +951,6 @@
 @param filterRedirects: if True, only iterate redirects; if False,
 omit redirects; if None, do not filter
 @param namespaces: only iterate pages in these namespaces
-@param step: limit each API call to this number of pages
 @param total: iterate no more than this number of pages in total
 @param content: if True, retrieve the content of the current version
 of each referring page (default False)
@@ -961,12 +960,12 @@
 followRedirects=followRedirects,
 filterRedirects=filterRedirects,
 namespaces=namespaces,
-step=step,
 total=total,
 content=content
 )
 
-def embeddedin(self, filter_redirects=None, namespaces=None, step=None,
+@deprecated_args(step=None)
+def embeddedin(self, filter_redirects=None, namespaces=None,
total=None, content=False):
 """
 Return an iterator for pages that embed this page as a template.
@@ -974,7 +973,6 @@
 @param filter_redirects: if True, only iterate redirects; if False,
 omit redirects; if None, do not filter
 @param namespaces: only iterate pages in these namespaces
-@param step: limit each API call to this number of pages
 @param total: iterate no more than this number of pages in total
 

[MediaWiki-commits] [Gerrit] [BREAK] Solve -user argument conflict. - change (pywikibot/core)

2016-01-25 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266212

Change subject: [BREAK] Solve -user argument conflict.
..

[BREAK] Solve -user argument conflict.

-user is a global option; rename the local implementation

bug: T87635
Change-Id: Ifb07f1e0d2ddc0e7cb780e21565cdaa04860c5d2
---
M scripts/template.py
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/12/266212/1

diff --git a/scripts/template.py b/scripts/template.py
index fba031c..783da18 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -29,13 +29,13 @@
  info will be loaded from the maintenance page of the live wiki.
  argument can also be given as "-xml:filename.xml".
 
--user:   Only process pages edited by a given user
+-onlyuser:   Only process pages edited by a given user
 
 -skipuser:   Only process pages not edited by a given user
 
--timestamp:  (With -user or -skipuser). Only check for a user where his edit is
- not older than the given timestamp. Timestamp must be writen in
- MediaWiki timestamp format which is "%Y%m%d%H%M%S"
+-timestamp:  (With -onlyuser or -skipuser). Only check for a user where his
+ edit is not older than the given timestamp. Timestamp must be
+ writen in MediaWiki timestamp format which is "%Y%m%d%H%M%S".
  If this parameter is missed, all edits are checked but this is
  restricted to the last 100 edits.
 
@@ -102,8 +102,8 @@
 #
 # (C) Daniel Herding, 2004
 # (C) Rob W.W. Hooft, 2003-2005
-# (C) xqt, 2009-2015
-# (C) Pywikibot team, 2004-2015
+# (C) xqt, 2009-2016
+# (C) Pywikibot team, 2004-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -301,8 +301,8 @@
 options['addedCat'] = arg[len('-addcat:'):]
 elif arg.startswith('-summary:'):
 options['summary'] = arg[len('-summary:'):]
-elif arg.startswith('-user:'):
-user = arg[len('-user:'):]
+elif arg.startswith('-onlyuser:'):
+user = arg[len('-onlyuser:'):]
 elif arg.startswith('-skipuser:'):
 user = arg[len('-skipuser:'):]
 skip = True

-- 
To view, visit https://gerrit.wikimedia.org/r/266212
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb07f1e0d2ddc0e7cb780e21565cdaa04860c5d2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] basic.py is a samply to create bot scripts with pywik... - change (pywikibot/core)

2016-01-24 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266052

Change subject: [IMPR] basic.py is a samply to create bot scripts with 
pywikibot framework
..

[IMPR] basic.py is a samply to create bot scripts with pywikibot framework

- Give a hint to use global simulate option for testings
- Some samples for private options
- remove ugly -dry option which doen't demonstrate anything anymore
- use several bot classes to demonstrate how to use them
- use CurrentPageBot class and treat_page method
- load method is obsolete with some bot subclasses
- additional comments

Change-Id: I2ba391ac22f1083b346dfb16aeeaeed0aa7a8e45
---
M scripts/basic.py
1 file changed, 78 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/52/266052/1

diff --git a/scripts/basic.py b/scripts/basic.py
index f481eb0..0b44275 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -7,16 +7,26 @@
 bots can be made. You can rename it to mybot.py, then edit it in
 whatever way you want.
 
+Use global -simulate option for test purposes. No changes to live wiki
+will be done.
+
 The following parameters are supported:
 
 
 
--dry  If given, doesn't do any real changes, but only shows
-  what would have been changed.
+-always   If used, the bot won't ask if it should file the message
+  onto user talk page.
 
+-text:Use this text to be added; otherwise 'Test' is used
+
+-replace: Dont add text but replace it
+
+-top  Place additional text on top of the page
+
+-summary: Set the action summary message for the edit.
 """
 #
-# (C) Pywikibot team, 2006-2015
+# (C) Pywikibot team, 2006-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -38,65 +48,79 @@
 }
 
 
-class BasicBot(SingleSiteBot):
+class BasicBot(
+# Refer pywikobot.bot for generic bot classes
+SingleSiteBot,  # A bot only working on one site
+# CurrentPageBot,  # Sets 'current_page'. Process it in treat_page method.
+   # Not needed here because we have subclasses
+ExistingPageBot,  # CurrentPageBot which only treats existing pages
+NoRedirectPageBot, # CurrentPageBot which only treats non-redirects
+AutomaticTWSummaryBot,  # Automatically defines summary; needs summary_key
+):
 
 """An incomplete sample bot."""
 
 # Edit summary message that should be used is placed on /i18n subdirectory.
 # The file containing these messages should have the same name as the 
caller
-# script (i.e. basic.py in this case)
+# script (i.e. basic.py in this case). Use summary_key to set the edit
+# summary message.
+summary_key = 'basic-changing'
 
-def __init__(self, generator, dry=False, **kwargs):
+def __init__(self, generator, **kwargs):
 """
 Constructor.
 
 @param generator: the page generator that determines on which pages
 to work
 @type generator: generator
-@param dry: if True, doesn't do any real changes, but only shows
-what would have been changed
-@type dry: bool
 """
-if dry:
-issue_deprecation_warning('dry argument', 
'pywikibot.config.simulate', 1)
-pywikibot.config.simulate = True
+# Add your own options to the bot
+# -always option is predefined by BaseBot class
+self.availableOptions.update({
+'replace': False,  # delete old text and write the new text
+'summary': None,  # your own bot summary
+'text': None,  # add this text. Otherwise use 'Test' as default
+'top': False,  # append text on top of the page
+})
 super(BasicBot, self).__init__(site=True, **kwargs)
 self.generator = generator
 
-# Set the edit summary message
-self.summary = i18n.twtranslate(self.site, 'basic-changing')
-
-def treat(self, page):
-"""Load the given page, does some changes, and saves it."""
-text = self.load(page)
-if not text:
-return
+def treat_page(self):
+"""Load the given page, do some changes, and save it."""
+text = self.currentpage.text
 
 
 # NOTE: Here you can modify the text in whatever way you want. #
 
 
 # If you find out that you do not want to edit this page, just return.
-# Example: This puts the text 'Test' at the beginning of the page.
-text = 'Test ' + text
+# Example: This puts Text on a page.
 
-if not self.userPut(page, page.text, text, summary=self.summary,
-ignore_save_related_errors=True):
-pywikibot.output(u'Page %s not saved.' % 

[MediaWiki-commits] [Gerrit] [bugfix] Fix comparing template name. - change (pywikibot/core)

2016-01-24 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266062

Change subject: [bugfix] Fix comparing template name.
..

[bugfix] Fix comparing template name.

misspellingTemplate may be a tuple.
Check whether a template name is part of it.

Change-Id: I2e9a906ec90a01dec600d8dfa619bd61a5b38363
---
M scripts/misspelling.py
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/62/266062/1

diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 3551f2a..e609fcf 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -129,8 +129,10 @@
 return True
 if self.misspellingTemplate.get(disambPage.site.code) is not None:
 for template, params in disambPage.templatesWithParams():
-if (template.title(withNamespace=False) ==
-self.misspellingTemplate[disambPage.site.code]):
+templates = self.misspellingTemplate[disambPage.site.code]
+if isinstance(templates, basestring):
+templates = (templates, )
+if template.title(withNamespace=False) in templates:
 # The correct spelling is in the last paramter.
 correctSpelling = params[-1]
 # On de.wikipedia, there are some cases where the

-- 
To view, visit https://gerrit.wikimedia.org/r/266062
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e9a906ec90a01dec600d8dfa619bd61a5b38363
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [L10N] use sitename to find the the corresponding site. - change (pywikibot/core)

2016-01-24 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266073

Change subject: [L10N] use sitename to find the the corresponding site.
..

[L10N] use sitename to find the the corresponding site.

bug: T94681
Change-Id: I0eaca5b35435984be5e7516e7e5dc8ebba21cf5e
---
M scripts/misspelling.py
1 file changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/73/266073/1

diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 52da484..a132897 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -57,18 +57,18 @@
 """Spelling bot."""
 
 misspellingTemplate = {
-'de': ('Falschschreibung', 'Obsolete Schreibung'),
+'wikipedia:de': ('Falschschreibung', 'Obsolete Schreibung'),
 }
 
 # Optional: if there is a category, one can use the -start
 # parameter.
 misspellingCategory = {
-'da': u'Omdirigeringer af fejlstavninger',  # only contains date 
redirects at the moment
-'de': ('Kategorie:Wikipedia:Falschschreibung',
+'wikipedia:da': u'Omdirigeringer af fejlstavninger',  # only contains 
date redirects at the moment
+'wikipedia:de': ('Kategorie:Wikipedia:Falschschreibung',
'Kategorie:Wikipedia:Obsolete Schreibung'),
-'en': u'Redirects from misspellings',
-'hu': u'Átirányítások hibás névről',
-'nl': u'Categorie:Wikipedia:Redirect voor spelfout',
+'wikipedia:en': u'Redirects from misspellings',
+'wikipedia:hu': u'Átirányítások hibás névről',
+'wikipedia:nl': u'Categorie:Wikipedia:Redirect voor spelfout',
 }
 
 def __init__(self, always, firstPageTitle, main_only):
@@ -83,9 +83,9 @@
 
 @rtype: generator
 """
-mylang = self.site.code
-if mylang in self.misspellingCategory:
-categories = self.misspellingCategory[mylang]
+sitename = self.site.sitename
+if sitename in self.misspellingCategory:
+categories = self.misspellingCategory[sitename]
 if isinstance(categories, basestring):
 categories = (categories, )
 generators = (
@@ -93,8 +93,8 @@
 pywikibot.Category(self.site, misspellingCategoryTitle),
 recurse=True, start=firstPageTitle)
 for misspellingCategoryTitle in categories)
-elif mylang in self.misspellingTemplate:
-templates = self.misspellingTemplate[mylang]
+elif sitename in self.misspellingTemplate:
+templates = self.misspellingTemplate[sitename]
 if isinstance(templates, basestring):
 templates = (templates, )
 generators = (
@@ -127,9 +127,9 @@
 if disambPage.isRedirectPage():
 self.alternatives.append(disambPage.getRedirectTarget().title())
 return True
-if self.misspellingTemplate.get(disambPage.site.code) is not None:
+if self.misspellingTemplate.get(disambPage.site.sitename) is not None:
 for template, params in disambPage.templatesWithParams():
-templates = self.misspellingTemplate[disambPage.site.code]
+templates = self.misspellingTemplate[disambPage.site.sitename]
 if isinstance(templates, basestring):
 templates = (templates, )
 if template.title(withNamespace=False) in templates:

-- 
To view, visit https://gerrit.wikimedia.org/r/266073
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0eaca5b35435984be5e7516e7e5dc8ebba21cf5e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [L10N] localisation update from master - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263329

Change subject: [L10N] localisation update from master
..

[L10N] localisation update from master

also sync import order and indentation

Change-Id: I16dde49cf457c3c3ec66e375221bde3e03327632
---
M scripts/clean_sandbox.py
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/29/263329/1

diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index b6d9824..5e4e484 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -39,9 +39,11 @@
 __version__ = '$Id$'
 #
 
-import time
 import datetime
+import time
+
 import pywikibot
+
 from pywikibot import i18n, Bot, pagegenerators
 
 content = {
@@ -63,6 +65,7 @@
   u'and editing skills below this line. As this page is for editing '
   u'experiments, this page will automatically be cleaned every 12 '
   u'hours. -->',
+'eo': '{{Bonvolu ne forigi tiun ĉi linion (Provejo)}}',
 'fa': u'{{subst:Wikipedia:ربات/sandbox}}',
 'fi': u'{{subst:Hiekka}}',
 'he': u'{{ארגז חול}}\n',
@@ -87,7 +90,7 @@
 'pt': u'{{página de testes}}\r\n',
 'ru': u'{{/Пишите ниже}}\n',
 'simple': u'{{subst:/Text}}',
-'sco': u'Feel free tae test here',
+'sco': u'{{subst:Saundbox}}',
 'sr': u'{{песак}}\n',
 'sv': u'{{subst:Sandlådan}}',
 'th': 

[MediaWiki-commits] [Gerrit] [sync] Synchronize with master branch: - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263325

Change subject: [sync] Synchronize with master branch:
..

[sync] Synchronize with master branch:

- doc strings
- messages
- import order
- indentation
- copyright string

Change-Id: Icc9b9509139357efff1298e50fe83fa9150c91bd
---
M scripts/__init__.py
M scripts/add_text.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/blockreview.py
M scripts/capitalize_redirects.py
7 files changed, 56 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/25/263325/1

diff --git a/scripts/__init__.py b/scripts/__init__.py
index ab8c50a..03688c1 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -1 +1,2 @@
+# -*- coding: utf-8  -*-
 """THIS DIRECTORY IS TO HOLD BOT SCRIPTS FOR THE NEW FRAMEWORK."""
diff --git a/scripts/add_text.py b/scripts/add_text.py
index b749256..64d8b0e 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -42,17 +42,17 @@
 # category:catname
 # Warning! Put it in one line, otherwise it won't work correctly.
 
-python add_text.py -cat:catname -summary:"Bot: Adding a template"
--text:"{{Something}}" -except:"\{\{([Tt]emplate:|)[Ss]omething" -up
+python pwb.py add_text -cat:catname -summary:"Bot: Adding a template" \
+-text:"{{Something}}" -except:"\{\{([Tt]emplate:|)[Ss]omething" -up
 
 2.
 # Command used on it.wikipedia to put the template in the page without any
 # category.
 # Warning! Put it in one line, otherwise it won't work correctly.
 
-python add_text.py -excepturl:"class='catlinks'>" -uncat
--text:"{{Categorizzare}}" -except:"\{\{([Tt]emplate:|)[Cc]ategorizzare"
--summary:"Bot: Aggiungo template Categorizzare"
+python pwb.py add_text -except:"\{\{([Tt]emplate:|)[Cc]ategorizzare" \
+-text:"{{Categorizzare}}" -excepturl:"class='catlinks'>" -uncat \
+-summary:"Bot: Aggiungo template Categorizzare"
 
 --- Credits and Help ---
 This script has been written by Botwiki's staff, if you want to help us
@@ -73,11 +73,12 @@
 __version__ = '$Id$'
 #
 
-import re
 import codecs
+import re
 import time
 
 import pywikibot
+
 from pywikibot import config, i18n, pagegenerators, textlib
 
 docuReplacements = {
@@ -160,15 +161,17 @@
 result = re.findall(regexSkipUrl, site.getUrl(url))
 if result != []:
 pywikibot.output(
-u'''Exception! regex (or word) used with -exceptUrl is in the page. Skip!
-Match was: %s''' % result)
+'Exception! regex (or word) used with -exceptUrl '
+'is in the page. Skip!\n'
+'Match was: %s' % result)
 return (False, False, always)
 if regexSkip is not None:
 result = re.findall(regexSkip, text)
 if result != []:
 pywikibot.output(
-u'''Exception! regex (or word) used with -except is in the page. Skip!
-Match was: %s''' % result)
+'Exception! regex (or word) used with -except '
+'is in the page. Skip!\n'
+'Match was: %s' % result)
 return (False, False, always)
 # If not up, text put below
 if not up:
@@ -192,6 +195,7 @@
categoriesInside, site,
True)
 # Dealing the stars' issue
+# TODO: T123150
 allstars = []
 starstext = textlib.removeDisabledParts(text)
 for star in starsList:
@@ -342,7 +346,7 @@
 generator = genFactory.getCombinedGenerator()
 if not generator:
 pywikibot.showHelp()
-return
+return False
 if not addText:
 pywikibot.error("The text to add wasn't given.")
 return
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 1e82623..a67b05a 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -97,14 +97,16 @@
 __version__ = '$Id$'
 #
 import datetime
-import time
+import locale
 import os
 import re
-import locale
+import time
+
 from hashlib import md5
 from math import ceil
 
 import pywikibot
+
 from pywikibot import i18n
 from pywikibot.textlib import TimeStripper
 from pywikibot.textlib import to_local_digits
@@ -473,7 +475,7 @@
 else:
 raise MissingConfigError(u'Missing or malformed template')
 if not self.get_attr('algo', ''):
-raise MissingConfigError(u'Missing algo')
+raise MissingConfigError('Missing argument "algo" in template')
 
 def feed_archive(self, archive, thread, max_archive_size, params=None):
 """Feed the thread to one of the archives.
@@ -595,6 +597,7 @@
 salt = None
 force = False
 calc = None
+sleep = 10
 args = []
 
 def if_arg_value(arg, name):
@@ -678,11 +681,12 @@
 try:
 archiver = PageArchiver(pg, a, salt, force)
  

[MediaWiki-commits] [Gerrit] [bugfix] "D" is a valid roman number char - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263324

Change subject: [bugfix] "D" is a valid roman number char
..

[bugfix] "D" is a valid roman number char

Also synchronize with master branch:
- use ascii_letters from string
- reorder imports

Change-Id: Ifc9ce2b02318db679540158fb209e56126356fee
---
M scripts/casechecker.py
1 file changed, 15 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/24/263324/1

diff --git a/scripts/casechecker.py b/scripts/casechecker.py
index e7aff0a..b98780f 100755
--- a/scripts/casechecker.py
+++ b/scripts/casechecker.py
@@ -2,19 +2,23 @@
 # -*- coding: utf-8  -*-
 """Bot to find all pages on the wiki with mixed latin and cyrilic alphabets."""
 #
-# (C) Pywikibot team, 2006-2014
+# (C) Pywikibot team, 2006-2015
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import print_function, unicode_literals
 __version__ = '$Id$'
 
-import os
-import sys
-import re
 import codecs
+import os
+import re
+from string import ascii_letters
+import sys
+
 import pywikibot
+
 from pywikibot import i18n
+
 from pywikibot.data import api
 from pywikibot.tools import first_lower, first_upper
 
@@ -102,7 +106,7 @@
 localKeyboard = u'йцукенгшщзфывапролдячсмить'
 latinKeyboard = u'qwertyuiopasdfghjklzxcvbnm'
 
-romanNumChars = u'IVXLMC'
+romanNumChars = u'IVXLCDM'
 # all letters that may be used as suffixes after roman numbers:  "Iый"
 romannumSuffixes = localLowerLtr
 romanNumSfxPtrn = re.compile(
@@ -111,8 +115,6 @@
 whitelists = {
 'ru': u'ВП:КЛ/Проверенные',
 }
-
-latLtr = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 lclClrFnt = u''
 latClrFnt = u''
@@ -244,10 +246,11 @@
 self.latToLclKeybDict = {}
 
 badPtrnStr = u'([%s][%s]|[%s][%s])' \
- % (self.latLtr, self.localLtr, self.localLtr, self.latLtr)
+ % (ascii_letters, self.localLtr,
+self.localLtr, ascii_letters)
 self.badWordPtrn = re.compile(u'[%s%s]*%s[%s%s]*'
-  % (self.latLtr, self.localLtr,
- badPtrnStr, self.latLtr,
+  % (ascii_letters, self.localLtr,
+ badPtrnStr, ascii_letters,
  self.localLtr))
 
 # Get whitelist
@@ -535,7 +538,7 @@
 else:
 if mightBeLcl and l not in self.latinSuspects:
 mightBeLcl = False
-if l not in self.latLtr:
+if l not in ascii_letters:
 raise ValueError(u'Assert failed')
 
 # Some words are well known and frequently mixed-typed
@@ -699,7 +702,7 @@
 else:
 res += self.suffixClr + self.lclClrFnt
 lastIsCyr = True
-elif l in self.latLtr:
+elif l in ascii_letters:
 if lastIsCyr:
 if toScreen:
 SetColor(FOREGROUND_RED)

-- 
To view, visit https://gerrit.wikimedia.org/r/263324
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc9ce2b02318db679540158fb209e56126356fee
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [L10N] add "sco" to redirected category pages - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263327

Change subject: [L10N] add "sco" to redirected category pages
..

[L10N] add "sco" to redirected category pages

also sync doc string and import order with master

Change-Id: I367530b860586e9770a4e19d67c750b5b7705afa
---
M scripts/category_redirect.py
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/27/263327/1

diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 6f0378f..b73b510 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -17,7 +17,9 @@
   moves all images, pages and categories in redirect categories
   to the target category.
 
-Usage: category_redirect.py [options]
+Usage:
+
+python pwb.py category_redirect [options]
 
 """
 #
@@ -29,11 +31,14 @@
 
 __version__ = '$Id$'
 #
-import sys
 import re
+import sys
 import time
+
 from datetime import timedelta
+
 import pywikibot
+
 from pywikibot import i18n, pagegenerators, config
 
 if sys.version_info[0] > 2:
@@ -82,6 +87,7 @@
 'pl': "Kategoria:Przekierowania kategorii",
 'pt': "Categoria:!Redirecionamentos de categorias",
 'ru': "Категория:Википедия:Категории-дубликаты",
+'sco': "Category:Wikipaedia soft redirectit categories",
 'simple': "Category:Category redirects",
 'sh': u"Kategorija:Preusmjerene kategorije Wikipedije",
 'vi': u"Thể loại:Thể loại đổi hướng",

-- 
To view, visit https://gerrit.wikimedia.org/r/263327
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I367530b860586e9770a4e19d67c750b5b7705afa
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [L10N] locaisation update from master - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263330

Change subject: [L10N] locaisation update from master
..

[L10N] locaisation update from master

also sync doc and import order

Change-Id: I9b46deb91eb8a3d203b6e680f89b8ea63e45ba4e
---
M scripts/commonscat.py
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/30/263330/1

diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index c297d2e..10ca962 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -23,7 +23,8 @@
   template.
 
 For example to go through all categories:
-commonscat.py -start:Category:!
+
+python pwb.py commonscat -start:Category:!
 """
 # Commonscat bot:
 #
@@ -63,9 +64,11 @@
 
 import re
 
-from add_text import add_text
 import pywikibot
+
 from pywikibot import i18n, pagegenerators, Bot
+
+from add_text import add_text
 
 docuReplacements = {
 '': pagegenerators.parameterHelp
@@ -130,9 +133,10 @@
 'os': (u'Commonscat', [u'Commons cat']),
 'pt': (u'Commonscat', [u'Commons cat']),
 'ro': (u'Commonscat', [u'Commons cat']),
+'sco': ('Commons category', ['Commonscat', 'Commons cat']),
 'ru': (u'Commonscat', [u'Викисклад-кат', u'Commons category']),
 'simple': (u'Commonscat',
-   [u'Commons cat',  u'Commons cat multi', u'Commons category',
+   ['Commons cat', 'Commons cat multi', 'Commons category',
 u'Commons category multi', u'CommonsCompact',
 u'Commons-inline']),
 'sh': (u'Commonscat', [u'Commons cat']),
@@ -149,6 +153,7 @@
 'uk': (u'Commonscat', [u'Commons cat', u'Category', u'Commonscat-inline']),
 'vi': (u'Commonscat',
[u'Commons2', u'Commons cat', u'Commons category', u'Commons+cat']),
+'yi': (u'קאמאנסקאט', [u'Commonscat']),
 'zh': (u'Commonscat', [u'Commons cat', u'Commons category']),
 'zh-classical': (u'共享類', [u'Commonscat']),
 'zh-yue': (u'同享類',

-- 
To view, visit https://gerrit.wikimedia.org/r/263330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b46deb91eb8a3d203b6e680f89b8ea63e45ba4e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Backport changelog to master - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263332

Change subject: Backport changelog to master
..

Backport changelog to master

Change-Id: I4bf919561f11b7109712bf106875ae58530d0cc8
---
M ChangeLog
1 file changed, 95 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/32/263332/1

diff --git a/ChangeLog b/ChangeLog
index 0af0188..17a191d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,100 @@
+Release 2.0rc4 (15 December 2015)
+=
+
+Bugfixes (core)
+---
+e42891d Remove dependency on pYsearch
+ecc39ce Require google>=0.7
+fa431a4 Desupport Python 2.6 for Pywikibot 2.0 release branch
+b1f6f39 config: Don't crash on later get_base_dir calls
+0925c51 cosmetic_changes: merge similar regexes
+4bf39f3 Update revId upon claim change
+ea11626 Update WOW hostnames
+2a5a4fa Mark site.patrol() as a user write action
+4f568c5 Fix interwikiFormat support for Link
+7cb6962 Changes are wrongly detected in the last langlink
+5c5d658 getLanguageLinks: Skip own site
+7ee8ec2 fix intersection of sets of namespaces
+94b0c43 Import textlib.TimeStripper
+584d7c1 Change "PyWikiBot" to "Pywikibot"
+1f8d57e Stop crashing item loads due to support of units
+c19dcfa __all__ items must be bytes on Python 2
+e6aa6ca Omit includeredirects parameter for allpages generator
+687ec9e Performance fix for sites using interwiki_putfirst option
+28db3d2 Fix Persian Wikipedia configuration
+3944f5e rollback: Use Revision instance properly
+860af34 Add must_be to DataSite write actions
+f8af8e0 Remove unneeded site argument to AutoFamily
+bf49a7d Fix ComparableMixin
+1d36e45 Deprecate ParamInfo.query_modules_with_limits
+e83c6a3 be-x-old is renamed to be-tarask
+19bbe7e Correctly identify qualifier from JSON
+
+Bugfixes (scripts)
+--
+4e78c27 checkimages: Expect NoPage exception
+fbb6266 interwiki: Optimize/remove unneeded calls to Page.isEmpty()
+428420a interwiki: Allow Subject.originPage to be updated
+a305d7b interwiki: Allow titletranslate.translate page to be None
+a786226 interwiki: '-ignore' parameter throws exception
+ab7abf5 interwiki: check for category before emptiness
+0db2e87 interwiki: do not automatically log in
+47ed5d5 nowcommons: Query at most one users
+
+Release 2.0rc3 (30 September 2015)
+==
+
+Bugfixes (core)
+---
+6406479 New Wikipedia site: azb
+b503a1e Indexes in str.format
+d1854f5 MediaWikiVersion: Accept new wmf style
+718e4a1 i18n: always follow master
+
+Release 2.0rc2 (9 July 2015)
+
+
+Bugfixes (scripts)
+--
+8d76870 replace.py: remove line endings when reading from file
+bfe60b0 archive.py: Don't ignore "DoNotArchiveUntil" timestamps
+0df272b redirect.py: Don't break the script for hidden pages.
+9806a7a upload.py: allow all formats allowed by commons
+1dcbfd8, 0592360 replace.py: fix handling of addedCat
+
+Small new features (scripts)
+
+a47c0d7 clean_sandbox.py: Use pagegenerators
+288b9ce replace.py: Inform about missing user-fixes.py
+
+Configuration updates
+-
+d721249 Changing the sandbox content template on Fa WP
+
+Family file updates
+---
+21d6a8d Remove broken wikis from battlestarwiki family
+3c2bcc5 Adding euskara and sicilianu languages to Vikidia family
+a3a3d53 WOW Wiki subdomains hr, ro & sr deleted
+474c786 Add new Wikipedia languages gom and lrc
+
+Bugfixes (core)
+---
+c7a12b5 fix UnicodeDecodeError on api error
+ea00683 pwb.py now correctly passes arguments to generate_family_file
+3685a24 Fix Win32 config.editor detection
+251 open_compressed: Wrap BZ2File in Py 2.7
+f2309e5 Skip RC entries without a title
+ab9fdfb PatrolEntry: Allow cur/prev id to be str
+156bdd0, 0b6fda9 Updates to i18n changes
+49fc65f Do not use ParamInfo during action=login
+796f273 Let pydot encode labels for Python 3 support
+3488a4b Fix and test interwiki_graph
+ba6b671 textlib: replaceExcept: Handle empty matches
+
 
 Release 2.0rc1 (25 May 2015)
-
+
 Major improvements include:
 - Sphinx documentation at https://doc.wikimedia.org/pywikibot/
 - Initial ProofreadPage support

-- 
To view, visit https://gerrit.wikimedia.org/r/263332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bf919561f11b7109712bf106875ae58530d0cc8
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] update maintenance from master - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263348

Change subject: update maintenance from master
..

update maintenance from master

- coding
- doc strings
- import oder
- verbose statement in compat2core.py
- IDENT constant and parameter order in make_i18n_dict.py

Change-Id: I87766e515ec53a155599f5426fabadc5a43b7ba7
---
M scripts/maintenance/__init__.py
M scripts/maintenance/cache.py
M scripts/maintenance/compat2core.py
M scripts/maintenance/make_i18n_dict.py
M scripts/maintenance/wikimedia_sites.py
5 files changed, 55 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/48/263348/1

diff --git a/scripts/maintenance/__init__.py b/scripts/maintenance/__init__.py
index ee430b4..fd43e14 100644
--- a/scripts/maintenance/__init__.py
+++ b/scripts/maintenance/__init__.py
@@ -1,2 +1,3 @@
+# -*- coding: utf-8  -*-
 # THIS DIRECTORY IS TO HOLD BOT SCRIPTS FOR THE NEW FRAMEWORK
 """Maintenance scripts."""
diff --git a/scripts/maintenance/cache.py b/scripts/maintenance/cache.py
index f05e9fd..15610f3 100755
--- a/scripts/maintenance/cache.py
+++ b/scripts/maintenance/cache.py
@@ -3,29 +3,35 @@
 r"""
 This script runs commands on each entry in the API caches.
 
-Syntax: cache.py [-password] [-delete] [-c '...'] [dir ...]
+Syntax:
+
+python pwb.py cache [-password] [-delete] [-c "..."] [dir ...]
 
 If no directory are specified, it will detect the API caches.
 
 If no command is specified, it will print the filename of all entries.
 If only -delete is specified, it will delete all entries.
 
-The option '-c' must be followed by a command in python syntax.
+-delete   Delete each command filtered. If that option is set the
+  default output will be nothing.
+
+-cFilter command in python syntax. It must evaulate to True to
+  output anything.
 
 Example commands:
   Print the filename of any entry with 'wikidata' in the key:
 
-entry if "wikidata" in entry._uniquedescriptionstr() else None
+-c entry if "wikidata" in entry._uniquedescriptionstr() else None
 
   Customised output if the site code is 'ar':
 
-entry.site.code == "ar" and print("%s" % entry._uniquedescriptionstr())
+-c entry.site.code == "ar" and print("%s" % entry._uniquedescriptionstr())
 
   Or the state of the login
-entry.site._loginstatus == LoginStatus.NOT_ATTEMPTED and \
+-c entry.site._loginstatus == LoginStatus.NOT_ATTEMPTED and \
 print("%s" % entry._uniquedescriptionstr())
 
-  These functions can be used as a command:
+Available filter commands:
 has_password(entry)
 is_logout(entry)
 empty_response(entry)
@@ -39,7 +45,7 @@
 newer_than(entry, interval)
 """
 #
-# (C) Pywikibot team, 2014
+# (C) Pywikibot team, 2014-2015
 #
 # Distributed under the terms of the MIT license.
 #
@@ -47,15 +53,17 @@
 __version__ = '$Id$'
 #
 
-import os
 import datetime
-import pickle
 import hashlib
+import os
+import pickle
+
 import pywikibot
+
 from pywikibot.data import api
 
-from pywikibot.site import APISite, DataSite, LoginStatus  # noqa
 from pywikibot.page import User  # noqa
+from pywikibot.site import APISite, DataSite, LoginStatus  # noqa
 
 
 class ParseError(Exception):
@@ -248,6 +256,8 @@
 func(entry)
 
 
+# Filter commands
+
 def has_password(entry):
 """Entry has a password in the entry."""
 if 'lgpassword' in entry._uniquedescriptionstr():
diff --git a/scripts/maintenance/compat2core.py 
b/scripts/maintenance/compat2core.py
index fb9ef6c..da3b33b 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -17,13 +17,16 @@
 usage
 
 to convert a script and show warnings about deprecated methods:
-pwb.py maintenance/compat2core 
+
+python  pwb.py maintenance/compat2core 
 
 to show warnings about deprecated methods:
-pwb.py maintenance/compat2core  -warnonly
+
+python pwb.py maintenance/compat2core  -warnonly
 """
 #
-# (C) xqt, 2014
+# (C) xqt, 2014-2015
+# (C) Pywikibot team, 2014-2015
 #
 # Distributed under the terms of the MIT license.
 #
@@ -32,9 +35,10 @@
 __version__ = '$Id$'
 #
 
+import codecs
 import os
 import re
-import codecs
+
 import pywikibot
 
 # be careful with replacement order!
@@ -76,8 +80,9 @@
 # other deprecated methods
 (r'(?>> bot.to_json()
 """
 #
-# (C) xqt, 2013-2014
-# (C) Pywikibot team, 2013-2014
+# (C) xqt, 2013-2015
+# (C) Pywikibot team, 2013-2015
 #
 # Distributed under the terms of the MIT license.
 #
@@ -33,9 +33,9 @@
 __version__ = '$Id$'
 #
 
-import os
-import json
 import codecs
+import json
+import os
 
 from pywikibot import config
 
@@ -55,9 +55,10 @@
 if hasattr(self.script, msg):
 self.messages.append(msg)
 self.messages.sort()
-self.dict = dict()
+self.dict = {}
 
 def print_all(self):
+"""Pretty 

[MediaWiki-commits] [Gerrit] update copyright year (from master) - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263347

Change subject: update copyright year (from master)
..

update copyright year (from master)

Change-Id: Ia4a1e98f0581a5c9adfe66ece9aeea2f23d052d9
---
M LICENSE
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/47/263347/1

diff --git a/LICENSE b/LICENSE
index 71d9a57..51e9f85 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2015 Pywikibot team
+Copyright (c) 2004-2016 Pywikibot team
 
 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation

-- 
To view, visit https://gerrit.wikimedia.org/r/263347
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4a1e98f0581a5c9adfe66ece9aeea2f23d052d9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] code cleanup - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263361

Change subject: code cleanup
..

code cleanup

- remove obsolete NothingFound class. This was previously used for compat's
  -untagged option which retrieved image informations from toolserver
- remove nothing list and use strip() method instead ti find empty descriptions
- remove return values in checkStep method. It is superfluous to "continue" a
  loop as a last statement.

Change-Id: I3a5d2218b115c83db8c35b6fbc792f8b19bc9a10
---
M scripts/checkimages.py
1 file changed, 9 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/61/263361/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 516efda..1393ae5 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -526,11 +526,6 @@
 """Log is full and the Bot cannot add other data to prevent Errors."""
 
 
-class NothingFound(pywikibot.Error):
-
-"""Regex returned [] instead of results."""
-
-
 def printWithTimeZone(message):
 """Print the messages followed by the TimeZone encoded correctly."""
 if message[-1] != ' ':
@@ -1471,9 +1466,6 @@
 
 def checkStep(self):
 """Check a single file page."""
-# nothing = Defining an empty image description
-nothing = ['', ' ', '  ', '   ', '\n', '\n ', '\n  ', '\n\n', '\n \n',
-   ' \n', ' \n ', ' \n \n']
 # something = Minimal requirements for an image description.
 # If this fits, no tagging will take place
 # (if there aren't other issues)
@@ -1511,11 +1503,11 @@
 except pywikibot.NoPage:
 pywikibot.output(u"Skipping %s because it has been deleted."
  % self.imageName)
-return True
+return
 except pywikibot.IsRedirectPage:
 pywikibot.output(u"Skipping %s because it's a redirect."
  % self.imageName)
-return True
+return
 # Delete the fields where the templates cannot be loaded
 regex_nowiki = re.compile(r'(.*?)', re.DOTALL)
 regex_pre = re.compile(r'(.*?)', re.DOTALL)
@@ -1525,7 +1517,7 @@
 # in the image the original text will be reloaded, don't worry).
 if self.isTagged():
 printWithTimeZone(u'%s is already tagged...' % self.imageName)
-return True
+return
 
 # something is the array with {{, MIT License and so on.
 for a_word in something:
@@ -1538,7 +1530,7 @@
 (license_found, hiddenTemplateFound) = self.smartDetection()
 # Here begins the check block.
 if brackets and license_found:
-return True
+return
 elif delete:
 pywikibot.output(u"%s is not a file!" % self.imageName)
 if not di:
@@ -1555,8 +1547,8 @@
textlink=True)}
 head = dih
 self.report(canctext, self.imageName, notification, head)
-return True
-elif self.imageCheckText in nothing:
+return
+elif not self.imageCheckText.strip():  # empty image description
 pywikibot.output(
 u"The file's description for %s does not contain a license "
 u" template!" % self.imageName)
@@ -1567,7 +1559,7 @@
 head = nh
 self.report(self.unvertext, self.imageName, notification, head,
 smwl)
-return True
+return
 else:
 pywikibot.output(u"%s has only text and not the specific 
license..."
  % self.imageName)
@@ -1578,7 +1570,7 @@
 head = nh
 self.report(self.unvertext, self.imageName, notification, head,
 smwl)
-return True
+return
 
 
 def main(*args):
@@ -1769,8 +1761,7 @@
 if duplicatesActive:
 if not Bot.checkImageDuplicated(duplicates_rollback):
 continue
-if Bot.checkStep():
-continue
+Bot.checkStep():
 
 if repeat:
 pywikibot.output(u"Waiting for %s seconds," % time_sleep)

-- 
To view, visit https://gerrit.wikimedia.org/r/263361
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a5d2218b115c83db8c35b6fbc792f8b19bc9a10
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use textlib.replace_links() with fixing_redirects.py - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263375

Change subject: Use textlib.replace_links() with fixing_redirects.py
..

Use textlib.replace_links() with fixing_redirects.py

Revert "[bugfix] Revert "New textlib.replace_links() link replacements""

This reverts commit 8a7c42f50ac1c99b99d7cac9ccd83e6e83bd8cda.

Change-Id: Ibbe4c7b9e27f32cb81fc3831894941bef492e3bf
---
M scripts/fixing_redirects.py
1 file changed, 2 insertions(+), 92 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/75/263375/1

diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index fe02548..9273772 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -13,7 +13,7 @@
 
 """
 #
-# (C) Pywikibot team, 2004-2016
+# (C) Pywikibot team, 2004-2015
 #
 # Distributed under the terms of the MIT license.
 #
@@ -21,15 +21,11 @@
 
 __version__ = '$Id$'
 #
-import re
-
 import pywikibot
 from pywikibot import pagegenerators
 from pywikibot.bot import (SingleSiteBot, ExistingPageBot, NoRedirectPageBot,
AutomaticTWSummaryBot, suggest_help)
-from pywikibot.textlib import does_text_contain_section
 from pywikibot.tools.formatter import color_format
-from pywikibot.tools import first_lower, first_upper as firstcap
 
 # This is required for the text that is shown when you run this script
 # with the parameter -help.
@@ -50,83 +46,6 @@
 ignore_server_errors = True
 summary_key = 'fixing_redirects-fixing'
 
-def replace_links(self, text, linkedPage, targetPage):
-"""Replace all source links by target."""
-mysite = pywikibot.Site()
-linktrail = mysite.linktrail()
-
-# make a backup of the original text so we can show the changes later
-linkR = re.compile(r'\[\[(?P[^\]\|#]*)(?P#[^\]\|]*)?'
-   r'(\|(?P[^\]]*))?\]\](?P' + 
linktrail + ')')
-curpos = 0
-# This loop will run until we have finished the current page
-while True:
-m = linkR.search(text, pos=curpos)
-if not m:
-break
-# Make sure that next time around we will not find this same hit.
-curpos = m.start() + 1
-# ignore interwiki links and links to sections of the same page
-if m.group('title').strip() == '' or \
-   mysite.isInterwikiLink(m.group('title')):
-continue
-else:
-actualLinkPage = pywikibot.Page(targetPage.site, 
m.group('title'))
-# Check whether the link found is to page.
-if actualLinkPage != linkedPage:
-continue
-
-# The link looks like this:
-# [[page_title|link_text]]trailing_chars
-page_title = m.group('title')
-link_text = m.group('label')
-
-if not link_text:
-# or like this: [[page_title]]trailing_chars
-link_text = page_title
-if m.group('section') is None:
-section = ''
-else:
-section = m.group('section')
-if section and targetPage.section():
-pywikibot.warning(
-'Source section {0} and target section {1} found. '
-'Skipping.'.format(section, targetPage))
-continue
-trailing_chars = m.group('linktrail')
-if trailing_chars:
-link_text += trailing_chars
-
-# remove preleading ":"
-if link_text[0] == ':':
-link_text = link_text[1:]
-if link_text[0].isupper() or link_text[0].isdigit():
-new_page_title = targetPage.title()
-else:
-new_page_title = first_lower(targetPage.title())
-
-# remove preleading ":"
-if new_page_title[0] == ':':
-new_page_title = new_page_title[1:]
-
-if (new_page_title == link_text and not section):
-newlink = "[[%s]]" % new_page_title
-# check if we can create a link with trailing characters instead 
of a
-# pipelink
-elif (len(new_page_title) <= len(link_text) and
-  firstcap(link_text[:len(new_page_title)]) ==
-  firstcap(new_page_title) and
-  re.sub(re.compile(linktrail), '',
- link_text[len(new_page_title):]) == '' and
-  not section):
-newlink = "[[%s]]%s" % (link_text[:len(new_page_title)],
-link_text[len(new_page_title):])
-else:
-newlink = "[[%s%s|%s]]" % (new_page_title, section, link_text)
-text = text[:m.start()] + newlink + text[m.end():]
-continue
-return text
-
 def 

[MediaWiki-commits] [Gerrit] Deprecate python 2.6 - change (pywikibot/core)

2016-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263372

Change subject: Deprecate python 2.6
..

Deprecate python 2.6

python 2.6 is deprecated and pwb 2.0 does not run under 2.6. anymore.
There is no reason to keep master behind the 2.0 branch supporting
python versions.

Change-Id: Ied97711c81adebe9c260c8e7c2647b6cc71846fa
---
M pwb.py
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/72/263372/1

diff --git a/pwb.py b/pwb.py
index fdd6fd4..0743658 100755
--- a/pwb.py
+++ b/pwb.py
@@ -31,13 +31,12 @@
 
 PYTHON_VERSION = sys.version_info[:3]
 PY2 = (PYTHON_VERSION[0] == 2)
-PY26 = (PYTHON_VERSION < (2, 7))
 
 versions_required_message = """
 Pywikibot not available on:
 %s
 
-Pywikibot is only supported under Python 2.6.5+, 2.7.2+ or 3.3+
+Pywikibot is only supported under Python 2.7.2+ or 3.3+
 """
 
 
@@ -45,8 +44,7 @@
 """Check that Python is supported."""
 # Any change to this must be copied to setup.py
 return (PYTHON_VERSION >= (3, 3, 0) or
-(PY2 and PYTHON_VERSION >= (2, 7, 2)) or
-(PY26 and PYTHON_VERSION >= (2, 6, 5)))
+(PY2 and PYTHON_VERSION >= (2, 7, 2)))
 
 
 if not python_is_supported():

-- 
To view, visit https://gerrit.wikimedia.org/r/263372
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied97711c81adebe9c260c8e7c2647b6cc71846fa
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [L10N] Update referencesTemplates for ar-wiki from master - change (pywikibot/core)

2016-01-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263218

Change subject: [L10N] Update referencesTemplates for ar-wiki from master
..

[L10N] Update referencesTemplates for ar-wiki from master

- Also ad some doc strings from master.
- site.sitename is a property. Update code from master.

Change-Id: Ib3f64ba0b9c49e9dab7476cf152ef50fef06fb4a
---
M scripts/noreferences.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/18/263218/1

diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 10d49f4..3b9844c 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -366,7 +366,8 @@
 # on your wiki, you don't have to enter anything here.
 referencesTemplates = {
 'wikipedia': {
-'ar': [u'Reflist', u'مراجع', u'ثبت المراجع', u'ثبت_المراجع', u'بداية 
المراجع', u'نهاية المراجع'],
+'ar': ['Reflist', 'مراجع', 'ثبت المراجع', 'ثبت_المراجع',
+   'بداية المراجع', 'نهاية المراجع'],
 'be': [u'Зноскі', u'Примечания', u'Reflist', u'Спіс заўваг',
u'Заўвагі'],
 'be-tarask': [u'Зноскі'],
@@ -636,6 +637,7 @@
 return self.createReferenceSection(oldText, index)
 
 def createReferenceSection(self, oldText, index, ident='=='):
+"""Create a reference section and insert it into the given text."""
 if self.site.language() in noTitleRequired:
 newSection = u'\n%s\n' % (self.referencesText)
 else:
@@ -647,7 +649,7 @@
 return oldText[:index] + newSection + oldText[index:]
 
 def run(self):
-
+"""Run the bot."""
 for page in self.generator:
 self.current_page = page
 try:
@@ -668,8 +670,7 @@
 pywikibot.output(u"Page %s is a disambig; skipping."
  % page.title(asLink=True))
 continue
-if self.site.sitename() == 'wikipedia:en' and \
-   page.isIpEdit():
+if self.site.sitename == 'wikipedia:en' and page.isIpEdit():
 pywikibot.output(
 u"Page %s is edited by IP. Possible vandalized"
 % page.title(asLink=True))

-- 
To view, visit https://gerrit.wikimedia.org/r/263218
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3f64ba0b9c49e9dab7476cf152ef50fef06fb4a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Move listpages.Formatter class to pywikibot.tools.formatter.py - change (pywikibot/core)

2016-01-09 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263183

Change subject: Move listpages.Formatter class to pywikibot.tools.formatter.py
..

Move listpages.Formatter class to pywikibot.tools.formatter.py

- move script Formatter class to tools library. This enables to reuse it
  e.g. for templatescount script later.
- add some tests to tools_formatter_tests

Also made bugfixes for Formatter.output method:
- fmt default parameter must be a string, not a integer
- use '3' as default option.
  Otherwise the method fails if num parameter isn't set.

Change-Id: Ie7dcdd45b3c339ab23b00cf04e44608b057fb33f
---
M pywikibot/tools/formatter.py
M scripts/listpages.py
M tests/tools_formatter_tests.py
3 files changed, 89 insertions(+), 68 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/83/263183/1

diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index a571ee4..939bcd1 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8  -*-
 """Module containing various formatting related utilities."""
 #
-# (C) Pywikibot team, 2015
+# (C) Pywikibot team, 2015-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -63,6 +63,70 @@
 output(self.format_list())
 
 
+class PagelistFormatter(object):
+
+"""Structure with Page attributes exposed for formatting from cmd line."""
+
+fmt_options = {
+'1': u"{num:4d} {page.title}",
+'2': u"{num:4d} [[{page.title}]]",
+'3': u"{page.title}",
+'4': u"[[{page.title}]]",
+'5': u"{num:4d} \03{{lightred}}{page.loc_title:<40}\03{{default}}",
+'6': u"{num:4d} {page.loc_title:<40} {page.can_title:<40}",
+'7': u"{num:4d} {page.loc_title:<40} {page.trs_title:<40}",
+}
+
+# Identify which formats need outputlang
+fmt_need_lang = [k for k, v in fmt_options.items() if 'trs_title' in v]
+
+def __init__(self, page, outputlang=None, default='**'):
+"""
+Constructor.
+
+@param page: the page to be formatted.
+@type page: Page object.
+@param outputlang: language code in which namespace before title should
+be translated.
+
+Page ns will be searched in Site(outputlang, page.site.family)
+and, if found, its custom name will be used in page.title().
+
+@type outputlang: str or None, if no translation is wanted.
+@param default: default string to be used if no corresponding
+namespace is found when outputlang is not None.
+
+"""
+self.site = page._link.site
+self.title = page._link.title
+self.loc_title = page._link.canonical_title()
+self.can_title = page._link.ns_title()
+self.outputlang = outputlang
+if outputlang is not None:
+# Cache onsite in case of translations.
+if not hasattr(self, "onsite"):
+self.onsite = pywikibot.Site(outputlang, self.site.family)
+try:
+self.trs_title = page._link.ns_title(onsite=self.onsite)
+# Fallback if no corresponding namespace is found in onsite.
+except pywikibot.Error:
+self.trs_title = u'%s:%s' % (default, page._link.title)
+
+def output(self, num=None, fmt='3'):
+"""Output formatted string."""
+fmt = self.fmt_options.get(fmt, fmt)
+# If selected format requires trs_title, outputlang must be set.
+if (fmt in self.fmt_need_lang or
+'trs_title' in fmt and
+self.outputlang is None):
+raise ValueError(
+u"Required format code needs 'outputlang' parameter set.")
+if num is None:
+return fmt.format(page=self)
+else:
+return fmt.format(num=num, page=self)
+
+
 class _ColorFormatter(Formatter):
 
 """Special string formatter which skips colors."""
diff --git a/scripts/listpages.py b/scripts/listpages.py
index 8c3c8f7..4f35ba6 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -83,7 +83,7 @@
 
 """
 #
-# (C) Pywikibot team, 2008-2014
+# (C) Pywikibot team, 2008-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -98,72 +98,9 @@
 import pywikibot
 from pywikibot import config2 as config, i18n
 from pywikibot.pagegenerators import GeneratorFactory, parameterHelp
+from pywikibot.tools.formatter import PagelistFormatter
 
 docuReplacements = {'': parameterHelp}
-
-
-class Formatter(object):
-
-"""Structure with Page attributes exposed for formatting from cmd line."""
-
-fmt_options = {
-'1': u"{num:4d} {page.title}",
-'2': u"{num:4d} [[{page.title}]]",
-'3': u"{page.title}",
-'4': u"[[{page.title}]]",
-'5': u"{num:4d} \03{{lightred}}{page.loc_title:<40}\03{{default}}",
-'6': u"{num:4d} 

[MediaWiki-commits] [Gerrit] [DOC] Add doc strings to methods - change (pywikibot/core)

2016-01-09 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263175

Change subject: [DOC] Add doc strings to methods
..

[DOC] Add doc strings to methods

Change-Id: Ic28b614b5cd7fb4d484f5352469fdbb838115951
---
M scripts/templatecount.py
1 file changed, 18 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/75/263175/1

diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index 7f50cfe..1793233 100755
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # -*- coding: utf-8  -*-
 """
-This script will display the list of pages transcluding a given list of 
templates.
+Display the list of pages transcluding a given list of templates.
 
 It can also be used to simply count the number of pages (rather than
 listing each individually).
@@ -31,8 +31,8 @@
 
 """
 #
-# (C) Pywikibot team, 2006-2014
-# (C) xqt, 2009-2014
+# (C) Pywikibot team, 2006-2016
+# (C) xqt, 2009-2016
 #
 # Distributed under the terms of the MIT license.
 #
@@ -53,6 +53,7 @@
 
 @classmethod
 def countTemplates(cls, templates, namespaces):
+"""Display number of transclusions for a list of templates."""
 templateDict = cls.template_dict(templates, namespaces)
 pywikibot.output(u'\nNumber of transclusions per template',
  toStdout=True)
@@ -70,6 +71,7 @@
 
 @classmethod
 def listTemplates(cls, templates, namespaces):
+"""Display transcluded pages for a list of templates."""
 templateDict = cls.template_dict(templates, namespaces)
 pywikibot.output(u'\nList of pages transcluding templates:',
  toStdout=True)
@@ -88,6 +90,14 @@
 
 @classmethod
 def template_dict(cls, templates, namespaces):
+"""
+Create a dict of templates and its transcluded pages.
+
+The names of the templates are the keys, and lists of pages
+transcluding templates are the values.
+
+@rtype: dict
+"""
 gen = cls.template_dict_generator(templates, namespaces)
 templateDict = {}
 for template, transcludingArray in gen:
@@ -96,9 +106,12 @@
 
 @staticmethod
 def template_dict_generator(templates, namespaces):
+"""
+Yield templates and a list of transcluded pages.
+
+@rtype: generator
+"""
 mysite = pywikibot.Site()
-# The names of the templates are the keys, and lists of pages
-# transcluding templates are the values.
 mytpl = mysite.namespaces.TEMPLATE
 for template in templates:
 transcludingArray = []

-- 
To view, visit https://gerrit.wikimedia.org/r/263175
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic28b614b5cd7fb4d484f5352469fdbb838115951
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [PEP8] update doc strings - change (pywikibot/core)

2016-01-09 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263179

Change subject: [PEP8] update doc strings
..

[PEP8] update doc strings

- replace @return by @rtype identifier if the line describes the type
- add some @rtype contents
- Start with new line for multiple line doc string
- remove empty line on bottom of doc string
- replace @exception identifier by @raise

Change-Id: I3f15785417c94c1a9ffc8ef43579db13d615193c
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 411 insertions(+), 290 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/79/263179/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index ac4c426..d4c1977 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -79,18 +79,19 @@
 
 class BasePage(UnicodeMixin, ComparableMixin):
 
-"""BasePage: Base object for a MediaWiki page.
+"""
+BasePage: Base object for a MediaWiki page.
 
 This object only implements internally methods that do not require
 reading from or writing to the wiki.  All other methods are delegated
 to the Site object.
 
 Will be subclassed by Page, WikibasePage, and FlowPage.
-
 """
 
 def __init__(self, source, title=u"", ns=0):
-"""Instantiate a Page object.
+"""
+Instantiate a Page object.
 
 Three calling formats are supported:
 
@@ -118,7 +119,6 @@
 @param ns: namespace number; required if source is a Site, ignored
 otherwise
 @type ns: int
-
 """
 if title is None:
 raise ValueError(u'Title cannot be None.')
@@ -150,7 +150,8 @@
 return self._link.site
 
 def version(self):
-"""Return MediaWiki version number of the page site.
+"""
+Return MediaWiki version number of the page site.
 
 This is needed to use @need_version() decorator for methods of
 Page objects.
@@ -168,7 +169,8 @@
 return self.site.data_repository()
 
 def namespace(self):
-"""Return the number of the namespace of the page.
+"""
+Return the number of the namespace of the page.
 
 @return: namespace of the page
 @rtype: int
@@ -183,7 +185,8 @@
 
 @property
 def content_model(self):
-"""Return the content model for this page.
+"""
+Return the content model for this page.
 
 If it cannot be reliably determined via the API,
 None is returned.
@@ -212,7 +215,8 @@
   withSection=True, asUrl=False, asLink=False,
   allowInterwiki=True, forceInterwiki=False, textlink=False,
   as_filename=False, insite=None):
-"""Return the title of this Page, as a Unicode string.
+"""
+Return the title of this Page, as a Unicode string.
 
 @param underscore: (not used with asLink) if true, replace all ' '
 characters with '_'
@@ -234,7 +238,7 @@
 @param insite: (only used if asLink is true) a site object where the
 title is to be shown. default is the current family/lang given by
 -family and -lang option i.e. config.family and config.mylang
-
+@rtype: unicode
 """
 title = self._link.canonical_title()
 label = self._link.title
@@ -289,11 +293,13 @@
 
 @remove_last_args(('decode', 'underscore'))
 def section(self):
-"""Return the name of the section this Page refers to.
+"""
+Return the name of the section this Page refers to.
 
 The section is the part of the title following a '#' character, if
 any. If no section is present, return None.
 
+@rtype: unicode
 """
 return self._link.section
 
@@ -339,14 +345,14 @@
   self.title(asUrl=True))
 
 def autoFormat(self):
-"""Return L{date.getAutoFormat} dictName and value, if any.
+"""
+Return L{date.getAutoFormat} dictName and value, if any.
 
 Value can be a year, date, etc., and dictName is 'YearBC',
 'Year_December', or another dictionary name. Please note that two
 entries may have exactly the same autoFormat, but be in two
 different namespaces, as some sites have categories with the
 same names. Regular titles return (None, None).
-
 """
 if not hasattr(self, '_autoFormat'):
 from pywikibot import date
@@ -364,7 +370,8 @@
  change_edit_time=None,
  expandtemplates=None)
 def get(self, force=False, get_redirect=False, sysop=False):
-"""Return the wiki-text of the page.
+"""
+Return the wiki-text of the page.
 
 This will retrieve the page from the server if it has not been
 retrieved yet, or if force is True. This can raise the following
@@ -383,6 +390,7 @@
 @param sysop:   if 

[MediaWiki-commits] [Gerrit] [bugfix] logentry.page() may return an int value - change (pywikibot/core)

2016-01-03 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/262082

Change subject: [bugfix] logentry.page() may return an int value
..

[bugfix] logentry.page() may return an int value

BlockEntry instance method page() may return an int value when
isAutoblockRemoval is True

Change-Id: I2c6f65c7241bd9f8e3648abc876c2aebbbc3e9d3
---
M tests/logentry_tests.py
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/82/262082/1

diff --git a/tests/logentry_tests.py b/tests/logentry_tests.py
index 77c0d88..d48c9fc 100644
--- a/tests/logentry_tests.py
+++ b/tests/logentry_tests.py
@@ -82,7 +82,10 @@
 self.assertIsInstance(logentry.pageid(), int)
 self.assertIsInstance(logentry.timestamp(), pywikibot.Timestamp)
 if 'title' in logentry.data:  # title may be missing
-self.assertIsInstance(logentry.page(), pywikibot.Page)
+if logtype == 'block' and logentry.isAutoblockRemoval:
+self.assertIsInstance(logentry.page(), int)
+else:
+self.assertIsInstance(logentry.page(), pywikibot.Page)
 else:
 self.assertRaises(KeyError, logentry.page)
 self.assertEqual(logentry.type(), logtype)

-- 
To view, visit https://gerrit.wikimedia.org/r/262082
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c6f65c7241bd9f8e3648abc876c2aebbbc3e9d3
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [IMPR] Add action_filter for logevents. - change (pywikibot/core)

2016-01-03 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/262108

Change subject: [IMPR] Add action_filter for logevents.
..

[IMPR] Add action_filter for logevents.

- This implementation enables filtering for multiple leaction types for a
  given letype wheres api's leaction only generates logevents of that given
  type.

- Also this enables action type filtering for older mw version < 1.17
- Test added for older family and new filter

Change-Id: Ia9cc5d8b9e84256c8f9db97c62eea53dc684f4e7
---
M pywikibot/site.py
M tests/logentry_tests.py
2 files changed, 51 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/08/262108/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 18b5679..06e2cb1 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4219,7 +4219,7 @@
 
 def logevents(self, logtype=None, user=None, page=None, namespace=None,
   start=None, end=None, reverse=False, tag=None,
-  step=None, total=None):
+  step=None, total=None, action_filter=None):
 """Iterate all log entries.
 
 @param logtype: only iterate entries of this type (see wiki
@@ -4250,6 +4250,16 @@
 @type step: int
 @param total: maximum number of events to iterate
 @type total: int
+@param action_filter: filter of single or multiple action types
+according to available leaction types for a given letype.
+
+Sample: logtype='block', action_filter=('block', 'reblock')
+retrieves all block events of given action types which in result
+excludes 'unblock' action.
+
+Note: Don't use this filter with action filtering by logtype
+parameter.
+@type action_filter: str or list/tuple of str
 @rtype: iterable
 
 @raises KeyError: the namespace identifier was not resolved
@@ -4267,7 +4277,10 @@
 MediaWikiVersion('1.17')):
 legen.request['leaction'] = logtype
 else:
-legen.request['letype'] = logtype.split('/')[0]
+letype, sep, leaction = logtype.partition('/')
+if action_filter is None and leaction:
+action_filter = [leaction]
+legen.request['letype'] = letype
 if user is not None:
 legen.request["leuser"] = user
 if page is not None:
@@ -4283,8 +4296,18 @@
 if tag:
 # Supported in version 1.16+; earlier sites will cause APIError
 legen.request['letag'] = tag
-
-return legen
+if isinstance(action_filter, str):
+action_filter = [actionfilter]
+for le in legen:
+if not action_filter:
+yield le
+else:
+assert isinstance(action_filter, (list, tuple))
+if le.action() in action_filter:
+yield le
+else:  # adjust counter
+legen.count -= 1
+
 
 @deprecated('APISite.logevents()')
 @deprecated_args(repeat=None)
diff --git a/tests/logentry_tests.py b/tests/logentry_tests.py
index 58fa10d..4aabfdc 100644
--- a/tests/logentry_tests.py
+++ b/tests/logentry_tests.py
@@ -51,10 +51,15 @@
 'family': 'lyricwiki',
 'code': 'en',
 'target': None,
+},
+'aged': {  # mw < 1.17
+'family': 'battlestarwiki',
+'code': 'en',
+'target': None,
 }
 }
 
-def _get_logentry(self, logtype):
+def _get_logentry(self, logtype, action_filter=None):
 """Retrieve a single log entry."""
 if self.site_key == 'old':
 # This is an assertion as the tests don't make sense with newer
@@ -62,7 +67,8 @@
 # isn't run on an older wiki.
 self.assertLess(MediaWikiVersion(self.site.version()),
 MediaWikiVersion('1.20'))
-return next(iter(self.site.logevents(logtype=logtype, total=1)))
+return next(iter(self.site.logevents(logtype=logtype, total=1,
+ action_filter=action_filter)))
 
 def _test_logevent(self, logtype):
 """Test a single logtype entry."""
@@ -182,6 +188,22 @@
 else:
 self.assertIsNone(logentry.duration())
 
+def test_BlockEntry_hide_unblock(self, key):
+"""Test BlockEntry methods for  action filter."""
+logentry = self._get_logentry('block',
+  action_filter=('block', 'reblock'))
+self.assertIn(logentry.action(), ('block', 'reblock'))
+self.assertIsInstance(logentry.flags(), list)
+# Check that there are no empty strings
+self.assertTrue(all(logentry.flags()))
+if logentry.expiry() is not None:
+

[MediaWiki-commits] [Gerrit] [DOC] fix logtype type docstring - change (pywikibot/core)

2016-01-02 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261984

Change subject: [DOC] fix logtype type docstring
..

[DOC] fix logtype type docstring

Change-Id: Id507ba5c862fb842388f94eb313dd5c4a8f4a44a
---
M pywikibot/site.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/84/261984/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index a7c0bd4..9327113 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4226,7 +4226,7 @@
 documentation for available types, which will include "block",
 "protect", "rights", "delete", "upload", "move", "import",
 "patrol", "merge")
-@param logtype: basestring
+@type logtype: basestring
 @param user: only iterate entries that match this user name
 @type user: basestring
 @param page: only iterate entries affecting this page

-- 
To view, visit https://gerrit.wikimedia.org/r/261984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id507ba5c862fb842388f94eb313dd5c4a8f4a44a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [i18n] prepare i18n for using twn further - change (pywikibot/core)

2015-12-29 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261360

Change subject: [i18n] prepare i18n for using twn further
..

[i18n] prepare i18n for using twn further

- use wikitext markup inside report method for headlines
- use dict for string formatting
- use fallback for additional messages which could be merged to twn later
- remove obsolete commons messages; they will fallback to 'en'
- remove unused return value for takesettings method

Change-Id: I57e7a779a1341a41a8f61dc8f06ca34d17604f05
---
M scripts/checkimages.py
1 file changed, 66 insertions(+), 64 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/60/261360/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 029bbd3..49dc702 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -192,66 +192,64 @@
 
 # The header of the Unknown extension's message.
 delete_immediately_head = {
-'ar': u"\n== امتداد غير معروف! ==\n",
-'en': u"\n== Unknown extension! ==\n",
-'fa': u"\n==بارگذاری تصاویر موجود در انبار==\n",
-'ga': u"\n== Iarmhír neamhaithnid! ==\n",
-'fr': u'\n== Extension inconnue ==\n',
-'hu': u'\n== Ismeretlen kiterjesztésű fájl ==\n',
-'it': u'\n\n== File non specificato ==\n',
-'ko': u'\n== 잘못된 파일 형식 ==\n',
-'ta': u'\n== இனங்காணப்படாத கோப்பு நீட்சி! ==\n',
-'ur': u"\n== نامعلوم توسیع! ==\n",
-'zh': u'\n==您上載的檔案格式可能有誤==\n',
+'ar': 'امتداد غير معروف!',
+'en': 'Unknown extension!',
+'fa': 'بارگذاری تصاویر موجود در انبار',
+'ga': 'Iarmhír neamhaithnid!',
+'fr': 'Extension inconnue',
+'hu': 'Ismeretlen kiterjesztésű fájl',
+'it': 'File non specificato',
+'ko': '잘못된 파일 형식',
+'ta': 'இனங்காணப்படாத கோப்பு நீட்சி!',
+'ur': 'نامعلوم توسیع!',
+'zh': '您上載的檔案格式可能有誤',
 }
 
 # Text that will be add if the bot find a unknown extension.
 delete_immediately_notification = {
-'ar': u'الملف [[:File:%s]] يبدو أن امتداده خاطيء, من فضلك تحقق. ',
-'commons': u'The [[:File:%s]] file seems to have a wrong extension, please 
check. ',
-'en': u'The [[:File:%s]] file seems to have a wrong extension, please 
check. ',
-'fa': u'به نظر می‌آید تصویر [[:تصویر:%s]] مسیر نادرستی داشته باشد لطفا 
بررسی کنید.',
-'ga': u'Tá iarmhír mícheart ar an comhad [[:File:%s]], scrúdaigh le 
d\'thoil. ',
-'fr': u'Le fichier [[:File:%s]] semble avoir une mauvaise extension, 
veuillez vérifier. ',
-'hu': u'A [[:Kép:%s]] fájlnak rossz a kiterjesztése, kérlek ellenőrízd. 
',
-'it': 
u'{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Ext|%s|__botnick__}} 
--',
-'ko': u'[[:그림:%s]]의 파일 형식이 잘못되었습니다. 확인 바랍니다.--',
-'ta': '[[:படிமம்:%s]] இனங்காணப்படாத கோப்பு நீட்சியை கொண்டுள்ளது தயவு 
செய்து ஒ'
-  'ரு முறை சரி பார்க்கவும் ',
-'ur': u'ملف [[:File:%s]] کی توسیع شاید درست نہیں ہے، براہ کرم جانچ لیں۔ 
',
-'zh': u'您好,你上傳的[[:File:%s]]無法被識別,請檢查您的檔案,謝謝。--',
+'ar': 'الملف %(file)s يبدو أن امتداده خاطيء, من فضلك تحقق.',
+'en': 'The [[:File:%(file)s]] file seems to have a wrong extension, please 
check.',
+'fa': 'به نظر می‌آید تصویر [[:تصویر:%(file)s]] مسیر نادرستی داشته باشد 
لطفا بررسی کنید.',
+'ga': 'Tá iarmhír mícheart ar an comhad %(file)s, scrúdaigh le d\'thoil.',
+'fr': 'Le fichier %(file)s semble avoir une mauvaise extension, veuillez 
vérifier.',
+'hu': 'A %(file)s fájlnak rossz a kiterjesztése, kérlek ellenőrízd.',
+'it': 
'{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Ext|%(file)s|__botnick__}}',
+'ko': '%(file)s의 파일 형식이 잘못되었습니다. 확인 바랍니다.',
+'ta': '%(file)s இனங்காணப்படாத கோப்பு நீட்சியை கொண்டுள்ளது தயவு செய்து ஒ'
+  'ரு முறை சரி பார்க்கவும்',
+'ur': 'ملف %(file)s کی توسیع شاید درست نہیں ہے، براہ کرم جانچ لیں۔',
+'zh': '您好,你上傳的%(file)s無法被識別,請檢查您的檔案,謝謝。',
 }
 
 # Summary of the delete immediately.
 # (e.g: Adding {{db-meta|The file has .%s as extension.}})
 msg_del_comm = {
-'ar': u'بوت: إضافة %s',
-'commons': u'Bot: Adding %s',
-'en': u'Bot: Adding %s',
-'fa': u'ربات: اضافه کردن %s',
-'ga': u'Róbó: Cuir %s leis',
-'fr': u'Robot : Ajouté %s',
-'hu': u'Robot:"%s" hozzáadása',
-'it': u'Bot: Aggiungo %s',
-'ja': u'ロボットによる: 追加 %s',
-'ko': u'로봇 : %s 추가',
-'ta': u'Bot: Adding %s',
-'ur': u'روبالہ: اضافہ %s',
-'zh': u'機器人: 正在新增 %s',
+'ar': 'بوت: إضافة %(adding)s',
+'en': 'Bot: Adding %(adding)s',
+'fa': 'ربات: اضافه کردن %(adding)s',
+'ga': 'Róbó: Cuir %(adding)s leis',
+'fr': 'Robot : Ajouté %(adding)s',
+'hu': 'Robot:"%(adding)s" hozzáadása',
+'it': 'Bot: Aggiungo %(adding)s',
+'ja': 'ロボットによる: 追加 %(adding)s',
+'ko': '로봇 : %(adding)s 추가',
+'ta': 'Bot: Adding %(adding)s',
+'ur': 'روبالہ: اضافہ %(adding)s',
+'zh': '機器人: 正在新增 %(adding)s',
 }
 
 # This is the most important header, because it will be used a 

[MediaWiki-commits] [Gerrit] [IMPR] replace __botnick__ by tildes - change (pywikibot/core)

2015-12-28 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261184

Change subject: [IMPR] replace __botnick__ by tildes
..

[IMPR] replace __botnick__ by tildes

Change-Id: I1816b9996f1a21db29b4e94bf2eaac469d664a0b
---
M scripts/checkimages.py
1 file changed, 9 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/84/261184/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index adfcaaf..5aeba66 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -215,7 +215,7 @@
 'ga': u'Tá iarmhír mícheart ar an comhad [[:File:%s]], scrúdaigh le 
d\'thoil. ',
 'fr': u'Le fichier [[:File:%s]] semble avoir une mauvaise extension, 
veuillez vérifier. ',
 'hu': u'A [[:Kép:%s]] fájlnak rossz a kiterjesztése, kérlek ellenőrízd. 
',
-'it': 
u'{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Ext|%s|__botnick__}} 
--',
+'it': '{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Ext|%s|~~~}} 
--',
 'ko': u'[[:그림:%s]]의 파일 형식이 잘못되었습니다. 확인 바랍니다.--',
 'ta': '[[:படிமம்:%s]] இனங்காணப்படாத கோப்பு நீட்சியை கொண்டுள்ளது தயவு 
செய்து ஒ'
   'ரு முறை சரி பார்க்கவும் ',
@@ -259,12 +259,12 @@
 # (feel free not to use if you don't need it)
 nothing_notification = {
 'commons': (u"\n{{subst:User:Filnik/untagged|File:%s}}\n\n''This message "
-u"was '''added automatically by __botnick__''', if you need "
+u"was '''added automatically by ~~~''', if you need "
 u"some help about it, please read the text above again and "
 u"follow the links in it, if you still need help ask at the "
 u"[[File:Human-help-browser.svg|18px|link=Commons:Help 
desk|?]] "
 u"'''[[Commons:Help desk|->]][[Commons:Help desk]]''' in any "
-u"language you like to use.'' --__botnick__ ~"""),
+u"language you like to use.'' --"""),
 'ar': u"{{subst:مصدر الصورة|File:%s}} --",
 'en': u"{{subst:image source|File:%s}} --",
 'fa': u"{{جا:اخطار نگاره|%s}}",
@@ -273,7 +273,7 @@
   u"helyezte el a vitalapodon, kérdéseddel fordulj a gazdájához, vagy "
   u"a [[WP:KF|Kocsmafalhoz]]. --",
 'it': '{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Senza licenza|'
-  '%s|__botnick__}} --',
+  '%s|~~~}} --',
 'ja': u"\n{{subst:Image copyright|File:%s}}--",
 'ko': u'\n{{subst:User:Kwjbot IV/untagged|%s}} --',
 'ta': u'\n{{subst:Di-no license-notice|படிமம்:%s}} ',
@@ -306,7 +306,7 @@
   u'képek]]ről szóló oldalunk, és segítségért fordulj a [[WP:KF-JO|'
   u'Jogi kocsmafalhoz]]. Köszönöm --',
 'it': u':{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Senza'
-  u'licenza2|%s|__botnick__}} --',
+  u'licenza2|%s|~~~}} --',
 }
 
 # You can add some settings to a wiki page. In this way, you can change them
@@ -405,14 +405,14 @@
 # (feel free not to use if you don't need it)
 HiddenTemplateNotification = {
 'commons': (u"\n{{subst:User:Filnik/whitetemplate|File:%s}}\n\n''This "
-u"message was added automatically by __botnick__, if you need "
+u"message was added automatically by ~~~, if you need "
 u"some help about it please read the text above again and "
 u"follow the links in it, if you still need help ask at the "
 u"[[File:Human-help-browser.svg|18px|link=Commons:Help 
desk|?]]"
 u" '''[[Commons:Help desk|→]] [[Commons:Help desk]]''' in any "
-u"language you like to use.'' --__botnick__ ~"),
+u"language you like to use.'' --"),
 'it': '{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/'
-  'Template_insufficiente|%s|__botnick__}} --',
+  'Template_insufficiente|%s|~~~}} --',
 'ko': u"\n{{subst:User:Kwj2772/whitetemplates|%s}} --",
 }
 
@@ -434,9 +434,8 @@
 
 # Message to put in the talk
 duplicates_user_talk_text = {
-'commons': u'{{subst:User:Filnik/duplicates|File:%s|File:%s}}',  # FIXME: 
it doesn't exist
 'it': '{{subst:Progetto:Coordinamento/Immagini/Bot/Messaggi/Duplicati|'
-  '%s|%s|__botnick__}} --',
+  '%s|%s|~~~}} --',
 }
 
 # Comment used by the bot while it reports the problem in the uploader's talk

-- 
To view, visit https://gerrit.wikimedia.org/r/261184
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1816b9996f1a21db29b4e94bf2eaac469d664a0b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org

[MediaWiki-commits] [Gerrit] [Bugfix] Don't format strings if they don't exists - change (pywikibot/core)

2015-12-28 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261180

Change subject: [Bugfix] Don't format strings if they don't exists
..

[Bugfix] Don't format strings if they don't exists

- assign delete_immediately message to msg_del_comm message before adding
  line feed.
- move di assignments to needed code part. Otherwise the script would break.
- Skip processing if no msg are given
- remove outdated comment

Change-Id: I4afdb32cb84e70b2e33c34d2c350c7bb75925558
---
M scripts/checkimages.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/80/261180/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 22a0946..ffa337d 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1502,10 +1502,6 @@
 dels = i18n.translate(self.site, msg_del_comm, fallback=True)
 smwl = i18n.translate(self.site, second_message_without_license)
 
-# Some formatting for delete immediately template
-di = u'\n%s' % di
-dels = dels % di
-
 try:
 self.imageCheckText = self.image.get()
 except pywikibot.NoPage:
@@ -1538,10 +1534,15 @@
 (license_found, hiddenTemplateFound) = self.smartDetection()
 # Here begins the check block.
 if brackets and license_found:
-# It works also without this... but i want only to be sure ^^
 return True
 elif delete:
 pywikibot.output(u"%s is not a file!" % self.imageName)
+if not (di and dih):
+pywikibot.output('No speedy deletion template given. 
Skipping.')
+return
+# Some formatting for delete immediately template
+dels = dels % di
+di = '\n' + di
 # Modify summary text
 pywikibot.setAction(dels)
 canctext = di % extension

-- 
To view, visit https://gerrit.wikimedia.org/r/261180
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4afdb32cb84e70b2e33c34d2c350c7bb75925558
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] String improvements - change (pywikibot/core)

2015-12-28 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/261201

Change subject: String improvements
..

String improvements

- use ascii_letters from string
- "D" is a roman number character too

Change-Id: I8e22bc009aef49d8ee68d55a0d62c08a59ac2062
---
M scripts/casechecker.py
1 file changed, 3 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/01/261201/1

diff --git a/scripts/casechecker.py b/scripts/casechecker.py
index d1858de..6014600 100755
--- a/scripts/casechecker.py
+++ b/scripts/casechecker.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8  -*-
 """Bot to find all pages on the wiki with mixed latin and cyrilic alphabets."""
 #
-# (C) Pywikibot team, 2006-2014
+# (C) Pywikibot team, 2006-2015
 #
 # Distributed under the terms of the MIT license.
 #
@@ -13,6 +13,7 @@
 import os
 import re
 import sys
+from string import ascii_letters as latLtr
 
 import pywikibot
 
@@ -107,7 +108,7 @@
 localKeyboard = u'йцукенгшщзфывапролдячсмить'
 latinKeyboard = u'qwertyuiopasdfghjklzxcvbnm'
 
-romanNumChars = u'IVXLMC'
+romanNumChars = u'IVXLCDM'
 # all letters that may be used as suffixes after roman numbers:  "Iый"
 romannumSuffixes = localLowerLtr
 romanNumSfxPtrn = re.compile(
@@ -116,8 +117,6 @@
 whitelists = {
 'ru': u'ВП:КЛ/Проверенные',
 }
-
-latLtr = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 lclClrFnt = u''
 latClrFnt = u''

-- 
To view, visit https://gerrit.wikimedia.org/r/261201
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e22bc009aef49d8ee68d55a0d62c08a59ac2062
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update mw and wmf version numbers - change (pywikibot/compat)

2015-12-24 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260928

Change subject: Update mw and wmf version numbers
..

Update mw and wmf version numbers

Change-Id: I118a3c1a3cfe011dde1cabbaaaf186360fa83213
---
M family.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat 
refs/changes/28/260928/1

diff --git a/family.py b/family.py
index 1552df0..cbf8bad 100644
--- a/family.py
+++ b/family.py
@@ -4331,7 +4331,7 @@
 # Don't use this, use versionnumber() instead. This only exists
 # to not break family files.
 # Here we return the latest mw release for downloading
-return '1.25.2'
+return '1.26.2'
 
 def versionnumber(self, code, version=None):
 """Return an int identifying MediaWiki version.
@@ -4967,7 +4967,7 @@
 # Don't use this, use versionnumber() instead. This only exists
 # to not break family files.
 # Here we return the latest mw release of wikimedia projects
-return '1.27.0-wmf.1'
+return '1.27.0-wmf.9'
 
 def shared_image_repository(self, code):
 return ('commons', 'commons')

-- 
To view, visit https://gerrit.wikimedia.org/r/260928
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I118a3c1a3cfe011dde1cabbaaaf186360fa83213
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update mw version string - change (pywikibot/core)

2015-12-24 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260930

Change subject: Update mw version string
..

Update mw version string

Change-Id: Ia34c7d727dcd18667060f37715edbed7f82cbe19
---
M pywikibot/family.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/30/260930/1

diff --git a/pywikibot/family.py b/pywikibot/family.py
index a139447..ce3f6c4 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1240,7 +1240,7 @@
 Use L{pywikibot.tools.MediaWikiVersion} to compare version strings.
 """
 # Here we return the latest mw release for downloading
-return '1.25.2'
+return '1.26.2'
 
 def force_version(self, code):
 """

-- 
To view, visit https://gerrit.wikimedia.org/r/260930
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia34c7d727dcd18667060f37715edbed7f82cbe19
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Typo fix - change (pywikibot/core)

2015-12-23 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260899

Change subject: Typo fix
..

Typo fix

Change-Id: I2b273f1c5c56fd3aebd9959ad250c2f9c5f7a431
---
M scripts/welcome.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/99/260899/1

diff --git a/scripts/welcome.py b/scripts/welcome.py
index b77d9e2..ea36244 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -151,7 +151,7 @@
 *  *
 * The regex to load the user might be slightly different from project to   *
 * project. (In this case, write to Filnik or the PWRF for help...) *
-* Use a class to group toghether the functions used.   *
+* Use a class to group together the functions used.   *
 *  *
  Badwords **
 
@@ -164,7 +164,7 @@
 or deleting.
 
 Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo" aren't
-badword at all but can be used for some bad-nickname.
+badwords at all but can be used for some bad-nickname.
 """
 #
 # (C) Alfio, 2005

-- 
To view, visit https://gerrit.wikimedia.org/r/260899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b273f1c5c56fd3aebd9959ad250c2f9c5f7a431
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Hazard-SJ 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Typo fix - change (pywikibot/core)

2015-12-23 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged.

Change subject: Typo fix
..


Typo fix

Change-Id: I2b273f1c5c56fd3aebd9959ad250c2f9c5f7a431
---
M scripts/welcome.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/welcome.py b/scripts/welcome.py
index b77d9e2..ea36244 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -151,7 +151,7 @@
 *  *
 * The regex to load the user might be slightly different from project to   *
 * project. (In this case, write to Filnik or the PWRF for help...) *
-* Use a class to group toghether the functions used.   *
+* Use a class to group together the functions used.   *
 *  *
  Badwords **
 
@@ -164,7 +164,7 @@
 or deleting.
 
 Some words, like "Administrator" or "Dio" (God in italian) or "Jimbo" aren't
-badword at all but can be used for some bad-nickname.
+badwords at all but can be used for some bad-nickname.
 """
 #
 # (C) Alfio, 2005

-- 
To view, visit https://gerrit.wikimedia.org/r/260899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2b273f1c5c56fd3aebd9959ad250c2f9c5f7a431
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Hazard-SJ 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] 'xcf' is a valid file extension - change (pywikibot/core)

2015-12-02 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/256387

Change subject: [bugfix] 'xcf' is a valid file extension
..

[bugfix] 'xcf' is a valid file extension

- assign delete_immediately message to msg_del_comm message before adding
  line feed.
- Skip processing if no sd template is given
- move di assignments to needed code part. Otherwise the script would break

Change-Id: I8adc815c658a3c3cf3052e8fb39e0cdd867b1026
---
M scripts/checkimages.py
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/87/256387/1

diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 0e752e5..da83713 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1477,7 +1477,7 @@
 # Don't put "}}" here, please. Useless and can give problems.
 something = ['{{']
 # Unused file extensions. Does not contain PDF.
-notallowed = ("xcf", "xls", "sxw", "sxi", "sxc", "sxd")
+notallowed = ('xls', 'sxw', 'sxi', 'sxc', 'sxd')
 brackets = False
 delete = False
 notification = None
@@ -1493,10 +1493,6 @@
 nn = i18n.translate(self.site, nothing_notification)
 dels = i18n.translate(self.site, msg_del_comm, fallback=True)
 smwl = i18n.translate(self.site, second_message_without_license)
-
-# Some formatting for delete immediately template
-di = u'\n%s' % di
-dels = dels % di
 
 try:
 self.imageCheckText = self.image.get()
@@ -1536,6 +1532,12 @@
 return True
 elif delete:
 pywikibot.output(u"%s is not a file!" % self.imageName)
+if not di:
+pywikibot.output('No speedy deletion template given. 
Skipping.')
+return
+# Some formatting for delete immediately template
+dels = dels % di
+di = '\n' + di
 # Modify summary text
 pywikibot.setAction(dels)
 canctext = di % extension

-- 
To view, visit https://gerrit.wikimedia.org/r/256387
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8adc815c658a3c3cf3052e8fb39e0cdd867b1026
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


<    2   3   4   5   6   7   8   9   10   11   >