jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1200416?usp=email )
Change subject: Cleanup: remove predefined yu-tld fix in fixes.py
......................................................................
Cleanup: remove predefined yu-tld fix in fixes.py
Also udpate docstrings
Bug: T402088
Change-Id: Ic10dbf77dfc645f62a621912e2139b765aa86e08
---
M docs/conf.py
M pywikibot/bot.py
M pywikibot/fixes.py
3 files changed, 15 insertions(+), 74 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/docs/conf.py b/docs/conf.py
index 63801d7..da9772b 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -549,7 +549,7 @@
# add link for fixes
if name == 'scripts.replace' and line == '&fixes-help;':
newlines.append(' The available fixes are '
- 'listed in :mod:`pywikibot.fixes`.')
+ 'listed in :mod:`fixes`.')
continue
# replace cosmetic changes warning
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index b197307..882a712 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -907,7 +907,7 @@
module.__doc__, flags=re.MULTILINE | re.DOTALL)
if hasattr(module, 'docuReplacements'):
for key, value in module.docuReplacements.items():
- help_text = help_text.replace(key, value.strip())
+ help_text = help_text.replace(key, value.rstrip())
_stdout(help_text)
if show_global or module_name == 'pwb':
diff --git a/pywikibot/fixes.py b/pywikibot/fixes.py
index 684850c..22f0805 100644
--- a/pywikibot/fixes.py
+++ b/pywikibot/fixes.py
@@ -1,4 +1,8 @@
-"""File containing all standard fixes."""
+"""File containing all standard fixes.
+
+.. versionremoved:: 11.0
+ The ``yu-tld`` predefined fix was removed.
+"""
#
# (C) Pywikibot team, 2008-2025
#
@@ -7,6 +11,7 @@
from __future__ import annotations
from pathlib import Path
+from textwrap import dedent
from pywikibot import config
@@ -14,29 +19,26 @@
parameter_help = """
Currently available predefined fixes:
- * HTML - Convert HTML tags to wiki syntax, and
+ * HTML - Convert HTML tags to wiki syntax, and \
fix XHTML.
* isbn - Fix badly formatted ISBNs.
- * syntax - Try to fix bad wiki markup. Do not run
- this in automatic mode, as the bot may
+ * syntax - Try to fix bad wiki markup. Do not run \
+ this in automatic mode, as the bot may \
make mistakes.
- * syntax-safe - Like syntax, but less risky; can be run
+ * syntax-safe - Like syntax, but less risky; can be run \
in automatic mode.
* case-de - Fix upper/lower case errors in German.
* grammar-de - Fix grammar and typography in German.
- * vonbis - Replace hyphens or dashes with "bis"
+ * vonbis - Replace hyphens or dashes with "bis" \
in German.
* music - Links to disambiguation pages in German.
* datum - Specific date formats in German.
- * correct-ar - Typo corrections for Arabic Wikipedia
+ * correct-ar - Typo corrections for Arabic Wikipedia \
and other Arabic wikis.
- * yu-tld - Fix links to .yu domains, which are disabled.
- See:
- https://lists.wikimedia.org/pipermail/wikibots-l/2009-February/000290.html
* fckeditor - Convert FCKeditor HTML tags to wiki syntax.
"""
-__doc__ += parameter_help
+__doc__ += dedent(parameter_help)
fixes = {
# These replacements will convert HTML to wiki syntax where possible, and
@@ -604,67 +606,6 @@
('Special:Whatlinkshere', 'Special:WhatLinksHere'),
],
},
- # yu top-level domain will soon be disabled, see
- # https://lists.wikimedia.org/pipermail/wikibots-l/2009-February/000290.html
- # The following are domains that are often-used.
- 'yu-tld': {
- 'regex': False,
- 'nocase': True,
- 'msg': {
- 'ar': 'روبوت: إصلاح الوصلات إلى نطاقات .yu',
- 'arz': 'روبوت: تصليح اللينكات للدومين .yu',
- 'de': 'Bot: Ersetze Links auf .yu-Domains',
- 'en': 'Robot: Replacing links to .yu domains',
- 'fa': 'ربات: جایگزینی پیوندها به دامنهها با پسوند yu',
- 'fr': ('Robot: Correction des liens pointant vers le domaine '
- '.yu, qui expire en 2009'),
- 'ksh': 'Bot: de ahle .yu-Domains loufe us, dröm ußjetuusch',
- 'sr': 'Бот: Исправљање линкова ка .yu домену',
- },
- 'replacements': [
- ('www.budva.cg.yu', 'www.budva.rs'),
- ('spc.org.yu', 'spc.rs'),
- ('www.oks.org.yu', 'www.oks.org.rs'),
- ('www.kikinda.org.yu', 'www.kikinda.rs'),
- ('www.ds.org.yu', 'www.ds.org.rs'),
- ('www.nbs.yu', 'www.nbs.rs'),
- ('www.serbia.sr.gov.yu', 'www.srbija.gov.rs'),
- ('eunet.yu', 'eunet.rs'),
- ('www.zastava-arms.co.yu', 'www.zastava-arms.co.rs'),
- ('www.airportnis.co.yu', 'www.airportnis.rs'),
- ('www.belex.co.yu', 'www.belex.rs'),
- ('beograd.org.yu', 'beograd.rs'),
- ('www.vlada.cg.yu', 'www.vlada.me'),
- ('webrzs.statserb.sr.gov.yu', 'webrzs.stat.gov.rs'),
- ('www.statserb.sr.gov.yu', 'webrzs.stat.gov.rs'),
- ('www.rastko.org.yu', 'www.rastko.org.rs'),
- ('www.reprezentacija.co.yu', 'www.reprezentacija.rs'),
- ('www.blic.co.yu', 'www.blic.co.rs'),
- ('www.beograd.org.yu', 'www.beograd.org.rs'),
- ('arhiva.glas-javnosti.co.yu', 'arhiva.glas-javnosti.rs'),
- ('www.srpsko-nasledje.co.yu', 'www.srpsko-nasledje.co.rs'),
- ('www.dnevnik.co.yu', 'www.dnevnik.rs'),
- ('www.srbija.sr.gov.yu', 'www.srbija.gov.rs'),
- ('www.kurir-info.co.yu/Arhiva', 'arhiva.kurir-info.rs/Arhiva'),
- ('www.kurir-info.co.yu/arhiva', 'arhiva.kurir-info.rs/arhiva'),
- ('www.kurir-info.co.yu', 'www.kurir-info.rs'),
- ('arhiva.kurir-info.co.yu', 'arhiva.kurir-info.rs'),
- ('www.prvaliga.co.yu', 'www.prvaliga.rs'),
- ('www.mitropolija.cg.yu', 'www.mitropolija.me'),
- ('www.spc.yu/sr', 'www.spc.rs/sr'),
- ('www.sk.co.yu', 'www.sk.co.rs'),
- ('www.ekoforum.org.yu', 'www.ekoforum.org'),
- ('www.svevlad.org.yu', 'www.svevlad.org.rs'),
- ('www.posta.co.yu', 'www.posta.rs'),
- ('www.glas-javnosti.co.yu', 'www.glas-javnosti.rs'),
- ('www.fscg.cg.yu', 'www.fscg.co.me'),
- ('ww1.rts.co.yu/euro', 'ww1.rts.co.rs/euro'),
- ('www.rtv.co.yu', 'www.rtv.rs'),
- ('www.politika.co.yu', 'www.politika.rs'),
- ('www.mfa.gov.yu', 'www.mfa.gov.rs'),
- ('www.drzavnauprava.sr.gov.yu', 'www.drzavnauprava.gov.rs'),
- ],
- },
# These replacements will convert HTML tag from FCK-editor to wiki syntax.
#
'fckeditor': {
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1200416?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic10dbf77dfc645f62a621912e2139b765aa86e08
Gerrit-Change-Number: 1200416
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1198323?usp=email )
Change subject: Move Python deprecation warning from pywikibot library to pwb wrapper
......................................................................
Move Python deprecation warning from pywikibot library to pwb wrapper
When Pywikibot is used as a side package, the deprecation warning is not
necessary because pip already installs the correct version. Otherwise,
the pwb wrapper script is the appropriate place for such a warning, as
it serves as the frontend entry point of Pywikibot.
Change-Id: I8818e2a0667e56622084a1f49388c278faa0d876
---
M pwb.py
M pywikibot/__init__.py
M tests/utils.py
3 files changed, 21 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pwb.py b/pwb.py
index 9c4af3b..07debd3 100755
--- a/pwb.py
+++ b/pwb.py
@@ -18,6 +18,12 @@
This version of Pywikibot only supports Python 3.8+.
"""
+DEPRECATED_PYTHON_MESSAGE = """
+
+Python {version} will be dropped soon with Pywikibot 11.
+It is recommended to use Python 3.9 or above.
+See phab: T401802 for further information.
+"""
def python_is_supported():
@@ -25,9 +31,21 @@
return sys.version_info[:3] >= (3, 8)
+def python_is_deprecated():
+ """Check that Python is deprecated."""
+ return sys.version_info[:3] < (3, 9)
+
+
if not python_is_supported(): # pragma: no cover
sys.exit(VERSIONS_REQUIRED_MESSAGE.format(version=sys.version))
+if python_is_deprecated():
+ import warnings
+ msg = DEPRECATED_PYTHON_MESSAGE.format(
+ version=sys.version.split(maxsplit=1)[0])
+ warnings.warn(msg, FutureWarning) # adjust this line no in utils.execute()
+ del warnings
+
def main() -> None:
"""Entry point for :func:`tests.utils.execute_pwb`."""
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 4ddaf22..9b35fde 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -59,7 +59,7 @@
)
from pywikibot.site import BaseSite as _BaseSite
from pywikibot.time import Timestamp
-from pywikibot.tools import PYTHON_VERSION, normalize_username
+from pywikibot.tools import normalize_username
if TYPE_CHECKING:
@@ -87,15 +87,6 @@
_sites: dict[str, APISite] = {}
-if PYTHON_VERSION < (3, 9):
- __version = sys.version.split(maxsplit=1)[0]
- warnings.warn(f"""
-
- Python {__version} will be dropped soon with Pywikibot 11.
- It is recommended to use Python 3.9 or above.
- See phab: T401802 for further information.
-""", FutureWarning) # adjust warnings.warn line no in utils.execute()
-
@cache
def _code_fam_from_url(url: str, name: str | None = None) -> tuple[str, str]:
diff --git a/tests/utils.py b/tests/utils.py
index 870ca14..bba040a 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -476,7 +476,8 @@
:param command: executable to run and arguments to use
"""
if PYTHON_VERSION < (3, 9):
- command.insert(1, '-W ignore::FutureWarning:pywikibot:92')
+ command.insert(1, '-W ignore::FutureWarning:pwb:46')
+ command.insert(1, '-W ignore::FutureWarning:__main__:46')
env = os.environ.copy()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1198323?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8818e2a0667e56622084a1f49388c278faa0d876
Gerrit-Change-Number: 1198323
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot