jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/945901 )
Change subject: [IMPR] Add https scheme if missing in url asked by generate_family_file.py
......................................................................
[IMPR] Add https scheme if missing in url asked by generate_family_file.py
Change-Id: I824ae409ddbbb8b585636f8376f0abc8f1890f20
---
M pywikibot/scripts/generate_family_file.py
1 file changed, 22 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/scripts/generate_family_file.py b/pywikibot/scripts/generate_family_file.py
index f6afdd5..e26a566 100755
--- a/pywikibot/scripts/generate_family_file.py
+++ b/pywikibot/scripts/generate_family_file.py
@@ -28,6 +28,8 @@
.. versionchanged:: 8.1
[s]trict can be given for <dointerwiki> parameter to ensure that
sites are from the given domain.
+.. versionchanged:: 8.4
+ If the url scheme is missing, ``https```will be used.
"""
#
# (C) Pywikibot team, 2010-2023
@@ -41,7 +43,7 @@
import sys
from contextlib import suppress
from typing import Optional
-from urllib.parse import urlparse
+from urllib.parse import urlparse, urlunparse
# see pywikibot.family.py
@@ -99,9 +101,15 @@
"""Ask for parameters if necessary."""
if self.base_url is None:
with suppress(KeyboardInterrupt):
- self.base_url = input('Please insert URL to wiki: ')
- if not self.base_url:
+ url = input('Please insert URL to wiki: ')
+ if not url:
return False
+ url = urlparse(url, 'https')
+ if not url.netloc and url.path:
+ self.base_url = urlunparse((url.scheme, url.path, url.netloc,
+ *url[3:]))
+ else:
+ self.base_url = urlunparse(url)
if self.name is None:
with suppress(KeyboardInterrupt):
@@ -120,12 +128,13 @@
"""Get wiki from base_url."""
import pywikibot
from pywikibot.exceptions import FatalServerError
- print('Generating family file from ' + self.base_url)
+ pywikibot.info('Generating family file from ' + self.base_url)
for verify in (True, False):
try:
w = self.Wiki(self.base_url, verify=verify)
except FatalServerError:
pywikibot.exception()
+ pywikibot.info()
if not pywikibot.bot.input_yn(
'Retry with disabled ssl certificate validation',
default=self.verify, automatic_quit=False,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/945901
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I824ae409ddbbb8b585636f8376f0abc8f1890f20
Gerrit-Change-Number: 945901
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947329 )
Change subject: [IMPR] Enable -touch in newitem script for confirmed user
......................................................................
[IMPR] Enable -touch in newitem script for confirmed user
Bug: T343877
Change-Id: I1dfa90bf54f0d7a7866a9eba99203f68ed9d8c9c
---
M scripts/newitem.py
1 file changed, 13 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/newitem.py b/scripts/newitem.py
index 61cdd06..5671960 100755
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -20,7 +20,7 @@
"""
#
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2023
#
# Distributed under the terms of the MIT license.
#
@@ -212,7 +212,8 @@
if not bot.site.logged_in():
bot.site.login()
user = pywikibot.User(bot.site, bot.site.username())
- if bot.opt.touch == 'newly' and 'autoconfirmed' not in user.groups():
+ if bot.opt.touch == 'newly' and not (
+ 'autoconfirmed' in user.groups() or 'confirmed' in user.groups()):
pywikibot.warning(fill(
f'You are logged in as {user.username}, an account that is not in '
f'the autoconfirmed group on {bot.site.sitename}. Script will not '
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947329
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1dfa90bf54f0d7a7866a9eba99203f68ed9d8c9c
Gerrit-Change-Number: 947329
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947850 )
Change subject: [IMPR] Remove old code for mw < 1.27
......................................................................
[IMPR] Remove old code for mw < 1.27
Bug: T306637
Change-Id: I4ba60fa97cae601abbe219d40769d7d374337387
---
M pywikibot/data/api/_paraminfo.py
M tests/api_tests.py
2 files changed, 24 insertions(+), 36 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api/_paraminfo.py b/pywikibot/data/api/_paraminfo.py
index 1097c00..4112919 100644
--- a/pywikibot/data/api/_paraminfo.py
+++ b/pywikibot/data/api/_paraminfo.py
@@ -102,8 +102,7 @@
self.paraminfo_keys = frozenset(['modules'])
# Assume that by v1.26, it will be desirable to prefetch 'query'
- if mw_ver > '1.26':
- self.preloaded_modules |= {'query'}
+ self.preloaded_modules |= {'query'}
self._fetch(self.preloaded_modules)
@@ -299,40 +298,21 @@
"""Check and generate submodules for the given module."""
parameters = self._paraminfo[module].get('parameters', [])
submodules = set()
- # Advanced submodule into added to MW API in df80f1ea
- if self.site.mw_version >= '1.26wmf9':
- # This is supplying submodules even if they aren't submodules
- # of the given module so skip those
- for param in parameters:
- if module == 'main' and param['name'] == 'format' \
- or 'submodules' not in param:
- continue
- for submodule in param['submodules'].values():
- if '+' in submodule:
- parent, child = submodule.rsplit('+', 1)
- else:
- parent, child = 'main', submodule
- if parent == module:
- submodules.add(child)
- else:
- # Boolean submodule info added to MW API in afa153ae
- if self.site.mw_version < '1.24wmf18':
- if module == 'main':
- params = {'action'}
- elif module == 'query':
- params = {'prop', 'list', 'meta'}
+ # This is supplying submodules even if they aren't submodules
+ # of the given module so skip those
+ for param in parameters:
+ if module == 'main' and param['name'] == 'format' \
+ or 'submodules' not in param:
+ continue
+
+ for submodule in param['submodules'].values():
+ if '+' in submodule:
+ parent, child = submodule.rsplit('+', 1)
else:
- params = set()
- for param in parameters:
- if param['name'] in params:
- param['submodules'] = ''
-
- for param in parameters:
- # Do not add format modules
- if 'submodules' in param \
- and (module != 'main' or param['name'] != 'format'):
- submodules |= set(param['type'])
+ parent, child = 'main', submodule
+ if parent == module:
+ submodules.add(child)
if submodules:
self._add_submodules(module, submodules)
diff --git a/tests/api_tests.py b/tests/api_tests.py
index dbffb21..edbae80 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -22,7 +22,6 @@
DefaultDrySiteTestCase,
DefaultSiteTestCase,
TestCase,
- require_version,
)
from tests.utils import FakeLoginManager
@@ -293,7 +292,6 @@
self.assertIn('query+revisions', pi.prefix_map)
- @require_version('>=1.25wmf4', 'support the new paraminfo api')
def test_new_mode(self):
"""Test the new modules-only mode explicitly."""
site = self.get_site()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947850
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I4ba60fa97cae601abbe219d40769d7d374337387
Gerrit-Change-Number: 947850
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/947813 )
Change subject: Localisation updates from https://translatewiki.net.
......................................................................
Localisation updates from https://translatewiki.net.
Change-Id: I2278cf113596963fba598ed3104ea538fc1c8af2
---
M category/yue.json
M add_text/yue.json
D delete/yue.json
M checkimages/mk.json
M checkimages/ru.json
M redirect/yue.json
A category_redirect/yue.json
M checkimages/ia.json
M checkimages/lb.json
D movepages/yue.json
M interwiki/yue.json
D basic/yue.json
M checkimages/de.json
M checkimages/fr.json
D pywikibot/yue.json
D weblinkchecker/yue.json
M welcome/yue.json
17 files changed, 34 insertions(+), 56 deletions(-)
Approvals:
L10n-bot: Looks good to me, approved
jenkins-bot: Verified
diff --git a/add_text/yue.json b/add_text/yue.json
index 52b2645..aec9bb8 100644
--- a/add_text/yue.json
+++ b/add_text/yue.json
@@ -1,6 +1,8 @@
{
"@metadata": {
- "authors": []
+ "authors": [
+ "Winston Sung"
+ ]
},
"add_text-adding": "機械人 加 %(adding)s"
}
diff --git a/basic/yue.json b/basic/yue.json
deleted file mode 100644
index 4d5b611..0000000
--- a/basic/yue.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "@metadata": {
- "authors": [
- "Hello903hello"
- ]
- },
- "basic-changing": "機械人:改緊⋯⋯"
-}
diff --git a/category/yue.json b/category/yue.json
index 8efd0fd..7a5bb3b 100644
--- a/category/yue.json
+++ b/category/yue.json
@@ -3,6 +3,7 @@
"authors": [
"Hello903hello",
"Moon0319",
+ "Winston Sung",
"Xqt"
]
},
diff --git a/category_redirect/yue.json b/category_redirect/yue.json
new file mode 100644
index 0000000..a3e9956
--- /dev/null
+++ b/category_redirect/yue.json
@@ -0,0 +1,8 @@
+{
+ "@metadata": {
+ "authors": [
+ "Xqt"
+ ]
+ },
+ "category_redirect-fix-double": "機械人:拉直連串跳轉"
+}
diff --git a/checkimages/de.json b/checkimages/de.json
index f3e3d64..923f9c3 100644
--- a/checkimages/de.json
+++ b/checkimages/de.json
@@ -11,6 +11,8 @@
"checkimages-doubles-head": "Datei-Duplikat",
"checkimages-doubles-talk-comment": "Bot: Benachrichtigung, dass die Datei bereits auf Commons vorhanden ist",
"checkimages-doubles-talk-text": "Vielen Dank für das Hochladen von %(upload)s. Diese Datei ist jedoch eine Kopie von:%(image)sDer Bot hat die Datei, die am wenigsten verwendet wurde oder aktuell war, als Duplikat markiert. Wenn Sie es für angebrachter halten, die Datei als sofort zu löschend markiert zu belassen, können Sie die doppelten Dateien löschen und die Löschvorlage von der zu belassenden Datei entfernen. Dies ist eine automatisierte Nachricht von %(bot)s.",
+ "checkimages-forced-mode": "('''Zwangsmodus''')",
+ "checkimages-has-duplicates": "hat folgende Dubletten%(force)s:",
"checkimages-log-comment": "Bot: Aktualisiere das Log",
"checkimages-no-license-head": "Bild ohne Lizenz",
"checkimages-source-tag-comment": "Bot: Markiere zur Dateiüberprüfung, da keine Lizenzvorlage gefunden.",
diff --git a/checkimages/fr.json b/checkimages/fr.json
index 0bbe476..764c298 100644
--- a/checkimages/fr.json
+++ b/checkimages/fr.json
@@ -14,6 +14,7 @@
"checkimages-doubles-file-comment": "Robot : fichier déjà sur Commons, peut être supprimé",
"checkimages-doubles-head": "Fichier dupliqué",
"checkimages-doubles-talk-comment": "Robot : notification que le fichier existe déjà sur Commons",
+ "checkimages-doubles-talk-text": "Merci d’avoir téléchargé %(upload)s. Toutefois, ce fichier est une copie de %(image)s. Le robot a marqué comme doublon du fichier qui a été le moins utilisé ou le plus récent. Si vous pensez qu’il est plus approprié de laisser le fichier marqué comme devant être supprimé immédiatement, sentez-vous libre de supprimer les fichiers dupliqués et supprimer le modèle de suppression de celui à conserver. Ceci est un message automatique de %(bot)s.",
"checkimages-forced-mode": "('''mode forcé''')",
"checkimages-has-duplicates": "a les doublons suivants%(force)s :",
"checkimages-log-comment": "Robot : mise à jour du journal",
diff --git a/checkimages/ia.json b/checkimages/ia.json
index af7b559..5a3fbcd 100644
--- a/checkimages/ia.json
+++ b/checkimages/ia.json
@@ -8,6 +8,7 @@
"checkimages-doubles-file-comment": "Robot: File es jam sur Commons, pote esser delite",
"checkimages-doubles-head": "File duplicate",
"checkimages-doubles-talk-comment": "Robot: Notifica que le file jam existe sur Commons",
+ "checkimages-doubles-talk-text": "Gratias pro haber incargate %(upload)s. Nonobstante, iste file es un copia de %(image)s. Le robot ha marcate como duplicato le file le minus usate o le plus recente. Si tu pensa que es plus appropriate lassar le file marcate como debente esser delite immediatemente, sia libere de deler le files duplicate e remover le patrono de deletion del file restante. Isto es un message automatic de %(bot)s.",
"checkimages-forced-mode": "('''modo fortiate''')",
"checkimages-has-duplicates": "ha le sequente duplicatos%(force)s:",
"checkimages-log-comment": "Robot: Actualisa le registro",
diff --git a/checkimages/lb.json b/checkimages/lb.json
index 7d4798f..4c52cfa 100644
--- a/checkimages/lb.json
+++ b/checkimages/lb.json
@@ -6,6 +6,7 @@
]
},
"checkimages-deletion-comment": "Bot: %(adding)s dobäisetzen",
+ "checkimages-forced-mode": "('''Zwangsmodus''')",
"checkimages-no-license-head": "Bild ouni Lizenz",
"checkimages-source-tag-comment": "Bot: Nei eropgelueden net markéierte Fichier markéieren",
"checkimages-source-notice-comment": "Bot: Quellinformatioun ufroen",
diff --git a/checkimages/mk.json b/checkimages/mk.json
index 860a2bd..0375100 100644
--- a/checkimages/mk.json
+++ b/checkimages/mk.json
@@ -8,6 +8,7 @@
"checkimages-doubles-file-comment": "Бот: Податотеката е веќе на Ризницата, може да биде избришана",
"checkimages-doubles-head": "Дуплирана податотека",
"checkimages-doubles-talk-comment": "Бот: Известување дека податотеката веќе постои на Ризницата",
+ "checkimages-doubles-talk-text": "Ви благодариме што ја подигнавте %(upload)s. Сепак, оваа податотека е дупликат на %(image)s. Ботот ја означи како таква онаа што е најмалку користена или најнова. Ако мислите дека е посоодветно да ја оставите означена за да се избрише веднаш , слободно избришете ги дуплираните податотеки и отстранете ја предлошката за бришење од онаа што треба да остане. Ова е автоматска порака од %(bot)s.",
"checkimages-forced-mode": "(''''принуден режим'''')",
"checkimages-has-duplicates": "ги има следниве дупликати%(force)s:",
"checkimages-log-comment": "Бот: Поднова на дневникот",
diff --git a/checkimages/ru.json b/checkimages/ru.json
index 33cebd3..2f94ef7 100644
--- a/checkimages/ru.json
+++ b/checkimages/ru.json
@@ -10,6 +10,9 @@
"checkimages-doubles-file-comment": "Бот: Файл уже на Викискладе, а потому может быть удалён",
"checkimages-doubles-head": "Дубликат",
"checkimages-doubles-talk-comment": "Бот: Нотификация в случае уже существующего файла на Викискладе",
+ "checkimages-doubles-talk-text": "Спасибо за загрузку %(upload)s. Однако этот файл является копией %(image)s. Бот пометил как дубликат файл, который оказался наименее используемым или последним. Если вы считаете более целесообразным оставить файл, помеченный как подлежащий немедленному удалению, не стесняйтесь удалить дубликаты файлов и удалить шаблон удаления из того файла, который нужно оставить. Это автоматическое сообщение от %(bot)s.",
+ "checkimages-forced-mode": "('''принудительный режим''')",
+ "checkimages-has-duplicates": "имеет следующие дубликаты%(force)s:",
"checkimages-log-comment": "Бот: Обновление журнала",
"checkimages-no-license-head": "Изображение без лицензии",
"checkimages-source-tag-comment": "Бот: Пометка недавно загруженных файлов без шаблонов лицензии",
diff --git a/delete/yue.json b/delete/yue.json
deleted file mode 100644
index de9158b..0000000
--- a/delete/yue.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "@metadata": {
- "authors": [
- "Hello903hello",
- "Moon0319"
- ]
- },
- "delete-from-file": "機械人:剷緊一堆版面。"
-}
diff --git a/interwiki/yue.json b/interwiki/yue.json
index 2f0f779..b1bf886 100644
--- a/interwiki/yue.json
+++ b/interwiki/yue.json
@@ -1,7 +1,8 @@
{
"@metadata": {
"authors": [
- "Ktchankt"
+ "Ktchankt",
+ "Winston Sung"
]
},
"interwiki-adding": "機械人 加: %(adding)s",
diff --git a/movepages/yue.json b/movepages/yue.json
deleted file mode 100644
index 7f254ae..0000000
--- a/movepages/yue.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "@metadata": {
- "authors": [
- "Hello903hello",
- "Moon0319"
- ]
- },
- "movepages-moving": "機械人:搬版"
-}
diff --git a/pywikibot/yue.json b/pywikibot/yue.json
deleted file mode 100644
index e210219..0000000
--- a/pywikibot/yue.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "@metadata": {
- "authors": [
- "Hello903hello",
- "Shinjiman"
- ]
- },
- "pywikibot-bot-prefix": "機械人:",
- "pywikibot-enter-category-name": "請輸入分類名:",
- "pywikibot-enter-file-links-processing": "有邊啲檔案版嘅拎要處理?",
- "pywikibot-enter-finished-browser": "喺瀏覽器完成編輯之後撳Enter掣。",
- "pywikibot-enter-namespace-number": "請輸入空間名嘅冧巴:",
- "pywikibot-enter-new-text": "請輸入新字:",
- "pywikibot-enter-page-processing": "應該去處理邊版?",
- "pywikibot-enter-xml-filename": "請輸入XML傾印嘅檔名:",
- "pywikibot-fixes-fckeditor": "機械人:修正視覺編輯器HTML",
- "pywikibot-fixes-html": "機械人:轉換/修正HTML",
- "pywikibot-fixes-syntax": "機械人:修正wiki語法",
- "pywikibot-touch": "Pywikibot touch編輯"
-}
diff --git a/redirect/yue.json b/redirect/yue.json
index 7af87a1..689a651 100644
--- a/redirect/yue.json
+++ b/redirect/yue.json
@@ -2,6 +2,7 @@
"@metadata": {
"authors": [
"Ktchankt",
+ "Winston Sung",
"Xqt"
]
},
diff --git a/weblinkchecker/yue.json b/weblinkchecker/yue.json
deleted file mode 100644
index 28cf1f7..0000000
--- a/weblinkchecker/yue.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "@metadata": {
- "authors": [
- "Moon0319"
- ]
- },
- "weblinkchecker-caption": "死拎"
-}
diff --git a/welcome/yue.json b/welcome/yue.json
index da1a387..42edacf 100644
--- a/welcome/yue.json
+++ b/welcome/yue.json
@@ -3,6 +3,7 @@
"authors": [
"Ktchankt",
"Shinjiman",
+ "Winston Sung",
"Xqt"
]
},
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/947813
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Change-Id: I2278cf113596963fba598ed3104ea538fc1c8af2
Gerrit-Change-Number: 947813
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947717 )
Change subject: [dod] fix spelling mistak in throttle.py
......................................................................
[dod] fix spelling mistak in throttle.py
Change-Id: I307ad5a59ab1be8c397aa37f4e0a10acb8993160
---
M pywikibot/throttle.py
1 file changed, 11 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/throttle.py b/pywikibot/throttle.py
index 0404497..2241059 100644
--- a/pywikibot/throttle.py
+++ b/pywikibot/throttle.py
@@ -1,6 +1,6 @@
"""Mechanics to slow down wiki read and/or write rate."""
#
-# (C) Pywikibot team, 2008-2022
+# (C) Pywikibot team, 2008-2023
#
# Distributed under the terms of the MIT license.
#
@@ -139,7 +139,7 @@
"""Count running processes for site and set process_multiplicity.
.. versionchanged:: 7.0
- process is not written to throttle.ctrl file is site is empty
+ process is not written to throttle.ctrl file if site is empty.
"""
global pid
mysite = self.mysite
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947717
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I307ad5a59ab1be8c397aa37f4e0a10acb8993160
Gerrit-Change-Number: 947717
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947356 )
Change subject: [doc] Fix logging documentation
......................................................................
[doc] Fix logging documentation
Change-Id: Ia8e5ae17a3fe1f799ee686c4774b46250f37e39f
---
M pywikibot/logging.py
1 file changed, 17 insertions(+), 8 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 9dafa11..f87bf92 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -20,7 +20,7 @@
argument, which is a string indicating the debugging layer.
"""
#
-# (C) Pywikibot team, 2010-2022
+# (C) Pywikibot team, 2010-2023
#
# Distributed under the terms of the MIT license.
#
@@ -175,7 +175,7 @@
are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- was renamed to :func:`info`; `text`was renamed to `msg`; `msg`
+ was renamed to :func:`info`; `text` was renamed to `msg`; `msg`
paramerer may be omitted; only keyword arguments are allowed except
for `msg`.
.. seealso::
@@ -196,7 +196,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; `msg` parameter may be omitted;
+ `text` was renamed to `msg`; `msg` parameter may be omitted;
only keyword arguments are allowed except for `msg`.
.. seealso::
- :python:`Logger.log()<library/logging.html#logging.Logger.log>`
@@ -214,7 +214,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.warning()<library/logging.html#logging.Logger.warning>`
@@ -231,7 +231,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.error()<library/logging.html#logging.Logger.error>`
@@ -247,7 +247,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.log()<library/logging.html#logging.Logger.log>`
@@ -264,7 +264,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `text`was renamed to `msg`; only keyword arguments are allowed
+ `text` was renamed to `msg`; only keyword arguments are allowed
except for `msg`.
.. seealso::
:python:`Logger.critical()
@@ -281,7 +281,7 @@
The arguments are interpreted as for :func:`logoutput`.
.. versionchanged:: 7.2
- `layer` parameter is optional; `text`was renamed to `msg`;
+ `layer` parameter is optional; `text` was renamed to `msg`;
only keyword arguments are allowed except for `msg`.
.. seealso::
:python:`Logger.debug()<library/logging.html#logging.Logger.debug>`
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/947356
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia8e5ae17a3fe1f799ee686c4774b46250f37e39f
Gerrit-Change-Number: 947356
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944234 )
Change subject: [cleanup] Remove mw_version check in api.Request._add_defaults
......................................................................
[cleanup] Remove mw_version check in api.Request._add_defaults
Python 8 supports mw 1.27 only; therefore remove the mw check.
This leads that site.version() is no longer called and the
error messages aren't printed. Update tests accordingly.
Bug: T306637
Change-Id: Ie91e5120931b757123659d2cc457f2d8a7413b06
---
M pywikibot/data/api/_requests.py
M tests/api_tests.py
2 files changed, 18 insertions(+), 11 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index ee19e54..7e7758c 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -438,8 +438,7 @@
# dummy rawcontinue parameter except for 'tokens' (T284577) and
# 'siteinfo' (T343204)
if ('tokens' not in meta and 'siteinfo' not in meta
- and 'continue' not in self._params
- and self.site.mw_version >= '1.25wmf5'):
+ and 'continue' not in self._params):
self._params.setdefault('rawcontinue', [''])
elif self.action == 'help':
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 783e1b5..dbffb21 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -856,8 +856,7 @@
@patch.object(pywikibot, 'info')
@patch.object(pywikibot, 'warning')
- @patch.object(pywikibot, 'error')
- def test_access_denied_notexist_username(self, error, warning, output):
+ def test_access_denied_notexist_username(self, warning, info):
"""Test the query with a username which does not exist."""
self.site._username = 'Not registered username'
req = api.Request(site=self.site, parameters={'action': 'query'})
@@ -869,10 +868,8 @@
warning.assert_called_with(
'API error readapidenied: '
'You need read permission to use this module.')
- error.assert_called_with(
- 'You have no API read permissions. Seems you are not logged in.')
self.assertIn(
- 'Logging in to steward:steward as ', output.call_args[0][0])
+ 'Logging in to steward:steward as ', info.call_args[0][0])
class TestLazyLoginNoUsername(TestLazyLoginBase):
@@ -880,9 +877,8 @@
"""Test no username."""
@patch.object(pywikibot, 'warning')
- @patch.object(pywikibot, 'error')
@patch.object(pywikibot.config, 'usernames', defaultdict(dict))
- def test_access_denied_no_username(self, error, warning):
+ def test_access_denied_no_username(self, warning):
"""Test the query without a username."""
self.site._username = None
req = api.Request(site=self.site, parameters={'action': 'query'})
@@ -894,8 +890,6 @@
warning.assert_called_with(
'API error readapidenied: '
'You need read permission to use this module.')
- error.assert_called_with(
- 'You have no API read permissions. Seems you are not logged in.')
class TestUrlEncoding(TestCase):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944234
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie91e5120931b757123659d2cc457f2d8a7413b06
Gerrit-Change-Number: 944234
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944210 )
Change subject: [cleanup] Remove unused _query_continue method.
......................................................................
[cleanup] Remove unused _query_continue method.
QueryGenerator._query_continue method is no longer used since
b8060a7e8b8553f5beca6046809c7f99cc66a0c8 and can be removed.
rename _continue() method to continue_update and merge it
with _add_continues. Always return None with it instead of
False because the result is not important anymore.
This looks like a breaking change but it does not care.
Bug: T343204
Change-Id: I4eaa37f150f8c0d9a008419637b7c320385708b0
---
M pywikibot/data/api/_generators.py
1 file changed, 31 insertions(+), 22 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/data/api/_generators.py b/pywikibot/data/api/_generators.py
index 1a30567..3090ef3 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -237,7 +237,6 @@
parameters['indexpageids'] = True # always ask for list of pageids
self.continue_name = 'continue'
- self.continue_update = self._continue
# Explicitly enable the simplified continuation
parameters['continue'] = True
self.request = self.request_class(**kwargs)
@@ -476,24 +475,18 @@
return None
- def _query_continue(self) -> bool:
- if all(key not in self.data[self.continue_name]
- for key in self.continuekey):
- pywikibot.log(
- "Missing '{}' key(s) in ['{}'] value."
- .format(self.continuekey, self.continue_name))
- return True
+ def continue_update(self) -> None:
+ """Update query with continue parameters.
- for query_continue_pair in self.data['query-continue'].values():
- self._add_continues(query_continue_pair)
- return False # a new request with query-continue is needed
-
- def _continue(self) -> bool:
- self._add_continues(self.data['continue'])
- return False # a new request with continue is needed
-
- def _add_continues(self, continue_pair) -> None:
- for key, value in continue_pair.items():
+ .. versionadded:: 3.0
+ .. versionchanged:: 4.0
+ explicit return a bool value to be used in :meth:`generator`
+ .. versionchanged:: 6.0
+ always return *False*
+ .. versionchanged:: 8.4
+ return *None* instead of *False*.
+ """
+ for key, value in self.data['continue'].items():
# query-continue can return ints (continue too?)
if isinstance(value, int):
value = str(value)
@@ -653,10 +646,8 @@
if self.continue_name not in self.data:
break
- if self.continue_update():
- break
-
- del self.data # a new request with (query-)continue is needed
+ self.continue_update()
+ del self.data # a new request with continue is needed
def result(self, data):
"""Process result data as needed for particular subclass."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944210
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I4eaa37f150f8c0d9a008419637b7c320385708b0
Gerrit-Change-Number: 944210
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged