Xqt has submitted this change and it was merged.
Change subject: [PEP8] changes
......................................................................
[PEP8] changes
Change-Id: I995ecb3eecbd48299271d8767c918e01f90ba663
---
M table2wiki.py
1 file changed, 54 insertions(+), 49 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/table2wiki.py b/table2wiki.py
index fa4b233..d2bd61e 100644
--- a/table2wiki.py
+++ b/table2wiki.py
@@ -48,17 +48,21 @@
"""
#
# (C) 2003 Thomas R. Koll, <tomk32(a)tomk32.de>
-# (C) Pywikipedia bot team, 2003-2010
+# (C) Pywikibot team, 2003-2013
#
# Distributed under the terms of the MIT license.
#
-__version__='$Id$'
+__version__ = '$Id$'
#
-import re, sys, time
+import re
+import sys
+import time
+
import wikipedia as pywikibot
from pywikibot import i18n
-import config, pagegenerators
+import config
+import pagegenerators
# This is required for the text that is shown when you run this script
# with the parameter -help.
@@ -82,22 +86,23 @@
if tableTagR.search(entry.text):
yield pywikibot.Page(pywikibot.getSite(), entry.title)
+
class Table2WikiRobot:
- def __init__(self, generator, quietMode = False):
+ def __init__(self, generator, quietMode=False):
self.generator = generator
self.quietMode = quietMode
def convertTable(self, table):
- '''
- Converts an HTML table to wiki syntax. If the table already is a wiki
- table or contains a nested wiki table, tries to beautify it.
+ """ Converts an HTML table to wiki syntax. If the table already is a
+ wiki table or contains a nested wiki table, tries to beautify it.
Returns the converted table, the number of warnings that occured and
a list containing these warnings.
- Hint: if you give an entire page text as a parameter instead of a table only,
- this function will convert all HTML tables and will also try to beautify all
- wiki tables already contained in the text.
- '''
+ Hint: if you give an entire page text as a parameter instead of a table
+ only, this function will convert all HTML tables and will also try to
+ beautify all wiki tables already contained in the text.
+
+ """
warnings = 0
# this array will contain strings that will be shown in case of possible
# errors, before the user is asked if he wants to accept the changes.
@@ -112,7 +117,6 @@
##################
# every open-tag gets a new line.
-
##################
# Note that we added the ## characters in markActiveTables().
@@ -140,7 +144,7 @@
r"\r\n|+\g<attr> | \g<caption>", newTable)
# caption without attributes
newTable = re.sub("(?i)<caption>(?P<caption>[\w\W]*?)<\/caption>",
- r"\r\n|+ \g<caption>", newTable)
+ r"\r\n|+ \g<caption>", newTable)
##################
# <th> often people don't write them within <tr>, be warned!
@@ -151,13 +155,13 @@
# <th> without attributes
newTable = re.sub("(?i)[\r\n]+<th>(?P<header>[\w\W]*?)<\/th>",
- r"\r\n! \g<header>\r\n", newTable)
+ r"\r\n! \g<header>\r\n", newTable)
# fail save. sometimes people forget </th>
# <th> without attributes, without closing </th>
newTable, n = re.subn("(?i)[\r\n]+<th>(?P<header>[\w\W]*?)[\r\n]+",
- r"\r\n! \g<header>\r\n", newTable)
- if n>0:
+ r"\r\n! \g<header>\r\n", newTable)
+ if n > 0:
warning_messages.append(
u'WARNING: found <th> without </th>. (%d occurences)\n' % n)
warnings += n
@@ -166,11 +170,10 @@
newTable, n = re.subn(
"(?i)[\r\n]+<th(?P<attr> [^>]*?)>(?P<header>[\w\W]*?)[\r\n]+",
r"\n!\g<attr> | \g<header>\r\n", newTable)
- if n>0:
+ if n > 0:
warning_messages.append(
u'WARNING: found <th ...> without </th>. (%d occurences\n)' % n)
warnings += n
-
##################
# <tr> with attributes
@@ -197,7 +200,7 @@
# TODO: some more docu please
newTable, n = re.subn("(?i)[\r\n]+<td>(?P<cell>[^\r\n]*?)<td>",
r"\r\n| \g<cell>\r\n", newTable)
- if n>0:
+ if n > 0:
warning_messages.append(
u'<td> used where </td> was expected. (%d occurences)\n' % n)
warnings += n
@@ -207,33 +210,33 @@
# "\r\n| \\2\r\n", newTable)
# newTable, n = re.subn("[\r\n]+<(td|TD)([^>]*?)>([^<]*?)<(td|TD)><\/(tr|TR)>",
# "\r\n|\\2| \\3\r\n", newTable)
- # if n>0:
+ # if n > 0:
# warning_messages.append(u'WARNING: found <td><td></tr>, but no </td>. (%d occurences)\n' % n)
# warnings += n
# what is this for?
newTable, n = re.subn("[\r\n]+<(td|TD)([^>]+?)>([^\r\n]*?)<\/(td|TD)>",
- r"\r\n|\2 | \3\r\n", newTable)
- if n>0:
+ r"\r\n|\2 | \3\r\n", newTable)
+ if n > 0:
warning_messages.append(
- u'WARNING: (sorry, bot code unreadable (1). I don\'t know why this warning is given.) (%d occurences)\n' % n)
+ u"WARNING: (sorry, bot code unreadable (1). I don't know why "
+ u"this warning is given.) (%d occurences)\n" % n)
# fail save. sometimes people forget </td>
# <td> without arguments, with missing </td>
newTable, n = re.subn("(?i)<td>(?P<cell>[^<]*?)[\r\n]+",
- r"\r\n| \g<cell>\r\n", newTable)
- if n>0:
- warning_messages.append(
- u'NOTE: Found <td> without </td>. This shouldn\'t cause problems.\n')
+ r"\r\n| \g<cell>\r\n", newTable)
+ if n > 0:
+ warning_messages.append(u"NOTE: Found <td> without </td>. This "
+ u"shouldn't cause problems.\n")
# <td> with attributes, with missing </td>
newTable, n = re.subn(
"(?i)[\r\n]*<td(?P<attr> [^>]*?)>(?P<cell>[\w\W]*?)[\r\n]+",
r"\r\n|\g<attr> | \g<cell>\r\n", newTable)
if n > 0:
- warning_messages.append(
- u'NOTE: Found <td> without </td>. This shouldn\'t cause problems.\n')
-
+ warning_messages.append(u"NOTE: Found <td> without </td>. This "
+ u"shouldn't cause problems.\n")
##################
# Garbage collecting ;-)
@@ -252,12 +255,11 @@
# "\\1|-----\r\n\\2", newTable)
# warnings = warnings + n
-
##################
# most <th> come with '''title'''. Senseless in my eyes cuz
# <th> should be bold anyways.
newTable = re.sub("[\r\n]+\!([^'\n\r]*)'''([^'\r\n]*)'''",
- r"\r\n!\1\2", newTable)
+ r"\r\n!\1\2", newTable)
##################
# kills indention within tables. Be warned, it might seldom bring
@@ -275,11 +277,10 @@
# newTable = re.sub("[\r\n]+\|[\t ]+?[\r\n]+", "\r\n| ", newTable)
# kills trailing spaces and tabs
newTable = re.sub("\r\n(.*)[\t\ ]+[\r\n]+",
- r"\r\n\1\r\n", newTable)
+ r"\r\n\1\r\n", newTable)
# kill extra new-lines
newTable = re.sub("[\r\n]{4,}(\!|\|)",
- r"\r\n\1", newTable);
-
+ r"\r\n\1", newTable)
##################
# shortening if <table> had no arguments/parameters
@@ -300,7 +301,8 @@
# pairs where the value already has correct quotation marks, and
# finally the key of the attribute we want to fix here.
# group 2 is the value of the attribute we want to fix here.
- # We recognize it by searching for a string of non-whitespace characters
+ # We recognize it by searching for a string of non-whitespace
+ # characters
# - [^\s]+? - which is not embraced by quotation marks - [^"]
newTable, num = re.subn(
r'([\r\n]+(?:\|-|\{\|)[^\r\n\|]+) *= *([^"\s>]+)',
@@ -308,9 +310,9 @@
num = 1
while num != 0:
- # The same for header and cell tags ( ! or | ), but for these tags the
- # attribute part is finished by a | character. We don't want to change
- # cell contents which accidentially contain an equal sign.
+ # The same for header and cell tags ( ! or | ), but for these tags
+ # the attribute part is finished by a | character. We don't want to
+ # change cell contents which accidentially contain an equal sign.
# Group 1 and 2 are anologously to the previous regular expression,
# group 3 are the remaining attribute key - value pairs.
newTable, num = re.subn(
@@ -328,16 +330,17 @@
####
# add a new line if first is * or #
newTable = re.sub("[\r\n]+\| ([*#]{1})",
- r"\r\n|\r\n\1", newTable)
+ r"\r\n|\r\n\1", newTable)
##################
# strip <center> from <th>
newTable = re.sub("([\r\n]+\![^\r\n]+?)<center>([\w\W]+?)<\/center>",
- r"\1 \2", newTable)
+ r"\1 \2", newTable)
# strip align="center" from <th> because the .css does it
- # if there are no other attributes than align, we don't need that | either
+ # if there are no other attributes than align, we don't need
+ # that | either
newTable = re.sub("([\r\n]+\! +)align\=\"center\" +\|",
- r"\1", newTable)
+ r"\1", newTable)
# if there are other attributes, simply strip the align="center"
newTable = re.sub(
"([\r\n]+\![^\r\n\|]+?)align\=\"center\"([^\n\r\|]+?\|)",
@@ -409,7 +412,7 @@
print "More opening than closing table tags. Skipping."
return None, 0, 0
# if another table tag is opened before one is closed
- elif nextStarting and nextStarting.start() < nextEnding.start():
+ elif nextStarting and nextStarting.start() < nextEnding.start():
offset += nextStarting.end()
text = text[nextStarting.end():]
depth += 1
@@ -439,7 +442,8 @@
break
pywikibot.output(">> Table %i <<" % (convertedTables + 1))
# convert the current table
- newTable, warningsThisTable, warnMsgsThisTable = self.convertTable(table)
+ newTable, warningsThisTable, warnMsgsThisTable = self.convertTable(
+ table)
# show the changes for this table
if not self.quietMode:
pywikibot.showDiff(table.replace('##table##', 'table'),
@@ -452,7 +456,6 @@
convertedTables += 1
pywikibot.output(warningMessages)
-
return text, convertedTables, warningSum
def treat(self, page):
@@ -489,7 +492,8 @@
if config.table2wikiSkipWarnings:
doUpload = True
else:
- print "There were %i replacement(s) that might lead to bad output." % warningSum
+ print("There were %i replacement(s) that might lead to bad "
+ "output.") % warningSum
doUpload = (pywikibot.input(
u'Do you want to change the page anyway? [y|N]') == "y")
if doUpload:
@@ -507,8 +511,9 @@
for page in self.generator:
self.treat(page)
+
def main():
- quietMode = False # use -quiet to get less output
+ quietMode = False # use -quiet to get less output
# if the -file argument is used, page titles are stored in this array.
# otherwise it will only contain one page.
articles = []
--
To view, visit https://gerrit.wikimedia.org/r/98077
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I995ecb3eecbd48299271d8767c918e01f90ba663
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
Xqt has submitted this change and it was merged.
Change subject: Set main namespace name to '' instead of None
......................................................................
Set main namespace name to '' instead of None
This should solve http://lists.wikimedia.org/pipermail/pywikipedia-l/2013-July/008060.html
Change-Id: Ifb045de24009e4675f14da45c5cbee3e8af664a0
---
M family.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
diff --git a/family.py b/family.py
index c0d237f..30e2bed 100644
--- a/family.py
+++ b/family.py
@@ -497,7 +497,7 @@
'zh-yue': [u'Special', u'特別', u'特殊'],
},
0: {
- '_default': None,
+ '_default': '',
},
1: {
'_default': u'Talk',
--
To view, visit https://gerrit.wikimedia.org/r/97724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifb045de24009e4675f14da45c5cbee3e8af664a0
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: 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: Removed 'UntaggedPageGenerator does not exist' warnings
......................................................................
Removed 'UntaggedPageGenerator does not exist' warnings
Change-Id: Iac41aa4833aa6f204966aaa9e3e6d13f133093e8
Original-Change-Id: Ib7e8a545334d11b73e93a740b39690520ef209f6
---
M scripts/add_text.py
1 file changed, 2 insertions(+), 12 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/add_text.py b/scripts/add_text.py
index 8eccc5e..c865be8 100644
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -29,9 +29,6 @@
-newimages Add text in the new images
--untagged Add text in the images that don't have any license template
- (Not yet supported)
-
-always If used, the bot won't ask if it should add the text
specified
@@ -67,7 +64,7 @@
#
# (C) Filnik, 2007-2010
-# (C) Pywikipedia bot team, 2007-2013
+# (C) Pywikibot team, 2007-2013
#
# Distributed under the terms of the MIT license.
#
@@ -77,6 +74,7 @@
import re
import webbrowser
import codecs
+
import pywikibot
from pywikibot import config
from pywikibot import i18n
@@ -330,14 +328,6 @@
regexSkip = pywikibot.input(u'What text should I skip?')
else:
regexSkip = arg[8:]
-## *** NOT YET SUPPORTED ***
-## elif arg.startswith('-untagged'):
-## if len(arg) == 9:
-## untaggedProject = pywikibot.input(
-## u'What project do you want to use?')
-## else:
-## untaggedProject = arg[10:]
-## generator = untaggedGenerator(untaggedProject)
elif arg == '-up':
up = True
elif arg == '-noreorder':
--
To view, visit https://gerrit.wikimedia.org/r/97997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iac41aa4833aa6f204966aaa9e3e6d13f133093e8
Gerrit-PatchSet: 3
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)googlemail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Synchronize date.py with compat, disable automatic check.
......................................................................
Synchronize date.py with compat, disable automatic check.
update from compat e29d4a7b6d9e8106fa21388acbd5e9689d05cbd6
SVN release 9834
Change-Id: If7c889228ecd4cbfc7f391a44d38bf5988b818be
---
M pywikibot/date.py
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 4aaf983..410540d 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -2400,6 +2400,6 @@
else:
print(u'Date module has been fully tested')
-# Do a quick test upon module loading!
-# Make sure the date file is correct
-test(quick=True)
+if __name__=="__main__":
+ # Test the date file
+ test(quick=False)
--
To view, visit https://gerrit.wikimedia.org/r/95201
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If7c889228ecd4cbfc7f391a44d38bf5988b818be
Gerrit-PatchSet: 4
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: Added UntaggedPageGenerator
......................................................................
Added UntaggedPageGenerator
Change-Id: Ib7e8a545334d11b73e93a740b39690520ef209f6
---
M pywikibot/pagegenerators.py
1 file changed, 38 insertions(+), 4 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 1970294..4033f68 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -20,14 +20,16 @@
__version__ = '$Id$'
#
-import re
import codecs
-import itertools
-import pywikibot
-import time
import date
+import itertools
+import re
+import time
+
+import pywikibot
from pywikibot import config
from pywikibot import deprecate_arg, i18n
+from pywikibot.comms import http
# ported from version 1 for backwards-compatibility
@@ -151,6 +153,11 @@
[[Special:RandomRedirect]]. Can also be given as
"-randomredirect:n" where n is the number of pages to be
returned, else 10 pages are returned.
+
+-untagged Work on image pages that don't have any license template on a
+ site given in the format "<language>.<project>.org, e.g.
+ "ja.wikipedia.org" or "commons.wikimedia.org".
+ Using an external Toolserver tool.
-google Work on all pages that are found in a Google search.
You need a Google Web API license key. Note that Google
@@ -480,6 +487,8 @@
self.articlefilter = arg[6:]
elif arg.startswith('-yahoo'):
gen = YahooSearchPageGenerator(arg[7:])
+ elif arg.startswith('-untagged'):
+ gen = UntaggedPageGenerator(arg[10:])
else:
pass
if gen:
@@ -1028,6 +1037,31 @@
for page in site.search(query, step=step, total=total, namespaces=namespaces):
yield page
+
+def UntaggedPageGenerator(untaggedProject, limit=500):
+ """ Function to get the pages returned by this tool:
+ http://toolserver.org/~daniel/WikiSense/UntaggedImages.php
+ """
+ URL = "http://toolserver.org/~daniel/WikiSense/UntaggedImages.php?"
+ REGEXP = r"<td valign='top' title='Name'><a href='http://.*?" \
+ "\.org/w/index\.php\?title=(.*?)'>.*?</a></td>"
+ lang, project = untaggedProject.split('.', 1)
+ if lang == 'commons':
+ wiki = 'wikifam=commons.wikimedia.org'
+ else:
+ wiki = 'wikilang=%s&wikifam=.%s' % (lang, project)
+ link = '%s&%s&max=%d&order=img_timestamp' % (URL, wiki, limit)
+ results = re.findall(REGEXP, http.request(site=None, uri=link))
+ if not results:
+ print link
+ raise pywikibot.Error(
+ 'Nothing found! Try to use the tool by yourself to be sure that it '
+ 'works!')
+ else:
+ for result in results:
+ yield pywikibot.Page(pywikibot.getSite(), result)
+
+
# following classes just ported from version 1 without revision; not tested
--
To view, visit https://gerrit.wikimedia.org/r/95209
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib7e8a545334d11b73e93a740b39690520ef209f6
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Pyfisch <pyfisch(a)googlemail.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: Extended comms/http.py so that it can also be used for non wiki site requests
......................................................................
Extended comms/http.py so that it can also be used for non wiki site requests
Original-Change-Id: Ib7e8a545334d11b73e93a740b39690520ef209f6
Change-Id: Ifc9e29ce43cce63eff305b956da40b4e41f273f9
---
M pywikibot/comms/http.py
1 file changed, 14 insertions(+), 7 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 1dee9ec..a4ad829 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -95,20 +95,27 @@
All parameters not listed below are the same as
L{httplib2.Http.request}, but the uri is relative
+ If the site argument is None the uri has to be absolute and is
+ taken. In this case ssl is ignored. Used for requests to non wiki
+ pages.
+
@param site: The Site to connect to
@param uri: the URI to retrieve (relative to the site's scriptpath)
@param ssl: Use https connection
@return: The received data (a unicode string).
"""
- if ssl:
- proto = "https"
- host = site.ssl_hostname()
- uri = site.ssl_pathprefix() + uri
+ if site:
+ if ssl:
+ proto = "https"
+ host = site.ssl_hostname()
+ uri = site.ssl_pathprefix() + uri
+ else:
+ proto = site.protocol()
+ host = site.hostname()
+ baseuri = urlparse.urljoin("%(proto)s://%(host)s" % locals(), uri)
else:
- proto = site.protocol()
- host = site.hostname()
- baseuri = urlparse.urljoin("%(proto)s://%(host)s" % locals(), uri)
+ baseuri = uri
# set default user-agent string
kwargs.setdefault("headers", {})
--
To view, visit https://gerrit.wikimedia.org/r/97996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc9e29ce43cce63eff305b956da40b4e41f273f9
Gerrit-PatchSet: 1
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: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)googlemail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change and it was merged.
Change subject: Improvements to listpages.py
......................................................................
Improvements to listpages.py
1. Structure of listpages.py now like in other scripts.
2. Removed uneeded except part which caused bad output.
3. Fixed typing error. parameterd -> parameters
Change-Id: Iacc0e929482b4baac12a078bdc9faf813f773444
---
M scripts/listpages.py
1 file changed, 17 insertions(+), 19 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/listpages.py b/scripts/listpages.py
index 2cb668b..96bc235 100644
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Print a list of pages, as defined by page generator parameterd
+Print a list of pages, as defined by page generator parameters
These parameters are supported to specify which pages titles to print:
@@ -20,23 +20,21 @@
def main(*args):
- try:
- gen = None
- genFactory = GeneratorFactory()
- for arg in pywikibot.handleArgs(*args):
- genFactory.handleArg(arg)
- gen = genFactory.getCombinedGenerator()
- if gen:
- i = 0
- for page in gen:
- i += 1
- pywikibot.stdout("%4d: %s" % (i, page.title()))
- else:
- pywikibot.showHelp()
- except Exception:
- pywikibot.error("Fatal error", exc_info=True)
- finally:
- pywikibot.stopme()
+ gen = None
+ genFactory = GeneratorFactory()
+ for arg in pywikibot.handleArgs(*args):
+ genFactory.handleArg(arg)
+ gen = genFactory.getCombinedGenerator()
+ if gen:
+ i = 0
+ for page in gen:
+ i += 1
+ pywikibot.stdout("%4d: %s" % (i, page.title()))
+ else:
+ pywikibot.showHelp()
if __name__ == "__main__":
- main()
+ try:
+ main()
+ finally:
+ pywikibot.stopme()
--
To view, visit https://gerrit.wikimedia.org/r/94605
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iacc0e929482b4baac12a078bdc9faf813f773444
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Pyfisch <pyfisch(a)googlemail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Pyfisch <pyfisch(a)googlemail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot