jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/443027 )
Change subject: [bugfix] Enable namespace filtering for unconnected_pages GeneratorFactory
......................................................................
[bugfix] Enable namespace filtering for unconnected_pages GeneratorFactory
pagegenerators namespaces filter uses the api to get pages filtered by
namespaces if the generator is a QueryGenerator. Otherwise it uses its
internal NamespaceFilterPageGenerator. Unfortunately there are some api
generators which does not have a namespace parameter.
Bug: T196619
Change-Id: If64aca45bdee4aadb3ccf56667c8eee4d5fb4e77
---
M pywikibot/pagegenerators.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 180b6a0..ec06f31 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -984,7 +984,8 @@
def _handle_unconnectedpages(self, value):
"""Handle `-unconnectedpages` argument."""
- return self.site.unconnected_pages(total=_int_none(value))
+ # T196619 don't use QueryGenerator due to namespace filtering
+ return (p for p in self.site.unconnected_pages(total=_int_none(value)))
def _handle_imagesused(self, value):
"""Handle `-imagesused` argument."""
--
To view, visit https://gerrit.wikimedia.org/r/443027
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If64aca45bdee4aadb3ccf56667c8eee4d5fb4e77
Gerrit-Change-Number: 443027
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: JAn Dudík <jan.dudik(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Multichill <maarten(a)mdammers.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/441011 )
Change subject: api.py: Cache the result of _get_cache_dir
......................................................................
api.py: Cache the result of _get_cache_dir
_get_cache_dir gets called on every CachedRequest.submit() and it involved
a disk access in _make_dir function. Disk access is slow and does not seem
necessary for every submit.
- Cache the result of _get_cache_dir by letting it overwrite itself on
first call.
The downside is that users no longer will be able to change the cache
directory dynamically by changing pywikibot.config2.base_dir value, but
I don't see why anyone would want to do that. Therefore, hopefully, this
minor change will not break any code.
Change-Id: Ib5275be8bd8cca7b8f211b137646da613f371328
---
M pywikibot/data/api.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index de17ab5..8d7d3c1 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2262,6 +2262,7 @@
path = os.path.join(pywikibot.config2.base_dir,
'apicache-py{0:d}'.format(PYTHON_VERSION[0]))
cls._make_dir(path)
+ cls._get_cache_dir = classmethod(lambda c: path) # cache the result
return path
@staticmethod
--
To view, visit https://gerrit.wikimedia.org/r/441011
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5275be8bd8cca7b8f211b137646da613f371328
Gerrit-Change-Number: 441011
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/440869 )
Change subject: [doc] Narrow or fix multiple links
......................................................................
[doc] Narrow or fix multiple links
- to phabricator, mediawiki.org, pypi, github, travis, etc.
+ also use __url__ where applicable
+ remove Special:MyLanguage as they can be outdated; let the user choose
his/her preferred option
Change-Id: If199ded6c799347a7feb1e98c4811d1692457fb9
---
M README.rst
M docs/getting_help.rst
M generate_user_files.py
M pywikibot/__init__.py
M pywikibot/comms/http.py
M pywikibot/config2.py
M pywikibot/epydoc.cfg
M pywikibot/i18n.py
M pywikibot/login.py
M pywikibot/pagegenerators.py
M pywikibot/tools/ip.py
M scripts/interwiki.py
M scripts/maintenance/diff_checker.py
M scripts/misspelling.py
M scripts/script_wui.py
M scripts/states_redirect.py
M setup.py
M tests/README.rst
M tests/api_tests.py
19 files changed, 52 insertions(+), 54 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README.rst b/README.rst
index 8567536..5fe87db 100644
--- a/README.rst
+++ b/README.rst
@@ -18,7 +18,7 @@
=========
The Pywikibot framework is a Python library that interfaces with the
-`MediaWiki API <https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page>`_
+`MediaWiki API <https://www.mediawiki.org/wiki/API:Main_page>`_
version 1.14 or higher.
Also included are various general function scripts that can be adapted for
@@ -44,7 +44,7 @@
pip install pywikibot
Our `installation
-guide <https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Pywikibot/Installa…>`_
+guide <https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation>`_
has more details for advanced usage.
Basic Usage
@@ -79,7 +79,7 @@
------------
Our code is maintained on Wikimedia's `Gerrit installation <https://gerrit.wikimedia.org/>`_,
-`learn <https://www.mediawiki.org/wiki/Special:MyLanguage/Developer_access>`_ how to get
+`learn <https://www.mediawiki.org/wiki/Developer_access>`_ how to get
started.
.. include:: CODE_OF_CONDUCT.rst
diff --git a/docs/getting_help.rst b/docs/getting_help.rst
index c39ca87..5a062b1 100644
--- a/docs/getting_help.rst
+++ b/docs/getting_help.rst
@@ -2,8 +2,8 @@
------------
.. note::
- Please see `Manual:Pywikibot/Communication <https://www.mediawiki.org/w/index.php?title=Manual%3APywikibot%2FCommunicat…>`_.
+ Please see `Manual:Pywikibot/Communication <https://www.mediawiki.org/wiki/Manual:Pywikibot/Communication>`_.
.. tip::
Please report bugs at `Phabricator <https://phabricator.wikimedia.org/>`_.
- You may use `this report form <https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projectPHIDs=…>`_.
+ You may use `this report form <https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?tags=pywikibo…>`_.
diff --git a/generate_user_files.py b/generate_user_files.py
index 79da3a7..0dbd20c 100755
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -21,7 +21,7 @@
_orig_no_user_config = os.environ.get('PYWIKIBOT2_NO_USER_CONFIG')
os.environ['PYWIKIBOT2_NO_USER_CONFIG'] = '2'
import pywikibot # noqa: E402
-from pywikibot import config # noqa: E402
+from pywikibot import config, __url__ # noqa: E402
# Reset this flag in case another script is run by pwb after this script
if not _orig_no_user_config:
@@ -263,11 +263,10 @@
# For each different username entered, ask if user wants to save a
# BotPassword (username, BotPassword name, BotPassword pass)
- msg = fill('See https://www.mediawiki.org/wiki/'
- 'Manual:Pywikibot/BotPasswords to know how to get codes.'
+ msg = fill('See {}/BotPasswords to know how to get codes.'
'Please note that plain text in {} and anyone with read '
'access to that directory will be able read the file.'
- .format(_fncpass))
+ .format(__url__, _fncpass))
botpasswords = []
userset = {user.name for user in userlist}
for username in userset:
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 763b378..b1a30bc 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -8,7 +8,7 @@
from __future__ import absolute_import, unicode_literals
__version__ = __release__ = '3.1.dev0'
-__url__ = 'https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Pywikibot'
+__url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
import atexit
import datetime
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 67ac5b6..0369214 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -29,10 +29,9 @@
import requests
-from pywikibot import __version__
+from pywikibot import __version__, __url__, config
from pywikibot.bot import calledModuleName
from pywikibot.comms import threadedhttp
-from pywikibot import config
from pywikibot.exceptions import (
FatalServerError, Server504Error, Server414Error
)
@@ -338,9 +337,9 @@
return config.authenticate[path]
warn('config.authenticate["{path}"] has invalid value.\n'
'It should contain 2 or 4 items, not {length}.\n'
- 'See https://www.mediawiki.org/wiki/Manual:Pywikibot/OAuth '
- 'for more info.'
- .format(path=path, length=len(config.authenticate[path])))
+ 'See {url}/OAuth for more info.'
+ .format(path=path, length=len(config.authenticate[path]),
+ url=__url__))
return None
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index fb85461..388ee8e 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -193,7 +193,7 @@
# one site
#
# Pywikibot also support OAuth 1.0a via mwoauth
-# https://pypi.python.org/pypi/mwoauth
+# https://pypi.org/project/mwoauth
#
# You can add OAuth tokens to your user-config.py of the following form:
#
@@ -565,7 +565,7 @@
# Should interwiki.py output a graph PNG file on conflicts?
# You need pydot for this:
-# https://pypi.python.org/pypi/pydot/1.0.2
+# https://pypi.org/project/pydot/1.0.2
# https://code.google.com/p/pydot/
interwiki_graph = False
diff --git a/pywikibot/epydoc.cfg b/pywikibot/epydoc.cfg
index 8dbe58f..c22e23c 100644
--- a/pywikibot/epydoc.cfg
+++ b/pywikibot/epydoc.cfg
@@ -26,7 +26,7 @@
# url
# The documented project's URL.
-url: https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Pywikibot
+url: https://www.mediawiki.org/wiki/Manual:Pywikibot
# frames
# Whether or not to include a frames-based table of contents.
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 49315d1..95afaf5 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -703,7 +703,7 @@
raise TranslationError(
'Unable to load messages package %s for bundle %s'
'\nIt can happen due to lack of i18n submodule or files. '
- 'Read %s/i18n'
+ 'See %s/i18n'
% (_messages_package_name, twtitle, __url__))
source_needed = False
@@ -733,11 +733,11 @@
break
else:
raise TranslationError(
- 'No %s translation has been defined for TranslateWiki key'
- ' %r\nIt can happen due to lack of i18n submodule or files. '
- 'Read https://mediawiki.org/wiki/PWB/i18n'
+ 'No %s translation has been defined for TranslateWiki key %r\n'
+ 'It can happen due to lack of i18n submodule or files. See '
+ '%s/i18n'
% ('English' if 'en' in langs else "'%s'" % lang,
- twtitle))
+ twtitle, __url__))
# send the language code back via the given mutable list parameter
if source_needed:
source.append(alt)
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 2780dbc..3558dcc 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -24,7 +24,7 @@
import pywikibot
-from pywikibot import config
+from pywikibot import config, __url__
from pywikibot.exceptions import NoUsername
from pywikibot.tools import deprecated_args, normalize_username, PY2
@@ -135,10 +135,10 @@
main_username = self.username
if '@' in self.username:
warn(
- 'When using BotPasswords it is recommended that you store your '
- 'login credentials in a password_file instead. '
- 'See https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords '
- 'for instructions and more information.')
+ 'When using BotPasswords it is recommended that you store '
+ 'your login credentials in a password_file instead. See '
+ '{}/BotPasswords for instructions and more information.'
+ .format(__url__))
main_username = self.username.partition('@')[0]
try:
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 85790cb..180b6a0 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2652,7 +2652,7 @@
Page generator using Yahoo! search results.
To use this generator, you need to install the package 'pYsearch'.
- https://pypi.python.org/pypi/pYsearch
+ https://pypi.org/project/pYsearch
To use this generator, install pYsearch
"""
@@ -2712,7 +2712,7 @@
To use this generator, you need to install the package 'google':
- L{https://pypi.python.org/pypi/google}
+ L{https://pypi.org/project/google}
This package has been available since 2010, hosted on github
since 2012, and provided by pypi since 2013.
diff --git a/pywikibot/tools/ip.py b/pywikibot/tools/ip.py
index c768f30..a4d131d 100644
--- a/pywikibot/tools/ip.py
+++ b/pywikibot/tools/ip.py
@@ -38,7 +38,7 @@
if ip_address and ip_address.__module__ == 'ipaddress':
if sys.version_info[0] < 3:
# This backport fails many tests
- # https://pypi.python.org/pypi/py2-ipaddress
+ # https://pypi.org/project/py2-ipaddress
# It accepts u'1111' as a valid IP address.
try:
ip_address(u'1111')
@@ -48,7 +48,7 @@
pass
# This backport only fails a few tests if given a unicode object
- # https://pypi.python.org/pypi/ipaddress
+ # https://pypi.org/project/ipaddress
# However while it rejects u'1111', it will consider '1111' valid
try:
ip_address(b'1111')
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 366b391..b36175f 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -320,7 +320,7 @@
interwiki_shownew: should interwiki.py display every new link it discovers?
interwiki_graph: output a graph PNG file on conflicts? You need pydot for
- this: https://pypi.python.org/pypi/pydot/1.0.2
+ this: https://pypi.org/project/pydot/1.0.2https://code.google.com/p/pydot/
interwiki_graph_format: the file format for interwiki graphs
diff --git a/scripts/maintenance/diff_checker.py b/scripts/maintenance/diff_checker.py
index 5f75727..7839153 100644
--- a/scripts/maintenance/diff_checker.py
+++ b/scripts/maintenance/diff_checker.py
@@ -30,6 +30,8 @@
from unidiff import PatchSet
+from pywikibot import __url__
+
if version_info.major == 3:
PY2 = False
from tokenize import tokenize, STRING
@@ -148,10 +150,8 @@
if not check(latest_patchset):
raise SystemExit(
'diff-checker failed.\n'
- 'Please review '
- '<https://www.mediawiki.org/wiki/'
- 'Manual:Pywikibot/Development/Guidelines#Miscellaneous> '
- 'and update your patch-set accordingly.'
+ 'Please review <{}/Development/Guidelines#Miscellaneous> '
+ 'and update your patch-set accordingly.'.format(__url__)
)
diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 4cff5ab..2ea30ba 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -46,7 +46,7 @@
Help Pywikibot team to provide support for your wiki by submitting
a bug to:
-https://phabricator.wikimedia.org/maniphest/task/create/?projects=pywikibot-core
+https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?tags=pywikibot-core
with category containing misspelling pages or a template for
these misspellings.\n"""
diff --git a/scripts/script_wui.py b/scripts/script_wui.py
index 9eb267d..020acd5 100755
--- a/scripts/script_wui.py
+++ b/scripts/script_wui.py
@@ -30,7 +30,7 @@
# @section FRAMEWORK
#
# Python wikipedia bot framework, DrTrigonBot.
-# @see https://www.mediawiki.org/wiki/Pywikibot
+# @see https://www.mediawiki.org/wiki/Manual:Pywikibot
# @see https://de.wikipedia.org/wiki/Benutzer:DrTrigonBot
#
# @section LICENSE
@@ -85,7 +85,7 @@
import crontab
import pywikibot
-# pywikibot.botirc depends on https://pypi.python.org/pypi/irc
+# pywikibot.botirc depends on https://pypi.org/project/irc
import pywikibot.botirc
from pywikibot.tools.formatter import color_format
diff --git a/scripts/states_redirect.py b/scripts/states_redirect.py
index 742b6f9..bdac42b 100755
--- a/scripts/states_redirect.py
+++ b/scripts/states_redirect.py
@@ -32,7 +32,7 @@
import pycountry
except ImportError:
pywikibot.error('This script requires the python-pycountry module')
- pywikibot.error('See: https://pypi.python.org/pypi/pycountry')
+ pywikibot.error('See: https://pypi.org/project/pycountry')
pywikibot.exception()
sys.exit(1)
diff --git a/setup.py b/setup.py
index 1616365..2bf1b9c 100644
--- a/setup.py
+++ b/setup.py
@@ -121,9 +121,9 @@
# tools.ip does not have a hard dependency on an IP address module,
# as it falls back to using regexes if one is not available.
# The functional backport of py3 ipaddress is acceptable:
- # https://pypi.python.org/pypi/ipaddress
+ # https://pypi.org/project/ipaddress
# However the Debian package python-ipaddr is also supported:
- # https://pypi.python.org/pypi/ipaddr
+ # https://pypi.org/project/ipaddr
# Other backports are likely broken.
# ipaddr 2.1.10+ is distributed with Debian and Fedora. See T105443.
dependencies.append('ipaddr>=2.1.10')
@@ -242,7 +242,7 @@
install_requires=dependencies,
dependency_links=dependency_links,
extras_require=extra_deps,
- url='https://www.mediawiki.org/wiki/Pywikibot',
+ url='https://www.mediawiki.org/wiki/Manual:Pywikibot',
download_url='https://tools.wmflabs.org/pywikibot/',
test_suite="tests.collector",
tests_require=test_deps,
diff --git a/tests/README.rst b/tests/README.rst
index 1c3601f..1edfab7 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -120,8 +120,8 @@
travis-ci.org according to the configuration in .travis.yml .
When changes are merged into the main repository, they are replicated to
-https://github.com/wikimedia/pywikibot-core , and travis tests are run and
-published at travis-ci.org/wikimedia/pywikibot-core/builds . These tests
+https://github.com/wikimedia/pywikibot , and travis tests are run and
+published at https://travis-ci.org/wikimedia/pywikibot/builds . These tests
use the Wikimedia global (SUL) account 'Pywikibot-test', which has a password
securely stored in .travis.yml . See section env:global:secure.
@@ -129,10 +129,10 @@
code changes that have not been merged into the main repository. To do this:
1. create a github and travis-ci account
-2. fork the main github repository https://github.com/wikimedia/pywikibot-core
+2. fork the main github repository https://github.com/wikimedia/pywikibot
3. enable builds from the travis profile page: https://travis-ci.org/profile
4. push changes into the forked git repository
-5. watch the build at https://travis-ci.org/<username>/pywikibot-core/builds
+5. watch the build at https://travis-ci.org/<username>/pywikibot/builds
Only travis-ci builds from the main repository can access the password for the
Wikimedia account 'Pywikibot-test'. All tests which require a logged in user
@@ -141,7 +141,7 @@
To enable 'user' tests on travis-ci builds for a different repository, add
a username and password to travis:
-1. Go to https://travis-ci.org/<username>/pywikibot-core/settings/env_vars
+1. Go to https://travis-ci.org/<username>/pywikibot/settings
2. Add a new variable named PYWIKIBOT2_USERNAME and a value of a valid
Wikimedia SUL username
3. Add another variable named USER_PASSWORD, with the private password for
@@ -171,10 +171,10 @@
1. create a github and appveyor account
2. fork the main github repository
3. create a project in ci.appveyor.com
-4. go to https://ci.appveyor.com/project/<username>/pywikibot-core/settings
+4. go to https://ci.appveyor.com/project/<username>/pywikibot/settings
and enter the custom configuration .yml filename: .appveyor.yml
5. push changes into the forked git repository
-6. watch the build at https://ci.appveyor.com/<username>/pywikibot-core/history
+6. watch the build at https://ci.appveyor.com/<username>/pywikibot/history
The 'user' tests are not yet enabled on appveyor builds.
@@ -187,14 +187,14 @@
1. create a github and circleci account
2. fork the main github repository
3. create a project in circleci.com
-4. go to https://circleci.com/gh/<username>/pywikibot-core/edit#env-vars
+4. go to https://circleci.com/gh/<username>/pywikibot/edit#env-vars
and add the following variables:
- PYWIKIBOT2_NO_USER_CONFIG=2
- TOXENV=py27,py34
5. push changes into the forked git repository
-6. watch the build at https://circleci.com/gh/<username>/pywikibot-core
+6. watch the build at https://circleci.com/gh/<username>/pywikibot
PYWIKIBOT2_NO_USER_CONFIG=2 is needed because 'python setup.py test' is run.
diff --git a/tests/api_tests.py b/tests/api_tests.py
index cc4d535..e73fa9a 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -1061,7 +1061,7 @@
site = self.get_site()
site.tokens._tokens.setdefault(site.user(), {})['edit'] = 'INVALID'
page = pywikibot.Page(site, 'Pywikibot bad token test')
- page.text = ('This page is testing whether pywikibot-core rerequests '
+ page.text = ('This page is testing whether pywikibot rerequests '
'a token when a badtoken error was received.')
page.save(summary='Bad token test')
--
To view, visit https://gerrit.wikimedia.org/r/440869
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If199ded6c799347a7feb1e98c4811d1692457fb9
Gerrit-Change-Number: 440869
Gerrit-PatchSet: 12
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/440909 )
Change subject: [IMPR] config2: clarify UserWarning error messages
......................................................................
[IMPR] config2: clarify UserWarning error messages
In Ie50078ae3315ba8ba70946b889a31e403c998dd7 a user-config var was removed
without depreciation.
This patch aims to clarify the different messages that are not very understandable,
as T166682 shows, making it clear that user-config.py file need to be edited.
Bug: T166682
Change-Id: I893f9817fb0838749bf062e72cd82438ec6ad0fb
---
M pywikibot/config2.py
1 file changed, 11 insertions(+), 9 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index fb85461..9a655f1 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -1046,10 +1046,10 @@
def __init__(self, name, actual_type, allowed_types):
super(_DifferentTypeError, self).__init__(
- 'Configuration variable "{0}" is defined as "{1.__name__}" but '
- 'expected "{2}".'.format(
- name, actual_type,
- '", "'.join(t.__name__ for t in allowed_types)))
+ 'Configuration variable "{0}" is defined as "{1.__name__}" in '
+ 'your user-config.py but expected "{2}".'
+ .format(name, actual_type, '", "'.join(t.__name__
+ for t in allowed_types)))
def _assert_default_type(name, value, default_value):
@@ -1086,8 +1086,10 @@
else:
user_config[name] = value
elif not name.startswith('_') and name not in skipped:
- warn('Configuration variable {0} is defined but unknown. '
- 'Misspelled?'.format(name), UserWarning)
+ warn('Configuration variable "{0}" is defined in your '
+ 'user-config.py but unknown. It can be a misspelled one or a '
+ 'variable that is no longer supported.'
+ .format(name), UserWarning)
_check_user_config_types(_uc, _glv, _imports)
@@ -1112,9 +1114,9 @@
globals()[_key] = _uc[_key]
if _key in _deprecated_variables:
- warn("'%s' is no longer a supported configuration variable.\n"
- "Please inform the maintainers if you depend on it." % _key,
- _ConfigurationDeprecationWarning)
+ warn('"{0}" present in our user-config.py is no longer a supported '
+ 'configuration variable. Please inform the maintainers if you '
+ 'depend on it.'.format(_key), _ConfigurationDeprecationWarning)
# If we cannot auto-detect the console encoding (e.g. when piping data)
# assume utf-8. On Linux, this will typically be correct; on windows,
--
To view, visit https://gerrit.wikimedia.org/r/440909
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I893f9817fb0838749bf062e72cd82438ec6ad0fb
Gerrit-Change-Number: 440909
Gerrit-PatchSet: 1
Gerrit-Owner: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/440851 )
Change subject: [doc] Fix script calls in docs
......................................................................
[doc] Fix script calls in docs
+ narrow dumps url
Change-Id: I040739bd21f9575975d235a2968ad83f6a20294a
---
M pywikibot/fixes.py
M scripts/README.rst
M scripts/blockpageschecker.py
M scripts/fixing_redirects.py
M scripts/imagecopy.py
M scripts/imagecopy_self.py
M scripts/lonelypages.py
M scripts/noreferences.py
M scripts/redirect.py
M scripts/replace.py
M scripts/table2wiki.py
M scripts/template.py
M scripts/templatecount.py
M tests/README.rst
14 files changed, 29 insertions(+), 27 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/fixes.py b/pywikibot/fixes.py
index 649bccf..ffa8636 100644
--- a/pywikibot/fixes.py
+++ b/pywikibot/fixes.py
@@ -329,7 +329,7 @@
},
# some disambiguation stuff for de:
- # python replace.py -fix:music -subcat:Album
+ # python pwb.py replace -fix:music -subcat:Album
'music': {
'regex': False,
'msg': {
@@ -350,7 +350,7 @@
},
# format of dates of birth and death, for de:
- # python replace.py -fix:datum -ref:Vorlage:Personendaten
+ # python pwb.py replace -fix:datum -ref:Vorlage:Personendaten
'datum': {
'regex': True,
'msg': {
@@ -441,7 +441,7 @@
},
# Corrections for Arabic Wikipedia and any Arabic wiki.
- # python replace.py -fix:correct-ar -start:! -always
+ # python pwb.py replace -fix:correct-ar -start:! -always
'correct-ar': {
'regex': True,
diff --git a/scripts/README.rst b/scripts/README.rst
index 3e11786..3d0ffa9 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -289,4 +289,4 @@
the various programs, can be retrieved by running the bot with the -help
parameter, e.g.
- python pwb.py interwiki.py -help
+ python pwb.py interwiki -help
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index 1ed9115..4b52b26 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -15,7 +15,7 @@
¶ms;
-xml Retrieve information from a local XML dump (pages-articles
- or pages-meta-current, see https://download.wikimedia.org).
+ or pages-meta-current, see https://dumps.wikimedia.org).
Argument can also be given as "-xml:filename".
-protectedpages: Check all the blocked pages; useful when you have not
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index 062571c..bfa8d1c 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -8,7 +8,7 @@
-featured Run over featured pages (for some wikimedia wikis only)
-Run fixing_redirects.py -help to see all the command-line
+Run python pwb.py fixing_redirects -help to see all the command-line
options -file, -ref, -links, ...
"""
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 09484f1..72c1e5a 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -33,25 +33,25 @@
Work on a single image::
- python pwb.py imagecopy.py -page:Image:<imagename>
+ python pwb.py imagecopy -page:Image:<imagename>
Work on the 100 newest images::
- python pwb.py imagecopy.py -newimages:100
+ python pwb.py imagecopy -newimages:100
Work on all images in a category:<cat>::
- python pwb.py imagecopy.py -cat:<cat>
+ python pwb.py imagecopy -cat:<cat>
Work on all images which transclude a template::
- python pwb.py imagecopy.py -transcludes:<template>
+ python pwb.py imagecopy -transcludes:<template>
Work on a single image and deletes the image when the transfer is complete
(only works if the user has sysops privilege, otherwise it will be marked for
deletion)::
- python pwb.py imagecopy.py -page:Image:<imagename> -delete
+ python pwb.py imagecopy -page:Image:<imagename> -delete
By default the bot works on your home wiki (set in user-config)
"""
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index c1f91cc..849e6a9 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -12,15 +12,15 @@
Work on a single file:
- python pwb.py imagecopy.py -page:file:<filename>
+ python pwb.py imagecopy -page:file:<filename>
Work on all images in a category:<cat>:
- python pwb.py imagecopy.py -cat:<cat>
+ python pwb.py imagecopy -cat:<cat>
Work on all images which transclude a template:
- python pwb.py imagecopy.py -transcludes:<template>
+ python pwb.py imagecopy -transcludes:<template>
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)
diff --git a/scripts/lonelypages.py b/scripts/lonelypages.py
index a527687..0f8c4b4 100755
--- a/scripts/lonelypages.py
+++ b/scripts/lonelypages.py
@@ -8,7 +8,7 @@
¶ms;
-xml Retrieve information from a local XML dump (pages-articles
- or pages-meta-current, see https://download.wikimedia.org).
+ or pages-meta-current, see https://dumps.wikimedia.org).
Argument can also be given as "-xml:filename".
-page Only edit a specific page.
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 838c244..7aaef7e 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -12,7 +12,7 @@
¶ms;
-xml Retrieve information from a local XML dump (pages-articles
- or pages-meta-current, see https://download.wikimedia.org).
+ or pages-meta-current, see https://dumps.wikimedia.org).
Argument can also be given as "-xml:filename".
-namespace:n Number or name of namespace to process. The parameter can be
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 8928813..59a00c9 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -27,7 +27,7 @@
and arguments can be:
-xml Retrieve information from a local XML dump
- (https://download.wikimedia.org). Argument can also be given as
+ (https://dumps.wikimedia.org). Argument can also be given as
"-xml:filename.xml". Cannot be used with -fullscan or -moves.
-fullscan Retrieve redirect pages from live wiki, not from a special page
diff --git a/scripts/replace.py b/scripts/replace.py
index 09e8584..fe56b4c 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -13,7 +13,7 @@
Furthermore, the following command line parameters are supported:
-xml Retrieve information from a local XML dump (pages-articles
- or pages-meta-current, see https://download.wikimedia.org).
+ or pages-meta-current, see https://dumps.wikimedia.org).
Argument can also be given as "-xml:filename".
-regex Make replacements using regular expressions. If this argument
@@ -104,7 +104,7 @@
If you want to change templates from the old syntax, e.g. {{msg:Stub}}, to the
new syntax, e.g. {{Stub}}, download an XML dump file (pages-articles) from
-https://download.wikimedia.org, then use this command:
+https://dumps.wikimedia.org, then use this command:
python pwb.py replace -xml -regex "{{msg:(.*?)}}" "{{\1}}"
@@ -127,7 +127,8 @@
python pwb.py replace referer referrer -file:typos.txt -excepttext:HTTP
-Please type "replace.py -help | more" if you can't read the top of the help.
+Please type "python pwb.py replace -help | more" if you can't read
+the top of the help.
"""
#
# (C) Daniel Herding, 2004-2012
diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py
index fb33807..2cbe443 100644
--- a/scripts/table2wiki.py
+++ b/scripts/table2wiki.py
@@ -19,7 +19,7 @@
them on the live wiki.
-xml Retrieve information from a local XML dump
- (pages_current, see https://download.wikimedia.org).
+ (pages_current, see https://dumps.wikimedia.org).
Argument can also be given as "-xml:filename".
Searches for pages with HTML tables, and tries to convert
them on the live wiki.
diff --git a/scripts/template.py b/scripts/template.py
index e112018..de6db92 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -5,7 +5,8 @@
It also converts the old MediaWiki boilerplate format to the new format.
-Syntax: python template.py [-remove] [xml[:filename]] oldTemplate [newTemplate]
+Syntax: python pwb.py template [-remove] [xml[:filename]] oldTemplate \
+ [newTemplate]
Specify the template on the command line. The program will pick up the template
page, and look for all pages using it. It will then automatically loop over
@@ -28,7 +29,7 @@
the same effect.
-xml retrieve information from a local dump
- (https://download.wikimedia.org). If this argument isn't given,
+ (https://dumps.wikimedia.org). If this argument isn't given,
info will be loaded from the maintenance page of the live wiki.
argument can also be given as "-xml:filename.xml".
diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index 6b36177..e22c726 100755
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -6,7 +6,7 @@
It can also be used to simply count the number of pages (rather than
listing each individually).
-Syntax: python templatecount.py command [arguments]
+Syntax: python pwb.py templatecount options templates
Command line options:
diff --git a/tests/README.rst b/tests/README.rst
index 1c3601f..5bea4ab 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -101,9 +101,9 @@
::
- python pwb.py tests/api_tests.py -v
- python pwb.py tests/site_tests.py -v
- python pwb.py tests/api_tests.py -v TestParamInfo.test_init
+ python pwb.py tests/api_tests -v
+ python pwb.py tests/site_tests -v
+ python pwb.py tests/api_tests -v TestParamInfo.test_init
env
~~~
--
To view, visit https://gerrit.wikimedia.org/r/440851
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I040739bd21f9575975d235a2968ad83f6a20294a
Gerrit-Change-Number: 440851
Gerrit-PatchSet: 1
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/440336 )
Change subject: [bugfix] assert for BasePage instead of Page in BaseBot.run
......................................................................
[bugfix] assert for BasePage instead of Page in BaseBot.run
Bug: T197218
Change-Id: I58c9dba812e8c2ec5d68bbea8a33813e1de37436
---
M pywikibot/bot.py
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 0a65ca4..51ad1bc 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1457,7 +1457,7 @@
def run(self):
"""Process all pages in generator.
- @raise AssertionError: "page" is not a pywikibot.Page object
+ @raise AssertionError: "page" is not a pywikibot.page.BasePage object
"""
self._start_ts = pywikibot.Timestamp.now()
if not hasattr(self, 'generator'):
@@ -1493,9 +1493,9 @@
else:
page = initialized_page
- assert isinstance(page, pywikibot.Page), \
- '"page" is not a pywikibot.Page object but {}.'.format(
- page.__class__)
+ assert isinstance(page, pywikibot.page.BasePage), (
+ '"page" is not a pywikibot.page.BasePage object but {}.'
+ .format(page.__class__))
if self.skip_page(page):
continue
--
To view, visit https://gerrit.wikimedia.org/r/440336
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I58c9dba812e8c2ec5d68bbea8a33813e1de37436
Gerrit-Change-Number: 440336
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot