jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/510520 )
Change subject: Skip TestLoginLogout if it is running on Appveyor
......................................................................
Skip TestLoginLogout if it is running on Appveyor
APPVEYOR environment variable may be 'True' or 'true'
Bug: T222508
Change-Id: I38e8af3921815ae45d8912bfa35f59fcd9a1b36f
---
M tests/site_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 2db780d..77b572f 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -3707,7 +3707,7 @@
"""Test for login and logout methods."""
- @unittest.skipIf(os.environ.get('APPVEYOR', 'false') == 'true',
+ @unittest.skipIf(os.environ.get('APPVEYOR', 'false') in ('true', 'True'),
'No user defined for APPVEYOR tests')
def test_login_logout(self):
"""Validate login and logout methods by toggling the state."""
--
To view, visit https://gerrit.wikimedia.org/r/510520
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: I38e8af3921815ae45d8912bfa35f59fcd9a1b36f
Gerrit-Change-Number: 510520
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
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/510698 )
Change subject: [cleanup] Simpliy generate_family_file.getlangs
......................................................................
[cleanup] Simpliy generate_family_file.getlangs
Change-Id: I0d9d3f4f9129281974aa6eed64e85d409954a9ff
---
M generate_family_file.py
1 file changed, 3 insertions(+), 5 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_family_file.py b/generate_family_file.py
index 97eac88..c529be6 100755
--- a/generate_family_file.py
+++ b/generate_family_file.py
@@ -91,8 +91,9 @@
else:
makeiw = self.dointerwiki
- if makeiw == 'y':
- pass
+ if makeiw == 'n':
+ self.langs = [wiki for wiki in self.langs
+ if wiki['url'] == w.iwpath]
elif makeiw == 'e':
for wiki in self.langs:
print(wiki['prefix'], wiki['url'])
@@ -100,9 +101,6 @@
self.langs = [wiki for wiki in self.langs
if wiki['prefix'] in do_langs
or wiki['url'] == w.iwpath]
- else:
- self.langs = [wiki for wiki in self.langs
- if wiki['url'] == w.iwpath]
def getapis(self):
"""Load other language pages."""
--
To view, visit https://gerrit.wikimedia.org/r/510698
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: I0d9d3f4f9129281974aa6eed64e85d409954a9ff
Gerrit-Change-Number: 510698
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/510471 )
Change subject: Add beta site to wikisource
......................................................................
Add beta site to wikisource
This ensures the repo knows of a safe site to use for ProofreadPage
edit test.
Re-work of the reverted commit: c0dfc3675bec60e8ac47e62d7386ab3060712607
Change-Id: Icf3d2a28645f9a13f8fb04677882e3bec919579c
---
M pywikibot/families/wikisource_family.py
M scripts/maintenance/wikimedia_sites.py
2 files changed, 18 insertions(+), 4 deletions(-)
Approvals:
Dvorapa: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikisource_family.py b/pywikibot/families/wikisource_family.py
index 2a4218d..f44b373 100644
--- a/pywikibot/families/wikisource_family.py
+++ b/pywikibot/families/wikisource_family.py
@@ -36,6 +36,9 @@
'bs', 'sah', 'gl', 'lt', 'sk', 'eu', 'cy', 'pa', 'zh-min-nan', 'fo',
]
+ # Sites we want to edit but not count as real languages
+ test_codes = ['beta']
+
category_redirect_templates = {
'_default': (),
'ar': ('قالب:تحويل تصنيف',),
@@ -51,9 +54,17 @@
def langs(cls):
cls.langs = super(Family, cls).langs
cls.langs['mul'] = cls.domain
+ cls.langs['beta'] = 'en.wikisource.beta.wmflabs.org'
return cls.langs
- languages_by_size.append('mul')
+ # Need to explicitly inject the beta domain
+ @classproperty
+ def domains(cls):
+ cls.domains = super(Family, cls).domains
+ cls.domains.append(cls.langs['beta'])
+ return cls.domains
+
+ languages_by_size += ['mul', 'beta']
# Global bot allowed languages on
# https://meta.wikimedia.org/wiki/BPI#Current_implementation
@@ -91,6 +102,7 @@
'tr': [100],
'vi': [102],
'zh': [102],
+ 'beta': [102],
}
# Subpages for documentation.
diff --git a/scripts/maintenance/wikimedia_sites.py b/scripts/maintenance/wikimedia_sites.py
index 493a1c6..574c674 100755
--- a/scripts/maintenance/wikimedia_sites.py
+++ b/scripts/maintenance/wikimedia_sites.py
@@ -35,7 +35,9 @@
'wiktionary',
]
-exceptions = ['-', 'mul']
+exceptions = {
+ 'wikisource': ['-', 'mul', 'beta']
+}
def update_family(families):
@@ -45,7 +47,7 @@
pywikibot.output('\nChecking family %s:' % family)
original = Family.load(family).languages_by_size
- for code in exceptions:
+ for code in exceptions.get(family, []):
if code in original:
original.remove(code)
obsolete = Family.load(family).obsolete
@@ -53,7 +55,7 @@
new = []
table = ws.languages_by_size(family)
for code in table:
- if not (code in obsolete or code in exceptions):
+ if not (code in obsolete or code in exceptions.get(family, [])):
new.append(code)
# put the missing languages to the right place
--
To view, visit https://gerrit.wikimedia.org/r/510471
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: Icf3d2a28645f9a13f8fb04677882e3bec919579c
Gerrit-Change-Number: 510471
Gerrit-PatchSet: 1
Gerrit-Owner: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
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/510277 )
Change subject: [IMPR] Fix getFileVersionHistory deprecation warnings in scripts
......................................................................
[IMPR] Fix getFileVersionHistory deprecation warnings in scripts
- FilePage.getFileVersionHistory is deprecated and should be avoided in scripts
as well
Change-Id: Ia8a7d66eaab4d17abd8dc816dbe115d11af61f3f
---
M pywikibot/page.py
M scripts/imagecopy.py
M scripts/imagecopy_self.py
M scripts/nowcommons.py
M scripts/unusedfiles.py
5 files changed, 7 insertions(+), 7 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index c39a3e6..79c9771 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2626,7 +2626,7 @@
def getFileVersionHistoryTable(self):
"""Return the version history in the form of a wiki table."""
lines = []
- for info in self.getFileVersionHistory():
+ for info in self.get_file_history():
dimension = '{width}×{height} px ({size} bytes)'.format(**info)
lines.append('| {timestamp} || {user} || {dimension} |'
'| <nowiki>{comment}</nowiki>'
diff --git a/scripts/imagecopy.py b/scripts/imagecopy.py
index 00a54c7..dad8dee 100644
--- a/scripts/imagecopy.py
+++ b/scripts/imagecopy.py
@@ -538,7 +538,7 @@
except NotImplementedError:
# No API, using the page file instead
(datetime, username, resolution, size,
- comment) = imagepage.getFileVersionHistory().pop()
+ comment) = imagepage.get_file_history().pop()
if always:
newname = imagepage.title(with_ns=False)
CommonsPage = pywikibot.Page(pywikibot.Site('commons',
diff --git a/scripts/imagecopy_self.py b/scripts/imagecopy_self.py
index f132d04..0d788e7 100644
--- a/scripts/imagecopy_self.py
+++ b/scripts/imagecopy_self.py
@@ -536,7 +536,7 @@
information template. If we really have nothing better.
"""
- uploadtime = imagepage.getFileVersionHistory()[-1][0]
+ uploadtime = imagepage.get_file_history()[-1][0]
uploadDatetime = datetime.strptime(uploadtime, '%Y-%m-%dT%H:%M:%SZ')
return ('{{Date|%s|%s|%s}} (original upload date)'
% (str(uploadDatetime.year),
@@ -569,7 +569,7 @@
def getAuthor(self, imagepage):
"""Get the first uploader."""
- return imagepage.getFileVersionHistory()[-1][1].strip()
+ return imagepage.get_file_history()[-1][1].strip()
def convertLinks(self, text, sourceSite):
"""Convert links from the current wiki to Commons."""
@@ -947,7 +947,7 @@
@param imagepage: The file page to retrieve the log.
@type imagepage: pywikibot.FilePage
"""
- filehistory = imagepage.getFileVersionHistory()
+ filehistory = imagepage.get_file_history()
filehistory.reverse()
site = imagepage.site()
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index ca899aa..1c7d9f6 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -329,7 +329,7 @@
if sha1 == commonsImagePage.latest_file_info.sha1:
pywikibot.output(
'The image is identical to the one on Commons.')
- if len(localImagePage.getFileVersionHistory()) > 1:
+ if len(localImagePage.get_file_history()) > 1:
pywikibot.output(
'This image has a version history. Please '
'delete it manually after making sure that '
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 9c010e4..2801f5b 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -78,7 +78,7 @@
self.append_text(image, '\n\n' + self.template_image)
if self.getOption('nouserwarning'):
return
- uploader = image.getFileVersionHistory().pop(0)['user']
+ uploader = image.get_file_history().pop(0)['user']
user = pywikibot.User(image.site, uploader)
usertalkpage = user.getUserTalkPage()
msg2uploader = self.template_user % {'title': image.title()}
--
To view, visit https://gerrit.wikimedia.org/r/510277
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: Ia8a7d66eaab4d17abd8dc816dbe115d11af61f3f
Gerrit-Change-Number: 510277
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.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/510165 )
Change subject: [IMPR] Make similar script search configurable
......................................................................
[IMPR] Make similar script search configurable
Change-Id: I92d79c82ac7fc4f5983be35d6993eb0186bc0c81
---
M pwb.py
M pywikibot/config2.py
2 files changed, 23 insertions(+), 3 deletions(-)
Approvals:
Dvorapa: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index d21d2d4..cd0324a 100755
--- a/pwb.py
+++ b/pwb.py
@@ -171,10 +171,15 @@
def find_alternates(filename, script_paths):
"""Search for similar filenames in the given script paths."""
- from pywikibot import input_choice, output
+ from pywikibot import config, input_choice, output
from pywikibot.bot import ShowingListOption, QuitKeyboardInterrupt
from pywikibot.tools.formatter import color_format
+ assert config.pwb_close_matches > 0, \
+ 'config.pwb_close_matches must be greater than 0'
+ assert 0.0 < config.pwb_cut_off < 1.0, \
+ 'config.pwb_cut_off must be a float in range [0, 1]'
+
print('ERROR: {} not found! Misspelling?'.format(filename),
file=sys.stderr)
@@ -188,13 +193,15 @@
scripts[name] = os.path.join(*(path + [script_name]))
filename = filename[:-3]
- similar_scripts = get_close_matches(filename, scripts, n=10, cutoff=0.7)
+ similar_scripts = get_close_matches(filename, scripts,
+ config.pwb_close_matches,
+ config.pwb_cut_off)
if not similar_scripts:
return None
if len(similar_scripts) == 1:
script = similar_scripts[0]
- wait_time = 5
+ wait_time = config.pwb_autostart_waittime
output(color_format(
'NOTE: Starting the most similar script '
'{lightyellow}{}.py{default}\n'
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index e155e60..1540dfe 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -482,6 +482,19 @@
# Currently only works if interface 'terminal' is set.
transliterate = True
+# The pwb.py wrapper calls the script given as parameter in this way
+# python pwb.py <name_of_script> <options>
+# If there is a misspelling in <name_of_script> the most similar script
+# scripts are displayed or if only one is found, it will be started.
+# There are some configuration values to change the behavior
+#
+# pwb_close_matches: the maximum number of simular scripts to be found
+pwb_close_matches = 10 # must be greater than 0
+# pwb_cut_off: similarity of scripts to be found
+pwb_cut_off = 0.7 # must be a float in the range [0, 1]
+# pwb_autostart_waittime: wait time until the most similar script starts
+pwb_autostart_waittime = 5.0
+
# Should the system bell ring if the bot expects user input?
ring_bell = False
--
To view, visit https://gerrit.wikimedia.org/r/510165
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: I92d79c82ac7fc4f5983be35d6993eb0186bc0c81
Gerrit-Change-Number: 510165
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)