jenkins-bot has submitted this change and it was merged.
Change subject: Use raise Err(...) instead of raise Err, ...
......................................................................
Use raise Err(...) instead of raise Err, ...
Change-Id: Ia08d34e42c476f3a196d54413c251ae0d6721103
---
M scripts/replace.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py
index e02cb0c..c0686ba 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -544,7 +544,7 @@
pywikibot.Site().login()
gen = genFactory.getCombinedGenerator()
if (len(commandline_replacements) % 2):
- raise pywikibot.Error, 'require even number of replacements.'
+ raise pywikibot.Error('require even number of replacements.')
elif (len(commandline_replacements) == 2 and fix is None):
replacements.append((commandline_replacements[0],
commandline_replacements[1]))
--
To view, visit https://gerrit.wikimedia.org/r/98280
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia08d34e42c476f3a196d54413c251ae0d6721103
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Ignore obsolete sites from beeing processed
......................................................................
Ignore obsolete sites from beeing processed
Wikidata may contain links to obsolete sites which raises an error.
Now we check this exception and ignore that site.
Change-Id: Ie0e7afbc2b17e4c56a6688203af03a4e5aa993a1
---
M scripts/featured.py
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/featured.py b/scripts/featured.py
index bffea39..2a24c43 100644
--- a/scripts/featured.py
+++ b/scripts/featured.py
@@ -312,6 +312,9 @@
except KeyboardInterrupt:
pywikibot.output('\nQuitting featured treat...')
break
+ except pywikibot.NoSuchSite:
+ pywikibot.output('"%s" is not a valid site. Skipping...' % code)
+ continue
self.writecache()
# not implemented yet
@@ -349,6 +352,9 @@
except KeyboardInterrupt:
pywikibot.output('\nQuitting featured treat...')
break
+ except pywikibot.NoSuchSite:
+ pywikibot.output('"%s" is not a valid site. Skipping...' % code)
+ continue
self.writecache()
def treat(self, code, process):
--
To view, visit https://gerrit.wikimedia.org/r/98152
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0e7afbc2b17e4c56a6688203af03a4e5aa993a1
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: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: [BUGFIX] Link._site is a site object and is not callable
......................................................................
[BUGFIX] Link._site is a site object and is not callable
Change-Id: I50f2d1f3b151919b1a3c4dabaa75d5a11b64966e
---
M pywikibot/page.py
1 file changed, 3 insertions(+), 2 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 1db43d3..02ae13f 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -1656,7 +1656,8 @@
in self.getFileVersionHistory():
lines.append(u'| %s || %s || %s || %s || <nowiki>%s</nowiki>'
% (datetime, username, resolution, size, comment))
- return u'{| border="1"\n! date/time || username || resolution || size || edit summary\n|----\n' + u'\n|----\n'.join(lines) + '\n|}'
+ return u'{| border="1"\n! date/time || username || resolution || size || edit summary\n|----\n' + \
+ u'\n|----\n'.join(lines) + '\n|}'
def usingPages(self, step=None, total=None, content=False):
"""Yield Pages on which the image is displayed.
@@ -3208,7 +3209,7 @@
"""\
%s is not a local page on %s, and the %s family is
not supported by PyWikiBot!"""
- % (self._text, self._site(), familyName))
+ % (self._text, self._site, familyName))
# Redundant interwiki prefix to the local wiki
if newsite == self._site:
--
To view, visit https://gerrit.wikimedia.org/r/98151
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I50f2d1f3b151919b1a3c4dabaa75d5a11b64966e
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: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: (PEP8] changes
......................................................................
(PEP8] changes
Change-Id: I40d16980fc53104246eeaf7a1c5743172bfc57a2
---
M unlink.py
1 file changed, 33 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/unlink.py b/unlink.py
index 8448479..cfce090 100644
--- a/unlink.py
+++ b/unlink.py
@@ -21,8 +21,13 @@
Removes links to the page [[Foo bar]] in articles and image descriptions.
"""
-
-__version__='$Id$'
+#
+# (C) Pywikibot team, 2007-2013
+#
+# Distributed under the terms of the MIT license.
+#
+__version__ = '$Id$'
+#
import re
import wikipedia as pywikibot
@@ -37,22 +42,32 @@
self.pageToUnlink = pageToUnlink
gen = pagegenerators.ReferringPageGenerator(pageToUnlink)
if namespaces != []:
- gen = pagegenerators.NamespaceFilterPageGenerator(gen, namespaces)
- self.generator = pagegenerators.PreloadingGenerator(gen)
+ gen = pagegenerators.NamespaceFilterPageGenerator(gen, namespaces)
+ self.generator = pagegenerators.PreloadingGenerator(gen)
linktrail = pywikibot.getSite().linktrail()
- # The regular expression which finds links. Results consist of four groups:
- # group title is the target page title, that is, everything before | or ].
- # group section is the page section. It'll include the # to make life easier for us.
- # group label is the alternative link title, that's everything between | and ].
- # group linktrail is the link trail, that's letters after ]] which are part of the word.
+ # The regular expression which finds links. Results consist of four
+ # groups:
+ #
+ # group title is the target page title, that is, everything
+ # before | or ].
+ #
+ # group section is the page section.
+ # It'll include the # to make life easier for us.
+ #
+ # group label is the alternative link title, that's everything
+ # between | and ].
+ #
+ # group linktrail is the link trail, that's letters after ]] which are
+ # part of the word.
# note that the definition of 'letter' varies from language to language.
- self.linkR = re.compile(r'\[\[(?P<title>[^\]\|#]*)(?P<section>#[^\]\|]*)?(\|(?P<label>[^\]]*))?\]\](?P<linktrail>' + linktrail + ')')
+ self.linkR = re.compile(r'\[\[(?P<title>[^\]\|#]*)(?P<section>#[^\]\|]*)?(\|(?P<label>[^\]]*))?\]\](?P<linktrail>%s)'
+ % linktrail)
self.always = always
self.done = False
self.comment = i18n.twtranslate(pywikibot.getSite(), 'unlink-unlinking',
self.pageToUnlink.title())
- def handleNextLink(self, text, match, context = 100):
+ def handleNextLink(self, text, match, context=100):
"""
Returns a tuple (text, jumpToBeginning).
text is the unicode string after the current link has been processed.
@@ -79,9 +94,9 @@
choice = 'a'
else:
pywikibot.output(
- text[max(0, match.start() - context) : match.start()] \
- + '\03{lightred}' + text[match.start() : match.end()] \
- + '\03{default}' + text[match.end() : match.end() + context])
+ text[max(0, match.start() - context):match.start()]
+ + '\03{lightred}' + text[match.start():match.end()]
+ + '\03{default}' + text[match.end():match.end() + context])
choice = pywikibot.inputChoice(
u'\nWhat shall be done with this link?\n',
['unlink', 'skip', 'edit', 'more context',
@@ -94,7 +109,7 @@
return text, False
elif choice == 'e':
editor = editarticle.TextEditor()
- newText = editor.edit(text, jumpIndex = match.start())
+ newText = editor.edit(text, jumpIndex=match.start())
# if user didn't press Cancel
if newText:
return newText, True
@@ -123,7 +138,7 @@
text = oldText
curpos = 0
while curpos < len(text):
- match = self.linkR.search(text, pos = curpos)
+ match = self.linkR.search(text, pos=curpos)
if not match:
break
# Make sure that next time around we will not find this same
@@ -148,7 +163,8 @@
def run(self):
for page in self.generator:
- if self.done: break
+ if self.done:
+ break
self.treat(page)
--
To view, visit https://gerrit.wikimedia.org/r/98262
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I40d16980fc53104246eeaf7a1c5743172bfc57a2
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot