jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/460757 )
Change subject: [bugfix] use Site.lang property for targetSite
......................................................................
[bugfix] use Site.lang property for targetSite
- Creating Site object for targetSite fails due to the deprecated method
"language" is passed to the Site() creator instead of the method's result.
Do not use deprecated Site.language method but the lang property instead.
- Use image_repository instead of the hardcoded Site.
Bug: T204445
Change-Id: I8e18b43c4bcc693fb82e900f2ffb2f2400783f20
---
M scripts/imagetransfer.py
1 file changed, 4 insertions(+), 6 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index 6f606df..c14431f 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -312,14 +312,12 @@
pywikibot.bot.suggest_help(missing_parameters=['page'])
return False
+ site = pywikibot.Site()
if not targetLang and not targetFamily:
- targetSite = pywikibot.Site('commons', 'commons')
+ targetSite = site.image_repository()
else:
- if not targetLang:
- targetLang = pywikibot.Site().language
- if not targetFamily:
- targetFamily = pywikibot.Site().family
- targetSite = pywikibot.Site(targetLang, targetFamily)
+ targetSite = pywikibot.Site(targetLang or site.lang,
+ targetFamily or site.family)
bot = ImageTransferBot(gen, interwiki=interwiki, targetSite=targetSite,
keep_name=keep_name)
bot.run()
--
To view, visit https://gerrit.wikimedia.org/r/460757
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: I8e18b43c4bcc693fb82e900f2ffb2f2400783f20
Gerrit-Change-Number: 460757
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/461932 )
Change subject: Temporarily add vcrpy!=2.0.0 as requirement for nose-detecthttp
......................................................................
Temporarily add vcrpy!=2.0.0 as requirement for nose-detecthttp
nose-detecthttp requires vcrpy. vcrpy 2.0.0 has had a breaking change which
makes it incompatible with Python<3.5.[1]
The root issue should be fixed upstream, but till then avoid vcrpy 2.0.0.
[1]: https://github.com/kevin1024/vcrpy/issues/393
Bug: T205073
Change-Id: I391bddea1dcfa0c9f214aa6ecc3827423199f904
---
M tox.ini
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tox.ini b/tox.ini
index 599af03..ac1e6e0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -77,6 +77,8 @@
deps =
nose
nose-detecthttp
+ # Temporary requirement. Should be fixed in vcrpy or required in nose-detecthttp.
+ vcrpy!=2.0.0
unicodecsv
mock
@@ -91,6 +93,8 @@
beautifulsoup4
nose
nose-detecthttp>=0.1.3
+ # Temporary requirement. Should be fixed in vcrpy or required in nose-detecthttp.
+ vcrpy!=2.0.0
six
mock
--
To view, visit https://gerrit.wikimedia.org/r/461932
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: I391bddea1dcfa0c9f214aa6ecc3827423199f904
Gerrit-Change-Number: 461932
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: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/312729 )
Change subject: Added -first to solve_disambiguation.py
......................................................................
Added -first to solve_disambiguation.py
The -first option from compat added to core/scripts/solve_disambiguation.py
Bug: T144694
Change-Id: I1e845a2e201f59799ce47d51aff99c14b9065436
---
M scripts/solve_disambiguation.py
1 file changed, 55 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index d08a7e0..823f513 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -53,6 +53,15 @@
-main only check pages in the main namespace, not in the talk,
wikipedia, user, etc. namespaces.
+ -first Uses only the first link of every line on the disambiguation
+ page that begins with an asterisk. Useful if the page is full
+ of irrelevant links that are not subject to disambiguation.
+ You won't get all af them as options, just the first on each
+ line. For a moderated example see
+ http://en.wikipedia.org/wiki/Szerdahely
+ A really exotic one is
+ http://hu.wikipedia.org/wiki/Brabant_(egyértelműsítő lap)
+
-start:XY goes through all disambiguation pages in the category on your
wiki that is defined (to the bot) as the category containing
disambiguation pages, starting at XY. If only '-start' or
@@ -618,7 +627,7 @@
}
def __init__(self, always, alternatives, getAlternatives, dnSkip,
- generator, primary, main_only, minimum=0):
+ generator, primary, main_only, first_only, minimum=0):
"""Initializer."""
super(DisambiguationRobot, self).__init__()
self.always = always
@@ -628,6 +637,7 @@
self.generator = generator
self.primary = primary
self.main_only = main_only
+ self.first_only = first_only
self.minimum = minimum
self.mysite = self.site
@@ -694,6 +704,40 @@
(?P<linktrail>%s)''' % linktrail,
flags=re.X)
+ @staticmethod
+ def firstlinks(page):
+ """Return a list of first links of every line beginning with *.
+
+ When a disambpage is full of unnecessary links, this may be useful
+ to sort out the relevant links. E.g. from line
+ *[[Jim Smith (smith)|Jim Smith]] ([[1832]]-[[1932]]) [[English]]
+ it returns only 'Jim Smith (smith)'
+ Lines without an asterisk at the beginning will be disregarded.
+ No check for page existence, it has already been done.
+ """
+ links = []
+ reg = re.compile(r'\*.*?\[\[(.*?)(?:\||\]\])')
+ for line in page.get().splitlines():
+ found = reg.match(line)
+ if found:
+ links.append(found.group(1))
+ return links
+
+ def firstize(self, page, links):
+ """Call firstlinks and remove extra links.
+
+ This will remove a lot of silly redundant links from overdecorated
+ disambiguation pages and leave the first link of each asterisked
+ line only. This must be done if -first is used in command line.
+
+ """
+ titles = [firstcap(t) for t in self.firstlinks(page)]
+ links = list(links)
+ for l in links[:]: # uses a copy because of remove!
+ if l.title() not in titles:
+ links.remove(l)
+ return links
+
def treat_links(self, refPage, disambPage):
"""Resolve the links to disambPage or its redirects.
@@ -1011,6 +1055,8 @@
disambPage2 = pywikibot.Page(
pywikibot.Link(disambTitle, self.mysite))
links = disambPage2.linkedPages()
+ if self.first_only:
+ links = self.firstize(disambPage2, links)
links = [correctcap(l, disambPage2.get()) for l in links]
except pywikibot.NoPage:
pywikibot.output(u"No page at %s, using redirect target."
@@ -1047,6 +1093,8 @@
% disambPage.title(),
self.mysite))
links = disambPage2.linkedPages()
+ if self.first_only:
+ links = self.firstize(disambPage2, links)
links = [correctcap(l, disambPage2.get())
for l in links]
except pywikibot.NoPage:
@@ -1059,6 +1107,8 @@
else:
try:
links = disambPage.linkedPages()
+ if self.first_only:
+ links = self.firstize(disambPage, links)
links = [correctcap(l, disambPage.get())
for l in links]
except pywikibot.NoPage:
@@ -1184,6 +1234,7 @@
dnSkip = False
generator = None
primary = False
+ first_only = False
main_only = False
# For sorting the linked pages, case can be ignored
@@ -1222,6 +1273,8 @@
dnSkip = True
elif arg == '-main':
main_only = True
+ elif arg == '-first':
+ first_only = True
elif arg.startswith('-min:'):
minimum = int(arg[5:])
elif arg.startswith('-start'):
@@ -1247,7 +1300,7 @@
site.login()
bot = DisambiguationRobot(always, alternatives, getAlternatives, dnSkip,
- generator, primary, main_only,
+ generator, primary, main_only, first_only,
minimum=minimum)
bot.run()
--
To view, visit https://gerrit.wikimedia.org/r/312729
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: I1e845a2e201f59799ce47d51aff99c14b9065436
Gerrit-Change-Number: 312729
Gerrit-PatchSet: 6
Gerrit-Owner: PranavAsty <asthana_pranav(a)yahoo.co.in>
Gerrit-Reviewer: Bináris <wikiposta(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/460371 )
Change subject: [doc] Update HISTORY.rst
......................................................................
[doc] Update HISTORY.rst
Change-Id: I8ced6a422abb5e120fe009a8a16dec5e2478ac42
---
M HISTORY.rst
1 file changed, 15 insertions(+), 0 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/HISTORY.rst b/HISTORY.rst
index ca50425..24c2e17 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -4,6 +4,21 @@
Current release
---------------
+* Remove cryptography support from python<=2.7.6 requirements (T203435)
+* textlib._tag_pattern: Do not mistake self-closing tags with start tag (T203568)
+* page.Link.langlinkUnsafe: Always set _namespace to a Namespace object (T203491)
+* Enable Namespace.content for mw < 1.16
+* Allow terminating the bot generator by BaseBot.stop() method (T198801)
+* Allow bot parameter in set_redirect_target
+* Do not show empty error messages (T203462)
+* Show the exception message in async mode (T203448)
+* Fix the extended user-config extraction regex (T145371)
+* Solve UnicodeDecodeError in site.getredirtarget (T126192)
+* Introduce a new APISite property: mw_version
+* Improve hash method for BasePage and Link
+* Avoid applying two uniquifying filters (T199615)
+* Fix skipping of language links in CosmeticChangesToolkit.removeEmptySections (T202629)
+* New mediawiki projects were provided
* Bugfixes and improvements
* Localisation updates
--
To view, visit https://gerrit.wikimedia.org/r/460371
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: I8ced6a422abb5e120fe009a8a16dec5e2478ac42
Gerrit-Change-Number: 460371
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/460319 )
Change subject: tests/http_tests.py: Fix unittest.skipTest calls
......................................................................
tests/http_tests.py: Fix unittest.skipTest calls
'unittest.skipTest' does not exist. Replace it with `self.skipTest`.
Bug: T204204
Change-Id: I6a4e55cc2e38a0ba26d9e881c125e9feaee6b326
---
M tests/http_tests.py
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/http_tests.py b/tests/http_tests.py
index 5125eec..2264e2b 100644
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -652,8 +652,8 @@
"""Test fetch method with no parameters."""
r = http.fetch(uri=self.url, params={})
if r.status == 503: # T203637
- unittest.skipTest('503: Service currently not available for '
- + self.url)
+ self.skipTest(
+ '503: Service currently not available for ' + self.url)
self.assertEqual(r.status, 200)
content = json.loads(r.text)
@@ -668,8 +668,8 @@
"""
r = http.fetch(uri=self.url, params={'fish&chips': 'delicious'})
if r.status == 503: # T203637
- unittest.skipTest('503: Service currently not available for '
- + self.url)
+ self.skipTest(
+ '503: Service currently not available for ' + self.url)
self.assertEqual(r.status, 200)
content = json.loads(r.text)
@@ -684,8 +684,8 @@
"""
r = http.fetch(uri=self.url, params={'fish%26chips': 'delicious'})
if r.status == 503: # T203637
- unittest.skipTest('503: Service currently not available for '
- + self.url)
+ self.skipTest(
+ '503: Service currently not available for ' + self.url)
self.assertEqual(r.status, 200)
content = json.loads(r.text)
--
To view, visit https://gerrit.wikimedia.org/r/460319
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: I6a4e55cc2e38a0ba26d9e881c125e9feaee6b326
Gerrit-Change-Number: 460319
Gerrit-PatchSet: 2
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: jenkins-bot (75)