jenkins-bot has submitted this change and it was merged.
Change subject: replace both with site.code: .lang and .language()
......................................................................
replace both with site.code: .lang and .language()
Change-Id: I75c9cea3827a18dfc0d71f838934c49e2c81aa98
---
M scripts/maintenance/compat2core.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/maintenance/compat2core.py b/scripts/maintenance/compat2core.py
index fe5af47..a6a0c0c 100644
--- a/scripts/maintenance/compat2core.py
+++ b/scripts/maintenance/compat2core.py
@@ -56,8 +56,8 @@
('(?<!\.)wikipedia\.', u'pywikibot.'),
# site instance call
('pywikibot\.getSite\s*\(\s*', 'pywikibot.Site('),
- # lang is differen from code. We should use code in core
- ('([Ss])ite.lang(\W*)', r'\1ite.code\2'),
+ # lang is different from code. We should use code in core
+ ('([Ss])ite.lang(?:uage\(\))?', r'\1ite.code'),
# change compat library classes to pywikibot intrinsic classes
('catlib\.Category\s*\(\s*', 'pywikibot.Category('),
('catlib\.change_category\s*\((\s*)(?P<article>.+?),\s*(?P<oldcat>.+?),',
--
To view, visit https://gerrit.wikimedia.org/r/135316
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I75c9cea3827a18dfc0d71f838934c49e2c81aa98
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: replace site.lang with site.code which is prefered in core
......................................................................
replace site.lang with site.code which is prefered in core
replacements made by compat2core script
Change-Id: I3495e3d995afa44557601ef46796bc1f9e9c09db
---
M scripts/casechecker.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/casechecker.py b/scripts/casechecker.py
index 27bce4c..2f0852c 100644
--- a/scripts/casechecker.py
+++ b/scripts/casechecker.py
@@ -249,8 +249,8 @@
self.seenUnresolvedLinks = set()
# TODO: handle "continue"
- if self.site.lang in self.whitelists:
- wlpage = self.whitelists[self.site.lang]
+ if self.site.code in self.whitelists:
+ wlpage = self.whitelists[self.site.code]
pywikibot.output(u'Loading whitelist from %s' % wlpage)
wlparams = {
'action': 'query',
@@ -288,7 +288,7 @@
for i in self.knownWords]))
else:
pywikibot.output(u'Whitelist is not known for language %s'
- % self.site.lang)
+ % self.site.code)
def RunQuery(self, params):
while True:
--
To view, visit https://gerrit.wikimedia.org/r/135319
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3495e3d995afa44557601ef46796bc1f9e9c09db
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: replace site.lang with site.code which is prefered in core
......................................................................
replace site.lang with site.code which is prefered in core
replacements made by compat2core script
Change-Id: I586791e8b4c433e1632d32fbaee4acd9190d976b
---
M scripts/catall.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/catall.py b/scripts/catall.py
index bda6131..15dc8cd 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -65,7 +65,7 @@
cattitle = "%s:%s" % (site.category_namespace(), p)
pllist.append(pywikibot.Page(site, cattitle))
page.put_async(pywikibot.replaceCategoryLinks(page.get(), pllist),
- comment=i18n.twtranslate(site.lang, 'catall-changing'))
+ comment=i18n.twtranslate(site.code, 'catall-changing'))
def main():
--
To view, visit https://gerrit.wikimedia.org/r/135320
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I586791e8b4c433e1632d32fbaee4acd9190d976b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: (bugfix) Don't pass -pageage option through gen.handleArg(), CI
......................................................................
(bugfix) Don't pass -pageage option through gen.handleArg(), CI
- "-pageage" may be recognized by gen.handleArg but it is a local
option only. Calling gen.handleArg() in else clause will solve it
- Show help doc if no generator is given like with -help option
- keep lines < 80 chars
- replace page.get() with more core-like page.text
Change-Id: I3eb84ef9993cfa7c33aa18a3be7576096d5fc7ee
---
M scripts/newitem.py
1 file changed, 32 insertions(+), 15 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/newitem.py b/scripts/newitem.py
index f674d53..c05cdfc 100644
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -29,8 +29,10 @@
"""
Arguments:
* generator - A generator that yields Page objects.
- * pageAge - The minimum number of days that has passed since the page was created
- * lastEdit - The minimum number of days that has passed since the page was last edited
+ * pageAge - The minimum number of days that has passed since
+ the page was created
+ * lastEdit - The minimum number of days that has passed since
+ the page was last edited
"""
self.generator = pagegenerators.PreloadingGenerator(generator)
@@ -44,29 +46,44 @@
"""
Starts the bot.
"""
- pywikibot.output('Page age is set to %s days so only pages created before %s will be considered.' % (self.pageAge, self.pageAgeBefore.isoformat()))
- pywikibot.output('Last edit is set to %s days so only pages last edited before %s will be considered.' % (self.lastEdit, self.lastEditBefore.isoformat()))
+ pywikibot.output('Page age is set to %s days so only pages created'
+ '\nbefore %s will be considered.'
+ % (self.pageAge, self.pageAgeBefore.isoformat()))
+ pywikibot.output('Last edit is set to %s days so only pages last edited'
+ '\nbefore %s will be considered.'
+ % (self.lastEdit, self.lastEditBefore.isoformat()))
for page in self.generator:
pywikibot.output('Processing %s' % page)
item = pywikibot.ItemPage.fromPage(page)
if item.exists():
- pywikibot.output('%s already has an item: %s. Doing a null edit on the page.' % (page, item))
- page.put(page.get())
+ pywikibot.output('%s already has an item: %s.\n'
+ 'Doing a null edit on the page.'
+ % (page, item))
+ page.put(page.text)
elif page.isRedirectPage():
pywikibot.output('%s is a redirect page. Skipping.' % page)
elif page.editTime() > self.lastEditBefore:
- pywikibot.output('Last edit on %s was on %s. Too recent. Skipping.' % (page, page.editTime().isoformat()))
+ pywikibot.output(
+ 'Last edit on %s was on %s.\nToo recent. Skipping.'
+ % (page, page.editTime().isoformat()))
else:
- (revId, revTimestamp, revUser, revComment) = page.getVersionHistory(reverseOrder=True, total=1)[0]
+ (revId, revTimestamp, revUser,
+ revComment) = page.getVersionHistory(reverseOrder=True,
+ total=1)[0]
if revTimestamp > self.pageAgeBefore:
- pywikibot.output('Page creation of %s on %s is too recent. Skipping.' % (page, page.editTime().isoformat()))
+ pywikibot.output(
+ 'Page creation of %s on %s is too recent. Skipping.'
+ % (page, page.editTime().isoformat()))
elif page.langlinks():
# FIXME: Implement this
- pywikibot.output('Found language links (interwiki links). Haven\'t implemented that yet so skipping.')
+ pywikibot.output(
+ "Found language links (interwiki links).\n"
+ "Haven't implemented that yet so skipping.")
else:
# FIXME: i18n
- summary = u'Bot: New item with sitelink from %s' % (page.title(asLink=True, insite=self.repo), )
+ summary = (u'Bot: New item with sitelink from %s'
+ % page.title(asLink=True, insite=self.repo))
data = {'sitelinks':
{item.getdbName(page.site):
@@ -82,7 +99,7 @@
pywikibot.output(summary)
item.editEntity(data, summary=summary)
# And do a null edit to force update
- page.put(page.get())
+ page.put(page.text)
def main():
@@ -98,12 +115,12 @@
pageAge = int(arg[9:])
elif arg.startswith('-lastedit:'):
lastEdit = int(arg[10:])
- if gen.handleArg(arg):
- continue
+ else:
+ gen.handleArg(arg)
generator = gen.getCombinedGenerator()
if not generator:
- # FIXME: Should throw some help
+ pywikibot.showHelp()
return
bot = NewItemRobot(generator, pageAge, lastEdit)
--
To view, visit https://gerrit.wikimedia.org/r/135395
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3eb84ef9993cfa7c33aa18a3be7576096d5fc7ee
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: (bug 65313) deny cosmetic changes with touch edit of newitems.py
......................................................................
(bug 65313) deny cosmetic changes with touch edit of newitems.py
Change-Id: I5cacc15f1653896b6f99f61970854a75d9672cbd
---
M pywikibot/config2.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 757905f..4424e89 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -569,7 +569,7 @@
# Appending the script name also works:
# cosmetic_changes_deny_script.append('your_script_name')
cosmetic_changes_deny_script = ['category_redirect', 'cosmetic_changes',
- 'touch']
+ 'newitem', 'touch']
# ############# REPLICATION BOT ################
# You can add replicate_replace to your user_config.py, which has the following
--
To view, visit https://gerrit.wikimedia.org/r/135391
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5cacc15f1653896b6f99f61970854a75d9672cbd
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
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: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: move userlib to pywikibot.compat, bugfix for interwiki.py
......................................................................
move userlib to pywikibot.compat, bugfix for interwiki.py
compat folder contains compatibility libraries from compat like
query and catlib.userlib is part of page.py and this deprecated
library should also placed here.
Change-Id: If697c3e294e3e69fb7224db76742906908cdb7a2
---
M README-conversion.txt
R pywikibot/compat/userlib.py
M scripts/interwiki.py
3 files changed, 3 insertions(+), 3 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index f70e7f2..b193c36 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -30,6 +30,7 @@
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/pywikibot/userlib.py b/pywikibot/compat/userlib.py
similarity index 100%
rename from pywikibot/userlib.py
rename to pywikibot/compat/userlib.py
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 3edaa55..96f4fe7 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -1727,7 +1727,7 @@
continue
mods, mcomment, adding, removing, modifying \
= compareLanguages(old, new, insite=site)
- #cannot create userlib.User with IP
+ #cannot create pywikibot.User with IP
smallWikiAllowed = (
page.isIpEdit() or
len(removing) > 0 or
@@ -1739,8 +1739,7 @@
)
)
if not smallWikiAllowed:
- import userlib
- user = userlib.User(page.site, page.userName())
+ user = pywikibot.User(page.site, page.userName())
# erstmal auch keine namen mit bot
if 'bot' not in user.groups() \
and 'bot' not in page.userName().lower():
--
To view, visit https://gerrit.wikimedia.org/r/135209
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If697c3e294e3e69fb7224db76742906908cdb7a2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Alex S.H. Lin <alexsh(a)mail2000.com.tw>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Russell Blau <russblau(a)imapmail.org>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Page.site is a property
......................................................................
Page.site is a property
Page.site() is unknown in core
Change-Id: If91625baa6f88d2768239c7482e506f059327102
---
M README-conversion.txt
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/README-conversion.txt b/README-conversion.txt
index c3c69cb..ae5966d 100644
--- a/README-conversion.txt
+++ b/README-conversion.txt
@@ -77,7 +77,7 @@
- titleWithoutNamespace(): replaced by Page.title(withNamespace=False)
- sectionFreeTitle(): replaced by Page.title(withSection=False)
- aslink(): replaced by Page.title(asLink=True)
-- encoding(): replaced by Page.site().encoding()
+- encoding(): replaced by Page.site.encoding()
The following methods of the Page object have been obsoleted and no longer
work (but these methods don't appear to be used anywhere in the code
--
To view, visit https://gerrit.wikimedia.org/r/134593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If91625baa6f88d2768239c7482e506f059327102
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: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: harvest_template.py perf: dont parse and discard
......................................................................
harvest_template.py perf: dont parse and discard
Currently the wikipage is parsed even when all of the parsed values
will be discarded. This is slow and noisy.
When an item has claims for all properties to be processed,
skip the item before fetching and parsing the wikitext.
Improve existing claim merge TODO to properly describe the complexity.
Change-Id: Ib3df4cce7125591e8fa585d18988e2a605456a09
---
M scripts/harvest_template.py
1 file changed, 6 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index d85084e..65ec3b3 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -94,6 +94,9 @@
if not item.exists():
pywikibot.output('%s doesn\'t have a wikidata item :(' % page)
#TODO FIXME: We should provide an option to create the page
+ item.get()
+ if set(self.fields.values()) <= set(item.claims.keys()):
+ pywikibot.output('%s item %s has claims for all properties. Skipping' % (page, item.title()))
else:
pagetext = page.get()
templates = pywikibot.extract_templates_and_params(pagetext)
@@ -121,8 +124,9 @@
pywikibot.output(
u'A claim for %s already exists. Skipping'
% claim.getID())
- # TODO FIXME: This is a very crude way of dupe
- # checking
+ # TODO: Implement smarter approach to merging
+ # harvested values with existing claims esp.
+ # without overwriting humans unintentionally.
else:
if claim.getType() == 'wikibase-item':
# Try to extract a valid page
--
To view, visit https://gerrit.wikimedia.org/r/135314
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3df4cce7125591e8fa585d18988e2a605456a09
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>