[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] Add codeclimate maintainabiltity shield and link to doc

2018-01-22 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403947 )

Change subject: [doc] Add codeclimate maintainabiltity shield and link to doc
..


[doc] Add codeclimate maintainabiltity shield and link to doc

Change-Id: Id3666b111aff9d03f77b9e73d551871fa7abe6ee
---
M README.rst
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Framawiki: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index b06ae49..543fa5b 100644
--- a/README.rst
+++ b/README.rst
@@ -4,6 +4,9 @@
 .. image:: 
https://codecov.io/gh/wikimedia/pywikibot/branch/master/graphs/badge.svg?branch=master
:alt: Code coverage
:target: http://codecov.io/github/wikimedia/pywikibot?branch=master
+.. image:: 
https://codeclimate.com/github/wikimedia/pywikibot-core/badges/gpa.svg
+   :alt: Maintainability
+   :target: https://codeclimate.com/github/wikimedia/pywikibot-core
 .. image:: https://img.shields.io/pypi/v/pywikibot.svg
:alt: Pywikibot release
:target: https://pypi.python.org/pypi/pywikibot

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3666b111aff9d03f77b9e73d551871fa7abe6ee
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Dalba 
Gerrit-Reviewer: Framawiki 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Ladsgroup 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: Zoranzoki21 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] Remove autosummary and numpydoc

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405595 )

Change subject: [doc] Remove autosummary and numpydoc
..

[doc] Remove autosummary and numpydoc

- autosummary isn't used
- numpydoc gives a lot of warnings
- some doc changes could be done by a sphinx hook

Change-Id: Iec1c0c90d279c774164390f60d720705a7e5ee70
---
M docs/conf.py
M docs/requirements-py3.txt
2 files changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/95/405595/1

diff --git a/docs/conf.py b/docs/conf.py
index 83c04f8..bd9a9bf 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -37,8 +37,7 @@
   'sphinx.ext.todo',
   'sphinx.ext.coverage',
   'sphinx.ext.viewcode',
-  'sphinx.ext.autosummary',
-  'numpydoc']
+]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index 6ff7fe5..1414a60 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -4,5 +4,5 @@
 
 sphinx
 sphinx-epytext>=0.0.4
-numpydoc
+
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec1c0c90d279c774164390f60d720705a7e5ee70
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] pywikibot/core[master]: [test] Exclude files and checks from code climate maintainab...

2018-01-21 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/404265 )

Change subject: [test] Exclude files and checks from code climate 
maintainability
..


[test] Exclude files and checks from code climate maintainability

Change-Id: I2fdd9467903f76341c9bbd8112d03b51a9255b83
---
A .codeclimate.yml
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Framawiki: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.codeclimate.yml b/.codeclimate.yml
new file mode 100644
index 000..98f2867
--- /dev/null
+++ b/.codeclimate.yml
@@ -0,0 +1,16 @@
+version: "2"
+
+checks:
+  argument-count:
+enabled: false
+  file-lines:
+enabled: false
+
+exclude_patterns:
+- docs/
+- !docs/conf.py
+- scripts/archive/
+- ez_setup.py
+- *.rst
+- *.txt
+

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2fdd9467903f76341c9bbd8112d03b51a9255b83
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Dalba 
Gerrit-Reviewer: Framawiki 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Ladsgroup 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: Zoranzoki21 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] fix rst issues

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405587 )

Change subject: [doc] fix rst issues
..

[doc] fix rst issues

Change-Id: Ia17ceba1fba965e14749eaf381b3d31ae72606bd
---
M docs/scripts/index.rst
M docs/scripts/scripts.i18n.rst
M docs/scripts/scripts.maintenance.rst
M docs/scripts/scripts.rst
4 files changed, 3 insertions(+), 85 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/87/405587/1

diff --git a/docs/scripts/index.rst b/docs/scripts/index.rst
index c5b1d6e..bef80d8 100644
--- a/docs/scripts/index.rst
+++ b/docs/scripts/index.rst
@@ -1,7 +1,7 @@
 Scripts reference
--
+-
 
-Provided Scripts by pywikibot
+Provided scripts by pywikibot
 =
 
 Pywikibot framework has a lot of ready-to-use scripts for several tasks.
diff --git a/docs/scripts/scripts.i18n.rst b/docs/scripts/scripts.i18n.rst
index e2ed902..07d48b8 100644
--- a/docs/scripts/scripts.i18n.rst
+++ b/docs/scripts/scripts.i18n.rst
@@ -4,5 +4,4 @@
 .. automodule:: scripts.i18n
 :members:
 :undoc-members:
-:show-inheritance:
-
+:show-inheritance:
\ No newline at end of file
diff --git a/docs/scripts/scripts.maintenance.rst 
b/docs/scripts/scripts.maintenance.rst
index 3680c91..bcc29e0 100644
--- a/docs/scripts/scripts.maintenance.rst
+++ b/docs/scripts/scripts.maintenance.rst
@@ -17,7 +17,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.maintenance.colors script
 -
 
@@ -25,7 +24,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.maintenance.compat2core script
 --
@@ -35,7 +33,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.maintenance.make_i18n_dict script
 -
 
@@ -43,7 +40,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.maintenance.wikimedia_sites script
 --
diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst
index b43271c..4a94d72 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -25,10 +25,8 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.archivebot script
 -
-
 
 scripts.basic script
 
@@ -38,7 +36,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.blockpageschecker script
 
 
@@ -46,7 +43,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.capitalize_redirects script
 ---
@@ -56,7 +52,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.catall script
 -
 
@@ -64,7 +59,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.category script
 ---
@@ -74,7 +68,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.cfd script
 --
 
@@ -82,7 +75,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.checkimages script
 --
@@ -92,7 +84,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.claimit script
 --
 
@@ -100,7 +91,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.clean_sandbox script
 
@@ -110,7 +100,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.commons_link script
 ---
 
@@ -118,7 +107,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.commonscat script
 -
@@ -128,7 +116,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.coordinate_import script
 
 
@@ -136,7 +123,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.cosmetic_changes script
 ---
@@ -146,7 +132,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.create_categories script
 
 
@@ -154,7 +139,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.data_ingestion script
 -
@@ -164,7 +148,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.delete script
 -
 
@@ -172,7 +155,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.disambredir script
 --
@@ -182,7 +164,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.djvutext script
 ---
 
@@ -190,7 +171,6 @@
 :members:
 :undoc-members:
 :show-inheritance:
-
 
 scripts.editarticle script
 --
@@ -200,7 +180,6 @@
 :undoc-members:
 :show-inheritance:
 
-
 scripts.fixing_redirects script
 ---
 
@@ -208,7 +187,6 @@
 :members:
 

[MediaWiki-commits] [Gerrit] integration/config[master]: Increase pywikibot-tox-docker timeout to 15 min

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405586 )

Change subject: Increase pywikibot-tox-docker timeout to 15 min
..

Increase pywikibot-tox-docker timeout to 15 min

pywikibot-core-tox-doc-docker needs nearby 10 min and
aborted several times. Increasing that time should fix this issue.

Change-Id: I817a71ac8faac41a00dd9fdcf368147c62fc5680
---
M jjb/pywikibot.yaml
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/86/405586/1

diff --git a/jjb/pywikibot.yaml b/jjb/pywikibot.yaml
index 68554e0..2c4eb26 100644
--- a/jjb/pywikibot.yaml
+++ b/jjb/pywikibot.yaml
@@ -11,7 +11,7 @@
  docker_image_var: 
docker-registry.wikimedia.org/releng/tox-pywikibot:0.1.0
  toxenv:
  - doc:
- build_timeout: 10 # minutes
+ build_timeout: 15 # minutes
  - nose
  - nose34
 - job-group:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I817a71ac8faac41a00dd9fdcf368147c62fc5680
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
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] pywikibot/core[master]: [IMPR] Simplify startswith/endswith code

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405584 )

Change subject: [IMPR] Simplify startswith/endswith code
..

[IMPR] Simplify startswith/endswith code

startswith or endswith prefix may be a tuple since py 2.5

Change-Id: Ia70e78a67352574d3031ce6c9851bf6ec5213714
---
M pywikibot/family.py
M scripts/checkimages.py
M scripts/delete.py
M scripts/weblinkchecker.py
4 files changed, 8 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/84/405584/1

diff --git a/pywikibot/family.py b/pywikibot/family.py
index 317b73c..0dae080 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Objects representing MediaWiki families."""
 #
-# (C) Pywikibot team, 2004-2017
+# (C) Pywikibot team, 2004-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -937,7 +937,7 @@
 if fam in config.family_files:
 family_file = config.family_files[fam]
 
-if family_file.startswith('http://') or 
family_file.startswith('https://'):
+if family_file.startswith(('http://', 'https://')):
 myfamily = AutoFamily(fam, family_file)
 Family._families[fam] = myfamily
 return Family._families[fam]
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 99ef506..02b340e 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -80,7 +80,7 @@
 # (C) Kyle/Orgullomoore, 2006-2007 (newimage.py)
 # (C) Siebrand Mazeland, 2007-2010
 # (C) Filnik, 2007-2011
-# (C) Pywikibot team, 2007-2017
+# (C) Pywikibot team, 2007-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1581,7 +1581,7 @@
 u'How many files do you want to check?'))
 else:
 limit = int(arg[7:])
-if arg.startswith('-sleep') or arg.startswith('-time'):
+if arg.startswith(('-sleep', '-time')):
 if arg.startswith('-sleep'):
 length = len('-sleep')
 else:
diff --git a/scripts/delete.py b/scripts/delete.py
index 359c588..57e99fe 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -49,7 +49,7 @@
 python pwb.py delete -cat:"To delete" -always
 """
 #
-# (C) Pywikibot team, 2017
+# (C) Pywikibot team, 2017-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -267,7 +267,7 @@
 if not summary:
 un = 'un' if 'undelete' in options else ''
 if pageName:
-if arg.startswith('-cat') or arg.startswith('-subcats'):
+if arg.startswith(('-cat', '-subcats')):
 summary = i18n.twtranslate(mysite, 'delete-from-category',
{'page': pageName})
 elif arg.startswith('-links'):
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index 54ac583..bc73f08 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -99,7 +99,7 @@
 """
 #
 # (C) Daniel Herding, 2005
-# (C) Pywikibot team, 2005-2017
+# (C) Pywikibot team, 2005-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -442,8 +442,7 @@
 except UnicodeError:
 redirTarget = redirTarget.decode(
 self.getEncodingUsedByServer())
-if redirTarget.startswith('http://') or \
-   redirTarget.startswith('https://'):
+if redirTarget.startswith(('http://', 'https://')):
 self.changeUrl(redirTarget)
 return True
 elif redirTarget.startswith('/'):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia70e78a67352574d3031ce6c9851bf6ec5213714
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] pywikibot/core[master]: [IMPR] Simplify invalid title parsing

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405583 )

Change subject: [IMPR] Simplify invalid title parsing
..

[IMPR] Simplify invalid title parsing

This is an alternat implementation of
https://gerrit.wikimedia.org/r/#/c/403957/

Change-Id: Ia2456e721472f9bb0386ab15ab1859aa54e63915
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/83/405583/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 0ca875bc..7863fb1 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5554,13 +5554,11 @@
 # * with 'relative' URLs. Forbid them explicitly.
 
 if u'.' in t and (
-t == u'.' or t == u'..' or
-t.startswith(u'./') or
-t.startswith(u'../') or
+t in ('.', '..') or
+t.startswith(('./', '../')) or
 u'/./' in t or
 u'/../' in t or
-t.endswith(u'/.') or
-t.endswith(u'/..')
+t.endswith(('/.', '/..')) or
 ):
 raise pywikibot.InvalidTitle(
 u"(contains . / combinations): '%s'"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2456e721472f9bb0386ab15ab1859aa54e63915
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] pywikibot/core[master]: [cleanup] always use for pagegenerators options inc...

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405581 )

Change subject: [cleanup] always use  for pagegenerators options 
inclusion
..

[cleanup] always use  for pagegenerators options inclusion

All scripts use  token or include pagegenerators options
except interwiki.py. Use the same token for all scripts.

Change-Id: I6f3437c7ae31f79d8ec06c8e427dd9aafabc0686
---
M docs/conf.py
M scripts/interwiki.py
2 files changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/81/405581/1

diff --git a/docs/conf.py b/docs/conf.py
index 83c04f8..60cfe23 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Configuration file for Sphinx."""
 #
-# (C) Pywikibot team, 2015-2017
+# (C) Pywikibot team, 2015-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -260,7 +260,7 @@
 if os.path.sep + "scripts" + os.path.sep not in obj.__file__:
 return
 for index, line in enumerate(lines):
-if line in ('', '_help;'):
+if line == '':
 lines[index] = ('This script supports use of '
 ':py:mod:`pywikibot.pagegenerators` arguments.')
 elif line == '':
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index b1bca2f..33b67e2 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -12,7 +12,7 @@
 
 These command-line arguments can be used to specify which pages to work on:
 
-_help;
+
 
 -days: Like -years, but runs through all date pages. Stops at
Dec 31. If the argument is given in the form -days:X,
@@ -337,8 +337,8 @@
 # (C) Rob W.W. Hooft, 2003
 # (C) Daniel Herding, 2004
 # (C) Yuri Astrakhan, 2005-2006
-# (C) xqt, 2009-2017
-# (C) Pywikibot team, 2007-2017
+# (C) xqt, 2009-2018
+# (C) Pywikibot team, 2007-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -366,7 +366,7 @@
 unicode = str
 
 docuReplacements = {
-'_help;': pagegenerators.parameterHelp
+'': pagegenerators.parameterHelp
 }
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f3437c7ae31f79d8ec06c8e427dd9aafabc0686
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] pywikibot/core[master]: [doc] No reason to restrict sphinx to very outdated release

2018-01-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405580 )

Change subject: [doc] No reason to restrict sphinx to very outdated release
..

[doc] No reason to restrict sphinx to very outdated release

Change-Id: Iae68e33e98c44e112a3a234d8237dd5f8fe5dd6e
---
M docs/requirements-py3.txt
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index 7403a65..6ff7fe5 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -1,8 +1,8 @@
 # This is a PIP requirements file for building Sphinx documentation of 
pywikibot
-# using sphinx-1.3b1 on python3.4, and is used by readthedocs.org.
+# using sphinx on python3.4.
 # requests-requirements.txt is also needed
 
-sphinx==1.3.1
+sphinx
 sphinx-epytext>=0.0.4
 numpydoc
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae68e33e98c44e112a3a234d8237dd5f8fe5dd6e
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] pywikibot/core[master]: utils.WarningSourceSkipContextManager: Ignore unclosed socke...

2018-01-20 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/405559 )

Change subject: utils.WarningSourceSkipContextManager: Ignore unclosed socket 
ResourceWarnings
..


utils.WarningSourceSkipContextManager: Ignore unclosed socket ResourceWarnings

Ignore unclosed socket ResourceWarnings from any file during
DeprecationTestCase run.
Python ResourceWarning happens when garbage collection is triggered which may
happen at any point during runtime. Therefore the source of the warning
is rather arbitrary.

See https://bugs.python.org/issue29564 for more info.

Bug: T185401
Change-Id: Ie15e5aebf4ebec2fd27831399762e5812916f939
---
M tests/utils.py
1 file changed, 1 insertion(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved



diff --git a/tests/utils.py b/tests/utils.py
index eaf68c4..e3c6526 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -260,9 +260,7 @@
 if (PYTHON_VERSION >= (3, 2)
 and issubclass(warn_msg.category, ResourceWarning)
 and any(str(warn_msg.message).startswith(msg) for msg in (
-'unclosed 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: Zoranzoki21 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Remove filterParents implementation from imagerecat.py

2018-01-20 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405533 )

Change subject: Remove filterParents implementation from imagerecat.py
..

Remove filterParents implementation from imagerecat.py

toolserver filter isn't available anymore.
Prevent unsucessful web call.

Bug: T78462
Change-Id: I41e080bf0eb9facd45b25485509fc5628b038503
---
M scripts/imagerecat.py
1 file changed, 10 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/33/405533/1

diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index 225b0bc..ea4c5d2 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -27,7 +27,7 @@
 """
 #
 # (C) Multichill, 2008-2011
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -43,6 +43,7 @@
 
 from pywikibot import pagegenerators, textlib
 from pywikibot.comms.http import fetch
+from pywikibot.tools import deprecated
 
 if sys.version_info[0] > 2:
 from urllib.parse import urlencode
@@ -293,12 +294,10 @@
 
 def applyAllFilters(categories):
 """Apply all filters on categories."""
-result = []
 result = filterDisambiguation(categories)
 result = followRedirects(result)
 result = filterBlacklist(result)
 result = filterCountries(result)
-result = filterParents(result)
 return result
 
 
@@ -370,29 +369,16 @@
 return list(set(result))
 
 
+@deprecated
 def filterParents(categories):
-"""Remove all parent categories from the set to prevent 
overcategorization."""
-result = []
-toFilter = u''
-for cat in categories:
-cat = cat.replace('_', ' ')
-toFilter = toFilter + "[[Category:" + cat + "]]\n"
-parameters = urlencode({'source': toFilter.encode('utf-8'),
-'bot': '1'})
-filterCategoriesRe = re.compile(r'\[\[Category:([^\]]*)\]\]')
-try:
-filterCategoriesPage = fetch(
-"https://toolserver.org/~multichill/filtercats.php?%s; % 
parameters)
-result = filterCategoriesRe.findall(
-filterCategoriesPage.content)
-except IOError:
-# Something is wrong, forget about this filter, and return the input
-return categories
+"""
+Remove all parent categories from the set to prevent overcategorization.
 
-if not result:
-# Is empty, dont want to remove all categories
-return categories
-return result
+DEPRECATED: Toolserver script isn't available anymore (T78462).
+This method is kept for compatibility and may be restored sometime by a new
+implementation.
+"""
+return categories
 
 
 def saveImagePage(imagepage, newcats, usage, galleries, onlyFilter):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41e080bf0eb9facd45b25485509fc5628b038503
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] pywikibot/core[master]: [doc] Show pagegenerators options with -help

2018-01-17 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404637 )

Change subject: [doc] Show pagegenerators options with -help
..

[doc] Show pagegenerators options with -help

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


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/37/404637/1

diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 6c8a731..2a9cd39 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -19,6 +19,8 @@
 
 Command line options:
 
+
+
 -always  Skip the GUI validation
 
 -setcat: Set the category of the copied image
@@ -51,9 +53,7 @@
 
  python pwb.py imagecopy.py -page:Image: -delete
 
-See pagegenerators.py for more ways to get a list of images.
 By default the bot works on your home wiki (set in user-config)
-
 """
 # Based on upload.py by:
 # (C) Rob W.W. Hooft, Andre Engels 2003-2007
@@ -93,6 +93,12 @@
 Tkinter = _tk_error
 Tkdialog = object
 
+# This is required for the text that is shown when you run this script
+# with the parameter -help.
+docuReplacements = {
+'': pagegenerators.parameterHelp
+}
+
 NL = ''
 
 nowCommonsTemplate = {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I384098245993581653758fd2fe11150063774201
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] pywikibot/core[master]: Declare development status as Production/Stable

2018-01-16 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404469 )

Change subject: Declare development status as Production/Stable
..

Declare development status as Production/Stable

As long as push tag a new release to pypi and create a tag for it
this is always tested by travis and appreyor builds so we can concluse
that the published release is stable (enough).

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


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

diff --git a/setup.py b/setup.py
index 495d3f2..4175a72 100644
--- a/setup.py
+++ b/setup.py
@@ -266,7 +266,7 @@
 test_suite="tests.collector",
 tests_require=test_deps,
 classifiers=[
-'Development Status :: 4 - Beta',
+'Development Status :: 5 - Production/Stable',
 'Environment :: Console',
 'Intended Audience :: Developers',
 'License :: OSI Approved :: MIT License',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0468a12e0fe96290c02b0c1020d1ab8de083c3c1
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] pywikibot/core[master]: [bugfix] Ignore unclosed socket warnings for py3

2018-01-16 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404449 )

Change subject: [bugfix] Ignore unclosed socket warnings for py3
..

[bugfix] Ignore unclosed socket warnings for py3

Bug: T184996
Change-Id: I3b979329780af4c75191607d2db900cfe154a763
---
M tests/utils.py
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/49/404449/1

diff --git a/tests/utils.py b/tests/utils.py
index ea9d420..dde0993 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -256,11 +256,12 @@
 else:
 skip_frames -= 1
 
-# Ignore socket IO warnings (T183696)
+# Ignore socket IO warnings (T183696, T184996)
 if (PYTHON_VERSION >= (3, 2)
 and issubclass(warn_msg.category, ResourceWarning)
 and 'unclosed 

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [compat2core] Note different results of getVersionHistory

2018-01-16 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404435 )

Change subject: [compat2core] Note different results of getVersionHistory
..

[compat2core] Note different results of getVersionHistory

- Page.getVersionHistory() gives a list of tuples with 4 items
  but tuple has 6 items in compat. Notify it in compat2core.py

This is an alternate implementation to solve T136513.
See: https://gerrit.wikimedia.org/r/#/c/291605/7

Bug: T136513
Change-Id: Ibd89306199ee346369d9241a78f61b94fcc3b9f3
---
M pywikibot/page.py
M scripts/maintenance/compat2core.py
2 files changed, 10 insertions(+), 5 deletions(-)


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

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 767835d..fb6acd2 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1699,9 +1699,13 @@
 return (self._revisions[rev] for rev in
 sorted(self._revisions, reverse=not reverse)[:total])
 
-# BREAKING CHANGE: in old framework, default value for getVersionHistory
-#  returned no more than 500 revisions; now, it iterates
-#  all revisions unless 'total' argument is used
+# BREAKING CHANGES:
+# - in old framework, default value for getVersionHistory returned nomore
+#   than 500 revisions; now, it iterates all revisions unless 'total'
+#   argument is used
+# - timestamp is a pywikibot.Timestampe, not a MediaWiki timestamp string
+# - old framework return a tuple of 6 items but size and tags are missing
+#   here
 @deprecated('Page.revisions()')
 @deprecated_args(forceReload=None, revCount='total', step=None,
  getAll=None, reverseOrder='reverse')
diff --git a/scripts/maintenance/compat2core.py 
b/scripts/maintenance/compat2core.py
index 4e62b64..827bed5 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -99,8 +99,9 @@
 ('.replaceImage(',
  'Page.replaceImage() is deprecated and does not work at core'),
 ('.getVersionHistory(',
- 'Page.getVersionHistory() returns a pywikibot.Timestamp object instead 
of\n'
- 'a MediaWiki one'),
+ 'Page.getVersionHistory() returns a pywikibot.Timestamp object instead\n'
+ 'of a MediaWiki one. It also returns a tuple of 4 items instead of 6:\n'
+ 'size and tags items are missing. Use Page.revisions instead.'),
 ('.contributions(',
  'User.contributions() returns a pywikibot.Timestamp object instead of a\n'
  'MediaWiki one'),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd89306199ee346369d9241a78f61b94fcc3b9f3
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] pywikibot/core[master]: Add vcr cassettes for some classes in wikibase_tests.py

2018-01-16 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404424 )

Change subject: Add vcr cassettes for some classes in wikibase_tests.py
..

Add vcr cassettes for some classes in wikibase_tests.py

Add vcr cassettes for some classses in wikibase_tests.py:
- TestRedirects
- TestLinks
- TestNamespaces

This reverts commit a01a3780839552b850eb1ccac9f82ff5cf0e3367.

Bug: T184081
Change-Id: I0ca9ffad52153a7a05450ea97381b00ea610f66b
---
A tests/cassettes/wikidata.wikidata/TestNamespaces.test_empty_wikibase_page.yaml
A 
tests/cassettes/wikidata.wikidata/TestNamespaces.test_item_unknown_namespace.yaml
A 
tests/cassettes/wikidata.wikidata/TestNamespaces.test_wikibase_namespace_selection.yaml
A tests/cassettes/wikidata.wikidata/TestRedirects.test_normal_item.yaml
A tests/cassettes/wikidata.wikidata/TestRedirects.test_redirect_item.yaml
A tests/cassettes/wikipedia.af/TestLinks.test_iterlinks_filtering.yaml
M tests/wikibase_tests.py
7 files changed, 2,363 insertions(+), 0 deletions(-)


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


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ca9ffad52153a7a05450ea97381b00ea610f66b
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] pywikibot/core[master]: Revert "Add vcr cassettes for some classes in wikibase_tests...

2018-01-16 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404420 )

Change subject: Revert "Add vcr cassettes for some classes in wikibase_tests.py"
..

Revert "Add vcr cassettes for some classes in wikibase_tests.py"

Revert due to failing tests:
https://travis-ci.org/wikimedia/pywikibot/builds/329129072

This reverts commit c535c77389ad137d48b877660a7a0eb62f9a12b7.

Change-Id: I6a90c7a7b7c21da679fe1f63435360da3835ac54
---
D tests/cassettes/wikidata.wikidata/TestNamespaces.test_empty_wikibase_page.yaml
D 
tests/cassettes/wikidata.wikidata/TestNamespaces.test_item_unknown_namespace.yaml
D 
tests/cassettes/wikidata.wikidata/TestNamespaces.test_wikibase_namespace_selection.yaml
D tests/cassettes/wikidata.wikidata/TestRedirects.test_normal_item.yaml
D tests/cassettes/wikidata.wikidata/TestRedirects.test_redirect_item.yaml
D tests/cassettes/wikipedia.af/TestLinks.test_iterlinks_filtering.yaml
M tests/wikibase_tests.py
7 files changed, 0 insertions(+), 2,363 deletions(-)


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


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a90c7a7b7c21da679fe1f63435360da3835ac54
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] pywikibot/core[master]: [test] Exclude files and checks from code climate maintainab...

2018-01-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404265 )

Change subject: [test] Exclude files and checks from code climate 
maintainability
..

[test] Exclude files and checks from code climate maintainability

Change-Id: I2fdd9467903f76341c9bbd8112d03b51a9255b83
---
A .codeclimate.yml
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/65/404265/1

diff --git a/.codeclimate.yml b/.codeclimate.yml
new file mode 100644
index 000..98f2867
--- /dev/null
+++ b/.codeclimate.yml
@@ -0,0 +1,16 @@
+version: "2"
+
+checks:
+  argument-count:
+enabled: false
+  file-lines:
+enabled: false
+
+exclude_patterns:
+- docs/
+- !docs/conf.py
+- scripts/archive/
+- ez_setup.py
+- *.rst
+- *.txt
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fdd9467903f76341c9bbd8112d03b51a9255b83
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] pywikibot/core[master]: [IMPR] Simplify transliteration table for Japanese and Chine...

2018-01-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403961 )

Change subject: [IMPR] Simplify transliteration table for Japanese and Chinese 
typographie
..

[IMPR] Simplify transliteration table for Japanese and Chinese typographie

Change-Id: Iae4bfbf209578444e0b7d5e641ed3b132158a255
---
M pywikibot/userinterfaces/transliteration.py
1 file changed, 22 insertions(+), 43 deletions(-)


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

diff --git a/pywikibot/userinterfaces/transliteration.py 
b/pywikibot/userinterfaces/transliteration.py
index 0736ac0..274a64b 100644
--- a/pywikibot/userinterfaces/transliteration.py
+++ b/pywikibot/userinterfaces/transliteration.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Module to transliterate text."""
 #
-# (C) Pywikibot team, 2006-2015
+# (C) Pywikibot team, 2006-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -688,52 +688,31 @@
 self.trans[char] = u"["
 for char in u"]】〗":
 self.trans[char] = u"]"
-for char in u"{":
-self.trans[char] = u"{"
-for char in u"}":
-self.trans[char] = u"}"
-for char in u"っ":
-self.trans[char] = u":"
-for char in u"ー":
-self.trans[char] = u"h"
-for char in u"゛":
-self.trans[char] = u"'"
-for char in u"゜":
-self.trans[char] = u"p"
-for char in u"。":
-self.trans[char] = u". "
-for char in u"、":
-self.trans[char] = u", "
-for char in u"・":
-self.trans[char] = u" "
-for char in u"〆":
-self.trans[char] = u"shime"
-for char in u"〜":
-self.trans[char] = u"-"
-for char in u"…":
-self.trans[char] = u"..."
-for char in u"‥":
-self.trans[char] = u".."
-for char in u"ヶ":
-self.trans[char] = u"months"
+self.trans['{'] = '{'
+self.trans['}'] = '}'
+self.trans['っ'] = ':'
+self.trans['ー'] = 'h'
+self.trans['゛'] = "'"
+self.trans['゜'] = 'p'
+self.trans['。'] = '. '
+self.trans['、'] = ', '
+self.trans['・'] = ' '
+self.trans['〆'] = 'shime'
+self.trans['〜'] = '-'
+self.trans['…'] = '...'
+self.trans['‥'] = '..'
+self.trans['ヶ'] = 'months'
 for char in u"•◦":
 self.trans[char] = u"_"
 for char in u"※*":
 self.trans[char] = u"*"
-for char in u"Ⓧ":
-self.trans[char] = u"(X)"
-for char in u"Ⓨ":
-self.trans[char] = u"(Y)"
-for char in u"!":
-self.trans[char] = u"!"
-for char in u"?":
-self.trans[char] = u"?"
-for char in u";":
-self.trans[char] = u";"
-for char in u":":
-self.trans[char] = u":"
-for char in u"。":
-self.trans[char] = u"."
+self.trans['Ⓧ'] = '(X)'
+self.trans['Ⓨ'] = '(Y)'
+self.trans['!'] = '!'
+self.trans['?'] = '?'
+self.trans[';'] = ';'
+self.trans[':'] = ':'
+self.trans['。'] = '.'
 for char in u",、":
 self.trans[char] = u","
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae4bfbf209578444e0b7d5e641ed3b132158a255
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] pywikibot/core[master]: [IMPR] use regex to parse invalid title

2018-01-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403957 )

Change subject: [IMPR] use regex to parse invalid title
..

[IMPR] use regex to parse invalid title

Change-Id: Ibfd5a548a7c2a9be67d0f60c55fed9054af27971
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/57/403957/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 67ff263..ec6e457 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5547,16 +5547,7 @@
 # Pages with "/./" or "/../" appearing in the URLs will
 # often be unreachable due to the way web browsers deal
 # * with 'relative' URLs. Forbid them explicitly.
-
-if u'.' in t and (
-t == u'.' or t == u'..' or
-t.startswith(u'./') or
-t.startswith(u'../') or
-u'/./' in t or
-u'/../' in t or
-t.endswith(u'/.') or
-t.endswith(u'/..')
-):
+if re.search(r'(?:^(?:\.{1,2}(?:$|/))|/\.{1,2}/|/\.{1,2}$)', t):
 raise pywikibot.InvalidTitle(
 u"(contains . / combinations): '%s'"
 % self._text)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfd5a548a7c2a9be67d0f60c55fed9054af27971
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] pywikibot/core[master]: [doc] Add codeclimate maintainabiltity shield and link to doc

2018-01-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403947 )

Change subject: [doc] Add codeclimate maintainabiltity shield and link to doc
..

[doc] Add codeclimate maintainabiltity shield and link to doc

Change-Id: Id3666b111aff9d03f77b9e73d551871fa7abe6ee
---
M README.rst
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/README.rst b/README.rst
index b06ae49..543fa5b 100644
--- a/README.rst
+++ b/README.rst
@@ -4,6 +4,9 @@
 .. image:: 
https://codecov.io/gh/wikimedia/pywikibot/branch/master/graphs/badge.svg?branch=master
:alt: Code coverage
:target: http://codecov.io/github/wikimedia/pywikibot?branch=master
+.. image:: 
https://codeclimate.com/github/wikimedia/pywikibot-core/badges/gpa.svg
+   :alt: Maintainability
+   :target: https://codeclimate.com/github/wikimedia/pywikibot-core
 .. image:: https://img.shields.io/pypi/v/pywikibot.svg
:alt: Pywikibot release
:target: https://pypi.python.org/pypi/pywikibot

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3666b111aff9d03f77b9e73d551871fa7abe6ee
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] pywikibot/core[master]: [doc] Add AppVeyor Build Status shield and link to README.rst

2018-01-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403944 )

Change subject: [doc] Add AppVeyor Build Status shield and link to README.rst
..

[doc] Add AppVeyor Build Status shield and link to README.rst

Change-Id: I7f54533a85ef82a94259ef64a72f6975c13820d7
---
M README.rst
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/44/403944/1

diff --git a/README.rst b/README.rst
index b06ae49..1678d66 100644
--- a/README.rst
+++ b/README.rst
@@ -1,6 +1,9 @@
 .. image:: https://secure.travis-ci.org/wikimedia/pywikibot.png?branch=master
-   :alt: Build Status
+   :alt: Travis Build Status
:target: https://travis-ci.org/wikimedia/pywikibot
+.. image:: 
https://img.shields.io/appveyor/ci/ladsgroup/pywikibot-g4xqx/master.svg?style=flat-square=AppVeyor%20CI
+   :alt: AppVeyor Build Status
+   :target: https://ci.appveyor.com/project/ladsgroup/pywikibot-g4xqx
 .. image:: 
https://codecov.io/gh/wikimedia/pywikibot/branch/master/graphs/badge.svg?branch=master
:alt: Code coverage
:target: http://codecov.io/github/wikimedia/pywikibot?branch=master

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f54533a85ef82a94259ef64a72f6975c13820d7
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] pywikibot/core[master]: [IMPR] Remove unneeded initializer from download_dump.py

2018-01-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403910 )

Change subject: [IMPR] Remove unneeded initializer from download_dump.py
..

[IMPR] Remove unneeded initializer from download_dump.py

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


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/10/403910/1

diff --git a/scripts/maintenance/download_dump.py 
b/scripts/maintenance/download_dump.py
index 91c2394..7b27c6d 100644
--- a/scripts/maintenance/download_dump.py
+++ b/scripts/maintenance/download_dump.py
@@ -61,10 +61,6 @@
 'revision': 'latest',
 }
 
-def __init__(self, **kwargs):
-"""Constructor."""
-super(DownloadDumpBot, self).__init__(**kwargs)
-
 def get_dump_name(self, db_name, typ):
 """Check if dump file exists locally in a Toolforge server."""
 db_path = '/public/dumps/public/{0}/'.format(db_name)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7159beb8bf482aa735a0553ed225c3e12aa34b70
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] pywikibot/core[master]: [cleanup] use assert instead of raising AssertionError

2018-01-12 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403906 )

Change subject: [cleanup] use assert instead of raising AssertionError
..

[cleanup] use assert instead of raising AssertionError

Change-Id: I9ae1af2cb2557169239052a3bb5f7b23e6283fb1
---
M pywikibot/date.py
M pywikibot/page.py
2 files changed, 22 insertions(+), 26 deletions(-)


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

diff --git a/pywikibot/date.py b/pywikibot/date.py
index b6c45ab..3ed48ed 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -7,7 +7,7 @@
 # (C) Andre Engels, 2004-2005
 # (C) Yuri Astrakhan, 2005-2006 (@gmail.com)
 #   (years/decades/centuries/millenniums str <=> int conversions)
-# (C) Pywikibot team, 2004-2017
+# (C) Pywikibot team, 2004-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -384,10 +384,9 @@
 if isinstance(dec, basestring):
 # Special case for strings that are replaced instead of
 # decoded
-if len(s) == 3:
-raise AssertionError(
-"Invalid pattern %s: Cannot use zero padding size "
-"in %s!" % (pattern, s))
+assert len(s) < 3, (
+'Invalid pattern {0}: Cannot use zero padding size '
+'in {1}!'.format(pattern, s))
 newPattern += re.escape(dec)
 strPattern += s # Keep the original text
 else:
@@ -451,8 +450,8 @@
   for i in range(len(decoders))]
 decValue = decf(values)
 
-if isinstance(decValue, basestring):
-raise AssertionError("Decoder must not return a string!")
+assert not isinstance(decValue, basestring), \
+   'Decoder must not return a string!'
 
 # recursive call to re-encode and see if we get the original
 # (may through filter exception)
@@ -473,19 +472,17 @@
 MakeParameter = _make_parameter
 
 if type(params) in _listTypes:
-if len(params) != len(decoders):
-raise AssertionError(
-"parameter count (%d) does not match decoder count (%d)"
-% (len(params), len(decoders)))
+assert len(params) == len(decoders), (
+'parameter count ({0}) does not match decoder count ({1})'
+.format(len(params), len(decoders)))
 # convert integer parameters into their textual representation
 params = [MakeParameter(decoders[i], params[i])
   for i in range(len(params))]
 return strPattern % tuple(params)
 else:
-if 1 != len(decoders):
-raise AssertionError(
-"A single parameter does not match %d decoders."
-% len(decoders))
+assert len(decoders) == 1, (
+'A single parameter does not match {0} decoders.'
+.format(len(decoders)))
 # convert integer parameter into its textual representation
 return strPattern % MakeParameter(decoders[0], params)
 
@@ -1959,15 +1956,16 @@
 
 
 def addFmt1(lang, isMnthOfYear, patterns):
-"""Add 12 month formats for a specific type ('January','Feb..), for a 
given language.
+"""Add 12 month formats for a specific type ('January', 'Feb.').
 
 The function must accept one parameter for the ->int or ->string
 conversions, just like everywhere else in the formats map.
 The patterns parameter is a list of 12 elements to be used for each month.
 
+@param lang: language code
+@type lang: str
 """
-if len(patterns) != 12:
-raise AssertionError(u'pattern %s does not have 12 elements' % lang)
+assert len(patterns) == 12, 'pattern %s does not have 12 elements' % lang
 
 for i in range(12):
 if patterns[i] is not None:
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 67ff263..1e3068f 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5199,10 +5199,9 @@
 @rtype: int or long
 @raises AssertionError: parent id not supplied to the constructor
 """
-if self._parent_id is None:
-raise AssertionError(
-'Revision %d was instantiated without a parent id'
-% self.revid)
+assert self._parent_id is not None, (
+'Revision {0} was instantiated without a parent id'
+.format(self.revid))
 
 return self._parent_id
 
@@ -5217,10 +5216,9 @@
 which always occurs for MediaWiki versions lower than 1.21.
 """
 # TODO: T102735: Add a sane default of 'wikitext' and others for <1.21
-if self._content_model is None:
-raise 

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [test] Don't check for socketIO client

2018-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403618 )

Change subject: [test] Don't check for socketIO client
..

[test] Don't check for socketIO client

- rcstreams was dropped. RCStream is offline and does no longer serve
  events. It is senseless to check for socketIO_client anymore.

Bug: T170534
Change-Id: Ia494f4cb112736afe716abbda406656dfeb6f4ec
---
M tests/pagegenerators_tests.py
1 file changed, 1 insertion(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/18/403618/1

diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index d17f415..12beb9a 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1411,17 +1411,7 @@
 super(EventStreamsPageGeneratorTestCase, cls).setUpClass()
 cls.client = 'sseclient'
 if not has_module(cls.client):
-cls.client = 'socketIO_client'
-try:
-import socketIO_client
-except ImportError:
-raise unittest.SkipTest(
-'Neither sseclient nor socketIO_client is available')
-if LooseVersion(
-socketIO_client.__version__) >= LooseVersion('0.6.1'):
-raise unittest.SkipTest(
-'socketIO_client %s not supported by Wikimedia-Stream'
-% socketIO_client.__version__)
+raise unittest.SkipTest('{0} is not available'.format(cls.client))
 
 def test_RC_pagegenerator_result(self):
 """Test RC pagegenerator."""

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia494f4cb112736afe716abbda406656dfeb6f4ec
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] pywikibot/core[master]: [cleanup] remove `__version__` string from pywikibot framewo...

2018-01-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403608 )

Change subject: [cleanup] remove `__version__` string from pywikibot framework 
scripts
..

[cleanup] remove `__version__` string from pywikibot framework scripts

Also show "SHA" in front of the SHA key instead of preleading "r" in bot.py

Bug: T87409
Change-Id: Ic3eacac9b11f5f78a40cfee82acbb5aaae9b8c45
---
M pywikibot/_wbtypes.py
M pywikibot/bot.py
M pywikibot/bot_choice.py
M pywikibot/botirc.py
M pywikibot/comms/http.py
M pywikibot/comms/threadedhttp.py
M pywikibot/compat/catlib.py
M pywikibot/compat/userlib.py
M pywikibot/config2.py
M pywikibot/cosmetic_changes.py
M pywikibot/daemonize.py
M pywikibot/data/api.py
M pywikibot/data/mysql.py
M pywikibot/date.py
M pywikibot/diff.py
M pywikibot/editor.py
M pywikibot/exceptions.py
M pywikibot/families/commons_family.py
M pywikibot/families/i18n_family.py
M pywikibot/families/incubator_family.py
M pywikibot/families/lyricwiki_family.py
M pywikibot/families/mediawiki_family.py
M pywikibot/families/meta_family.py
M pywikibot/families/omegawiki_family.py
M pywikibot/families/osm_family.py
M pywikibot/families/outreach_family.py
M pywikibot/families/species_family.py
M pywikibot/families/strategy_family.py
M pywikibot/families/test_family.py
M pywikibot/families/vikidia_family.py
M pywikibot/families/wikia_family.py
M pywikibot/families/wikibooks_family.py
M pywikibot/families/wikidata_family.py
M pywikibot/families/wikimania_family.py
M pywikibot/families/wikimediachapter_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/wikitech_family.py
M pywikibot/families/wikiversity_family.py
M pywikibot/families/wikivoyage_family.py
M pywikibot/families/wiktionary_family.py
M pywikibot/families/wowwiki_family.py
M pywikibot/family.py
M pywikibot/fixes.py
M pywikibot/flow.py
M pywikibot/i18n.py
M pywikibot/interwiki_graph.py
M pywikibot/logentries.py
M pywikibot/logging.py
M pywikibot/login.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/plural.py
M pywikibot/proofreadpage.py
M pywikibot/site.py
M pywikibot/site_detect.py
M pywikibot/specialbots.py
M pywikibot/textlib.py
M pywikibot/throttle.py
M pywikibot/titletranslate.py
M pywikibot/tools/__init__.py
M pywikibot/tools/_logging.py
M pywikibot/tools/chars.py
M pywikibot/tools/djvu.py
M pywikibot/tools/formatter.py
M pywikibot/tools/ip.py
M pywikibot/userinterfaces/gui.py
M pywikibot/userinterfaces/terminal_interface.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/userinterfaces/terminal_interface_unix.py
M pywikibot/userinterfaces/terminal_interface_win32.py
M pywikibot/userinterfaces/transliteration.py
M pywikibot/version.py
M pywikibot/weblib.py
M pywikibot/xmlreader.py
77 files changed, 9 insertions(+), 174 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/08/403608/1

diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 7071ac4..8afbe4e 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -7,9 +7,6 @@
 #
 from __future__ import absolute_import, unicode_literals
 
-__version__ = '$Id$'
-#
-
 import json
 
 from pywikibot.tools import StringTypes
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 03e22e8..8522542 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -48,13 +48,11 @@
 used.
 """
 #
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2018
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import absolute_import, unicode_literals
-
-__version__ = '$Id$'
 
 # Note: the intention is to develop this module (at some point) into a Bot
 # class definition that can be subclassed to create new, functional bot
@@ -963,7 +961,7 @@
 m = re.search(r"\$Id"
   r": (\w+) \$", pywikibot.__version__)
 if m:
-pywikibot.output(u'Pywikibot r%s' % m.group(1))
+pywikibot.output('Pywikibot SHA {0}'.format(m.group(1)))
 else:
 # Version ID not available on SVN repository.
 # Maybe this information should be imported from version.py
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 64cce6c..ddc04ec 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -7,8 +7,6 @@
 #
 from __future__ import absolute_import, unicode_literals
 
-__version__ = '$Id$'
-
 import pywikibot
 
 
diff --git a/pywikibot/botirc.py b/pywikibot/botirc.py
index 6b10b0c..ae630ee 100644
--- a/pywikibot/botirc.py
+++ b/pywikibot/botirc.py
@@ -13,8 +13,6 @@
 #
 from __future__ import absolute_import, unicode_literals
 
-__version__ = '$Id$'
-
 # Note: the intention is to develop this module (at some point) into a Bot
 # class definition that can be subclassed to create new, functional bot
 # scripts, instead of 

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [cleanup] Remove __version__ string from scripts/archive/fea...

2018-01-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403599 )

Change subject: [cleanup] Remove __version__ string from 
scripts/archive/featured.py
..

[cleanup] Remove __version__ string from scripts/archive/featured.py

Bug: T87409
Change-Id: Iecf90b816d7b151955f8676f3dfb070422500f9b
---
M scripts/archive/featured.py
M scripts/ndashredir.py
2 files changed, 0 insertions(+), 6 deletions(-)


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

diff --git a/scripts/archive/featured.py b/scripts/archive/featured.py
index 5ae04e1..1702ec8 100755
--- a/scripts/archive/featured.py
+++ b/scripts/archive/featured.py
@@ -63,9 +63,6 @@
 #
 from __future__ import absolute_import, unicode_literals
 
-__version__ = '$Id$'
-#
-
 import pickle
 import re
 import sys
diff --git a/scripts/ndashredir.py b/scripts/ndashredir.py
index 70696e4..3937188 100644
--- a/scripts/ndashredir.py
+++ b/scripts/ndashredir.py
@@ -33,9 +33,6 @@
 #
 from __future__ import absolute_import, unicode_literals
 
-__version__ = '$Id$'
-#
-
 import pywikibot
 from pywikibot import i18n, pagegenerators
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecf90b816d7b151955f8676f3dfb070422500f9b
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] pywikibot/core[master]: [doc] Update current release tag

2018-01-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403436 )

Change subject: [doc] Update current release tag
..

[doc] Update current release tag

Change-Id: If594d3e753479e914507a91ac2835d3dfe612c7c
---
M docs/conf.py
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/docs/conf.py b/docs/conf.py
index 83c04f8..2b414d8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Configuration file for Sphinx."""
 #
-# (C) Pywikibot team, 2015-2017
+# (C) Pywikibot team, 2015-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -63,7 +63,7 @@
 # The short X.Y version.
 version = '3.0'
 # The full version, including alpha/beta/rc tags.
-release = '3.0.20170713'
+release = '3.0.20180108'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If594d3e753479e914507a91ac2835d3dfe612c7c
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] pywikibot/core[master]: [L10N] Update languages_by_size

2018-01-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403409 )

Change subject: [L10N] Update languages_by_size
..

[L10N] Update languages_by_size

Change-Id: If78f2d7f357cb9ab181292ff6af0937f9231ac1b
---
M pywikibot/families/wikipedia_family.py
M pywikibot/families/wiktionary_family.py
2 files changed, 11 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/09/403409/1

diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index 1b19c32..f409ef1 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -44,7 +44,7 @@
 'lb', 'mr', 'sco', 'af', 'pnb', 'ga', 'is', 'ba', 'cv', 'fy', 'su',
 'sw', 'my', 'lmo', 'an', 'yo', 'ne', 'pa', 'gu', 'io', 'nds',
 'scn', 'bpy', 'als', 'bar', 'ku', 'kn', 'ia', 'ckb', 'qu', 'mn',
-'arz', 'bat-smg', 'gd', 'wa', 'nap', 'si', 'yi', 'bug', 'am',
+'arz', 'bat-smg', 'gd', 'nap', 'wa', 'si', 'yi', 'bug', 'am',
 'cdo', 'or', 'map-bms', 'fo', 'mzn', 'hsb', 'xmf', 'mai', 'li',
 'sah', 'sa', 'vec', 'ilo', 'os', 'mrj', 'hif', 'mhr', 'bh', 'eml',
 'roa-tara', 'ps', 'diq', 'pam', 'sd', 'hak', 'nso', 'se',
@@ -53,12 +53,12 @@
 'fiu-vro', 'co', 'lrc', 'tk', 'kv', 'csb', 'so', 'gv', 'as', 'lad',
 'myv', 'zea', 'nv', 'ay', 'udm', 'lez', 'stq', 'ie', 'kw', 'nrm',
 'pcd', 'mwl', 'rm', 'koi', 'ab', 'gom', 'ug', 'cbk-zam', 'lij',
-'gn', 'mt', 'fur', 'kab', 'dsb', 'dv', 'sn', 'ang', 'ext', 'ln',
+'gn', 'mt', 'fur', 'dsb', 'dv', 'sn', 'ang', 'ln', 'ext', 'kab',
 'frp', 'ksh', 'lo', 'gag', 'dty', 'pag', 'pi', 'olo', 'av', 'xal',
 'pfl', 'bxr', 'haw', 'krc', 'pap', 'kaa', 'rw', 'pdc', 'bjn', 'to',
-'nov', 'kl', 'ha', 'arc', 'jam', 'kbd', 'tyv', 'tpi', 'tet', 'ig',
-'ki', 'na', 'roa-rup', 'lbe', 'jbo', 'ty', 'bi', 'mdf', 'za', 'kg',
-'lg', 'wo', 'srn', 'tcy', 'zu', 'chr', 'kbp', 'ltg', 'sm', 'om',
+'nov', 'ha', 'kl', 'arc', 'jam', 'kbd', 'tyv', 'tpi', 'tet', 'ig',
+'ki', 'na', 'roa-rup', 'lbe', 'jbo', 'ty', 'mdf', 'za', 'kg', 'lg',
+'wo', 'bi', 'srn', 'tcy', 'zu', 'chr', 'kbp', 'sm', 'ltg', 'om',
 'xh', 'rmy', 'tn', 'cu', 'pih', 'rn', 'chy', 'tw', 'tum', 'ts',
 'st', 'got', 'pnt', 'ss', 'ch', 'bm', 'fj', 'ady', 'iu', 'ny',
 'atj', 'ee', 'ks', 'ak', 'ik', 've', 'sg', 'ff', 'dz', 'ti', 'cr',
diff --git a/pywikibot/families/wiktionary_family.py 
b/pywikibot/families/wiktionary_family.py
index 11a0a25..05c2e89 100644
--- a/pywikibot/families/wiktionary_family.py
+++ b/pywikibot/families/wiktionary_family.py
@@ -36,13 +36,13 @@
 self.languages_by_size = [
 'en', 'mg', 'fr', 'sh', 'ru', 'es', 'zh', 'de', 'nl', 'lt', 'sv',
 'ku', 'pl', 'el', 'it', 'ta', 'hu', 'fi', 'tr', 'ca', 'ko', 'io',
-'kn', 'pt', 'hy', 'vi', 'sr', 'chr', 'ja', 'hi', 'th', 'ro', 'no',
-'ml', 'id', 'et', 'uz', 'li', 'my', 'or', 'te', 'fa', 'eo', 'cs',
+'kn', 'pt', 'hy', 'vi', 'sr', 'ja', 'chr', 'hi', 'th', 'ro', 'no',
+'ml', 'id', 'et', 'uz', 'li', 'my', 'or', 'te', 'fa', 'cs', 'eo',
 'ar', 'jv', 'az', 'eu', 'gl', 'oc', 'da', 'lo', 'br', 'uk', 'hr',
-'fj', 'tg', 'bg', 'ps', 'simple', 'cy', 'sk', 'wa', 'vo', 'is',
-'zh-min-nan', 'la', 'scn', 'af', 'he', 'ast', 'tl', 'sw', 'ky',
-'fy', 'nn', 'lv', 'co', 'pnb', 'mn', 'ka', 'pa', 'nds', 'sl', 'sq',
-'lb', 'bs', 'nah', 'sa', 'kk', 'tk', 'bn', 'km', 'sm', 'mk', 'hsb',
+'fj', 'tg', 'bg', 'simple', 'ps', 'cy', 'sk', 'vo', 'wa', 'is',
+'zh-min-nan', 'la', 'scn', 'af', 'he', 'ast', 'tl', 'ky', 'sw',
+'fy', 'nn', 'lv', 'co', 'pnb', 'mn', 'pa', 'ka', 'nds', 'sl', 'sq',
+'lb', 'bs', 'nah', 'sa', 'kk', 'bn', 'tk', 'km', 'sm', 'mk', 'hsb',
 'be', 'ms', 'ga', 'ur', 'an', 'wo', 'vec', 'ang', 'tt', 'sd', 'gn',
 'mr', 'so', 'csb', 'ug', 'gd', 'mt', 'st', 'roa-rup', 'si', 'hif',
 'ia', 'ie', 'mi', 'ay', 'kl', 'fo', 'jbo', 'ln', 'zu', 'na', 'gu',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If78f2d7f357cb9ab181292ff6af0937f9231ac1b
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] pywikibot/core[master]: PendingDeprecationWarning: support for py2.6 and py3.3 will ...

2018-01-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403404 )

Change subject: PendingDeprecationWarning: support for py2.6 and py3.3 will be 
dropped
..

PendingDeprecationWarning: support for py2.6 and py3.3 will be dropped

Change-Id: Ic93bb50a4d48a6831c31ef9a3d1823855cc1284f
---
M HISTORY.rst
M pwb.py
2 files changed, 12 insertions(+), 3 deletions(-)


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

diff --git a/HISTORY.rst b/HISTORY.rst
index c88b72a..28d94f7 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
 Current release
 ---
 
+* PendingDeprecationWarning: support for py2.6 and py3.3 will be dropped
 * Bugfixes and improvements
 * Localisation updates
 
diff --git a/pwb.py b/pwb.py
index 2f495ce..9454d08 100755
--- a/pwb.py
+++ b/pwb.py
@@ -32,12 +32,13 @@
 PYTHON_VERSION = sys.version_info[:3]
 PY2 = (PYTHON_VERSION[0] == 2)
 PY26 = (PYTHON_VERSION < (2, 7))
+SUPPORT = 'supported under Python 2.7.2+ or 3.4+'
 
 versions_required_message = """
 Pywikibot not available on:
-%s
+{version}
 
-Pywikibot is only supported under Python 2.6.5+, 2.7.2+ or 3.3+
+Pywikibot is only {supported}.
 """
 
 
@@ -50,7 +51,8 @@
 
 
 if not python_is_supported():
-print(versions_required_message % sys.version)
+print(versions_required_message.format(version=sys.version,
+   supported=SUPPORT))
 sys.exit(1)
 
 pwb = None
@@ -200,6 +202,12 @@
 
 def main():
 """Command line entry point."""
+if PY2 or not PY2 and PYTHON_VERSION < (3, 4):
+warn('\nPywikibot support for Python release {version} will be '
+ 'dropped soon.\nPywikibot will be {supported} further.\n'
+ .format(version=sys.version, supported=SUPPORT),
+ PendingDeprecationWarning )
+
 global filename
 if filename:
 file_package = None

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic93bb50a4d48a6831c31ef9a3d1823855cc1284f
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] pywikibot/core[master]: [doc] Prepare next release

2018-01-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402886 )

Change subject: [doc] Prepare next release
..

[doc] Prepare next release

Change-Id: Iaa88a6e057a52d8d486d83dedcf84d293c56e04c
---
M HISTORY.rst
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/86/402886/1

diff --git a/HISTORY.rst b/HISTORY.rst
index 71052a5..c88b72a 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,12 @@
 Current release
 ---
 
+* Bugfixes and improvements
+* Localisation updates
+
+3.0.20180108
+
+
 * Maintenance script to download Wikimedia database dump
 * Option to auto-create accounts when logging in
 * Ship wikimania family file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa88a6e057a52d8d486d83dedcf84d293c56e04c
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] pywikibot/core[master]: [DOC] Cleanup doc string

2018-01-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402865 )

Change subject: [DOC] Cleanup doc string
..

[DOC] Cleanup doc string

Change-Id: Ice48b587d60beed0eed8a08e25e720fd3950f35f
---
M generate_family_file.py
1 file changed, 0 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/65/402865/1

diff --git a/generate_family_file.py b/generate_family_file.py
index cd1caa7..58698a5 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -2,8 +2,6 @@
 # -*- coding: utf-8 -*-
 """
 This script generates a family file from a given URL.
-
-Hackish, etc. Regexps, yes. Sorry, jwz.
 """
 from __future__ import (absolute_import, division,
 print_function, unicode_literals)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice48b587d60beed0eed8a08e25e720fd3950f35f
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] pywikibot/core[master]: [IMPR] Add isAnonymous() check in User.isRegistered()

2018-01-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402829 )

Change subject: [IMPR] Add isAnonymous() check in User.isRegistered()
..

[IMPR] Add isAnonymous() check in User.isRegistered()

This could safe up to 4 api calls

Bug: T183877
Change-Id: I5b165cb6675a3d38f50d413e1db3ff6519316788
---
M pywikibot/page.py
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 5195af2..3eb02e4 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3188,7 +3188,8 @@
 @rtype: bool
 """
 # T135828: the registration timestamp may be None but the key exists
-return 'registration' in self.getprops(force)
+return (not self.isAnonymous()
+and 'registration' in self.getprops(force))
 
 def isAnonymous(self):
 """

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b165cb6675a3d38f50d413e1db3ff6519316788
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] pywikibot/core[master]: [FIX] Remove py2.6 warning detection from context manager

2018-01-08 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402771 )

Change subject: [FIX] Remove py2.6 warning detection from context manager
..

[FIX] Remove py2.6 warning detection from context manager

This warning detection has never triggered because warn_msg never becomes
a DeprecationWarning because it is a warnings.WarningMessage instance

Bug: T184396
Change-Id: I7326bf30c0ca35e6f3497c7b7650a8841ee1a855
---
M tests/utils.py
1 file changed, 1 insertion(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/71/402771/1

diff --git a/tests/utils.py b/tests/utils.py
index 240cda8..4350448 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Test utilities."""
 #
-# (C) Pywikibot team, 2013-2017
+# (C) Pywikibot team, 2013-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -254,13 +254,6 @@
 break
 else:
 skip_frames -= 1
-
-# Avoid failures because cryptography is mentioning Python 2.6
-# is outdated
-if PYTHON_VERSION < (2, 7):
-if (isinstance(warn_msg, DeprecationWarning) and
-str(warn_msg.message) == PYTHON_26_CRYPTO_WARN):
-return
 
 log.append(warn_msg)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7326bf30c0ca35e6f3497c7b7650a8841ee1a855
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] pywikibot/core[master]: [bugfix] show deprecation warning

2018-01-06 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402587 )

Change subject: [bugfix] show deprecation warning
..

[bugfix] show deprecation warning

A warning level > 1 isn't be shown in some cases.

Bug: T184337
Change-Id: Ib7483d83c735db34b8518c002cd4349d64a12ac6
---
M pywikibot/tools/__init__.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/87/402587/1

diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index b9c99e0..68903e4 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Miscellaneous helper functions (not wiki-dependent)."""
 #
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1746,7 +1746,7 @@
 warning_message = self._deprecated[attr][2]
 warn(warning_message.format(self._module.__name__, attr,
 self._deprecated[attr][0]),
- DeprecationWarning, 2)
+ DeprecationWarning, 1)
 if self._deprecated[attr][1]:
 return self._deprecated[attr][1]
 elif '.' in self._deprecated[attr][0]:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7483d83c735db34b8518c002cd4349d64a12ac6
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] pywikibot/core[master]: [bugfix] Don't allow interwiki prefix when adding categories

2018-01-02 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401490 )

Change subject: [bugfix] Don't allow interwiki prefix when adding categories
..

[bugfix] Don't allow interwiki prefix when adding categories

Bug: T183908
Change-Id: I4ac7aa9aef2a98f93daa9ddb77fe2eedfc2b9521
---
M pywikibot/textlib.py
1 file changed, 10 insertions(+), 13 deletions(-)


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

diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 71abed2..41595ca 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -7,7 +7,7 @@
 
 """
 #
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1196,29 +1196,26 @@
 categoryRN = re.compile(
 r'^[^\S\n]*\[\[\s*(%s)\s*:\s*%s\s*((?:\|[^]]+)?\]\])[^\S\n]*\n'
 % (catNamespace, title), re.I | re.M)
+exceptions = ['nowiki', 'comment', 'math', 'pre', 'source']
 if newcat is None:
 # First go through and try the more restrictive regex that removes
 # an entire line, if the category is the only thing on that line (this
 # prevents blank lines left over in category lists following a 
removal.)
 text = replaceExcept(oldtext, categoryRN, '',
- ['nowiki', 'comment', 'math', 'pre', 'source'],
- site=site)
+ exceptions, site=site)
 text = replaceExcept(text, categoryR, '',
- ['nowiki', 'comment', 'math', 'pre', 'source'],
- site=site)
+ exceptions, site=site)
 elif add_only:
-text = replaceExcept(oldtext, categoryR,
- '{0}\n{1}'.format(
- oldcat.title(asLink=True),
- newcat.title(asLink=True)),
- ['nowiki', 'comment', 'math', 'pre', 'source'],
- site=site)
+text = replaceExcept(
+oldtext, categoryR,
+'{0}\n{1}'.format(oldcat.title(asLink=True, allowInterwiki=False),
+  newcat.title(asLink=True, allowInterwiki=False)),
+exceptions, site=site)
 else:
 text = replaceExcept(oldtext, categoryR,
  '[[%s:%s\\2' % (site.namespace(14),
  
newcat.title(withNamespace=False)),
- ['nowiki', 'comment', 'math', 'pre', 'source'],
- site=site)
+ exceptions, site=site)
 return text
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ac7aa9aef2a98f93daa9ddb77fe2eedfc2b9521
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] pywikibot/core[master]: [compat2core] compat library parts are accessible directly

2018-01-01 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401378 )

Change subject: [compat2core] compat library parts are accessible directly
..

[compat2core] compat library parts are accessible directly

pywikibot/compat is part of the sys.path modified by teh pwb.py wrapper script.
It is not necessary to import catlib, userlib or query from pywikibot.compat
but it could be imported directly.

Change-Id: I96a5422b9d2efe4a6c55e7ad9aa4029068659818
---
M README-conversion.txt
M scripts/maintenance/compat2core.py
2 files changed, 2 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/78/401378/1

diff --git a/README-conversion.txt b/README-conversion.txt
index d89dec1..1d1c0bd 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -29,9 +29,6 @@
 change "import wikipedia" to "import pywikibot"
 change "import pagegenerators" to "from pywikibot import pagegenerators"
 change "import config" to "from pywikibot import config"
-change "import catlib" to "from pywikibot.compat import catlib"
-change "import query" to "from pywikibot.compat import query"
-change "import userlib" to "from pywikibot.compat import userlib"
 change "wikipedia." to "pywikibot."
 
 wikipedia.setAction() no longer works; you must revise the script to pass an
diff --git a/scripts/maintenance/compat2core.py 
b/scripts/maintenance/compat2core.py
index 4e62b64..f5c8610 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -26,8 +26,8 @@
 python pwb.py compat2core  -warnonly
 """
 #
-# (C) xqt, 2014-2017
-# (C) Pywikibot team, 2014-2017
+# (C) xqt, 2014-2018
+# (C) Pywikibot team, 2014-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -50,8 +50,6 @@
 ('import wikipedia(?: as pywikibot)?', 'import pywikibot'),
 ('(?https://gerrit.wikimedia.org/r/401378
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96a5422b9d2efe4a6c55e7ad9aa4029068659818
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] pywikibot/core[master]: [FIX] Add Python version to apicache directory name

2018-01-01 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401374 )

Change subject: [FIX] Add Python version to apicache directory name
..

[FIX] Add Python version to apicache directory name

Add Python version to apicache directory name because Python 3 can not load
cache entries created by Python 2, resulting in lots of warning messages when
running on both versions.

Bug: T183857
Change-Id: Id225d7b688428b0608894708dea0191b2628ec6f
---
M pywikibot/data/api.py
1 file changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/74/401374/1

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 9e2627d..8ab2eec 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Interface to Mediawiki's api.php."""
 #
-# (C) Pywikibot team, 2007-2017
+# (C) Pywikibot team, 2007-2018
 #
 # Distributed under the terms of the MIT license.
 #
@@ -38,8 +38,8 @@
 Error, TimeoutError, InvalidTitle, UnsupportedPage
 )
 from pywikibot.tools import (
-MediaWikiVersion, deprecated, itergroup, ip, PY2, getargspec,
-UnicodeType
+MediaWikiVersion, deprecated, itergroup, ip, PY2, PYTHON_VERSION,
+getargspec, UnicodeType
 )
 from pywikibot.tools.formatter import color_format
 
@@ -2242,7 +2242,8 @@
 @return: base directory path for cache entries
 @rtype: basestring
 """
-path = os.path.join(pywikibot.config2.base_dir, 'apicache')
+path = os.path.join(pywikibot.config2.base_dir,
+'apicache-py{0:d}'.format(PYTHON_VERSION[0]))
 cls._make_dir(path)
 return path
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id225d7b688428b0608894708dea0191b2628ec6f
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] pywikibot/core[master]: [DOC] Update pwb LICENSE

2018-01-01 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401373 )

Change subject: [DOC] Update pwb LICENSE
..

[DOC] Update pwb LICENSE

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


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

diff --git a/LICENSE b/LICENSE
index 54b9519..90dbacc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2017 Pywikibot team
+Copyright (c) 2004-2018 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/401373
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I13d676ff57fb70ea2d60748598cce6b40d0fe823
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] pywikibot/core[master]: [IMPR] Remove not impelemted page and site methods

2017-12-26 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400236 )

Change subject: [IMPR] Remove not impelemted page and site methods
..

[IMPR] Remove not impelemted page and site methods

- page.py: only show a warning when using removeImage or replaceImage
  which is the same behaviour as before this change

-site.py: remove depecated method which raised an NotImplementedError.
  This raises an AttributeError now which a bit different but it shouldn't
  care anyway,

Change-Id: I63e468f4b22714cf281755de90e8d9bf75647f7d
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 12 insertions(+), 34 deletions(-)


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

diff --git a/pywikibot/page.py b/pywikibot/page.py
index 3511f43..5948519 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2217,20 +2217,14 @@
 restrictions = self.protection()
 return dict((k, list(restrictions[k])) for k in restrictions)
 
-# ## DISABLED METHODS (warnings provided) ##
-# these methods are easily replaced by editing the page's text using
-# textlib methods and then using put() on the result.
-
-def removeImage(self, image, put=False, summary=None, safe=True):
-"""Old method to remove all instances of an image from page."""
-warn('Page.removeImage() is no longer supported.',
- _NotImplementedWarning, 2)
-
-def replaceImage(self, image, replacement=None, put=False, summary=None,
- safe=True):
-"""Old method to replace all instances of an image with another."""
-warn('Page.replaceImage() is no longer supported.',
- _NotImplementedWarning, 2)
+def __getattr__(self, name):
+"""Generic disabled method warnings."""
+if name in ('removeImage', 'replaceImage'):
+warn('Page.{0}() is no longer supported.'.format(name),
+ _NotImplementedWarning, 2)
+return lambda x: None
+raise AttributeError("'{0}' object has no attribute '{1}'"
+ .format(self.__class__.__name__, name))
 
 
 class Page(BasePage):
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 9794b6e..c379a94 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -894,6 +894,10 @@
 
 def __getattr__(self, attr):
 """Delegate undefined methods calls to the Family object."""
+if attr in ('checkCharset', 'cookies', 'updateCookies',
+'solveCaptcha'):
+raise NotImplementedError('{0}.{1} is deprecated.'
+  .format(self.__class__.__name__, attr))
 if hasattr(self.__class__, attr):
 return getattr(self.__class__, attr)
 try:
@@ -1285,26 +1289,6 @@
  compress=True, cookies=None):
 """DEPRECATED."""
 return self.getUrl(address, data=data)
-
-@deprecated
-def checkCharset(self, charset):
-"""DEPRECATED."""
-raise NotImplementedError
-
-@deprecated
-def cookies(self, sysop=False):
-"""DEPRECATED."""
-raise NotImplementedError
-
-@deprecated
-def updateCookies(self, datas, sysop=False):
-"""DEPRECATED."""
-raise NotImplementedError
-
-@deprecated
-def solveCaptcha(self, data):
-"""DEPRECATED."""
-raise NotImplementedError
 
 
 def must_be(group=None, right=None):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63e468f4b22714cf281755de90e8d9bf75647f7d
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] pywikibot/core[master]: [bugfix] Ignore foreign package warnings

2017-12-26 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400228 )

Change subject: [bugfix] Ignore foreign package warnings
..

[bugfix] Ignore foreign package warnings

Ignore foreign package warnings in TestDeprecatedEditTokenFunctions.test_token

Bug: T183696
Change-Id: I27c46c98d1ccedf8726ed11d881316dbcb616bba
---
M tests/site_tests.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/28/400228/1

diff --git a/tests/site_tests.py b/tests/site_tests.py
index bd77485..b7fcc3b 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -2120,6 +2120,7 @@
 
 def test_token(self):
 """Test ability to get page tokens using site.tokens."""
+self._ignore_unknown_warning_packages = True
 token = self.token
 mysite = self.get_site()
 mainpage = self.get_mainpage()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I27c46c98d1ccedf8726ed11d881316dbcb616bba
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] pywikibot/core[master]: [doc] Show new features in HIYSTORY.rst

2017-12-25 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400190 )

Change subject: [doc] Show new features in HIYSTORY.rst
..

[doc] Show new features in HIYSTORY.rst

Change-Id: Idb525810ce7b17bd4e7615dc8e17d8f5dae8e121
---
M HISTORY.rst
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/HISTORY.rst b/HISTORY.rst
index ab4bc4d..71052a5 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,8 @@
 Current release
 ---
 
+* Maintenance script to download Wikimedia database dump
+* Option to auto-create accounts when logging in
 * Ship wikimania family file
 * Drop battlestarwiki family file
 * Bugfixes and improvements

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb525810ce7b17bd4e7615dc8e17d8f5dae8e121
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] pywikibot/core[master]: [doc] Update package info

2017-12-25 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/400189 )

Change subject: [doc] Update package info
..

[doc] Update package info

- add code of conduct
- place image buttons on top
- add code coverage link

Change-Id: I88cc85111ddbc1e2e0178bf940a86798abfbd080
---
M README.rst
1 file changed, 10 insertions(+), 6 deletions(-)


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

diff --git a/README.rst b/README.rst
index ae83ef9..5b223be 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,12 @@
+.. image:: 
https://secure.travis-ci.org/wikimedia/pywikibot-core.png?branch=master
+   :alt: Build Status
+   :target: https://travis-ci.org/wikimedia/pywikibot
+.. image:: 
https://codecov.io/gh/wikimedia/pywikibot/branch/master/graphs/badge.svg?branch=master
+   :alt: Code coverage
+   :target: http://codecov.io/github/wikimedia/pywikibot?branch=master
+.. image:: https://img.shields.io/pypi/v/pywikibot.svg
+   :alt: Pywikibot release
+   :target: https://pypi.python.org/pypi/pywikibot
 
 Pywikibot
 =
@@ -66,9 +75,4 @@
 `learn `_ 
how to get
 started.
 
-.. image:: 
https://secure.travis-ci.org/wikimedia/pywikibot-core.png?branch=master
-   :alt: Build Status
-   :target: https://travis-ci.org/wikimedia/pywikibot
-.. image:: https://img.shields.io/pypi/v/pywikibot.svg
-   :alt: Pywikibot release
-   :target: https://pypi.python.org/pypi/pywikibot
\ No newline at end of file
+.. include:: CODE_OF_CONDUCT.rst

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88cc85111ddbc1e2e0178bf940a86798abfbd080
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] pywikibot/core[master]: [bugfix] re-enable TestGeneral.testWikibase tests

2017-12-23 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399988 )

Change subject: [bugfix] re-enable TestGeneral.testWikibase tests
..

[bugfix] re-enable TestGeneral.testWikibase tests

Wikimedia main page aliases has been changed to title cased items

Bug: T183626
Change-Id: I4635b39d603c74aa58044812318b17a0a4705332
---
M tests/wikibase_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/88/399988/1

diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 757dfa1..2392031 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -130,7 +130,7 @@
 self.assertIn('en', item.labels)
 self.assertTrue(item.labels['en'].lower().endswith('main page'))
 self.assertIn('en', item.aliases)
-self.assertIn('home page', item.aliases['en'])
+self.assertIn('home page', (a.lower() for a in item.aliases['en']))
 self.assertEqual(item.namespace(), 0)
 item2 = ItemPage(repo, 'q5296')
 self.assertEqual(item2.getID(), 'Q5296')

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4635b39d603c74aa58044812318b17a0a4705332
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] pywikibot/core[master]: [IMPR] Introduce a timestamp in deprecated decorator

2017-12-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399755 )

Change subject: [IMPR] Introduce a timestamp in deprecated decorator
..

[IMPR] Introduce a timestamp in deprecated decorator

- also add timestamps in scripts files

Bug: T106121
Change-Id: I376c6ee1a2be5118ea331e51d3b8332cb5250b4b
---
M pywikibot/tools/__init__.py
M scripts/category.py
M scripts/data_ingestion.py
M scripts/replace.py
M scripts/replicate_wiki.py
M scripts/template.py
M scripts/weblinkchecker.py
7 files changed, 39 insertions(+), 13 deletions(-)


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

diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index b9c99e0..6a2e891 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -22,6 +22,7 @@
 import time
 import types
 
+from datetime import datetime
 from distutils.version import Version
 from functools import wraps
 from warnings import catch_warnings, showwarning, warn
@@ -1356,17 +1357,41 @@
 return outer_wrapper
 
 
-def issue_deprecation_warning(name, instead, depth, warning_class=None):
+def issue_deprecation_warning(name, instead, depth, warning_class=None,
+  since=None):
 """Issue a deprecation warning."""
+if since:
+days = (datetime.utcnow() - datetime.strptime(since, '%Y%m%d')).days
+years = days // 365
+days = days % 365
+months = days / 30
+days = days % 30
+if years == 1:
+years = 0
+months += 12
+years = '{0} years'.format(years) if years else ''
+months = '{0} month{1}'.format(
+months, 's' if months != 1 else '') if months else ''
+if years and months:
+years += ' and '
+days = '{0} day{1}'.format(
+days, 's' if days != 1 else '') if not years else ''
+if months and days:
+months += ' and '
+since = ' since {0}{1}{2}'.format(years, months, days)
+else:
+since = ''
 if instead:
 if warning_class is None:
 warning_class = DeprecationWarning
-warn(u'{0} is deprecated; use {1} instead.'.format(name, instead),
+warn('{0} is deprecated{1}; use {2} instead.'
+ .format(name, since, instead),
  warning_class, depth + 1)
 else:
 if warning_class is None:
 warning_class = _NotImplementedWarning
-warn('{0} is deprecated.'.format(name), warning_class, depth + 1)
+warn('{0} is deprecated{1}.'
+ .format(name, since), warning_class, depth + 1)
 
 
 @add_full_name
@@ -1396,7 +1421,7 @@
 """
 name = obj.__full_name__
 depth = get_wrapper_depth(wrapper) + 1
-issue_deprecation_warning(name, instead, depth)
+issue_deprecation_warning(name, instead, depth, since=since)
 return obj(*args, **kwargs)
 
 def add_docstring(wrapper):
@@ -1436,6 +1461,7 @@
 
 return wrapper
 
+since = kwargs.pop('since', None)
 without_parameters = len(args) == 1 and len(kwargs) == 0 and 
callable(args[0])
 if 'instead' in kwargs:
 instead = kwargs['instead']
diff --git a/scripts/category.py b/scripts/category.py
index 6d09ada..a0dcadb 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -769,7 +769,7 @@
 CategoryMoveRobot without newcat param instead.
 """
 
-@deprecated('CategoryMoveRobot.__init__()')
+@deprecated('CategoryMoveRobot.__init__()', since='20140416')
 def __init__(self, catTitle, batchMode=False, editSummary='',
  
useSummaryForDeletion=CategoryMoveRobot.DELETION_COMMENT_AUTOMATIC,
  titleRegex=None, inPlace=False, pagesonly=False):
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index a6628c1..05cd3ed 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -178,13 +178,13 @@
 self.pagefmt = pagefmt
 
 @property
-@deprecated('generator')
+@deprecated('generator', since='20150508')
 def reader(self):
 """Get generator. Deprecated."""
 return self.generator
 
 @reader.setter
-@deprecated('generator')
+@deprecated('generator', since='20150508')
 def reader(self, value):
 """Set generator. Deprecated."""
 self.generator = value
@@ -211,7 +211,7 @@
 
 return title
 
-@deprecated("treat()")
+@deprecated('treat()', since='20150118')
 def doSingle(self):
 """Process one page."""
 return self.treat(next(self.reader))
diff --git a/scripts/replace.py b/scripts/replace.py
index ddaea1b..db68545 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -651,7 +651,7 @@
 
 return new_text
 
-@deprecated('apply_replacements')
+@deprecated('apply_replacements', since='20160816')

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] use reStructuredText instead of markdown

2017-12-20 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399396 )

Change subject: [doc] use reStructuredText instead of markdown
..

[doc] use reStructuredText instead of markdown

- a rst file could be included to other doc files e.g. in readme.rst
  for the pypi package

Change-Id: I4859ebecd83e1d6eecb0c38bd5317c02085f4e55
---
D CODE_OF_CONDUCT.md
A CODE_OF_CONDUCT.rst
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/96/399396/1

diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 7815dda..000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,2 +0,0 @@
-The development of this software is covered by a [Code of 
Conduct](https://www.mediawiki.org/wiki/Code_of_Conduct).
-
diff --git a/CODE_OF_CONDUCT.rst b/CODE_OF_CONDUCT.rst
new file mode 100644
index 000..ea6ab54
--- /dev/null
+++ b/CODE_OF_CONDUCT.rst
@@ -0,0 +1,5 @@
+Code of Conduct
+---
+
+The development of this software is covered by a `Code of Conduct 
`_.
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4859ebecd83e1d6eecb0c38bd5317c02085f4e55
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] pywikibot/core[master]: [L10N] Remove battlestarwiki_family.py out of the framework

2017-12-20 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399390 )

Change subject: [L10N] Remove battlestarwiki_family.py out of the framework
..

[L10N] Remove battlestarwiki_family.py out of the framework

- de.battlestarwiki.org and en.battlestarwiki.org are no longer available
  but closed since this year.
- Some of the en pages was ported to en.battlestarwikiclone.org but
  the de site is lost and available via web.archive.org.
  This clone can be reached via generate_family_file when needed

Change-Id: Iffa70aa32c7902294f5633d25806ce256cca1649
---
M HISTORY.rst
M docs/api_ref/pywikibot.families.rst
D pywikibot/families/battlestarwiki_family.py
M pywikibot/family.py
4 files changed, 1 insertion(+), 34 deletions(-)


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

diff --git a/HISTORY.rst b/HISTORY.rst
index 1b3b1c4..af33cac 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
 Current release
 ---
 
+* Drop battlestarwiki family file
 * Bugfixes and improvements
 * Localisation updates
 
diff --git a/docs/api_ref/pywikibot.families.rst 
b/docs/api_ref/pywikibot.families.rst
index 51cc605..68c2dca 100644
--- a/docs/api_ref/pywikibot.families.rst
+++ b/docs/api_ref/pywikibot.families.rst
@@ -9,14 +9,6 @@
 Submodules
 --
 
-pywikibot.families.battlestarwiki_family module

-
-.. automodule:: pywikibot.families.battlestarwiki_family
-:members:
-:undoc-members:
-:show-inheritance:
-
 pywikibot.families.commons_family module
 
 
diff --git a/pywikibot/families/battlestarwiki_family.py 
b/pywikibot/families/battlestarwiki_family.py
deleted file mode 100644
index 1a12f79..000
--- a/pywikibot/families/battlestarwiki_family.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Family module for Battlestar Wiki."""
-#
-# (C) Pywikibot team, 2007-2015
-#
-# Distributed under the terms of the MIT license.
-#
-from __future__ import absolute_import, unicode_literals
-
-__version__ = '$Id$'
-
-from pywikibot import family
-
-
-# The Battlestar Wiki family, a set of Battlestar wikis.
-class Family(family.SubdomainFamily):
-
-"""Family class for Battlestar Wiki."""
-
-name = 'battlestarwiki'
-domain = 'battlestarwiki.org'
-
-codes = ['en', 'de']
-
-interwiki_removals = ['fr', 'zh', 'es', 'ms', 'tr', 'simple']
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 59be0f8..363c6b8 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -326,7 +326,6 @@
 'aspienetwiki': 'aspienetwiki',
 'atmwiki':  'atmwiki',
 'b':'wikibooks',
-'battlestarwiki':   'battlestarwiki',
 'bemi': 'bemi',
 'benefitswiki': 'benefitswiki',
 'betawiki': 'betawiki',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iffa70aa32c7902294f5633d25806ce256cca1649
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] pywikibot/core[master]: [pypi] wikimania family will be shipped with next release

2017-12-20 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399383 )

Change subject: [pypi] wikimania family will be shipped with next release
..

[pypi] wikimania family will be shipped with next release

Change-Id: I91e7a591a9b6d75bf164d4b37cd26c3f5d05ce56
---
M HISTORY.rst
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/83/399383/1

diff --git a/HISTORY.rst b/HISTORY.rst
index 1b3b1c4..7c12c32 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
 Current release
 ---
 
+* Ship wikimania family file
 * Bugfixes and improvements
 * Localisation updates
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91e7a591a9b6d75bf164d4b37cd26c3f5d05ce56
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] pywikibot/core[master]: Replace assertRaises with assertRaisesRegex in isbn_tests.py

2017-12-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399348 )

Change subject: Replace assertRaises with assertRaisesRegex in isbn_tests.py
..

Replace assertRaises with assertRaisesRegex in isbn_tests.py

assertRaises is not as good of a test as assertRaisesRegex.
The latter has an extra parameter to match the exception message,
allowing more precision when checking an error.

Change restored after revert in Ib41b30

Bug: T154281
Change-Id: Id67d5b76c0dc5a70289478d842cd3ebdc28b1b85
---
M tests/isbn_tests.py
1 file changed, 21 insertions(+), 8 deletions(-)


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

diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py
index df00417..fc48a08 100644
--- a/tests/isbn_tests.py
+++ b/tests/isbn_tests.py
@@ -39,6 +39,11 @@
 
 """Test CosmeticChanges ISBN fix."""
 
+ISBN_DIGITERROR_RE = 'ISBN [0-9]+ is not [0-9]+ digits long'
+ISBN_INVALIDERROR_RE = 'Invalid ISBN found'
+ISBN_CHECKSUMERROR_RE = 'ISBN checksum of [0-9]+ is incorrect'
+ISBN_INVALIDCHARERROR_RE = 'ISBN [0-9a-zA-Z]+ contains invalid characters'
+
 def test_valid_isbn(self):
 """Test ISBN."""
 cc = CosmeticChangesToolkit(self.site, namespace=0)
@@ -54,17 +59,25 @@
 cc = CosmeticChangesToolkit(self.site, namespace=0)
 
 # Invalid characters
-self.assertRaises(AnyIsbnValidationException,
-  cc.fix_ISBN, 'ISBN 0975229LOL')
+self.assertRaisesRegex(AnyIsbnValidationException,
+   (self.ISBN_DIGITERROR_RE + '|' +
+self.ISBN_INVALIDERROR_RE),
+   cc.fix_ISBN, 'ISBN 0975229LOL')
 # Invalid checksum
-self.assertRaises(AnyIsbnValidationException,
-  cc.fix_ISBN, 'ISBN 0975229801')
+self.assertRaisesRegex(AnyIsbnValidationException,
+   (self.ISBN_CHECKSUMERROR_RE + '|' +
+self.ISBN_INVALIDERROR_RE),
+   cc.fix_ISBN, 'ISBN 0975229801')
 # Invalid length
-self.assertRaises(AnyIsbnValidationException,
-  cc.fix_ISBN, 'ISBN 09752298')
+self.assertRaisesRegex(AnyIsbnValidationException,
+   (self.ISBN_DIGITERROR_RE + '|' +
+self.ISBN_INVALIDERROR_RE),
+   cc.fix_ISBN, 'ISBN 09752298')
 # X in the middle
-self.assertRaises(AnyIsbnValidationException,
-  cc.fix_ISBN, 'ISBN 09752X9801')
+self.assertRaisesRegex(AnyIsbnValidationException,
+   (self.ISBN_INVALIDCHARERROR_RE + '|' +
+self.ISBN_INVALIDERROR_RE),
+   cc.fix_ISBN, 'ISBN 09752X9801')
 
 def test_ignore_invalid_isbn(self):
 """Test fixing ISBN numbers with an invalid ISBN."""

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

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

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: Revert "Replace assertRaises with assertRaisesRegex in isbn_...

2017-12-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399344 )

Change subject: Revert "Replace assertRaises with assertRaisesRegex in 
isbn_tests.py"
..

Revert "Replace assertRaises with assertRaisesRegex in isbn_tests.py"

This reverts commit 4625bef2d3a1dc0c1929cd9cb745666d75211578
due to a lot of tests failing:
https://travis-ci.org/wikimedia/pywikibot/builds/319000537

Change-Id: Ib41b30f1672a131a7cdf53b3b930fa8db2fd3e4c
---
M tests/isbn_tests.py
1 file changed, 8 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/44/399344/1

diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py
index fc48a08..df00417 100644
--- a/tests/isbn_tests.py
+++ b/tests/isbn_tests.py
@@ -39,11 +39,6 @@
 
 """Test CosmeticChanges ISBN fix."""
 
-ISBN_DIGITERROR_RE = 'ISBN [0-9]+ is not [0-9]+ digits long'
-ISBN_INVALIDERROR_RE = 'Invalid ISBN found'
-ISBN_CHECKSUMERROR_RE = 'ISBN checksum of [0-9]+ is incorrect'
-ISBN_INVALIDCHARERROR_RE = 'ISBN [0-9a-zA-Z]+ contains invalid characters'
-
 def test_valid_isbn(self):
 """Test ISBN."""
 cc = CosmeticChangesToolkit(self.site, namespace=0)
@@ -59,25 +54,17 @@
 cc = CosmeticChangesToolkit(self.site, namespace=0)
 
 # Invalid characters
-self.assertRaisesRegex(AnyIsbnValidationException,
-   (self.ISBN_DIGITERROR_RE + '|' +
-self.ISBN_INVALIDERROR_RE),
-   cc.fix_ISBN, 'ISBN 0975229LOL')
+self.assertRaises(AnyIsbnValidationException,
+  cc.fix_ISBN, 'ISBN 0975229LOL')
 # Invalid checksum
-self.assertRaisesRegex(AnyIsbnValidationException,
-   (self.ISBN_CHECKSUMERROR_RE + '|' +
-self.ISBN_INVALIDERROR_RE),
-   cc.fix_ISBN, 'ISBN 0975229801')
+self.assertRaises(AnyIsbnValidationException,
+  cc.fix_ISBN, 'ISBN 0975229801')
 # Invalid length
-self.assertRaisesRegex(AnyIsbnValidationException,
-   (self.ISBN_DIGITERROR_RE + '|' +
-self.ISBN_INVALIDERROR_RE),
-   cc.fix_ISBN, 'ISBN 09752298')
+self.assertRaises(AnyIsbnValidationException,
+  cc.fix_ISBN, 'ISBN 09752298')
 # X in the middle
-self.assertRaisesRegex(AnyIsbnValidationException,
-   (self.ISBN_INVALIDCHARERROR_RE + '|' +
-self.ISBN_INVALIDERROR_RE),
-   cc.fix_ISBN, 'ISBN 09752X9801')
+self.assertRaises(AnyIsbnValidationException,
+  cc.fix_ISBN, 'ISBN 09752X9801')
 
 def test_ignore_invalid_isbn(self):
 """Test fixing ISBN numbers with an invalid ISBN."""

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib41b30f1672a131a7cdf53b3b930fa8db2fd3e4c
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] pywikibot/core[master]: [doc] Print a more understandable error message

2017-12-18 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398882 )

Change subject: [doc] Print a more understandable error message
..

[doc] Print a more understandable error message

- currently type checking of the color_format text value may give the message
  "expected str got " for python 2 which is a bit confusing.
- now it gives "expected  got " for python 2 and
  "expected  got " in python 3 which is more
  accurate

Change-Id: Id3c07760c6c8d5ec611975c4d9d0c34a65466f7d
---
M pywikibot/tools/formatter.py
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index 149454b..cd8b96c 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -156,7 +156,8 @@
 raise ValueError('Keyword argument(s) use valid color(s): ' +
  '", "'.join(self.colors.intersection(kwargs)))
 if not isinstance(format_string, UnicodeType):
-raise TypeError('expected str, got 
{0}'.format(type(format_string)))
+raise TypeError('expected {0}, got {1}'
+.format(type(''), type(format_string)))
 return super(_ColorFormatter, self).vformat(format_string, args,
 kwargs)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3c07760c6c8d5ec611975c4d9d0c34a65466f7d
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] pywikibot/core[master]: [tests] Ignore N812 naming rules for pywikibot/userinterface...

2017-12-17 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398688 )

Change subject: [tests] Ignore N812 naming rules for 
pywikibot/userinterfaces/gui.py
..

[tests] Ignore N812 naming rules for pywikibot/userinterfaces/gui.py

Change-Id: I93f264c632d256faa1b04f47d76a1485a1b6c5b4
---
M pywikibot/userinterfaces/gui.py
M tox.ini
2 files changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/88/398688/1

diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 21f866b..c57acb9 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -22,7 +22,7 @@
 if sys.version_info[0] > 2:
 import tkinter as Tkinter
 from tkinter.scrolledtext import ScrolledText
-from tkinter import simpledialog as tkSimpleDialog  # noqa: N812
+from tkinter import simpledialog as tkSimpleDialog
 else:
 import Tkinter
 import tkSimpleDialog
diff --git a/tox.ini b/tox.ini
index 906911d..dd784dd 100644
--- a/tox.ini
+++ b/tox.ini
@@ -180,6 +180,7 @@
 pywikibot/family.py : E241
 pywikibot/fixes.py : E241
 pywikibot/textlib.py : E241
+pywikibot/userinterfaces/gui.py : N801
 pywikibot/userinterfaces/terminal_interface_unix.py : E241
 pywikibot/userinterfaces/terminal_interface_win32.py : E241
 pywikibot/textlib.py : N801

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I93f264c632d256faa1b04f47d76a1485a1b6c5b4
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] pywikibot/core[master]: [L10N] Update linktrails

2017-12-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398491 )

Change subject: [L10N] Update linktrails
..

[L10N] Update linktrails

Change-Id: Icc3716f30d93e775a9834c729ac1fea02af3a2be
---
M pywikibot/family.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/91/398491/1

diff --git a/pywikibot/family.py b/pywikibot/family.py
index b708069..12e706f 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -150,6 +150,7 @@
 'an': u'[a-záéíóúñ]*',
 'ar': u'[a-zء-ي]*',
 'ast': u'[a-záéíóúñ]*',
+'atj': '[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'arz': u'[a-zء-ي]*',
 'azb': u'[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
 'av': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
@@ -177,6 +178,7 @@
 'cy': u'[àáâèéêìíîïòóôûŵŷa-z]*',
 'da': u'[a-zæøå]*',
 'de': u'[a-zäöüß]*',
+'din': '[äëɛɛ̈éɣïŋöɔɔ̈óa-z]*',
 'dsb': u'[äöüßa-z]*',
 'el': 
u'[a-zαβγδεζηθικλμνξοπρστυφχψωςΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩάέήίόύώϊϋΐΰΆΈΉΊΌΎΏΪΫ]*',
 'eml': u'[a-zàéèíîìóòúù]*',
@@ -209,6 +211,7 @@
 'is': u'[áðéíóúýþæöa-z-–]*',
 'it': u'[a-zàéèíîìóòúù]*',
 'ka': u'[a-zაბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰ“»]*',
+'kbp': '[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
 'kk': 
u'[a-zäçéğıïñöşüýʺʹа-яёәғіқңөұүһٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ“»]*',
 'kl': u'[a-zæøå]*',
 'koi': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
@@ -289,6 +292,7 @@
 'tyv': u'[a-zабвгдеёжзийклмнопрстуфхцчшщъыьэюя]*',
 'udm': u'[a-zа-яёӝӟӥӧӵ]*',
 'uk': u'[a-zабвгґдеєжзиіїйклмнопрстуфхцчшщьєюяёъы“»]*',
+'ur': '[ابپتٹثجچحخدڈذر​ڑ​زژسشصضطظعغفقکگل​م​نوؤہھیئےآأءۃ]*',
 'uz': u'[a-zʻʼ“»]*',
 'vec': u'[a-zàéèíîìóòúù]*',
 'vep': u'[äöõšüža-z]*',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc3716f30d93e775a9834c729ac1fea02af3a2be
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] pywikibot/core[master]: [IMPR] Simplify isCategoryRedirect method

2017-12-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398474 )

Change subject: [IMPR] Simplify isCategoryRedirect method
..

[IMPR] Simplify isCategoryRedirect method

- test for args length instead of try/except IndexError construct
- assign self._catredirect = False only once
- use Namespace.CATEGORY constants
- improve error messages

Change-Id: Ib74d6215d4b57ccd6eb9d74fa46b09d71c6cb12c
---
M pywikibot/page.py
1 file changed, 12 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/74/398474/1

diff --git a/pywikibot/page.py b/pywikibot/page.py
index d9580b6..e6c157d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -847,28 +847,26 @@
 if not self.is_categorypage():
 return False
 if not hasattr(self, "_catredirect"):
+self._catredirect = False
 catredirs = self.site.category_redirects()
 for (template, args) in self.templatesWithParams():
 if template.title(withNamespace=False) in catredirs:
-# Get target (first template argument)
-try:
-p = pywikibot.Page(self.site, args[0].strip(), ns=14)
-if p.namespace() == 14:
+if args:
+# Get target (first template argument)
+p = pywikibot.Page(
+self.site, args[0].strip(), Namespace.CATEGORY)
+if p.namespace() == Namespace.CATEGORY:
 self._catredirect = p.title()
 else:
 pywikibot.warning(
-u"Target %s on %s is not a category"
-% (p.title(asLink=True),
-   self.title(asLink=True)))
-self._catredirect = False
-except IndexError:
+'Category redirect target {0} on {1} is not a '
+'category'.format(p.title(asLink=True),
+  self.title(asLink=True)))
+else:
 pywikibot.warning(
-u"No target for category redirect on %s"
-% self.title(asLink=True))
-self._catredirect = False
+'No target found for category redirect on '
++ self.title(asLink=True))
 break
-else:
-self._catredirect = False
 return bool(self._catredirect)
 
 def getCategoryRedirectTarget(self):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib74d6215d4b57ccd6eb9d74fa46b09d71c6cb12c
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] pywikibot/core[master]: [IMPR] Simplify Page.text Property

2017-12-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398473 )

Change subject: [IMPR] Simplify Page.text Property
..

[IMPR] Simplify Page.text Property

- use Page.exists() method instead of try/except construct

Change-Id: Ic364b7abb842666b8dab8c55a0627b3ad5815a66
---
M pywikibot/page.py
1 file changed, 1 insertion(+), 5 deletions(-)


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

diff --git a/pywikibot/page.py b/pywikibot/page.py
index d9580b6..fce34e7 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -622,11 +622,7 @@
 @rtype: unicode
 """
 if not hasattr(self, '_text') or self._text is None:
-try:
-self._text = self.get(get_redirect=True)
-except pywikibot.NoPage:
-# TODO: what other exceptions might be returned?
-self._text = u""
+self._text = self.get(get_redirect=True) if self.exists() else ''
 return self._text
 
 @text.setter

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic364b7abb842666b8dab8c55a0627b3ad5815a66
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] pywikibot/core[master]: [IMPR] Simplify isCategoryRedirect method

2017-12-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398472 )

Change subject: [IMPR] Simplify isCategoryRedirect method
..

[IMPR] Simplify isCategoryRedirect method

- test for args length instead of try/except IndexError construct
- assign self._catredirect = False only once
- use Namespace.CATEGORY constants
- improve error messages

Change-Id: I87bc3e29047985a1fb36a49d6f9370c981cba6df
---
M pywikibot/page.py
1 file changed, 12 insertions(+), 14 deletions(-)


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

diff --git a/pywikibot/page.py b/pywikibot/page.py
index d9580b6..e6c157d 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -847,28 +847,26 @@
 if not self.is_categorypage():
 return False
 if not hasattr(self, "_catredirect"):
+self._catredirect = False
 catredirs = self.site.category_redirects()
 for (template, args) in self.templatesWithParams():
 if template.title(withNamespace=False) in catredirs:
-# Get target (first template argument)
-try:
-p = pywikibot.Page(self.site, args[0].strip(), ns=14)
-if p.namespace() == 14:
+if args:
+# Get target (first template argument)
+p = pywikibot.Page(
+self.site, args[0].strip(), Namespace.CATEGORY)
+if p.namespace() == Namespace.CATEGORY:
 self._catredirect = p.title()
 else:
 pywikibot.warning(
-u"Target %s on %s is not a category"
-% (p.title(asLink=True),
-   self.title(asLink=True)))
-self._catredirect = False
-except IndexError:
+'Category redirect target {0} on {1} is not a '
+'category'.format(p.title(asLink=True),
+  self.title(asLink=True)))
+else:
 pywikibot.warning(
-u"No target for category redirect on %s"
-% self.title(asLink=True))
-self._catredirect = False
+'No target found for category redirect on '
++ self.title(asLink=True))
 break
-else:
-self._catredirect = False
 return bool(self._catredirect)
 
 def getCategoryRedirectTarget(self):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87bc3e29047985a1fb36a49d6f9370c981cba6df
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] pywikibot/core[master]: [compat] drop compat module

2017-12-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398024 )

Change subject: [compat] drop compat module
..

[compat] drop compat module

core branch is now 10 years old and decommission of compat was one year ago.
The compat module was created in 2012 and older catlib and userlib where
merged into that folder in 2014.

The framework is not using this compatibility modul anymore and bot
operators get a deprecation waring for their private scripts when the module
is used.

I guess it is time to drop this module because all scripts should use the
core framework equivalent parts. It might be more difficult to keep this
backward compatibility alive and btw its usage is unsure because the behavior
is never testet.

- drop compat library module
- remove references from docs
- remove folder it from pwb sys path
- update README-conversion.txt
- update compat2core.py maintenance script
- prepare history file for the next pypi release

Change-Id: I32cd9ca2d1ef32a25f741fe46160317cb649c4ef
---
M HISTORY.rst
M README-conversion.txt
D docs/api_ref/pywikibot.compat.rst
M docs/api_ref/pywikibot.rst
M pwb.py
M pywikibot/CONTENT.rst
M pywikibot/DIRECTORIES.rst
D pywikibot/compat/__init__.py
D pywikibot/compat/catlib.py
D pywikibot/compat/query.py
D pywikibot/compat/userlib.py
M scripts/maintenance/compat2core.py
12 files changed, 11 insertions(+), 162 deletions(-)


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

diff --git a/HISTORY.rst b/HISTORY.rst
index 1b3b1c4..89a69f9 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,7 @@
 Current release
 ---
 
+* compat module has been dropped
 * Bugfixes and improvements
 * Localisation updates
 
diff --git a/README-conversion.txt b/README-conversion.txt
index d89dec1..1d17d22 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -29,9 +29,10 @@
 change "import wikipedia" to "import pywikibot"
 change "import pagegenerators" to "from pywikibot import pagegenerators"
 change "import config" to "from pywikibot import config"
-change "import catlib" to "from pywikibot.compat import catlib"
-change "import query" to "from pywikibot.compat import query"
-change "import userlib" to "from pywikibot.compat import userlib"
+change "catlib.Category" to "pywikibot.Category"
+change "catlib.change_category(page, ...)" to "page.change_category(...)"
+change "query.GetData(request)" to 
"pywikibot.data.api.request(**request).submit()"
+change "userlib.User" to "pywikibot.User"
 change "wikipedia." to "pywikibot."
 
 wikipedia.setAction() no longer works; you must revise the script to pass an
diff --git a/docs/api_ref/pywikibot.compat.rst 
b/docs/api_ref/pywikibot.compat.rst
deleted file mode 100644
index d059d1a..000
--- a/docs/api_ref/pywikibot.compat.rst
+++ /dev/null
@@ -1,34 +0,0 @@
-pywikibot.compat package
-
-
-.. automodule:: pywikibot.compat
-:members:
-:undoc-members:
-:show-inheritance:
-
-Submodules
---
-
-pywikibot.compat.catlib module
---
-
-.. automodule:: pywikibot.compat.catlib
-:members:
-:undoc-members:
-:show-inheritance:
-
-pywikibot.compat.query module
--
-
-.. automodule:: pywikibot.compat.query
-:members:
-:undoc-members:
-:show-inheritance:
-
-pywikibot.compat.userlib module

-
-.. automodule:: pywikibot.compat.userlib
-:members:
-:undoc-members:
-:show-inheritance:
diff --git a/docs/api_ref/pywikibot.rst b/docs/api_ref/pywikibot.rst
index 21c21b3..d943385 100644
--- a/docs/api_ref/pywikibot.rst
+++ b/docs/api_ref/pywikibot.rst
@@ -12,7 +12,6 @@
 .. toctree::
 
 pywikibot.comms
-pywikibot.compat
 pywikibot.data
 pywikibot.families
 pywikibot.tools
diff --git a/pwb.py b/pwb.py
index 51e6632..6d6262e 100755
--- a/pwb.py
+++ b/pwb.py
@@ -9,7 +9,7 @@
 and it will use the package directory to store all user files, will fix up
 search paths so the package does not need to be installed, etc.
 """
-# (C) Pywikibot team, 2015-2016
+# (C) Pywikibot team, 2015-2017
 #
 # Distributed under the terms of the MIT license.
 #
@@ -147,7 +147,7 @@
 rewrite_path = absolute_path
 
 sys.path = [sys.path[0], rewrite_path,
-os.path.join(rewrite_path, 'pywikibot', 'compat'),
+os.path.join(rewrite_path, 'pywikibot'),
 ] + sys.path[1:]
 
 try:
diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst
index 180c4e4..e3b23e5 100644
--- a/pywikibot/CONTENT.rst
+++ b/pywikibot/CONTENT.rst
@@ -99,19 +99,6 @@
 
 
 
+---+---+
-| compat| Package to provide compatibility with compat 
scripts. |
-|   | (should never be used)   
  

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [L10N] Update languages_by_size

2017-12-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398009 )

Change subject: [L10N] Update languages_by_size
..

[L10N] Update languages_by_size

Change-Id: Ie158955e70a103ecd8846c272f1233cd27089a02
---
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/wiktionary_family.py
5 files changed, 31 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/09/398009/1

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

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] Prepare next pypi release

2017-12-13 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398008 )

Change subject: [doc] Prepare next pypi release
..

[doc] Prepare next pypi release

- fix travis target

Change-Id: I81e27dfbe900361a90ba2ac85a6921d5d9000d40
---
M HISTORY.rst
M README.rst
2 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/08/398008/1

diff --git a/HISTORY.rst b/HISTORY.rst
index 67027d1..53b628c 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,12 @@
 Current release
 ---
 
+* Bugfixes and improvements
+* Localisation updates
+
+3.0.20171212
+---
+
 * Introduce userscripts directory
 * Generator settings inside (user-)fixes.py
 * BaseUnlinkBot has become part of the framework in specialbots.py
diff --git a/README.rst b/README.rst
index da016a3..ae83ef9 100644
--- a/README.rst
+++ b/README.rst
@@ -68,7 +68,7 @@
 
 .. image:: 
https://secure.travis-ci.org/wikimedia/pywikibot-core.png?branch=master
:alt: Build Status
-   :target: https://travis-ci.org/wikimedia/pywikibot-core
+   :target: https://travis-ci.org/wikimedia/pywikibot
 .. image:: https://img.shields.io/pypi/v/pywikibot.svg
:alt: Pywikibot release
:target: https://pypi.python.org/pypi/pywikibot
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I81e27dfbe900361a90ba2ac85a6921d5d9000d40
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] pywikibot/core[master]: [bugfix] Catch AttributeError and raise the ValueError

2017-12-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396917 )

Change subject: [bugfix] Catch AttributeError and raise the ValueError
..

[bugfix] Catch AttributeError and raise the ValueError

Bug: T182529
Change-Id: Id03f32e8dc422a22f9998030836da5be8d25af52
---
M pywikibot/proofreadpage.py
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index f4e6a08..2919514 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -532,12 +532,12 @@
 soup = Soup(response.content)
 
 try:
-# None if nothing is found by .find()
 self._url_image = soup.find(class_='prp-page-image')
+# if None raises AttributeError
 self._url_image = self._url_image.find('img')
 # if None raises TypeError.
 self._url_image = self._url_image['src']
-except TypeError:
+except (TypeError, AttributeError):
 raise ValueError('No prp-page-image src found for %s.' % self)
 else:
 self._url_image = 'https:' + self._url_image

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id03f32e8dc422a22f9998030836da5be8d25af52
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] pywikibot/core[master]: [bugfix] Fix default alias for "thumb"

2017-12-09 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396588 )

Change subject: [bugfix] Fix default alias for "thumb"
..

[bugfix] Fix default alias for "thumb"

- "mini" is the new default alias for "thumb" in German after
  https://phabricator.wikimedia.org/rMW4c2c2ef01a6251f68d813977068ce66187c3bef4

Change-Id: I6b4fb5f11015df4b60919f7b78107a2e5a369c9d
---
M tests/cosmetic_changes_tests.py
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/88/396588/1

diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 6900b3e..6e22088 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -264,18 +264,18 @@
 def test_translateMagicWords(self):
 """Test translateMagicWords method."""
 self.assertEqual(
-'[[File:Foo.bar|miniatur]]',
+'[[File:Foo.bar|mini]]',
 self.cct.translateMagicWords('[[File:Foo.bar|thumb]]'))
 self.assertEqual(
-'[[File:Foo.bar|miniatur]]',
-self.cct.translateMagicWords('[[File:Foo.bar|mini]]'))
+'[[File:Foo.bar|mini]]',
+self.cct.translateMagicWords('[[File:Foo.bar|miniatur]]'))
 # test local namespace
 self.assertEqual(
-'[[Datei:Foo.bar|miniatur]]',
+'[[Datei:Foo.bar|mini]]',
 self.cct.translateMagicWords('[[Datei:Foo.bar|thumb]]'))
 # test multiple magic words
 self.assertEqual(
-'[[File:Foo.bar|links|miniatur]]',
+'[[File:Foo.bar|links|mini]]',
 self.cct.translateMagicWords('[[File:Foo.bar|left|thumb]]'))
 # test magic words at the end
 self.assertEqual(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b4fb5f11015df4b60919f7b78107a2e5a369c9d
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] pywikibot/core[master]: [IMPR] A more preceese exception for patrol.py

2017-12-06 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395702 )

Change subject: [IMPR] A more preceese exception for patrol.py
..

[IMPR] A more preceese exception for patrol.py

Change-Id: I56c0a598c3431f166e81fb077b1cee50ac771b14
---
M scripts/patrol.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/scripts/patrol.py b/scripts/patrol.py
index a20484e..f21be42 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -279,7 +279,7 @@
 author_ns = 0
 try:
 author_ns = self.site.family.authornamespaces[self.site.lang][0]
-except Exception:
+except (AttributeError, KeyError):
 pass
 if author_ns:
 author_ns_prefix = self.site.namespace(author_ns)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56c0a598c3431f166e81fb077b1cee50ac771b14
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] pywikibot/core[master]: [IMPR] use contextlib.closing for closing a file

2017-12-05 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395697 )

Change subject: [IMPR] use contextlib.closing for closing a file
..

[IMPR] use contextlib.closing for closing a file

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


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/97/395697/1

diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index a6628c1..8057a60 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -16,6 +16,7 @@
 
 import base64
 import codecs
+from contextlib import closing
 import hashlib
 import io
 import os
@@ -291,7 +292,7 @@
 pywikibot.error('%s could not be opened: %s' % (filename, e))
 continue
 
-try:
+with closing(f):
 files = CSVReader(f, urlcolumn='url',
   site=config_page.site,
   dialect=configuration['csvDialect'],
@@ -303,8 +304,6 @@
site=None)
 
 bot.run()
-finally:
-f.close()
 
 
 if __name__ == "__main__":

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2c0b043d23065b95d34d9034eb27e3a3822f069
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] pywikibot/core[master]: [IMPR] code cleanup

2017-12-05 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395696 )

Change subject: [IMPR] code cleanup
..

[IMPR] code cleanup

- remove obsolete pass statements
- fix dicstring in imageuncat.py
- use context manager to open a file in solve_disambiguation.py

Change-Id: I5d0c862a9cdb11ce4bd12d9d68b397b19c62d602
---
M pywikibot/date.py
M pywikibot/page.py
M pywikibot/throttle.py
M scripts/cfd.py
M scripts/imageuncat.py
M scripts/makecat.py
M scripts/redirect.py
M scripts/solve_disambiguation.py
M scripts/upload.py
M scripts/welcome.py
M tests/aspects.py
M tests/ui_tests.py
12 files changed, 20 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/96/395696/1

diff --git a/pywikibot/date.py b/pywikibot/date.py
index a9b0e39..f3ec6fb 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -7,7 +7,7 @@
 # (C) Andre Engels, 2004-2005
 # (C) Yuri Astrakhan, 2005-2006 (@gmail.com)
 #   (years/decades/centuries/millenniums str <=> int conversions)
-# (C) Pywikibot team, 2004-2016
+# (C) Pywikibot team, 2004-2017
 #
 # Distributed under the terms of the MIT license.
 #
@@ -377,10 +377,10 @@
 decoders = []
 for s in _reParameters.split(pattern):
 if s is None:
-pass
-elif (len(s) in (2, 3) and s[0] == '%' and
-  s[-1] in _digitDecoders and
-  (len(s) == 2 or s[1] in _decimalDigits)):
+continue
+if (len(s) in (2, 3) and s[0] == '%' and
+s[-1] in _digitDecoders and
+(len(s) == 2 or s[1] in _decimalDigits)):
 # Must match a "%2d" or "%d" style
 dec = _digitDecoders[s[-1]]
 if isinstance(dec, basestring):
diff --git a/pywikibot/page.py b/pywikibot/page.py
index ad87584..d9580b6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -5978,6 +5978,5 @@
 except UnicodeError as ex:
 if not firstException:
 firstException = ex
-pass
 # Couldn't convert, raise the original exception
 raise firstException
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 71c0da8..0f82b68 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -89,9 +89,7 @@
 try:
 f = open(self.ctrlfilename, 'r')
 except IOError:
-if not pid:
-pass
-else:
+if pid:
 raise
 else:
 now = time.time()
diff --git a/scripts/cfd.py b/scripts/cfd.py
index b09db1f..7a56747 100755
--- a/scripts/cfd.py
+++ b/scripts/cfd.py
@@ -178,11 +178,7 @@
 robot = CategoryMoveBot(oldcat=src, batch=True, comment=summary,
 deletion_comment=action_summary,
 inplace=True)
-else:
-# This line does not fit any of our regular expressions,
-# so ignore it.
-pass
-if summary != "" and robot is not None:
+if summary and robot is not None:
 pywikibot.stdout(summary)
 # Run, robot, run!
 robot.run()
diff --git a/scripts/imageuncat.py b/scripts/imageuncat.py
index 315f839..f285299 100755
--- a/scripts/imageuncat.py
+++ b/scripts/imageuncat.py
@@ -1294,7 +1294,7 @@
 Add the uncat template to the page.
 
 @param page: Page to be modified
-@rtype: Page
+@type page: pywikibot.Page
 """
 newtext = page.get() + puttext
 pywikibot.showDiff(page.get(), newtext)
diff --git a/scripts/makecat.py b/scripts/makecat.py
index c4c6f1b..0f647ad 100755
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -79,7 +79,6 @@
 pass
 except pywikibot.IsRedirectPage:
 cl = True
-pass
 else:
 cats = [x for x in pl.categories()]
 if workingcat not in cats:
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 4ce593a..4fd4448 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -291,7 +291,6 @@
 pass
 except KeyError:
 result = None
-pass
 yield (redirect, result, target, final)
 
 def retrieve_broken_redirects(self):
@@ -513,10 +512,8 @@
 pywikibot.warning(
 u'Redirect target %s is not a valid page title.'
 % str(e)[10:])
-pass
 except pywikibot.InvalidTitle:
 pywikibot.exception()
-pass
 except pywikibot.NoPage:
 movedTarget = None
 try:
@@ -611,8 +608,7 @@
 u'Skipping: Redirect target %s is not a redirect.'
 % newRedir.title(asLink=True))
 

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] fix doc description files

2017-12-04 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395046 )

Change subject: [doc] fix doc description files
..

[doc] fix doc description files

Change-Id: I0dba1ae1d5d492783182caf5a0c25b9e53cca273
---
M docs/scripts/scripts.maintenance.rst
M docs/scripts/scripts.rst
2 files changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/46/395046/1

diff --git a/docs/scripts/scripts.maintenance.rst 
b/docs/scripts/scripts.maintenance.rst
index 0efc042..3680c91 100644
--- a/docs/scripts/scripts.maintenance.rst
+++ b/docs/scripts/scripts.maintenance.rst
@@ -46,7 +46,7 @@
 
 
 scripts.maintenance.wikimedia_sites script
--
+--
 
 .. automodule:: scripts.maintenance.wikimedia_sites
 :members:
diff --git a/docs/scripts/scripts.rst b/docs/scripts/scripts.rst
index 44ecbc9..9a9f05d 100644
--- a/docs/scripts/scripts.rst
+++ b/docs/scripts/scripts.rst
@@ -39,10 +39,10 @@
 :show-inheritance:
 
 
-scripts.blockpagechecker script
+scripts.blockpageschecker script
 ---
 
-.. automodule:: scripts.blockpagechecker
+.. automodule:: scripts.blockpageschecker
 :members:
 :undoc-members:
 :show-inheritance:
@@ -105,7 +105,7 @@
 scripts.clean_sandbox script
 
 
-.. automodule:: scripts.clean_sandboy
+.. automodule:: scripts.clean_sandbox
 :members:
 :undoc-members:
 :show-inheritance:
@@ -129,10 +129,10 @@
 :show-inheritance:
 
 
-scripts.coodinate_import script
+scripts.coordinate_import script
 ---
 
-.. automodule:: scripts.coodinate_import
+.. automodule:: scripts.coordinate_import
 :members:
 :undoc-members:
 :show-inheritance:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0dba1ae1d5d492783182caf5a0c25b9e53cca273
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] pywikibot...CommonsDelinker[master]: Fix flake8 issues for statements

2017-11-27 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393552 )

Change subject: Fix flake8 issues for statements
..


Fix flake8 issues for statements

E701 multiple statements on one line (colon)
E703 statement ends with a semicolon

Change-Id: I67b820172bd4dbb6ebec0d3a7218b724b8023efa
---
M checkusage.py
M delinker.py
M image_replacer.py
M plugins/replace_with_dummy.py
M threadpool.py
M tox.ini
6 files changed, 46 insertions(+), 25 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved



diff --git a/checkusage.py b/checkusage.py
index 5e761dd..af94554 100644
--- a/checkusage.py
+++ b/checkusage.py
@@ -105,8 +105,10 @@
 self._conn.connect()
 
 def request(self, method, path, headers, data):
-if not headers: headers = {}
-if not data: data = ''
+if not headers:
+headers = {}
+if not data:
+data = ''
 headers['Connection'] = 'Keep-Alive'
 headers['User-Agent'] = 'MwClient/' + __ver__
 
@@ -243,11 +245,13 @@
 self.http_max_retries = http_max_retries
 self.http_callback = http_callback
 
-if no_db: return
+if no_db:
+return
 
 self.mysql_host_prefix = mysql_host_prefix
 self.mysql_kwargs = mysql_kwargs.copy() # To be safe
-if 'host' in self.mysql_kwargs: del self.mysql_kwargs['host']
+if 'host' in self.mysql_kwargs:
+del self.mysql_kwargs['host']
 self.use_autoconn = use_autoconn
 self.mysql_retry_timeout = mysql_retry_timeout
 self.mysql_max_retries = mysql_max_retries
@@ -328,9 +332,11 @@
 if family.shared_image_repository(lang) != (lang, family_name) and 
shared:
 left_join = 'LEFT JOIN %s.image ON (il_to = img_name) WHERE 
img_name IS NULL AND' % dbname
 else:
-left_join = 'WHERE';
+left_join = 'WHERE'
+
 query = """SELECT page_namespace, page_title FROM %s.page, 
%s.imagelinks
 %s page_id = il_from AND il_to = %%s"""
+
 self.databases[dbname][1].execute(query % (dbname, dbname, left_join),
 (image.encode('utf-8', 'ignore'), ))
 for page_namespace, page_title in self.databases[dbname][1]:
@@ -400,7 +406,8 @@
 return
 
 usages = res['query'].get('imageusage')
-if not usages: return
+if not usages:
+return
 
 # Apparently this someday changed from dict to list?
 if type(usages) is dict:
@@ -429,7 +436,8 @@
 def close(self):
 if getattr(self, 'http'):
 self.http.close()
-if not hasattr(self, 'databases'): return
+if not hasattr(self, 'databases'):
+return
 for connection, cursor in self.databases.itervalues():
 try:
 connection.close()
diff --git a/delinker.py b/delinker.py
index b352cd1..a0209a7 100644
--- a/delinker.py
+++ b/delinker.py
@@ -256,7 +256,8 @@
 current_link_ends = [link_end for link_end in link_ends
 if link_end > image_start]
 end = image_start
-if current_link_ends: end = current_link_ends[0]
+if current_link_ends:
+end = current_link_ends[0]
 
 while current_link_starts and current_link_ends:
 start = current_link_starts.pop(0)
@@ -286,7 +287,8 @@
 
 # Perform the replacements
 for old, new in replacements:
-if old: new_text = new_text.replace(old, new)
+if old:
+new_text = new_text.replace(old, new)
 
 # Remove the image from galleries
 hook = 'gallery'
@@ -427,7 +429,8 @@
 # like mediawiki.org and meta and species.
 output(u'%s Using default summary for %s' % (self, site))
 
-if default: return default
+if default:
+return default
 
 if site.family.name != 'wikipedia' and 
self.CommonsDelinker.config['global']:
 if site.family.name in ('wiktionary', 'wikibooks', 'wikiquote',
@@ -568,7 +571,8 @@
 def starve(self):
 self.pool.jobLock.acquire()
 try:
-if self.pool[id(self)].isSet(): return False
+if self.pool[id(self)].isSet():
+return False
 
 output(u'%s Starving' % self)
 self.CheckUsage.close()
@@ -638,7 +642,8 @@
 self.database.commit()
 
 def do(self, args):
-if not self.enabled: return
+if not self.enabled:
+return
 try:
 if len(args) == 3:
 self.log_replacement(*args)
@@ -657,7 +662,8 @@
 def starve(self):
 self.pool.jobLock.acquire()
 try:
-if self.pool[id(self)].isSet(): return False
+if self.pool[id(self)].isSet():
+  

[MediaWiki-commits] [Gerrit] pywikibot...CommonsDelinker[master]: Fix flake8 issues for imports

2017-11-27 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393551 )

Change subject: Fix flake8 issues for imports
..


Fix flake8 issues for imports

E401 multiple imports on one line
E402 module level import not at top of file

Change-Id: Ib4da78363c08eb4d430bde320007d4baa3f6d7aa
---
M image_replacer.py
M mysql_autoconnection.py
M threadpool.py
M tox.ini
4 files changed, 10 insertions(+), 8 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved



diff --git a/image_replacer.py b/image_replacer.py
index 9c09930..2ceb268 100644
--- a/image_replacer.py
+++ b/image_replacer.py
@@ -316,7 +316,8 @@
 def main():
 global R
 
-import sys, traceback
+import sys
+import traceback
 pywikibot.handleArgs()
 output(u'Running ' + __version__)
 
diff --git a/mysql_autoconnection.py b/mysql_autoconnection.py
index 42314a4..23f5fa6 100755
--- a/mysql_autoconnection.py
+++ b/mysql_autoconnection.py
@@ -11,7 +11,8 @@
 #
 __version__ = '$Id: mysql_autoconnection.py 7588 2009-11-03 20:36:09Z 
btongminh $'
 
-import MySQLdb, MySQLdb.cursors
+import MySQLdb
+import MySQLdb.cursors
 import time
 
 
diff --git a/threadpool.py b/threadpool.py
index 11f0f4f..b5a7f03 100644
--- a/threadpool.py
+++ b/threadpool.py
@@ -22,10 +22,12 @@
 #
 # Distributed under the terms of the MIT license.
 #
-__version__ = '$Id: threadpool.py 10816 2012-12-23 17:07:01Z btongminh $'
-#
 
-import sys, threading, os
+import os
+import sys
+import threading
+
+__version__ = '$Id: threadpool.py 10816 2012-12-23 17:07:01Z btongminh $'
 
 
 class ThreadPool(dict):
diff --git a/tox.ini b/tox.ini
index 1933087..d44f244 100644
--- a/tox.ini
+++ b/tox.ini
@@ -29,8 +29,6 @@
 # E251 unexpected spaces around keyword / parameter equals
 # E261 at least two spaces before inline comment
 # E265 block comment should start with '# '
-# E401 multiple imports on one line
-# E402 module level import not at top of file
 # E502 the backslash is redundant between brackets
 # E701 multiple statements on one line (colon)
 # E703 statement ends with a semicolon
@@ -43,4 +41,4 @@
 # W291 trailing whitespace
 # W293 blank line contains whitespace
 # W602 deprecated form of raising exception
-ignore=E123,E125,E127,E128,E201,E221,E251,E261,E265,E401,E402,E502,E701,E703,E711,E721,E722,F401,F811,F841,W291,W293,W602
+ignore=E123,E125,E127,E128,E201,E221,E251,E261,E265,E502,E701,E703,E711,E721,E722,F401,F811,F841,W291,W293,W602

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib4da78363c08eb4d430bde320007d4baa3f6d7aa
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/CommonsDelinker
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: Legoktm 
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] pywikibot...CommonsDelinker[master]: Fix flake8 issues related to blank lines

2017-11-27 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393549 )

Change subject: Fix flake8 issues related to blank lines
..


Fix flake8 issues related to blank lines

E301 expected 1 blank line, found 0
E302 expected 2 blank lines, found 1
E303 too many blank lines (2)
E305 expected 2 blank lines after class or function definition, found 1
E306 expected 1 blank line before a nested definition, found 0
W391 blank line at end of file

In image_replacer.py, regroup the constants before the function
definitions.

Change-Id: I7906c7b9ea2840cd7b878788aeb5dda4fb8e0f2a
---
M checkusage.py
M delinker.py
M image_replacer.py
M mysql_autoconnection.py
M plugins/books.py
M plugins/debug.py
M plugins/replace_with_dummy.py
M plugins/skipped_pages.py
M threadpool.py
M tox.ini
10 files changed, 73 insertions(+), 29 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved



diff --git a/checkusage.py b/checkusage.py
index 64f12d0..5e761dd 100644
--- a/checkusage.py
+++ b/checkusage.py
@@ -61,15 +61,19 @@
 pass
 __ver__ = '0.4c'
 
+
 def strip_ns(title):
 title = title.replace(' ', '_')
 if title.find(':') != -1:
 return title[title.find(':') + 1:]
 return title
+
+
 def strip_image(title):
 if title.startswith('Image:'):
 return strip_ns(title)
 return title
+
 
 def family(domain):
 if domain is None:
@@ -90,6 +94,7 @@
 if domain == 'wikisource.org':
 return '-', 'wikisource'
 raise RuntimeError('Unknown family ' + domain)
+
 
 # Not sure whether this belongs here
 class HTTP(object):
@@ -158,8 +163,10 @@
 data['error']['info'])
 
 return data
+
 def close(self):
 self._conn.close()
+
 
 class HTTPPool(list):
 def __init__(self, retry_timeout = 10, max_retries = -1,
@@ -186,7 +193,6 @@
 self.remove(conn)
 self.wait()
 conn = self.find_conn(host)
-
 
 def find_conn(self, host):
 for conn in self:
@@ -285,7 +291,6 @@
 
 self.domains[dbname] = domain
 
-
 def connect_mysql(self, host):
 # A bug in MySQLdb 1.2.1_p will force you to set
 # all your connections to use_unicode = False.
@@ -303,6 +308,7 @@
 cursor = database.cursor()
 self.connections.append((database, cursor))
 return database, cursor
+
 def connect_http(self):
 if not self.http:
 self.http = HTTPPool(retry_timeout = self.http_retry_timeout,
@@ -372,7 +378,6 @@
 else:
 return
 
-
 def get_usage_live(self, site, image, shared = False):
 self.connect_http()
 
@@ -410,7 +415,6 @@
 stripped_title = title
 yield namespace, stripped_title, title
 
-
 def exists(self, site, image):
 self.connect_http()
 # Check whether the image still is deleted on Commons.
@@ -431,4 +435,3 @@
 connection.close()
 except:
 pass
-
diff --git a/delinker.py b/delinker.py
index 1b4418c..b352cd1 100644
--- a/delinker.py
+++ b/delinker.py
@@ -54,15 +54,19 @@
 # FIXME: They should be defined *somewhere* in the Python library, not?
 WHITESPACE = u' \r\n\t\u200e\u200f\u202a\u202a\u202b\u202c\u202d\u202e'
 
+
 def wait_callback(object):
 output(u'%s Connection has been lost in %s. Attempting reconnection.' % 
(threading.currentThread(), repr(object)), False)
 if hasattr(object, 'error'):
 output(u'Error was %s: %s' % tuple(object.error))
 
+
 def universal_unicode(s):
 if type(s) is str:
 return s.decode('utf-8', 'ignore')
 return unicode(s)
+
+
 def connect_database():
 engine = config.CommonsDelinker['sql_engine']
 kwargs = config.CommonsDelinker['sql_config'].copy()
@@ -83,19 +87,26 @@
 # TODO: Add support for sqlite3
 raise RuntimeError('Unsupported database engine %s' % engine)
 
+
 class ImmutableByReference(object):
 def __init__(self, data):
 self.data = data
+
 def set(self, value):
 self.data = value
+
 def get(self):
 return self.data
+
 def __str__(self):
 return str(self.data)
+
 def __unicode__(self):
 return unicode(self.data)
+
 def __int__(self):
 return int(self.data)
+
 
 class Delinker(threadpool.Thread):
 # TODO: Method names could use some clean up
@@ -197,6 +208,7 @@
 def create_regex(s):
 first, other = re.escape(s[0]), re.escape(s[1:])
 return ur'(?:[%s%s]%s)' % (first.upper(), first.lower(), other)
+
 def create_regex_i(s):
 return ur'(?:%s)' % u''.join([u'[%s%s]' % (c.upper(), 
c.lower()) for c in s])
 
@@ -281,9 +293,11 @@
 r_galleries = ur'(?s)(\<%s\>)(.*?)(\<\/%s\>)' % 
(create_regex_i('gallery'),
 create_regex_i('gallery'))
 r_gallery = 

[MediaWiki-commits] [Gerrit] pywikibot...CommonsDelinker[master]: Pass flake8

2017-11-24 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393123 )

Change subject: Pass flake8
..


Pass flake8

Ignore all pending errors.
Bump max_line_length from 120 to 179.

Change-Id: Ic7504382bb92498e69af13237c85d7c7711b7e97
---
M tox.ini
1 file changed, 35 insertions(+), 1 deletion(-)

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



diff --git a/tox.ini b/tox.ini
index 06e2be5..ddc11eb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -15,4 +15,38 @@
 
 [flake8]
 exclude = .tox
-max_line_length = 120
+
+# Should be 120?
+max_line_length = 179
+
+# TODO: have to fix them all
+# E123 closing bracket does not match indentation of opening bracket's line
+# E125 continuation line with same indent as next logical line
+# E127 continuation line over-indented for visual indent
+# E128 continuation line under-indented for visual indent
+# E201 whitespace after '('
+# E221 multiple spaces before operator
+# E251 unexpected spaces around keyword / parameter equals
+# E261 at least two spaces before inline comment
+# E265 block comment should start with '# '
+# E301 expected 1 blank line, found 0
+# E302 expected 2 blank lines, found 1
+# E303 too many blank lines (2)
+# E305 expected 2 blank lines after class or function definition, found 1
+# E306 expected 1 blank line before a nested definition, found 0
+# E401 multiple imports on one line
+# E402 module level import not at top of file
+# E502 the backslash is redundant between brackets
+# E701 multiple statements on one line (colon)
+# E703 statement ends with a semicolon
+# E711 comparison to None should be 'if cond is not None:'
+# E721 do not compare types, use 'isinstance()'
+# E722 do not use bare except'
+# F401 'XXX' imported but unused
+# F811 redefinition of unused '' from line ##
+# F841 local variable 'e' is assigned to but never used
+# W291 trailing whitespace
+# W293 blank line contains whitespace
+# W391 blank line at end of file
+# W602 deprecated form of raising exception
+ignore=E123,E125,E127,E128,E201,E221,E251,E261,E265,E301,E302,E303,E305,E306,E401,E402,E502,E701,E703,E711,E721,E722,F401,F811,F841,W291,W293,W391,W602

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic7504382bb92498e69af13237c85d7c7711b7e97
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/CommonsDelinker
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Xqt 

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


[MediaWiki-commits] [Gerrit] pywikibot...CommonsDelinker[master]: .gitignore /.tox

2017-11-24 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393119 )

Change subject: .gitignore /.tox
..


.gitignore /.tox

Change-Id: If90d7aabe0d1a81537ebb767efe15589fa6cded9
---
A .gitignore
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
  Xqt: Verified; Looks good to me, approved



diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..5f4d761
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/.tox

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If90d7aabe0d1a81537ebb767efe15589fa6cded9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/CommonsDelinker
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: Xqt 

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


[MediaWiki-commits] [Gerrit] pywikibot...CommonsDelinker[master]: Accept positional arguments for tox -e flake8

2017-11-24 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393120 )

Change subject: Accept positional arguments for tox -e flake8
..


Accept positional arguments for tox -e flake8

Eg:
   tox -e flake8 -- --statistics

Change-Id: I187a99e09ca6396c5780c276e30b0302ed30b5e4
---
M tox.ini
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/tox.ini b/tox.ini
index f05cb65..06e2be5 100644
--- a/tox.ini
+++ b/tox.ini
@@ -10,7 +10,7 @@
 envlist = flake8
 
 [testenv:flake8]
-commands = flake8
+commands = flake8 {posargs}
 deps = flake8
 
 [flake8]

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I187a99e09ca6396c5780c276e30b0302ed30b5e4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/CommonsDelinker
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Xqt 

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


[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [L10N] Update languages_by_size

2017-11-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392687 )

Change subject: [L10N] Update languages_by_size
..

[L10N] Update languages_by_size

Change-Id: I0e5895f39847ebd29736d90bb55af02ee121e19a
---
M pywikibot/families/wikibooks_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
6 files changed, 32 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/87/392687/1

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

[MediaWiki-commits] [Gerrit] pywikibot...xqbot[master]: [bugfix] changed regex pattern for wikihistory

2017-11-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392629 )

Change subject: [bugfix] changed regex pattern for wikihistory
..

[bugfix] changed regex pattern for wikihistory

Change-Id: If4a7447c82e49a6b4976afc127bed6c32c22832f
---
M afd_notice.py
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/afd_notice.py b/afd_notice.py
index e02d1f4..227f2fe 100644
--- a/afd_notice.py
+++ b/afd_notice.py
@@ -269,8 +269,8 @@
 time.sleep(60)
 continue
 else:
-pattern = (
-r'>(?P.+?)\s\((?P\d{1,3})&')
+pattern = (r'>(?P.+?)\s'
+   r'\((?P\d{1,3})&')
 for main, main_cnt in re.findall(pattern,
  r.decode('utf-8')):
 main_cnt = int(main_cnt)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4a7447c82e49a6b4976afc127bed6c32c22832f
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] pywikibot/core[master]: [bugfix] fix xml decoding

2017-11-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392314 )

Change subject: [bugfix] fix xml decoding
..

[bugfix] fix xml decoding

- read xml encoding from xml file if no charset is given
- use utf-8 as default

Bug: T180915
Change-Id: I4091eb8428b2c0bffbda657ee59583857363e1d5
---
M pywikibot/comms/threadedhttp.py
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/14/392314/1

diff --git a/pywikibot/comms/threadedhttp.py b/pywikibot/comms/threadedhttp.py
index 4e1f9e1..a52b758 100644
--- a/pywikibot/comms/threadedhttp.py
+++ b/pywikibot/comms/threadedhttp.py
@@ -1,13 +1,14 @@
 # -*- coding: utf-8 -*-
 """Http backend layer, formerly providing a httplib2 wrapper."""
 from __future__ import absolute_import, unicode_literals
-# (C) Pywikibot team, 2007-2015
+# (C) Pywikibot team, 2007-2017
 
 __version__ = '$Id$'
 __docformat__ = 'epytext'
 
 # standard python libraries
 import codecs
+import re
 import sys
 
 if sys.version_info[0] > 2:
@@ -127,6 +128,13 @@
 elif 'json' in content_type:
 # application/json | application/sparql-results+json
 self._header_encoding = 'utf-8'
+elif 'xml' in content_type:
+header = self.raw[:100].splitlines()[0]
+m = re.search('encoding="(?P.+)"', header)
+if m:
+self._header_encoding = m.group('encoding')
+else:
+self._header_encoding = 'utf-8'
 else:
 self._header_encoding = None
 return self._header_encoding

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4091eb8428b2c0bffbda657ee59583857363e1d5
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] pywikibot...xqbot[master]: [IMPR] Improvements fro deletion requests notifier

2017-11-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392304 )

Change subject: [IMPR] Improvements fro deletion requests notifier
..

[IMPR] Improvements fro deletion requests notifier

Change-Id: I80a058b5efc440e6cb4dd29dec2e46a00e2e26e0
---
M afd_notice.py
1 file changed, 43 insertions(+), 35 deletions(-)


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

diff --git a/afd_notice.py b/afd_notice.py
index 65704f0..d70b127 100644
--- a/afd_notice.py
+++ b/afd_notice.py
@@ -193,14 +193,10 @@
 
 # inform creator
 if creator and creator != latest:
-if creator in self.ignoreUser:
-pywikibot.output('>>> Creator {0} has opted out'
- .format(creator))
-else:
-user = pywikibot.User(self.site, creator)
-if self.could_be_informed(user):
-pywikibot.output('>>> Creator is ' + creator)
-self.inform(user, page=page.title(), action='angelegte')
+user = pywikibot.User(self.site, creator)
+if self.could_be_informed(user, 'Creator'):
+pywikibot.output('>>> Creator is ' + creator)
+self.inform(user, page=page.title(), action='angelegte')
 
 # inform main authors for articles
 for author, percent in self.find_authors(page):
@@ -210,14 +206,14 @@
 continue
 if (author != latest and author != creator):
 user = pywikibot.User(self.site, author)
-if self.could_be_informed(user):
+if self.could_be_informed(user, 'Main author'):
 pywikibot.output('>>> Main author {0} with {1} % edits'
  .format(author, percent))
 self.inform(user, page=page.title(),
 action='%süberarbeitete' % (
 'stark ' if percent >= 25 else ''))
 
-def could_be_informed(self, user):
+def could_be_informed(self, user, group):
 """Check whether user could be informed.
 
 Also print additional informations.
@@ -226,14 +222,17 @@
 @return: whether user could be informed or not
 @rtype: bool
 """
-if not user.isRegistered():
-pywikibot.output('>>> Created by IP user, skipping')
+if user.username in self.ignoreUser:
+pywikibot.output('>>> {0} {1} has opted out'
+ .format(group, user.username))
+elif not user.isRegistered():
+pywikibot.output('>>> {0} is an IP user, skipping'.format(group))
 elif user.isBlocked():
-pywikibot.output('>>> Creator {0} is blocked, skipping'
- .format(user.username))
+pywikibot.output('>>> {0} {1} is blocked, skipping'
+ .format(group, user.username))
 elif 'bot' in user.groups():
-pywikibot.output('>>> Creator {0} is a bot, skipping'
- .format(user.username))
+pywikibot.output('>>> {0} {1} is a bot, skipping'
+ .format(group, user.username))
 else:
 return True
 return False
@@ -253,25 +252,33 @@
 if page.namespace() == pywikibot.site.Namespace.MAIN:
 url = ('https://tools.wmflabs.org/wikihistory/dewiki/'
'getauthors.php?page_id={0}'.format(page.pageid))
-try:
-r = fetch(url)
-except requests.exceptions.ConnectionError:
-pywikibot.exception()
-else:
-if r.status not in (200, ):
-pywikibot.warning('wikihistory request status is %d'
-  % r.status)
+retries = 0
+while retries < 5:
+retries += 1
+try:
+r = fetch(url)
+except requests.exceptions.ConnectionError:
+pywikibot.exception()
 else:
-pattern = r'>(?P.+?)\s\((?P\d{1,3})&'
-for main, main_cnt in re.findall(pattern,
- r.decode('utf-8')):
-main_cnt = int(main_cnt)
-percent += main_cnt
-if ' weitere' in main:
-break
-yield main, main_cnt
-if percent > 50:
-break
+if r.status not in (200, ):
+pywikibot.warning('wikihistory request status is %d'
+  % r.status)
+elif 'Timeout' in r.decode('utf-8'):
+

[MediaWiki-commits] [Gerrit] pywikibot...xqbot[master]: [IMPR] Check page restrictions for ww only

2017-11-19 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392303 )

Change subject: [IMPR] Check page restrictions for ww only
..

[IMPR] Check page restrictions for ww only

Other improvements

Change-Id: I7e263fc23560c899d8d71d8be9cfa660ce730569
---
M checkvotes.py
1 file changed, 4 insertions(+), 3 deletions(-)


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

diff --git a/checkvotes.py b/checkvotes.py
index fa761ed..eb0534a 100644
--- a/checkvotes.py
+++ b/checkvotes.py
@@ -62,7 +62,7 @@
 page = pywikibot.Page(site, 'Wikipedia:Kandidaturen')
 text = page.get()
 FOLDER = 'Wikipedia:Adminkandidaturen/'
-R = re.compile(r'\{\{%s(.+?)[\||\}]' % FOLDER)
+R = re.compile(r'\{\{:?%s(.+?)[\||\}]' % FOLDER)
 for pagename in R.findall(text):
 if pagename.lower() != 'intro':
 if not votepage or votepage == pagename:
@@ -194,6 +194,7 @@
 }
 
 ignore_server_errors = True
+ignore_save_related_errors = True
 
 def __init__(self, generator, template, always, blockinfo, **kwargs):
 """
@@ -530,9 +531,9 @@
 
 # page.getRestrictions() may delete the content
 # if revision ID has been changed (bug: T93364)
-# TODO: für Prüfung hier ausschließen
+global ww
 restrictions = page.getRestrictions()
-if restrictions:
+if ww and restrictions:
 if 'edit' in restrictions and restrictions['edit']:
 if 'sysop' in restrictions['edit']:
 pywikibot.output('\nPage %s is locked; skipping.'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e263fc23560c899d8d71d8be9cfa660ce730569
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] pywikibot/core[master]: [L10N] update languages_by_size

2017-11-11 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390633 )

Change subject: [L10N] update languages_by_size
..

[L10N] update languages_by_size

Change-Id: Id9b6af6661fda3d44fc4ea575453b5eb7a0712cf
---
M pywikibot/families/wikibooks_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
6 files changed, 21 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/33/390633/1

diff --git a/pywikibot/families/wikibooks_family.py 
b/pywikibot/families/wikibooks_family.py
index 43788bc..8482147 100644
--- a/pywikibot/families/wikibooks_family.py
+++ b/pywikibot/families/wikibooks_family.py
@@ -41,7 +41,7 @@
 'vi', 'th', 'ca', 'fi', 'id', 'sq', 'fa', 'zh', 'ru', 'az', 'cs',
 'sv', 'da', 'hr', 'sr', 'tr', 'ko', 'ar', 'no', 'gl', 'ba', 'ro',
 'ta', 'tl', 'mk', 'is', 'uk', 'sa', 'hi', 'ka', 'lt', 'sk', 'tt',
-'eo', 'el', 'bg', 'bn', 'li', 'hy', 'si', 'ms', 'sl', 'ur', 'la',
+'eo', 'el', 'bg', 'li', 'bn', 'hy', 'si', 'ms', 'sl', 'ur', 'la',
 'ml', 'km', 'ia', 'et', 'cv', 'mr', 'eu', 'kk', 'oc', 'be', 'pa',
 'ne', 'fy', 'tg', 'te', 'af', 'ku', 'ky', 'bs', 'mg', 'cy',
 ]
diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index c5cba30..d7cf106 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -40,10 +40,10 @@
 'vi', 'ja', 'pt', 'zh', 'uk', 'fa', 'ca', 'ar', 'no', 'sh', 'fi',
 'hu', 'id', 'ko', 'cs', 'ro', 'sr', 'ms', 'tr', 'eu', 'eo', 'bg',
 'hy', 'da', 'zh-min-nan', 'sk', 'min', 'kk', 'he', 'lt', 'hr',
-'ce', 'et', 'sl', 'be', 'gl', 'el', 'nn', 'uz', 'simple', 'az',
+'ce', 'et', 'sl', 'be', 'gl', 'el', 'nn', 'simple', 'uz', 'az',
 'la', 'ur', 'hi', 'vo', 'th', 'ka', 'ta', 'cy', 'mk', 'tg', 'tl',
 'mg', 'oc', 'ky', 'lv', 'bs', 'tt', 'new', 'sq', 'te', 'pms', 'br',
-'be-tarask', 'zh-yue', 'ast', 'bn', 'ml', 'ht', 'lb', 'jv', 'mr',
+'zh-yue', 'be-tarask', 'ast', 'bn', 'ml', 'ht', 'lb', 'jv', 'mr',
 'azb', 'af', 'sco', 'pnb', 'ga', 'is', 'cv', 'ba', 'fy', 'su',
 'sw', 'my', 'lmo', 'an', 'yo', 'ne', 'gu', 'io', 'pa', 'nds',
 'scn', 'bpy', 'als', 'bar', 'ku', 'kn', 'ia', 'qu', 'ckb', 'mn',
@@ -51,10 +51,10 @@
 'cdo', 'map-bms', 'or', 'fo', 'mzn', 'hsb', 'xmf', 'li', 'mai',
 'sah', 'sa', 'vec', 'ilo', 'os', 'mrj', 'hif', 'mhr', 'bh', 'eml',
 'roa-tara', 'ps', 'diq', 'pam', 'sd', 'hak', 'nso', 'se', 'ace',
-'bcl', 'mi', 'nah', 'zh-classical', 'nds-nl', 'szl', 'gan', 'wuu',
-'vls', 'rue', 'frr', 'bo', 'glk', 'km', 'vep', 'sc', 'fiu-vro',
+'bcl', 'mi', 'zh-classical', 'nah', 'nds-nl', 'szl', 'gan', 'wuu',
+'vls', 'rue', 'km', 'frr', 'bo', 'glk', 'vep', 'sc', 'fiu-vro',
 'co', 'crh', 'lrc', 'tk', 'kv', 'csb', 'so', 'gv', 'as', 'lad',
-'zea', 'ay', 'myv', 'udm', 'lez', 'stq', 'kw', 'nv', 'ie', 'nrm',
+'zea', 'ay', 'myv', 'udm', 'lez', 'nv', 'stq', 'kw', 'ie', 'nrm',
 'pcd', 'mwl', 'rm', 'koi', 'gom', 'ug', 'ab', 'lij', 'gn', 'mt',
 'fur', 'dsb', 'cbk-zam', 'dv', 'ang', 'ln', 'ext', 'sn', 'kab',
 'ksh', 'lo', 'gag', 'frp', 'pag', 'pi', 'olo', 'dty', 'av', 'xal',
@@ -63,8 +63,8 @@
 'ki', 'na', 'lbe', 'roa-rup', 'jbo', 'ty', 'mdf', 'kg', 'za', 'wo',
 'lg', 'bi', 'srn', 'zu', 'chr', 'tcy', 'ltg', 'sm', 'om', 'xh',
 'tn', 'pih', 'cu', 'chy', 'rmy', 'tw', 'kbp', 'tum', 'ts', 'st',
-'got', 'rn', 'pnt', 'ss', 'fj', 'bm', 'ch', 'ady', 'iu', 'ny',
-'ee', 'ks', 'ak', 'ik', 've', 'sg', 'dz', 'ff', 'atj', 'ti', 'cr',
+'got', 'rn', 'pnt', 'ss', 'bm', 'fj', 'ch', 'ady', 'iu', 'ny',
+'ee', 'ks', 'ak', 'ik', 've', 'sg', 'atj', 'dz', 'ff', 'ti', 'cr',
 'din',
 ]
 
diff --git a/pywikibot/families/wikiquote_family.py 
b/pywikibot/families/wikiquote_family.py
index a865570..f816c05 100644
--- a/pywikibot/families/wikiquote_family.py
+++ b/pywikibot/families/wikiquote_family.py
@@ -36,7 +36,7 @@
 self.languages_by_size = [
 'en', 'it', 'pl', 'ru', 'cs', 'fa', 'de', 'pt', 'es', 'uk', 'sk',
 'fr', 'bs', 'tr', 'he', 'ca', 'fi', 'lt', 'th', 'bg', 'sl', 'eo',
-'hy', 'el', 'nn', 'id', 'hr', 'zh', 'hu', 'su', 'li', 'az', 'ko',
+'hy', 'el', 'nn', 'hr', 'id', 'zh', 'hu', 'su', 'li', 'az', 'ko',
 'nl', 'ja', 'ar', 'gu', 'sv', 'sr', 'gl', 'ur', 'te', 'ta', 'cy',
 'la', 'no', 'ml', 'et', 'vi', 'kn', 'ku', 

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [test] Fix print function doc tests

2017-11-10 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390381 )

Change subject: [test] Fix print function doc tests
..

[test] Fix print function doc tests

behaviour of flake8-print has been changed since 3.01.
Change the tests exception list then.

Change-Id: Iad9b5790b299dfb17daa8cec0ef11c6c8b1231cb
---
M pywikibot/comms/http.py
M pywikibot/userinterfaces/win32_unicode.py
M scripts/harvest_template.py
M tox.ini
4 files changed, 12 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/81/390381/1

diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 146f8b6..b6fb20d 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -117,7 +117,7 @@
 message = 'Closing network session.'
 if hasattr(sys, 'last_type'):
 # we quit because of an exception
-print(sys.last_type)  # flake8: disable=T003 (print)
+print(sys.last_type)
 critical(message)
 else:
 log(message)
diff --git a/pywikibot/userinterfaces/win32_unicode.py 
b/pywikibot/userinterfaces/win32_unicode.py
index f769a91..19ed9bb 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -175,7 +175,7 @@
 # so that we can at least see them.
 def _complain(message):
 print(isinstance(message, str) and message or repr(message),
-  file=original_stderr)  # noqa: print
+  file=original_stderr)
 
 
 def register_cp65001():
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 2d797b9..0869356 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -94,7 +94,7 @@
 if not willstop:
 willstop = True
 print('Received ctrl-c. Finishing current item; '
-  'press ctrl-c again to abort.')  # noqa
+  'press ctrl-c again to abort.')
 else:
 raise KeyboardInterrupt
 
diff --git a/tox.ini b/tox.ini
index 504dc70..a645895 100644
--- a/tox.ini
+++ b/tox.ini
@@ -168,22 +168,25 @@
 require-code = true
 putty-auto-ignore = true
 putty-ignore =
-generate_family_file.py : +T001, T003
-pwb.py : +T001, T003
-setup.py : +T003
+generate_family_file.py : +T001
+pwb.py : +T001
+setup.py : +T001
+pywikibot/comms/http.py : +T001
 
pywikibot/date.py,pywikibot/family.py,pywikibot/fixes.py,pywikibot/textlib.py,pywikibot/userinterfaces/terminal_interface_unix.py,pywikibot/userinterfaces/terminal_interface_win32.py,pywikibot/families/wikipedia_family.py
 : +E241
 pywikibot/textlib.py : +N801
 pywikibot/userinterfaces/transliteration.py : +N801
-pywikibot/userinterfaces/win32_unicode.py : +N801, N812
+pywikibot/userinterfaces/win32_unicode.py : +N801, N812, T001
 tests/page_tests.py : +E241
 scripts/,/pagegenerators.parameterHelp/ : +E241
 scripts/imagetransfer.py,scripts/maintenance/wikimedia_sites.py : +E241
 tests/ui_tests.py : +D102, D103, N801
-tests/__init__.py,tests/aspects.py,tests/script_tests.py,tests/pwb/ : 
+T001, T003
+tests/__init__.py,tests/aspects.py,tests/script_tests.py,tests/pwb/ : +T001
 tests/,/from pywikibot.tools import/ : +N813
 scripts/checkimages.py,scripts/imagecopy.py,scripts/imagecopy_self.py : 
+N801
-scripts/maintenance/make_i18n_dict.py : +T001, T003
+scripts/maintenance/make_i18n_dict.py : +T001
 scripts/archive/featured.py : +D102, D103
+scripts/flickrripper.py : +T001
+scripts/harvest_template : +T001
 scripts/script_wui.py : +D102
 scripts/makecat.py : +D103
 scripts/interwiki.py,/""/ : +P102

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad9b5790b299dfb17daa8cec0ef11c6c8b1231cb
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] pywikibot...drtrigonbot[master]: git.wikimedia.org -> phab

2017-11-08 Thread Xqt (Code Review)
Xqt has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/389918 )

Change subject: git.wikimedia.org -> phab
..


git.wikimedia.org -> phab

I couldn't find updated urls for 
https://phabricator.wikimedia.org/diffusion/PWDT/browse/master/fabfile.py;21d6cda9c284d3d6752e139ada75951af64fc1a7$90-91
and 
https://phabricator.wikimedia.org/diffusion/PWDT/browse/master/fabfile.py;21d6cda9c284d3d6752e139ada75951af64fc1a7$97-98
 so I didn't touch them.

Bug: T139089
Change-Id: I9927170698e4a01531ca01617e8ddf2629fc1e5b
---
M fabfile.py
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/fabfile.py b/fabfile.py
index 84664a9..9223ea1 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -4,7 +4,7 @@
 
 1.) download and install git (and fabric)
 2.) download the fabfile, e.g.:
-$ wget 
https://git.wikimedia.org/raw/pywikibot%2Fbots%2Fdrtrigonbot/HEAD/fabfile.py
+$ wget 
https://phabricator.wikimedia.org/diffusion/PWDT/browse/master/fabfile.py
 3.) run the fabfile:
 $ fab -H localhost install
 4.) setup your config files by generating new or copying existing ones

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9927170698e4a01531ca01617e8ddf2629fc1e5b
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/drtrigonbot
Gerrit-Branch: master
Gerrit-Owner: TerraCodes 
Gerrit-Reviewer: Xqt 

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


[MediaWiki-commits] [Gerrit] pywikibot...xqbot[master]: [pep8] code styles

2017-11-06 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389414 )

Change subject: [pep8] code styles
..

[pep8] code styles

Change-Id: I923ba1ec448f4f66d9b77a8b2695ff641e723379
---
M tests/vandalism_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/tests/vandalism_tests.py b/tests/vandalism_tests.py
index 839cafb..ac32a63 100644
--- a/tests/vandalism_tests.py
+++ b/tests/vandalism_tests.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Test vandalism modules."""
 #
 # (C) xqt, 2015-2017

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I923ba1ec448f4f66d9b77a8b2695ff641e723379
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] pywikibot...xqbot[master]: [pep8] code styles

2017-11-05 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389327 )

Change subject: [pep8] code styles
..

[pep8] code styles

Change-Id: Iae96b5d1513f303c1ad33665e638f427d00cc77b
---
M tests/vandalism_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/tests/vandalism_tests.py b/tests/vandalism_tests.py
index 839cafb..ac32a63 100644
--- a/tests/vandalism_tests.py
+++ b/tests/vandalism_tests.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Test vandalism modules."""
 #
 # (C) xqt, 2015-2017

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae96b5d1513f303c1ad33665e638f427d00cc77b
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] pywikibot...xqbot[master]: [pep8] code styles

2017-11-05 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389326 )

Change subject: [pep8] code styles
..

[pep8] code styles

Change-Id: I8f97ee31a802108f02a181198b348497624ba2e5
---
M __init__.py
M afd_notice.py
M checkvotes.py
M imagereview.py
M tests/__init__.py
M tests/afd_notice_tests.py
M tests/checkvotes_tests.py
M tests/imagereview_tests.py
M tests/utils.py
M tests/vandalism_tests.py
M vandalism.py
11 files changed, 17 insertions(+), 32 deletions(-)


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

diff --git a/__init__.py b/__init__.py
index 2a4a7da..69c6e6a 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,3 +1,3 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Private xqbot scripts."""
 # THIS DIRECTORY IS TO HOLD PRIVATE XQBOT BOT SCRIPTS FOR THE CORE FRAMEWORK
diff --git a/afd_notice.py b/afd_notice.py
index c532519..a392d7c 100644
--- a/afd_notice.py
+++ b/afd_notice.py
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """
 Inform users about deletion requests.
 
@@ -14,7 +14,7 @@
 
 """
 #
-# (C) xqt, 2013-2016
+# (C) xqt, 2013-2017
 #
 # Distributed under the terms of the MIT license.
 #
diff --git a/checkvotes.py b/checkvotes.py
index d91b5a2..fa761ed 100644
--- a/checkvotes.py
+++ b/checkvotes.py
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """
 Script to verify the eligibility for votes on de-wiki.
 
@@ -20,13 +20,9 @@
 #
 from __future__ import absolute_import, print_function, unicode_literals
 
-__version__ = '$Id: b7d0f7af1cfce7db63fe73ddf71d24191b41d14a $'
-#
-
 import re
 
 import pywikibot
-
 from pywikibot import config, pagegenerators
 from pywikibot.bot import ExistingPageBot, NoRedirectPageBot, SingleSiteBot
 from pywikibot.comms import http
diff --git a/imagereview.py b/imagereview.py
index 7e8cd30..a098bf8 100644
--- a/imagereview.py
+++ b/imagereview.py
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 #
 """
 This bot script is developed for the image review processing on de-wiki.
diff --git a/tests/__init__.py b/tests/__init__.py
index 5a9c7c5..c4efe7a 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,2 +1,2 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Package tests for xqbot scripts."""
diff --git a/tests/afd_notice_tests.py b/tests/afd_notice_tests.py
index d3cbea5..49f4d02 100644
--- a/tests/afd_notice_tests.py
+++ b/tests/afd_notice_tests.py
@@ -1,18 +1,16 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Test imagereview modules."""
 #
-# (C) xqt, 2016
+# (C) xqt, 2016-2017
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import absolute_import, print_function, unicode_literals
 
-__version__ = '$Id $'
-
 import unittest
 
 from tests import utils  # noqa
-import afd_notice
+import afd_notice  # noqa
 
 import pywikibot
 from pywikibot import config
diff --git a/tests/checkvotes_tests.py b/tests/checkvotes_tests.py
index 027e404..8e038c3 100644
--- a/tests/checkvotes_tests.py
+++ b/tests/checkvotes_tests.py
@@ -1,19 +1,17 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Test vandalism modules."""
 #
-# (C) xqt, 2016
+# (C) xqt, 2016-2017
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import absolute_import, print_function, unicode_literals
 
-__version__ = '$Id$'
-
 import unittest
 
-from tests import utils  # noqa
 from pywikibot.comms.http import fetch
 
+from tests import utils
 from checkvotes import SB_TOOL, SB_TOOL_NEW
 
 
diff --git a/tests/imagereview_tests.py b/tests/imagereview_tests.py
index 3b0ec18..66991df 100644
--- a/tests/imagereview_tests.py
+++ b/tests/imagereview_tests.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Test imagereview modules."""
 #
 # (C) xqt, 2016-2017
@@ -10,7 +10,7 @@
 import unittest
 
 from tests import utils  # noqa
-import imagereview
+import imagereview  # noqa
 
 import pywikibot
 
diff --git a/tests/utils.py b/tests/utils.py
index 568a040..de1c5cc 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,13 +1,11 @@
-# -*- coding: utf-8  -*-
+# -*- coding: utf-8 -*-
 """Support module for test suite."""
 #
-# (C) xqt, 2016
+# (C) xqt, 2016-2017
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import absolute_import, print_function, unicode_literals
-
-__version__ = '$Id: $'
 
 import sys
 
diff --git a/tests/vandalism_tests.py b/tests/vandalism_tests.py
index 98e68d1..2fb0070 100644
--- a/tests/vandalism_tests.py
+++ b/tests/vandalism_tests.py
@@ -7,14 +7,12 @@
 #
 from __future__ import absolute_import, print_function, unicode_literals
 
-__version__ = '$Id$'
-
 import re
 
 import unittest
 
 from tests import utils  # noqa
-from vandalism import getAccuser, isIn
+from vandalism import getAccuser, isIn  # noqa
 
 
 class 

[MediaWiki-commits] [Gerrit] pywikibot...xqbot[master]: [IMPR] Additional hints for uninformed users

2017-11-05 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389325 )

Change subject: [IMPR] Additional hints for uninformed users
..

[IMPR] Additional hints for uninformed users

Change-Id: Ifd9f26df03f8d22f490113e6d1933b03ecc6c6ea
---
M afd_notice.py
1 file changed, 35 insertions(+), 10 deletions(-)


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

diff --git a/afd_notice.py b/afd_notice.py
index c532519..a6336e8 100644
--- a/afd_notice.py
+++ b/afd_notice.py
@@ -192,12 +192,15 @@
 latest = next(page.revisions(total=1)).user
 
 # inform creator
-if creator and creator != latest and creator not in self.ignoreUser:
-user = pywikibot.User(self.site, creator)
-if user.isRegistered() and not (user.isBlocked() or
-'bot' in user.groups()):
-pywikibot.output('>>> Creator is ' + creator)
-self.inform(user, page=page.title(), action=u'angelegte')
+if creator and creator != latest:
+if creator in self.ignoreUser:
+pywikibot.output('>>> Creator {0} has opted out'
+ .format(creator))
+else:
+user = pywikibot.User(self.site, creator)
+if self.could_be_informed(user):
+pywikibot.output('>>> Creator is ' + creator)
+self.inform(user, page=page.title(), actionu'angelegte')
 
 # inform main authors for articles
 for author, percent in self.find_authors(page):
@@ -207,14 +210,36 @@
 continue
 if (author != latest and author != creator):
 user = pywikibot.User(self.site, author)
-if user.isRegistered() and not (user.isBlocked() or
-'bot' in user.groups()):
-pywikibot.output('>>> Main author %s with %d %% edits'
- % (author, percent))
+if self.could_be_informed(user):
+pywikibot.output('>>> Main author {0} with {1} % edits'
+ .format(author, percent))
 self.inform(user, page=page.title(),
 action='%süberarbeitete' % (
 'stark ' if percent >= 25 else ''))
 
+def could_be_informed(self, user):
+"""Check whether user could be informed.
+
+Also print additional informations.
+@param user: The user to be informed
+@type user: pywikibot.User
+@return: whether user could be informed or not
+@rtype: bool
+"""
+if not user.isRegistered():
+pywikibot.output('>>> Created by IP user, skipping')
+elif user.isBlocked():
+pywikibot.output('>>> Creator {0} is blocked, skipping'
+ .format(user.username))
+elif 'bot' in user.groups():
+pywikibot.output('>>> Creator {0} is a bot, skipping'
+ .format(user.username))
+else:
+return True
+return False
+
+
+
 def find_authors(self, page):
 """
 Retrieve main authors of given page.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd9f26df03f8d22f490113e6d1933b03ecc6c6ea
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] pywikibot/core[master]: [test] pagegenerators_tests.py: Update the expected search r...

2017-11-03 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/388515 )

Change subject: [test] pagegenerators_tests.py: Update the expected search 
result
..

[test] pagegenerators_tests.py: Update the expected search result

Bug: T179232
Change-Id: I248e270497ee449dc61336d414834fa4b291f4c6
---
M tests/pagegenerators_tests.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/15/388515/1

diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 92b530c..906598e 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1241,9 +1241,9 @@
 # American Broadcasting Company
 page1 = next(gen)
 self.assertEqual(page1.title(), 'Q169889')
-# Australian Broadcasting Corporation
+# ABC, Wikimedia disambiguation page
 page2 = next(gen)
-self.assertEqual(page2.title(), 'Q781365')
+self.assertEqual(page2.title(), 'Q286874')
 
 def test_get_category_site(self):
 """Test the getCategory method."""

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I248e270497ee449dc61336d414834fa4b291f4c6
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] pywikibot...xqbot[master]: [test] additional tests

2017-10-31 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387633 )

Change subject: [test] additional tests
..

[test] additional tests

Change-Id: I991a27248b212c254d0f6f2f3303b667e3a39e59
---
M tox.ini
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/tox.ini b/tox.ini
index ff9ff63..566c2f3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -21,13 +21,14 @@
 basepython = python2.7
 deps = flake8<3
pyflakes>=1.2.3
-   flake8-docstrings>=1.0.2
+   flake8-docstrings>=1.1.0
flake8-putty>=0.3.2
flake8-coding<1.3.0
flake8-comprehensions
flake8-copyright
flake8-future-import
flake8-string-format
+   flake8-isort
flake8-import-order
flake8-tuple>=0.2.8
pep8-naming

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I991a27248b212c254d0f6f2f3303b667e3a39e59
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] pywikibot/core[master]: [test] Don't use flake8-import-order 0.14 or 0.14.2

2017-10-31 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387603 )

Change subject: [test] Don't use flake8-import-order 0.14 or 0.14.2
..

[test] Don't use flake8-import-order 0.14 or 0.14.2

Alternate to I47d6a9367d132

Change-Id: Ifdf8c4aa6dcd6ddbbf2b9116266581c1cc85ed91
---
M tox.ini
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/tox.ini b/tox.ini
index e12ea9b..efd4a4c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -64,7 +64,7 @@
flake8-comprehensions
flake8-future-import
flake8-string-format
-   flake8-import-order
+   flake8-import-order!= 0.14,!= 0.14.2
flake8-tuple>=0.2.8
flake8-print>=2.0.1
flake8-mock>=0.3

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifdf8c4aa6dcd6ddbbf2b9116266581c1cc85ed91
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] pywikibot/core[master]: [L10N] Update languages_by_size

2017-10-31 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387592 )

Change subject: [L10N] Update languages_by_size
..

[L10N] Update languages_by_size

Change-Id: I8331ede20b2db82123bf45d6ba31cd52e1769111
---
M pywikibot/families/wikipedia_family.py
M pywikibot/families/wikisource_family.py
M pywikibot/families/wiktionary_family.py
3 files changed, 28 insertions(+), 28 deletions(-)


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

diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index 3d908f1..c5cba30 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -49,23 +49,23 @@
 'scn', 'bpy', 'als', 'bar', 'ku', 'kn', 'ia', 'qu', 'ckb', 'mn',
 'arz', 'bat-smg', 'wa', 'gd', 'nap', 'yi', 'bug', 'si', 'am',
 'cdo', 'map-bms', 'or', 'fo', 'mzn', 'hsb', 'xmf', 'li', 'mai',
-'sah', 'sa', 'vec', 'ilo', 'os', 'mrj', 'hif', 'mhr', 'bh',
-'roa-tara', 'eml', 'diq', 'pam', 'ps', 'sd', 'hak', 'nso', 'se',
-'ace', 'bcl', 'mi', 'nah', 'zh-classical', 'nds-nl', 'szl', 'gan',
-'vls', 'wuu', 'rue', 'bo', 'frr', 'glk', 'vep', 'km', 'sc',
-'fiu-vro', 'co', 'crh', 'lrc', 'tk', 'kv', 'csb', 'so', 'gv', 'as',
-'lad', 'zea', 'ay', 'myv', 'udm', 'lez', 'stq', 'kw', 'nv', 'ie',
-'nrm', 'pcd', 'mwl', 'rm', 'koi', 'gom', 'ug', 'ab', 'lij', 'gn',
-'mt', 'fur', 'dsb', 'cbk-zam', 'dv', 'ang', 'ln', 'ext', 'kab',
-'sn', 'ksh', 'lo', 'gag', 'frp', 'pag', 'pi', 'olo', 'dty', 'av',
-'xal', 'pfl', 'bxr', 'haw', 'krc', 'kaa', 'pap', 'rw', 'pdc',
-'bjn', 'to', 'nov', 'kl', 'arc', 'jam', 'kbd', 'ha', 'tpi', 'tyv',
-'tet', 'ig', 'ki', 'na', 'lbe', 'roa-rup', 'jbo', 'ty', 'mdf',
-'kg', 'za', 'wo', 'lg', 'bi', 'srn', 'zu', 'chr', 'tcy', 'ltg',
-'sm', 'om', 'xh', 'tn', 'pih', 'chy', 'cu', 'rmy', 'tw', 'kbp',
-'tum', 'ts', 'st', 'got', 'rn', 'pnt', 'ss', 'bm', 'fj', 'ch',
-'ady', 'iu', 'ny', 'ee', 'ks', 'ak', 'ik', 've', 'sg', 'dz', 'ff',
-'ti', 'atj', 'cr', 'din',
+'sah', 'sa', 'vec', 'ilo', 'os', 'mrj', 'hif', 'mhr', 'bh', 'eml',
+'roa-tara', 'ps', 'diq', 'pam', 'sd', 'hak', 'nso', 'se', 'ace',
+'bcl', 'mi', 'nah', 'zh-classical', 'nds-nl', 'szl', 'gan', 'wuu',
+'vls', 'rue', 'frr', 'bo', 'glk', 'km', 'vep', 'sc', 'fiu-vro',
+'co', 'crh', 'lrc', 'tk', 'kv', 'csb', 'so', 'gv', 'as', 'lad',
+'zea', 'ay', 'myv', 'udm', 'lez', 'stq', 'kw', 'nv', 'ie', 'nrm',
+'pcd', 'mwl', 'rm', 'koi', 'gom', 'ug', 'ab', 'lij', 'gn', 'mt',
+'fur', 'dsb', 'cbk-zam', 'dv', 'ang', 'ln', 'ext', 'sn', 'kab',
+'ksh', 'lo', 'gag', 'frp', 'pag', 'pi', 'olo', 'dty', 'av', 'xal',
+'pfl', 'bxr', 'haw', 'krc', 'kaa', 'pap', 'rw', 'pdc', 'bjn', 'to',
+'nov', 'kl', 'arc', 'jam', 'kbd', 'ha', 'tyv', 'tpi', 'tet', 'ig',
+'ki', 'na', 'lbe', 'roa-rup', 'jbo', 'ty', 'mdf', 'kg', 'za', 'wo',
+'lg', 'bi', 'srn', 'zu', 'chr', 'tcy', 'ltg', 'sm', 'om', 'xh',
+'tn', 'pih', 'cu', 'chy', 'rmy', 'tw', 'kbp', 'tum', 'ts', 'st',
+'got', 'rn', 'pnt', 'ss', 'fj', 'bm', 'ch', 'ady', 'iu', 'ny',
+'ee', 'ks', 'ak', 'ik', 've', 'sg', 'dz', 'ff', 'atj', 'ti', 'cr',
+'din',
 ]
 
 # Sites we want to edit but not count as real languages
diff --git a/pywikibot/families/wikisource_family.py 
b/pywikibot/families/wikisource_family.py
index 2294a8d..e975af2 100644
--- a/pywikibot/families/wikisource_family.py
+++ b/pywikibot/families/wikisource_family.py
@@ -33,7 +33,7 @@
 self.languages_by_size = [
 'en', 'pl', 'ru', 'de', 'fr', 'zh', 'he', 'it', 'es', 'ar', 'cs',
 'pt', 'fa', 'www', 'hu', 'ml', 'ko', 'sv', 'sr', 'gu', 'bn', 'sl',
-'te', 'sa', 'el', 'ro', 'fi', 'uk', 'vi', 'ja', 'az', 'th', 'hy',
+'te', 'sa', 'el', 'ro', 'fi', 'uk', 'vi', 'ja', 'th', 'az', 'hy',
 'ca', 'ta', 'br', 'hr', 'nl', 'is', 'la', 'no', 'vec', 'eo', 'tr',
 'be', 'et', 'mk', 'yi', 'kn', 'id', 'da', 'bg', 'li', 'mr', 'as',
 'or', 'bs', 'sah', 'lt', 'gl', 'sk', 'cy', 'pa', 'zh-min-nan',
diff --git a/pywikibot/families/wiktionary_family.py 
b/pywikibot/families/wiktionary_family.py
index 12d619b..59319c9 100644
--- a/pywikibot/families/wiktionary_family.py
+++ b/pywikibot/families/wiktionary_family.py
@@ -38,16 +38,16 @@
 'ku', 'pl', 'el', 'it', 'ta', 'fi', 'hu', 'tr', 'ko', 'ca', 'io',
 'kn', 'pt', 'vi', 'hy', 'sr', 'chr', 'ja', 'hi', 'ro', 'no', 'th',
 'ml', 'id', 'et', 'uz', 'li', 'my', 'or', 'te', 'fa', 'eo', 'cs',
-'ar', 'jv', 'eu', 'az', 

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] turn off some stylistic checks of pydocstyle

2017-10-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386868 )

Change subject: [doc] turn off some stylistic checks of pydocstyle
..

[doc] turn off some stylistic checks of pydocstyle

Bug: T166950
Change-Id: I699a730023604da73bd279aef94bc752af80a53d
---
M tox.ini
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/tox.ini b/tox.ini
index dae32ea..cfdd07f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -136,6 +136,9 @@
 [flake8]
 # The following are intentionally ignored, possibly pending consensus
 # D105: Missing docstring in magic method
+# D106: Missing docstring in public nested class
+# D107: Missing docstring in __init__
+# D202: No blank lines allowed after function docstring
 # D211: No blank lines allowed before class docstring
 # FI10,FI12,FI13,FI15: __future__ import "division", "with_statement", 
"print_function" and "generator_stop" missing
 # FI5: __future__ import "x" present
