jenkins-bot has submitted this change and it was merged.
Change subject: Have tox nose env set PYWIKIBOT2_NO_USER_CONFIG=1
......................................................................
Have tox nose env set PYWIKIBOT2_NO_USER_CONFIG=1
The nose env skips tests flagged with site, hence we most probably dont
depend on a user config.
Change-Id: Iadf1bb6d6cc4230609b24e07a67309a6d3ccfe91
---
M tox.ini
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index 5ddf7ed..c2e9021 100644
--- a/tox.ini
+++ b/tox.ini
@@ -18,6 +18,7 @@
deps = flake8-docstrings
[testenv:nose]
+setenv = PYWIKIBOT2_NO_USER_CONFIG=1
commands = nosetests -a "!site"
deps = nose
--
To view, visit https://gerrit.wikimedia.org/r/152959
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iadf1bb6d6cc4230609b24e07a67309a6d3ccfe91
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <hashar(a)free.fr>
Gerrit-Reviewer: Bartosz Dziewoński <matma.rex(a)gmail.com>
Gerrit-Reviewer: Hashar <hashar(a)free.fr>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: standard pagegenerators and minor improvements for commons_link.py
......................................................................
standard pagegenerators and minor improvements for commons_link.py
partial backport of Iad89d280890938b2d2dbaf1a127e62bb41ea618e
bug: 57027 (2nd part)
Change-Id: I573b2e218922f4a020b90f419504fb49946bccb0
---
M commons_link.py
1 file changed, 22 insertions(+), 49 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/commons_link.py b/commons_link.py
index d40de55..c8df1e0 100644
--- a/commons_link.py
+++ b/commons_link.py
@@ -1,8 +1,7 @@
#!/usr/bin/python
-# coding: utf-8
-
+# -*- coding: utf-8 -*-
"""
-Include commons template in home wiki.
+Include Commons template in home wiki.
This bot functions mainly in the en.wikipedia, because it
compares the names of articles and category in English
@@ -11,23 +10,19 @@
redirect, this also functions.
Run:
-Syntax: python commons_link.py action [-option]
+Syntax: python commons_link.py [action] [pagegenerator]
where action can be one of these:
* pages : Run over articles, include {{commons}}
* categories : Run over categories, include {{commonscat}}
-and option can be one of these:
- * -cat : Work on all pages which are in a specific category.
- * -ref : Work on all pages that link to a certain page.
- * -link : Work on all pages that are linked from a certain page.
- * -start : Work on all pages on the home wiki, starting at the named page.
- * -page : Work on one page.
+and pagegenerator can be one of these:
+¶ms;
"""
#
# (C) Leonardo Gregianin, 2006
-# (C) Pywikibot team, 2007-2013
+# (C) Pywikibot team, 2007-2014
#
# Distributed under the terms of the MIT license.
#
@@ -38,6 +33,10 @@
import wikipedia as pywikibot
import pagegenerators
import catlib
+
+docuReplacements = {
+ '¶ms;': pagegenerators.parameterHelp,
+}
comment1 = {
'ar': u'روبوت: تضمين قالب كومنز',
@@ -171,54 +170,28 @@
pywikibot.output(u'Category does not exist in Commons!')
except pywikibot.NoPage:
- pywikibot.output(u'Page %s does not exist?!' % page.title())
+ pywikibot.output(u'Page %s does not exist' % page.title())
except pywikibot.IsRedirectPage:
pywikibot.output(u'Page %s is a redirect; skipping.'
% page.title())
except pywikibot.LockedPage:
- pywikibot.output(u'Page %s is locked?!' % page.title())
+ pywikibot.output(u'Page %s is locked' % page.title())
if __name__ == "__main__":
- singlepage = []
- gen = None
- start = None
+ genFactory = pagegenerators.GeneratorFactory()
try:
action = None
for arg in pywikibot.handleArgs():
- if arg == ('pages'):
- action = 'pages'
- elif arg == ('categories'):
- action = 'categories'
- elif arg.startswith('-start:'):
- start = pywikibot.Page(pywikibot.getSite(), arg[7:])
- gen = pagegenerators.AllpagesPageGenerator(
- start.title(withNamespace=False),
- namespace=start.namespace(),
- includeredirects=False)
- elif arg.startswith('-cat:'):
- cat = catlib.Category(pywikibot.getSite(),
- 'Category:%s' % arg[5:])
- gen = pagegenerators.CategorizedPageGenerator(cat)
- elif arg.startswith('-ref:'):
- ref = pywikibot.Page(pywikibot.getSite(), arg[5:])
- gen = pagegenerators.ReferringPageGenerator(ref)
- elif arg.startswith('-link:'):
- link = pywikibot.Page(pywikibot.getSite(), arg[6:])
- gen = pagegenerators.LinkedPageGenerator(link)
- elif arg.startswith('-page:'):
- singlepage = pywikibot.Page(pywikibot.getSite(), arg[6:])
- gen = iter([singlepage])
- #else:
- #bug
+ if arg in ('pages', 'categories'):
+ action = arg
+ else:
+ genFactory.handleArg(arg)
- if action == 'pages':
- preloadingGen = pagegenerators.PreloadingGenerator(gen)
- bot = CommonsLinkBot(preloadingGen, acceptall=False)
- bot.pages()
- elif action == 'categories':
- preloadingGen = pagegenerators.PreloadingGenerator(gen)
- bot = CommonsLinkBot(preloadingGen, acceptall=False)
- bot.categories()
+ gen = genFactory.getCombinedGenerator()
+ if gen and action:
+ gen = pagegenerators.PreloadingGenerator(gen)
+ bot = CommonsLinkBot(gen, acceptall=False)
+ getattr(bot, action)()
else:
pywikibot.showHelp(u'commons_link')
finally:
--
To view, visit https://gerrit.wikimedia.org/r/147899
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I573b2e218922f4a020b90f419504fb49946bccb0
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
John Vandenberg has submitted this change and it was merged.
Change subject: Allow github forks to run travis nosetests builds
......................................................................
Allow github forks to run travis nosetests builds
The wiki user 'Pywikibot-test' only works on the 'wikimedia'
travis-ci account. This prevents forks of the gibhub from
running tests on travis-ci with the original codebase.
nosetests support was added recently, and can be used to run
only tests which do not access the Wikimedia sites or other
Internet services.
Change-Id: I0f22caaf8b5cd314a196a5e3cc25ae830231ccb5
---
M .travis.yml
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
John Vandenberg: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index 84833d7..f395eaf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,7 @@
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install ordereddict; fi
+ - export GITHUB_USER=`echo $TRAVIS_REPO_SLUG | cut -d '/' -f 1`
- mkdir ~/.pywikibot
- touch ~/.pywikibot/user-config.py
@@ -28,7 +29,7 @@
- cd ../..
script:
- - python setup.py test
+ - if [ "$GITHUB_USER" = 'wikimedia' ]; then python setup.py test; else PYWIKIBOT2_NO_USER_CONFIG=1 nosetests -a '!site,!net' -v ; fi
env:
global:
--
To view, visit https://gerrit.wikimedia.org/r/152837
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0f22caaf8b5cd314a196a5e3cc25ae830231ccb5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: github
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: remove the WikibasePage.__defined_by() method
......................................................................
remove the WikibasePage.__defined_by() method
it has been deprecated since almost a year:
I05917eb982f41dcdc92d8e45292ba6c27eac47f7
Change-Id: I5de9fe1df375f17d52001f691402d0eecfbc4e9e
---
M pywikibot/page.py
1 file changed, 0 insertions(+), 5 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index cf6f367..d5a7cd6 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2597,11 +2597,6 @@
del self._link._title
return Page(self).title(**kwargs)
- @deprecated("_defined_by")
- def __defined_by(self, singular=False):
- """ DEPRECATED. """
- return self._defined_by(singular=singular)
-
def _defined_by(self, singular=False):
"""
Internal function to provide the API parameters to identify the entity.
--
To view, visit https://gerrit.wikimedia.org/r/152831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5de9fe1df375f17d52001f691402d0eecfbc4e9e
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Remove 'page title parts' mechanism in scripts
......................................................................
Remove 'page title parts' mechanism in scripts
- catall.py
- disambredir.py
- imagetransfer.py (reduces one part of bug 68659,
and fixes usage help in docstring)
- interwiki.py
- makecat.py (fixes bug 69062)
- solve_disambiguation.py
Should also resolve intermittent build error:
https://travis-ci.org/wikimedia/pywikibot-core/jobs/31504947
Continues:
Ic5983b64cbc0cd96c98c105574ccb1db6dbaf9a6
Change-Id: I1eebb39c0c033e53bd0d240307f755076cb848ec
---
M scripts/catall.py
M scripts/disambredir.py
M scripts/imagetransfer.py
M scripts/interwiki.py
M scripts/makecat.py
M scripts/solve_disambiguation.py
M tests/script_tests.py
7 files changed, 79 insertions(+), 100 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Ricordisamoa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/catall.py b/scripts/catall.py
index e908bd0..1e61f11 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
"""
-Add or change categories on a number of pages. Usage: catall.py name - goes
-through pages, starting at 'name'. Provides the categories on the page and asks
-whether to change them. If no starting name is provided, the bot starts at 'A'.
+Add or change categories on a number of pages.
+
+Usage:
+ catall.py [start]
+
+Provides the categories on the page and asks whether to change them.
+
+If no starting name is provided, the bot starts at 'A'.
Options:
-onlynew : Only run on pages that do not yet have a category.
@@ -71,18 +76,15 @@
def main():
docorrections = True
- start = []
+ start = 'A'
- for arg in pywikibot.handleArgs():
+ local_args = pywikibot.handleArgs()
+
+ for arg in local_args:
if arg == '-onlynew':
docorrections = False
else:
- start.append(arg)
-
- if not start:
- start = 'A'
- else:
- start = ' '.join(start)
+ start = arg
mysite = pywikibot.Site()
diff --git a/scripts/disambredir.py b/scripts/disambredir.py
index 8038993..058e90a 100644
--- a/scripts/disambredir.py
+++ b/scripts/disambredir.py
@@ -3,6 +3,12 @@
"""
Goes through the disambiguation pages, checks their links, and asks for
each link that goes to a redirect page whether it should be replaced.
+
+Usage:
+ python disambredir.py [start]
+
+If no starting name is provided, the bot starts at '!'.
+
"""
#
# (c) André Engels and others, 2006-2009
@@ -144,21 +150,24 @@
def main():
- start = []
- for arg in pywikibot.handleArgs():
- start.append(arg)
- if start:
- start = " ".join(start)
- else:
- start = "!"
+ local_args = pywikibot.handleArgs()
+
+ generator = None
+ start = local_args[0] if local_args else '!'
+
mysite = pywikibot.Site()
try:
+ mysite.disambcategory()
+ except pywikibot.Error as e:
+ pywikibot.output(e)
+ else:
generator = pagegenerators.CategorizedPageGenerator(
mysite.disambcategory(), start=start)
- except pywikibot.NoPage:
- pywikibot.output(
- "The bot does not know the disambiguation category for your wiki.")
- raise
+
+ if not generator:
+ pywikibot.showHelp()
+ return
+
# only work on articles
generator = pagegenerators.NamespaceFilterPageGenerator(generator, [0])
generator = pagegenerators.PreloadingGenerator(generator)
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index ee869f4..aff1a39 100644
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -4,7 +4,7 @@
Syntax:
- python imagetransfer.py pagename [-interwiki] [-targetLang:xx] -targetFamily:yy]
+ python imagetransfer.py pagename [-interwiki] [-tolang:xx] [-tofamily:yy]
Arguments:
@@ -38,7 +38,6 @@
import upload
from pywikibot import config
from pywikibot import i18n
-from pywikibot import pagegenerators
copy_message = {
'ar': u"هذه الصورة تم نقلها من %s. الوصف الأصلي كان:\r\n\r\n%s",
@@ -298,16 +297,17 @@
def main():
- # if -file is not used, this temporary array is used to read the page title.
- pageTitle = []
- page = None
+ pageTitle = None
gen = None
+
interwiki = False
keep_name = False
targetLang = None
targetFamily = None
- for arg in pywikibot.handleArgs():
+ local_args = pywikibot.handleArgs()
+
+ for arg in local_args:
if arg == '-interwiki':
interwiki = True
elif arg.startswith('-keepname'):
@@ -316,29 +316,15 @@
targetLang = arg[8:]
elif arg.startswith('-tofamily:'):
targetFamily = arg[10:]
- elif arg.startswith('-file'):
- if len(arg) == 5:
- filename = pywikibot.input(
- u'Please enter the list\'s filename: ')
- else:
- filename = arg[6:]
- gen = pagegenerators.TextfilePageGenerator(filename)
- else:
- pageTitle.append(arg)
+ elif not pageTitle:
+ pageTitle = arg
- if not gen:
- # if the page title is given as a command line argument,
- # connect the title's parts with spaces
- if pageTitle != []:
- pageTitle = ' '.join(pageTitle)
- page = pywikibot.Page(pywikibot.Site(), pageTitle)
- # if no page title was given as an argument, and none was
- # read from a file, query the user
- if not page:
- pageTitle = pywikibot.input(u'Which page to check:')
- page = pywikibot.Page(pywikibot.Site(), pageTitle)
- # generator which will yield only a single Page
+ if pageTitle:
+ page = pywikibot.Page(pywikibot.Site(), pageTitle)
gen = iter([page])
+ else:
+ pywikibot.showHelp()
+ return
if not targetLang and not targetFamily:
targetSite = pywikibot.Site('commons', 'commons')
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index c071d9d..595a6d9 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -2422,7 +2422,7 @@
def main():
- singlePageTitle = []
+ singlePageTitle = ''
opthintsonly = False
# Which namespaces should be processed?
# default to [] which means all namespaces will be processed
@@ -2491,7 +2491,8 @@
until = arg[7:]
else:
if not genFactory.handleArg(arg):
- singlePageTitle.append(arg)
+ if not singlePageTitle:
+ singlePageTitle = arg
# Do not use additional summary with autonomous mode
if globalvar.autonomous:
@@ -2564,7 +2565,6 @@
# TODO: filter namespaces if -namespace parameter was used
readWarnfile(warnfile, bot)
else:
- singlePageTitle = ' '.join(singlePageTitle)
if not singlePageTitle and not opthintsonly:
singlePageTitle = pywikibot.input(u'Which page to check:')
if singlePageTitle:
diff --git a/scripts/makecat.py b/scripts/makecat.py
index fe4d372..d09a5bf 100644
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -1,9 +1,10 @@
# -*- coding: UTF-8 -*-
"""
-This bot takes as its argument (or, if no argument is given, asks for it), the
-name of a new or existing category. It will then try to find new articles for
-this category (pages linked to and from pages already in the category), asking
-the user which pages to include and which not.
+This bot takes as its argument the name of a new or existing category.
+
+It will then try to find new articles for this category
+(pages linked to and from pages already in the category),
+asking the user which pages to include and which not.
Arguments:
-nodates automatically skip all pages that are years or dates (years
@@ -39,6 +40,7 @@
__version__ = '$Id$'
#
+import sys
import codecs
import pywikibot
from pywikibot import date, pagegenerators, i18n
@@ -192,7 +194,7 @@
checkbroken = True
removeparent = True
main = True
- workingcatname = []
+ workingcatname = ''
tocheck = []
for arg in pywikibot.handleArgs():
if arg.startswith('-nodate'):
@@ -206,13 +208,13 @@
removeparent = False
elif arg.startswith('-all'):
main = False
- else:
- workingcatname.append(arg)
+ elif not workingcatname:
+ workingcatname = arg
- if len(workingcatname) == 0:
- workingcatname = pywikibot.input("Which page to start with? ")
- else:
- workingcatname = ' '.join(workingcatname)
+ if not workingcatname:
+ pywikibot.showHelp()
+ sys.exit(0)
+
mysite = pywikibot.Site()
pywikibot.setAction(i18n.twtranslate(mysite, 'makecat-create', {'cat': workingcatname}))
workingcat = pywikibot.Category(mysite,
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 7476cb8..09ef8f7 100644
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -3,12 +3,11 @@
"""
Script to help a human solve disambiguations by presenting a set of options.
-Specify the disambiguation page on the command line, or enter it at the
-prompt after starting the program. (If the disambiguation page title starts
-with a '-', you cannot name it on the command line, but you can enter it at
-the prompt.) The program will pick up the page, and look for all
-alternative links, and show them with a number adjacent to them. It will
-then automatically loop over all pages referring to the disambiguation page,
+Specify the disambiguation page on the command line.
+
+The program will pick up the page, and look for all alternative links,
+and show them with a number adjacent to them. It will then automatically
+loop over all pages referring to the disambiguation page,
and show 30 characters of context on each side of the reference to help you
make the decision between the alternatives. It will ask you to type the
number of the appropriate replacement, and perform the change.
@@ -1017,19 +1016,17 @@
alternatives = []
getAlternatives = True
dnSkip = False
- # if the -file argument is used, page titles are dumped in this array.
- # otherwise it will only contain one page.
generator = None
- # This temporary array is used to read the page title if one single
- # page to work on is specified by the arguments.
- pageTitle = []
+ pageTitle = None
primary = False
main_only = False
# For sorting the linked pages, case can be ignored
minimum = 0
- for arg in pywikibot.handleArgs(*args):
+ local_args = pywikibot.handleArgs(*args)
+
+ for arg in local_args:
if arg.startswith('-primary:'):
primary = True
getAlternatives = False
@@ -1081,29 +1078,19 @@
except pywikibot.NoPage:
pywikibot.output("Disambiguation category for your wiki is not known.")
raise
- elif arg.startswith("-"):
- pywikibot.output("Unrecognized command line argument: %s" % arg)
- # show help text and exit
- pywikibot.showHelp()
- else:
- pageTitle.append(arg)
+ elif not pageTitle:
+ pageTitle = arg
+
site = pywikibot.Site()
site.login()
- # if the disambiguation page is given as a command line argument,
- # connect the title's parts with spaces
- if pageTitle != []:
- pageTitle = ' '.join(pageTitle)
+ if pageTitle:
page = pywikibot.Page(pywikibot.Link(pageTitle, site))
generator = iter([page])
- # if no disambiguation page was given as an argument, and none was
- # read from a file, query the user
if not generator:
- pageTitle = pywikibot.input(
- u'On which disambiguation page do you want to work?')
- page = pywikibot.Page(pywikibot.Link(pageTitle, site))
- generator = iter([page])
+ pywikibot.showHelp()
+ return
bot = DisambiguationRobot(always, alternatives, getAlternatives, dnSkip,
generator, primary, main_only,
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 75154cc..abfdcc4 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -63,11 +63,8 @@
script_input = {
'catall': 'q\n', # q for quit
- 'disambredir': '\n', # prompts for user to choose action to take
'editarticle': 'Test page\n',
- 'imagetransfer': 'Test page\n',
'interwiki': 'Test page\n',
- 'makecat': 'Test page\n\n',
# 'misspelling': 'q\n', # pressing 'q' doesnt work. bug 68663
'replace': 'foo\nbar\n\n\n', # match, replacement,
# Enter to begin, Enter for default summary.
@@ -84,15 +81,14 @@
'category_redirect',
'cfd',
'clean_sandbox',
+ 'disambredir',
'lonelypages',
- 'makecat',
'misspelling',
'revertbot',
'noreferences',
'nowcommons',
'script_wui',
'shell',
- 'solve_disambiguation',
'unusedfiles',
'upload',
'watchlist',
@@ -127,7 +123,6 @@
# The following auto-run and typically cant be validated,
# however these strings are very likely to exist within
# the timeout of 5 seconds.
- 'makecat': '(Default is [[',
'revertbot': 'Fetching new batch of contributions',
'upload': 'ERROR: Upload error',
}
@@ -217,15 +212,13 @@
no_args_expected_results)
if script_name in ['checkimages', # bug 68613
'data_ingestion', # bug 68611
- 'disambredir', # quittable auto-run with
- # highly variable output.
'flickrripper', # bug 68606 (and deps)
'imagerecat', # bug 68658
- 'imagetransfer', # bug 68659
'pagefromfile', # bug 68660
'upload', # raises custom ValueError
] or (
((config.family != 'wikipedia' or config.mylang != 'en') and script_name == 'cfd') or
+ (config.family == 'wikipedia' and script_name == 'disambredir') or
(config.family == 'wikipedia' and config.mylang != 'en' and script_name == 'misspelling')):
dct[test_name] = unittest.expectedFailure(dct[test_name])
dct[test_name].__doc__ = \
--
To view, visit https://gerrit.wikimedia.org/r/151396
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1eebb39c0c033e53bd0d240307f755076cb848ec
Gerrit-PatchSet: 6
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Bep <bjorn.erik.pedersen(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Use core-like Site.code instead of Site.lang
......................................................................
Use core-like Site.code instead of Site.lang
- the site code not the language code is needed here
- bugfix for site.language which is a function, not a string
Change-Id: Id8df6cf8209cd4f69b62a2b67524ae3d0aaf84c9
---
M scripts/cosmetic_changes.py
1 file changed, 15 insertions(+), 15 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index 90edde5..90c0918 100755
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -182,7 +182,7 @@
text = self.fixReferences(text)
text = self.fixStyle(text)
text = self.fixTypo(text)
- if self.site.lang in ['ckb', 'fa']:
+ if self.site.code in ['ckb', 'fa']:
text = self.fixArabicLetters(text)
try:
text = isbn.hyphenateIsbnNumbers(text)
@@ -200,7 +200,7 @@
"""
if not self.talkpage and pywikibot.calledModuleName() != 'interwiki':
interwikiR = re.compile(r'\[\[%s\s?:([^\[\]\n]*)\]\]'
- % self.site.lang)
+ % self.site.code)
text = interwikiR.sub(r'[[\1]]', text)
return text
@@ -257,7 +257,7 @@
# ignoring nn-wiki of cause of the comment line above iw section
if not self.template and '{{Personendaten' not in text and \
'{{SORTIERUNG' not in text and '{{DEFAULTSORT' not in text and \
- self.site.lang not in ('et', 'it', 'bg', 'ru'):
+ self.site.code not in ('et', 'it', 'bg', 'ru'):
categories = pywikibot.getCategoryLinks(text, site=self.site)
if not self.talkpage: # and pywikibot.calledModuleName() <> 'interwiki':
@@ -265,7 +265,7 @@
if self.template:
loc = None
try:
- tmpl, loc = moved_links[self.site.lang]
+ tmpl, loc = moved_links[self.site.code]
del tmpl
except KeyError:
pass
@@ -289,7 +289,7 @@
# Adding categories
if categories:
##Sorting categories in alphabetic order. beta test only on Persian Wikipedia, TODO fix bug for sorting
- #if self.site.language() == 'fa':
+ #if self.site.code == 'fa':
# categories.sort()
##Taking main cats to top
# for name in categories:
@@ -333,16 +333,16 @@
namespaces = list(self.site.namespace(nsNumber, all=True))
thisNs = namespaces.pop(0)
if nsNumber == 6 and family.name == 'wikipedia':
- if self.site.lang in ('en', 'fr') and \
+ if self.site.code in ('en', 'fr') and \
LV(self.site.version()) >= LV('1.14'):
# do not change "Image" on en-wiki and fr-wiki
assert u'Image' in namespaces
namespaces.remove(u'Image')
- if self.site.lang == 'hu':
+ if self.site.code == 'hu':
# do not change "Kép" on hu-wiki
assert u'Kép' in namespaces
namespaces.remove(u'Kép')
- elif self.site.lang == 'pt':
+ elif self.site.code == 'pt':
# bug #3346901 should be implemented
continue
# lowerspaced and underscored namespaces
@@ -366,7 +366,7 @@
"""
# not wanted at ru
# arz uses english stylish codes
- if self.site.lang not in ['arz', 'ru']:
+ if self.site.code not in ['arz', 'ru']:
exceptions = ['nowiki', 'comment', 'math', 'pre']
for magicWord in ['img_thumbnail', 'img_left', 'img_center',
'img_right', 'img_none', 'img_framed',
@@ -593,9 +593,9 @@
def replaceDeprecatedTemplates(self, text):
exceptions = ['comment', 'math', 'nowiki', 'pre']
if self.site.family.name in deprecatedTemplates and \
- self.site.lang in deprecatedTemplates[self.site.family.name]:
+ self.site.code in deprecatedTemplates[self.site.family.name]:
for template in deprecatedTemplates[
- self.site.family.name][self.site.lang]:
+ self.site.family.name][self.site.code]:
old = template[0]
new = template[1]
if new is None:
@@ -619,7 +619,7 @@
## https://de.wikipedia.org/w/index.php?title=Wikipedia%3aVandalismusmeldung&d…
## text = pywikibot.replaceExcept(text,
## r'\[https?://%s\.%s\.org/wiki/(?P<link>\S+)\s+(?P<title>.+?)\s?\]'
-## % (self.site.lang, self.site.family.name),
+## % (self.site.code, self.site.family.name),
## r'[[\g<link>|\g<title>]]', exceptions)
# external link in double brackets
text = pywikibot.replaceExcept(
@@ -699,7 +699,7 @@
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
'startspace']
# convert prettytable to wikitable class
- if self.site.language in ('de', 'en'):
+ if self.site.code in ('de', 'en'):
text = pywikibot.replaceExcept(text,
r'(class="[^"]*)prettytable([^"]*")',
r'\1wikitable\2', exceptions)
@@ -748,7 +748,7 @@
'fa': u'۰۱۲۳۴۵۶۷۸۹',
}
faChrs = u'ءاآأإئؤبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیةيك' + digits['fa']
- new = digits.pop(self.site.lang)
+ new = digits.pop(self.site.code)
# This only works if there are only two items in digits dict
old = digits[digits.keys()[0]]
# do not change inside file links
@@ -762,7 +762,7 @@
% {'fa': faChrs}))
exceptions.append(pattern)
text = pywikibot.replaceExcept(text, u',', u'،', exceptions)
- if self.site.lang == 'ckb':
+ if self.site.code == 'ckb':
text = pywikibot.replaceExcept(text,
u'\u0647([.\u060c_<\\]\\s])',
u'\u06d5\\1', exceptions)
--
To view, visit https://gerrit.wikimedia.org/r/152803
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id8df6cf8209cd4f69b62a2b67524ae3d0aaf84c9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Site.code is to be used in core instead of Site.lang
......................................................................
Site.code is to be used in core instead of Site.lang
- We must use the site code instead of the language code as key.
- Use core-like Page.text instead of page.get(True)
Change-Id: Ia51ce1e1f892e1fe70312627c05be9124b34dfab
---
M scripts/clean_sandbox.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Mpaa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 6939777..6bfaecc 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -164,10 +164,10 @@
user_sandboxTemplate)
localSandbox = pywikibot.Page(self.site, localSandboxTitle)
content.update(user_content)
- sandboxTitle[self.site.lang] = [item.title() for item in
+ sandboxTitle[self.site.code] = [item.title() for item in
localSandbox.getReferences(
onlyTemplateInclusion=True)]
- if self.site.lang not in user_sandboxTemplate:
+ if self.site.code not in user_sandboxTemplate:
content[self.site.code] = None
pywikibot.output(
u'Not properly set-up to run in user namespace!')
@@ -198,7 +198,7 @@
u'%s is a redirect page, cleaning it anyway'
% sandboxPage.title(asLink=True))
try:
- text = sandboxPage.get(get_redirect=True)
+ text = sandboxPage.text
if not self.getOption('text'):
translatedContent = i18n.translate(self.site, content)
else:
--
To view, visit https://gerrit.wikimedia.org/r/152802
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia51ce1e1f892e1fe70312627c05be9124b34dfab
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>