@@ -159,7 +162,7 @@
 # D413: Missing blank line after last section
 # D412: No blank lines allowed between a section header and its content
 
-ignore = 
C401,C402,C405,E402,D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,N802,N803,N806,D401,D413,D103,D412
+ignore = 
C401,C402,C405,E402,D105,D106,D107,D202,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,N802,N803,N806,D401,D413,D103,D412
 exclude = 
.tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
 min-version = 2.6
 max_line_length = 100

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I699a730023604da73bd279aef94bc752af80a53d
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] pywikibot/core[master]: [test] remove flake8-import-order stylistic check

2017-10-27 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386852 )

Change subject: [test] remove flake8-import-order stylistic check
..

[test] remove flake8-import-order stylistic check

- I100 and I101 are already disabled
- I202 is a newly introduced check (with flake8-import-order 0.14).
  That means that addidional blank lines inside import groups should be
  prevented but PEP8 only says:
  "You should put a blank line between each group of imports". Does it
  care then? On the other hand this check also indicates such imports like
from foo import (
bar,
baz,
)
  and I guess this should never be marked.
- finally we have I201 check to ensure that we have a blank line between
  the three related import groups but I guess we can surely ignore it or
  comment it as a recommendation during review

Bug: T166950
Change-Id: I47d6a9367d13224779909dd897d5af3231d04d01
---
M tox.ini
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/tox.ini b/tox.ini
index e12ea9b..dae32ea 100644
--- a/tox.ini
+++ b/tox.ini
@@ -64,7 +64,6 @@
flake8-comprehensions
flake8-future-import
flake8-string-format
-   flake8-import-order
flake8-tuple>=0.2.8
flake8-print>=2.0.1
flake8-mock>=0.3
@@ -144,7 +143,7 @@
 # H236: Mandatory use of six for Python 2 & 3 metaclass support
 # H404: docstring multiline start
 # H405: docstring summary line
-# H301,I100,I101: import order rules; Pywikibot uses rules H306 and I201
+# H301: import order rules; Pywikibot uses rule H306
 
 # The following are to be fixed
 # C401, C402, C405: does not work with py 2.6
@@ -160,7 +159,7 @@
 # D413: Missing blank line after last section
 # D412: No blank lines allowed between a section header and its content
 
-ignore = 
C401,C402,C405,E402,D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,I100,I101,N802,N803,N806,D401,D413,D103,D412
+ignore = 
C401,C402,C405,E402,D105,D211,FI10,FI12,FI13,FI15,FI16,FI17,FI5,H101,H201,H236,H301,H404,H405,N802,N803,N806,D401,D413,D103,D412
 exclude = 
.tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
 min-version = 2.6
 max_line_length = 100

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I47d6a9367d13224779909dd897d5af3231d04d01
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] pywikibot/core[master]: [bugfix] Remove overlap warning

2017-10-23 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385973 )

Change subject: [bugfix] Remove overlap warning
..

[bugfix] Remove overlap warning

The overlap warning was introduced with T92626 but is still unclear what to
do with it. The naming conflict seems already solved.

See also:
https://gerrit.wikimedia.org/r/#/c/196642/5/pywikibot/data/api.py@269

Bug: T92626
Bug: T170168
Bug: T178794
Change-Id: Ib81558295da67145f5b76d4100b60484f9fa2281
---
M pywikibot/data/api.py
1 file changed, 0 insertions(+), 9 deletions(-)


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

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index f2c06dd..540648d 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -299,15 +299,6 @@
 self._fetch(set(['query']))
 assert 'query' in self._modules
 
-_reused_module_names = self._action_modules & self._modules['query']
-
-# The only name clash in core between actions and query submodules is
-# action=tokens and actions=query=tokens, and this will warn if
-# any new ones appear.
-if _reused_module_names > set(['tokens']):
-warn('Unexpected overlap between action and query submodules: %s'
- % (_reused_module_names - set(['tokens'])), UserWarning)
-
 def _emulate_pageset(self):
 """Emulate the pageset module, which existed in MW 1.15-1.24."""
 # pageset isnt a module in the new system, so it is emulated, with

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib81558295da67145f5b76d4100b60484f9fa2281
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] pywikibot/core[master]: [doc] Fix options documentation

2017-10-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385800 )

Change subject: [doc] Fix options documentation
..

[doc] Fix options documentation

Change-Id: I92164d19116b10e65596c3feb7d10e9f3b3f3e93
---
M scripts/maintenance/compat2core.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/00/385800/1

diff --git a/scripts/maintenance/compat2core.py 
b/scripts/maintenance/compat2core.py
index 854d224..4e62b64 100755
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -12,8 +12,8 @@
 The scripts asks for the .py file and converts it to
 -core.py in the same directory. The following option is supported:
 
-- warnonly: Do not convert the source but show warning messages. This is good
-to check already merged scripts.
+-warnonly  Do not convert the source but show warning messages. This is good
+   to check already merged scripts.
 
 usage
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92164d19116b10e65596c3feb7d10e9f3b3f3e93
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] pywikibot/core[master]: [doc] Fix doc string in a way not to break the options tables

2017-10-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385799 )

Change subject: [doc] Fix doc string in a way not to break the options tables
..

[doc] Fix doc string in a way not to break the options tables

See:

https://doc.wikimedia.org/pywikibot/api_ref/pywikibot.html#generator-options

Change-Id: Iab02d9f55ba6e6a734bad65d9fccbdda9769409e
---
M pywikibot/pagegenerators.py
1 file changed, 224 insertions(+), 215 deletions(-)


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

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index b0c6dab..9111a1d 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -69,291 +69,300 @@
 GENERATOR OPTIONS
 =
 
--cat  Work on all pages which are in a specific category.
-  Argument can also be given as "-cat:categoryname" or
-  as "-cat:categoryname|fromtitle" (using # instead of |
-  is also allowed in this one and the following)
+-catWork on all pages which are in a specific category.
+Argument can also be given as "-cat:categoryname" or
+as "-cat:categoryname|fromtitle" (using # instead of |
+is also allowed in this one and the following)
 
--catr Like -cat, but also recursively includes pages in
-  subcategories, sub-subcategories etc. of the
-  given category.
-  Argument can also be given as "-catr:categoryname" or
-  as "-catr:categoryname|fromtitle".
+-catr   Like -cat, but also recursively includes pages in
+subcategories, sub-subcategories etc. of the
+given category.
+Argument can also be given as "-catr:categoryname" or
+as "-catr:categoryname|fromtitle".
 
--subcats  Work on all subcategories of a specific category.
-  Argument can also be given as "-subcats:categoryname" or
-  as "-subcats:categoryname|fromtitle".
+-subcatsWork on all subcategories of a specific category.
+Argument can also be given as "-subcats:categoryname" or
+as "-subcats:categoryname|fromtitle".
 
--subcatsr Like -subcats, but also includes sub-subcategories etc. of
-  the given category.
-  Argument can also be given as "-subcatsr:categoryname" or
-  as "-subcatsr:categoryname|fromtitle".
+-subcatsr   Like -subcats, but also includes sub-subcategories etc. of
+the given category.
+Argument can also be given as "-subcatsr:categoryname" or
+as "-subcatsr:categoryname|fromtitle".
 
--uncatWork on all pages which are not categorised.
+-uncat  Work on all pages which are not categorised.
 
--uncatcat Work on all categories which are not categorised.
+-uncatcat   Work on all categories which are not categorised.
 
--uncatfiles   Work on all files which are not categorised.
+-uncatfiles Work on all files which are not categorised.
 
--file Read a list of pages to treat from the named text file.
-  Page titles in the file may be either enclosed with
-  [[brackets]], or be separated by new lines.
-  Argument can also be given as "-file:filename".
+-file   Read a list of pages to treat from the named text file.
+Page titles in the file may be either enclosed with
+[[brackets]], or be separated by new lines.
+Argument can also be given as "-file:filename".
 
--filelinksWork on all pages that use a certain image/media file.
-  Argument can also be given as "-filelinks:filename".
+-filelinks  Work on all pages that use a certain image/media file.
+Argument can also be given as "-filelinks:filename".
 
--search   Work on all pages that are found in a MediaWiki search
-  across all namespaces.
+-search Work on all pages that are found in a MediaWiki search
+across all namespaces.
 
--logeventsWork on articles that were on a specified Special:Log.
-  The value may be a comma separated list of these values:
+-logevents  Work on articles that were on a specified Special:Log.
+The value may be a comma separated list of these values:
 
-  logevent,username,start,end
+logevent,username,start,end
 
-  or for backward compatibility:
+or for backward compatibility:
 
-  

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [bugfix] Use grnfilterredir for random pages

2017-10-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385773 )

Change subject: [bugfix] Use grnfilterredir for random pages
..

[bugfix] Use grnfilterredir for random pages

Bug: T178732
Change-Id: I0763cf99fd113cd25a0048d8a760b16fc4828346
---
M pywikibot/site.py
M tests/site_tests.py
2 files changed, 47 insertions(+), 8 deletions(-)


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

diff --git a/pywikibot/site.py b/pywikibot/site.py
index 2e0895e..1a08666 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4925,7 +4925,7 @@
 return usgen
 
 @deprecated('Site.randompages(total=1)')
-def randompage(self, redirect=False):
+def randompage(self, redirect=None):
 """
 DEPRECATED.
 
@@ -4934,18 +4934,18 @@
 """
 return self.randompages(total=1, redirects=redirect)
 
-@deprecated('Site.randompages(total=1, redirects=True)')
+@deprecated("Site.randompages(total=1, redirects='redirects')")
 def randomredirectpage(self):
 """
 DEPRECATED: Use Site.randompages() instead.
 
 @return: Return a random redirect page
 """
-return self.randompages(total=1, redirects=True)
+return self.randompages(total=1, redirects='redirects')
 
 @deprecated_args(step=None)
 def randompages(self, total=None, namespaces=None,
-redirects=False, content=False):
+redirects=None, content=False):
 """Iterate a number of random pages.
 
 Pages are listed in a fixed sequence, only the starting point is
@@ -4956,17 +4956,38 @@
 @type namespaces: iterable of basestring or Namespace key,
 or a single instance of those types. May be a '|' separated
 list of namespace identifiers.
-@param redirects: if True, include only redirect pages in results
-(default: include only non-redirects)
+@param redirects: if 'redirects, include only redirect pages in
+results, 'nonredirects' does not include redirects and 'all'
+include both types. (default: 'nonredirects')
+@type redirects: str (one of 'nonredirects', 'redirects', 'all')
 @param content: if True, load the current content of each iterated page
 (default False)
 @raises KeyError: a namespace identifier was not resolved
 @raises TypeError: a namespace identifier has an inappropriate
 type such as NoneType or bool
+@raises AssertError: unsupported redirects parameter
 """
+filteritems = ('nonredirects', 'redirects', 'all')
+if isinstance(redirects, bool):
+issue_deprecation_warning(
+'Parameter redirects={0}'.format(redirects),
+"redirects='{0}'".format(filteritems[redirects]) +
+('' if redirects else ' or redirects=None'), 2)
+redirects = filteritems[redirects]
+params = {}
+if redirects is not None:
+assert(redirects in filteritems)
+if MediaWikiVersion(self.version()) < MediaWikiVersion('1.26'):
+if redirects == 'all':
+warn("parameter redirects='all' is not supported by mw "
+ 'version {0}. Ignoring it.'.format(self.version()),
+ UserWarning)
+params['grnredirect'] = redirects == 'redirects'
+else:
+params['grnfilterredir'] = redirects
 rngen = self._generator(api.PageGenerator, type_arg="random",
 namespaces=namespaces, total=total,
-g_content=content, grnredirect=redirects)
+g_content=content, **params)
 return rngen
 
 # Catalog of editpage error codes, for use in generating messages.
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 1b45692..3f1788d 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -28,6 +28,7 @@
 PY2,
 StringTypes as basestring,
 UnicodeType as unicode,
+suppress_warnings,
 )
 
 from tests import unittest_print
@@ -2002,10 +2003,27 @@
 def test_redirects(self):
 """Test site.randompages() with redirects."""
 mysite = self.get_site()
-for rndpage in mysite.randompages(total=5, redirects=True):
+for rndpage in mysite.randompages(total=5, redirects='redirects'):
 self.assertIsInstance(rndpage, pywikibot.Page)
 self.assertTrue(rndpage.isRedirectPage())
 
+def test_all(self):
+"""Test site.randompages() with 'all'."""
+mysite = self.get_site()
+for rndpage in mysite.randompages(total=5, redirects='all'):
+self.assertIsInstance(rndpage, pywikibot.Page)
+
+def test_deprecated_params(self):
+"""Test 

[MediaWiki-commits] [Gerrit] pywikibot/core[master]: [doc] give a better hint for deprecated methods

2017-10-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385767 )

Change subject: [doc] give a better hint for deprecated methods
..

[doc] give a better hint for deprecated methods

Change-Id: Iaa3a3ddba02abcb13f93d2375363b579fcac9eda
---
M pywikibot/site.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/67/385767/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index ac20cd0..2e0895e 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -4924,7 +4924,7 @@
 'users', ususers=usernames, site=self, usprop=usprop)
 return usgen
 
-@deprecated("Site.randompages()")
+@deprecated('Site.randompages(total=1)')
 def randompage(self, redirect=False):
 """
 DEPRECATED.
@@ -4934,7 +4934,7 @@
 """
 return self.randompages(total=1, redirects=redirect)
 
-@deprecated("Site.randompages()")
+@deprecated('Site.randompages(total=1, redirects=True)')
 def randomredirectpage(self):
 """
 DEPRECATED: Use Site.randompages() instead.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa3a3ddba02abcb13f93d2375363b579fcac9eda
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] pywikibot/core[master]: [test] suppress deprecation warning in archivebot_tests.py

2017-10-21 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385766 )

Change subject: [test] suppress deprecation warning in archivebot_tests.py
..

[test] suppress deprecation warning in archivebot_tests.py

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


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/66/385766/1

diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py
index 3b4971c..cfa0c07 100644
--- a/tests/archivebot_tests.py
+++ b/tests/archivebot_tests.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """Tests for archivebot scripts."""
 #
-# (C) Pywikibot team, 2016
+# (C) Pywikibot team, 2016-2017
 #
 # Distributed under the terms of the MIT license.
 #
@@ -13,8 +13,7 @@
 import pywikibot.page
 
 from pywikibot.textlib import TimeStripper
-from pywikibot.tools import StringTypes as basestring
-
+from pywikibot.tools import suppress_warnings, StringTypes as basestring
 from scripts import archivebot
 
 from tests.aspects import unittest, TestCase
@@ -98,7 +97,8 @@
 def test_checkstr(self):
 """Test for extracting key and duration from shorthand notation of 
durations."""
 self.assertEqual(archivebot.checkstr('400s'), ('s', '400'))
-self.assertEqual(archivebot.checkstr('3000'), ('s', '3000'))
+with suppress_warnings():
+self.assertEqual(archivebot.checkstr('3000'), ('s', '3000'))
 self.assertEqual(archivebot.checkstr('7d'), ('d', '7'))
 self.assertEqual(archivebot.checkstr('3y'), ('y', '3'))
 # Should pass, because the key is verified in str2time

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc8dc3b65b6799dacd781cee664118ea6db4a523
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] pywikibot/core[master]: Partly revert "Merge "[IMPR] Improvements for reflinks.py""

2017-10-20 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385765 )

Change subject: Partly revert "Merge "[IMPR] Improvements for reflinks.py""
..

Partly revert "Merge "[IMPR] Improvements for reflinks.py""

This reverts commit d3321813be3a5c4c2caa41da41d0ffae52dbdf31, reversing
changes made to cdec68327ef440339205caa187496ff115dd25cd.

Change-Id: I0e2e0ce398e6e08ec6cddc4d8bad849e39788896
---
M scripts/reflinks.py
1 file changed, 20 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/65/385765/1

diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index 6235bac..6553876 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -761,20 +761,26 @@
 genFactory = pagegenerators.GeneratorFactory()
 
 for arg in local_args:
-arg, sep, value = arg.partition(':')
-option = arg.partition('-')[2]
-if option == 'summary':
-options[option] = value
-elif option in ('always', 'ignorepdf'):
-options[option] = True
-elif option == 'limit':
-options[option] = int(value)
-elif option == 'xmlstart':
-xmlStart = value or pywikibot.input(
-'Please enter the dumped article to start with:')
-elif option == 'xml':
-xmlFilename = value or pywikibot.input(
-"Please enter the XML dump's filename:")
+if arg.startswith('-summary:'):
+options['summary'] = arg[9:]
+elif arg == '-always':
+options['always'] = True
+elif arg == '-ignorepdf':
+options['ignorepdf'] = True
+elif arg.startswith('-limit:'):
+options['limit'] = int(arg[7:])
+elif arg.startswith('-xmlstart'):
+if len(arg) == 9:
+xmlStart = pywikibot.input(
+u'Please enter the dumped article to start with:')
+else:
+xmlStart = arg[10:]
+elif arg.startswith('-xml'):
+if len(arg) == 4:
+xmlFilename = pywikibot.input(
+u'Please enter the XML dump\'s filename:')
+else:
+xmlFilename = arg[5:]
 else:
 genFactory.handleArg(arg)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e2e0ce398e6e08ec6cddc4d8bad849e39788896
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] pywikibot/core[master]: [test] Replace expected_failure_if with skipIf decorator

2017-10-18 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385024 )

Change subject: [test] Replace expected_failure_if with skipIf decorator
..

[test] Replace expected_failure_if with skipIf decorator

unittest's expected failure decorators are handy when a bug was
identified in the code but wasn't fixed yet in the current release.
The different behavior of py2 and py3 related to string elements
which aren't string constants cannot be solved because it is an
upstream problem and part of the release difference issue.

Therefore we shouldn't use that expected failure reminder but just
skip the test for py3.

Bug: T178528
Change-Id: I40fce5d7a4605fcc1b2cdd7b811c31eef53d4a2c
---
M tests/tools_tests.py
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index be7acc0..c671186 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -573,10 +573,10 @@
 deduper = tools.filter_unique(self.strs, container=deduped, key=hash)
 self._test_dedup_str(deduped, deduper, hash)
 
-@expected_failure_if(not tools.PY2)
+@unittest.skipIf(not tools.PY2,
+ 'str in Py3 behave like objects and id as key fails')
 def test_str_id(self):
-"""Test str using id as key fails on Python 3."""
-# str in Python 3 behave like objects.
+"""Test str using id as key."""
 deduped = set()
 deduper = tools.filter_unique(self.strs, container=deduped, key=id)
 self._test_dedup_str(deduped, deduper, id)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40fce5d7a4605fcc1b2cdd7b811c31eef53d4a2c
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] pywikibot/core[master]: [IMPR] Introduce suppress_warnings context manager

2017-10-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384328 )

Change subject: [IMPR] Introduce suppress_warnings context manager
..

[IMPR] Introduce suppress_warnings context manager

Introduce suppress_warnings contect manager which is derived from
warnings.catch_warnings that temporarily suppresses warnings.
It could be used by unittests to hide some deprecation warnings when
deprecated methods are tested explicitly.

Change-Id: Id22d7f296c0159c081a36f851b6372f711d92e11
---
M pywikibot/tools/__init__.py
M tests/user_tests.py
2 files changed, 20 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/28/384328/1

diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 7e1c9c1..129a02e 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -23,7 +23,7 @@
 import types
 
 from distutils.version import Version
-from warnings import warn
+from warnings import catch_warnings, simplefilter, warn
 
 PYTHON_VERSION = sys.version_info[:3]
 PY2 = (PYTHON_VERSION[0] == 2)
@@ -207,6 +207,16 @@
 return self.method(owner)
 
 
+class suppress_warnings(catch_warnings):
+
+"""A context manager that temporarily suppresses warnings."""
+
+def __enter__(self):
+"""Catch the old filter settings and ignore all warnings."""
+super(suppress_warnings, self).__enter__()
+simplefilter('ignore')
+
+
 class UnicodeMixin(object):
 
 """Mixin class to add __str__ method in Python 2 or 3."""
diff --git a/tests/user_tests.py b/tests/user_tests.py
index 96b99d9..149cb41 100644
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -9,6 +9,7 @@
 
 import pywikibot
 
+from pywikibot.tools import suppress_warnings
 from pywikibot import User
 
 from tests.aspects import TestCase, unittest
@@ -24,7 +25,8 @@
 def test_registered_user(self):
 """Test registered user."""
 user = User(self.site, 'Xqt')
-self.assertEqual(user.name(), user.username)
+with suppress_warnings():
+self.assertEqual(user.name(), user.username)
 self.assertEqual(user.title(withNamespace=False), user.username)
 self.assertTrue(user.isRegistered())
 self.assertFalse(user.isAnonymous())
@@ -58,7 +60,8 @@
 def test_anonymous_user(self):
 """Test registered user."""
 user = User(self.site, '123.45.67.89')
-self.assertEqual(user.name(), user.username)
+with suppress_warnings():
+self.assertEqual(user.name(), user.username)
 self.assertEqual(user.title(withNamespace=False), user.username)
 self.assertFalse(user.isRegistered())
 self.assertTrue(user.isAnonymous())
@@ -70,7 +73,8 @@
 def test_unregistered_user(self):
 """Test unregistered user."""
 user = User(self.site, 'This user name is not registered yet')
-self.assertEqual(user.name(), user.username)
+with suppress_warnings():
+self.assertEqual(user.name(), user.username)
 self.assertEqual(user.title(withNamespace=False), user.username)
 self.assertFalse(user.isRegistered())
 self.assertFalse(user.isAnonymous())
@@ -82,7 +86,8 @@
 def test_invalid_user(self):
 """Test invalid user."""
 user = User(self.site, 'Invalid char\x9f in Name')
-self.assertEqual(user.name(), user.username)
+with suppress_warnings():
+self.assertEqual(user.name(), user.username)
 self.assertEqual(user.title(withNamespace=False), user.username)
 self.assertFalse(user.isRegistered())
 self.assertFalse(user.isAnonymous())

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id22d7f296c0159c081a36f851b6372f711d92e11
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] pywikibot/core[master]: [bugfix] Prevent nested error handing

2017-10-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384324 )

Change subject: [bugfix] Prevent nested error handing
..

[bugfix] Prevent nested error handing

Bug: T176297
Change-Id: I5d5b2be952946bc776249d87e892fd3c3fbb79d9
---
M tests/site_tests.py
1 file changed, 6 insertions(+), 5 deletions(-)


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

diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3adc9ee..515106c 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1487,11 +1487,12 @@
 get_redirects=True, where='title'):
 self.assertIsInstance(hit, pywikibot.Page)
 self.assertEqual(hit.namespace(), 0)
-try:
-self.assertIn('wiki', hit.title().lower())
-except AssertionError:
-self.assertTrue(any('wiki' in r.title().lower() for r in
-hit.getReferences(redirectsOnly=True)))
+if 'wiki' not in hit.title().lower():
+self.assertTrue(
+any('wiki' in r.title().lower()
+for r in hit.getReferences(redirectsOnly=True)),
+"'wiki' neither found in '{0}' nor in its references"
+.format(hit.title().lower()))
 except pywikibot.data.api.APIError as e:
 if e.code in ('search-title-disabled', 'gsrsearch-title-disabled'):
 raise unittest.SkipTest(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d5b2be952946bc776249d87e892fd3c3fbb79d9
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] pywikibot/core[master]: [bugfix] Require cryptography<2.0 for Python 3.3

2017-10-15 Thread Xqt (Code Review)
Xqt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384321 )

Change subject: [bugfix]  Require cryptography<2.0 for Python 3.3
..

[bugfix]  Require cryptography<2.0 for Python 3.3

Bug: T178241
Bug: T175883
Change-Id: I1a2e63161ffa2390b6d11d22132cb7824893
---
M requirements.txt
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/requirements.txt b/requirements.txt
index 98c9c0d..6b3e39b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -23,7 +23,8 @@
 
 # requests security extra
 pyOpenSSL>=0.14,!=17.2.0 ; python_full_version < '2.7.9'
-cryptography>=1.3.4 ; python_full_version < '2.7.9'
+cryptography>=1.3.4 ; python_full_version < '2.7.9' or python_version > '3.3'
+cryptography>=1.3.4,<2.0 ; python_version == '3.3'
 idna>=2.0.0 ; python_full_version < '2.7.9'
 # https://github.com/eliben/pycparser/issues/147
 pycparser != 2.14

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a2e63161ffa2390b6d11d22132cb7824893
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


  1   2   3   4   5   6   7   8   9   10   >