jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164670?usp=email )
Change subject: Test: set threshold for cyclomatic complexity to 50
......................................................................
Test: set threshold for cyclomatic complexity to 50
The threshold can be described with the following values:
1-5: low risk - No action needed.
6-15: medium risk - Review and monitor.
16-25: high risk - Review and refactor.
Recommended to add comments if the function is absolutely needed
to be kept as it is.
26-50: very-high risk - Refactor to reduce the complexity.
>50: critical risk - Must refactor this.
This can make the code untestable and very difficult to understand.
n.b. there are 24 issues with threshold of 25.
Change-Id: Ia96900950580dee6ec8fbeec13c46df6ef294390
---
M scripts/replace.py
M tox.ini
2 files changed, 3 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py
index c771be0..7414bfc 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -161,7 +161,7 @@
the top of the help.
"""
#
-# (C) Pywikibot team, 2004-2024
+# (C) Pywikibot team, 2004-2025
#
# Distributed under the terms of the MIT license.
#
@@ -910,7 +910,7 @@
return pagegenerators.MySQLPageGenerator(sql)
-def main(*args: str) -> None: # noqa: C901
+def main(*args: str) -> None:
"""Process command line arguments and invoke bot.
If args is an empty list, sys.argv is used.
diff --git a/tox.ini b/tox.ini
index de53fd6..0c859e3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -131,7 +131,7 @@
exclude = .tox,.git,./*.egg,build,./scripts/i18n/*
color = always
format = %(blue)s%(path)s%(reset)s: %(bold)sline %(row)d:%(reset)s%(col)d: %(bold)s%(red)s%(code)s%(reset)s %(text)s
-max-complexity = 49
+max-complexity = 50
max-doc-length = 79
# The following are to be fixed
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164670?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: Ia96900950580dee6ec8fbeec13c46df6ef294390
Gerrit-Change-Number: 1164670
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164662?usp=email )
Change subject: fix: adjust comment in yml files
......................................................................
fix: adjust comment in yml files
Change-Id: If3f6a05346b4389567bb3cbe47ee8f3e4dd5c006
---
M .github/workflows/doctest.yml
M .github/workflows/login_tests-ci.yml
M .github/workflows/oauth_tests-ci.yml
M .github/workflows/pywikibot-ci.yml
4 files changed, 4 insertions(+), 4 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml
index 6e2f854..dee414e 100644
--- a/.github/workflows/doctest.yml
+++ b/.github/workflows/doctest.yml
@@ -38,7 +38,7 @@
with:
python-version: ${{ matrix.python-version }}
- # use deadsnakes/action for development releases
+ # use deadsnakes/action for development releases
- name: Set up development Python ${{ matrix.python-version }}
uses: deadsnakes/action(a)v3.2.0
if: endsWith(matrix.python-version, '-dev')
diff --git a/.github/workflows/login_tests-ci.yml b/.github/workflows/login_tests-ci.yml
index 9ce854b..f167462 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -61,7 +61,7 @@
with:
python-version: ${{ matrix.python-version }}
- # use deadsnakes/action for development releases
+ # use deadsnakes/action for development releases
- name: Set up development Python ${{ matrix.python-version }}
uses: deadsnakes/action(a)v3.2.0
if: endsWith(matrix.python-version, '-dev')
diff --git a/.github/workflows/oauth_tests-ci.yml b/.github/workflows/oauth_tests-ci.yml
index 2006ca0..8fe4cd8 100644
--- a/.github/workflows/oauth_tests-ci.yml
+++ b/.github/workflows/oauth_tests-ci.yml
@@ -46,7 +46,7 @@
with:
python-version: ${{ matrix.python-version }}
- # use deadsnakes/action for development releases
+ # use deadsnakes/action for development releases
- name: Set up development Python ${{ matrix.python-version }}
uses: deadsnakes/action(a)v3.2.0
if: endsWith(matrix.python-version, '-dev')
diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml
index 847ec66..6130c33 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -82,7 +82,7 @@
with:
python-version: ${{ matrix.python-version }}
- # use deadsnakes/action for development releases
+ # use deadsnakes/action for development releases
- name: Set up development Python ${{ matrix.python-version }}
uses: deadsnakes/action(a)v3.2.0
if: endsWith(matrix.python-version, '-dev')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164662?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: If3f6a05346b4389567bb3cbe47ee8f3e4dd5c006
Gerrit-Change-Number: 1164662
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164580?usp=email )
Change subject: doc: update ROADMAP.rst and CHANGELOG.rst
......................................................................
doc: update ROADMAP.rst and CHANGELOG.rst
Change-Id: I26a23809991f73f96bdb1c77bd08b80561731c1a
---
M ROADMAP.rst
M scripts/CHANGELOG.rst
2 files changed, 33 insertions(+), 11 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index f982227..fb6a0e9 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,12 @@
Current Release Changes
=======================
-* (no changes yet)
+* Add -cookies option to :mod:`login<pywikibot.scripts.login>` script to login with cookies files only
+* Create a Site using :func:`pywikibot.Site` constructor with a given url even if the url ends with
+ a slash (:phab:`T396592`)
+* Remove hard-coded error messages from :meth:`login.LoginManager.login` and use API response instead
+* Add additional informations to :meth:`Site.login()<pywikibot.site._apisite.APISite.login>` error message (:phab:`T395670`)
+* i18n updates
Current Deprecations
====================
@@ -16,8 +21,8 @@
'millennium' must be used instead.
* 10.0.0: *includeredirects* parameter of :func:`pagegenerators.AllpagesPageGenerator` and
:func:`pagegenerators.PrefixingPageGenerator` is deprecated and should be replaced by *filterredir*
-* 9.6.0: :meth:`BaseSite.languages()<pywikibot.site._basesite.BaseSite.languages>` will be removed in favour of
- :attr:`BaseSite.codes<pywikibot.site._basesite.BaseSite.codes>`
+* 9.6.0: :meth:`BaseSite.languages()<pywikibot.site._basesite.BaseSite.languages>` will be removed in
+ favour of :attr:`BaseSite.codes<pywikibot.site._basesite.BaseSite.codes>`
* 9.5.0: :meth:`DataSite.getPropertyType()<pywikibot.site._datasite.DataSite.getPropertyType>` will be removed
in favour of :meth:`DataSite.get_property_type()<pywikibot.site._datasite.DataSite.get_property_type>`
* 9.3.0: :meth:`page.BasePage.userName` and :meth:`page.BasePage.isIpEdit` are deprecated in favour of
@@ -25,16 +30,16 @@
* 9.2.0: Imports of :mod:`logging` functions from :mod:`bot` module is deprecated and will be desupported
* 9.2.0: *total* argument in ``-logevents`` pagegenerators option is deprecated;
use ``-limit`` instead (:phab:`T128981`)
-* 9.0.0: The *content* parameter of :meth:`proofreadpage.IndexPage.page_gen` is deprecated and will be ignored
- (:phab:`T358635`)
+* 9.0.0: The *content* parameter of :meth:`proofreadpage.IndexPage.page_gen` is deprecated and will be
+ ignored (:phab:`T358635`)
* 9.0.0: ``userinterfaces.transliteration.transliterator`` was renamed to :class:`Transliterator
<userinterfaces.transliteration.Transliterator>`
-* 9.0.0: ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to
- ``succ``
+* 9.0.0: ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was
+ renamed to ``succ``
* 9.0.0: ``type`` parameter of :meth:`site.APISite.protectedpages()
<pywikibot.site._generators.GeneratorsMixin.protectedpages>` was renamed to ``protect_type``
-* 9.0.0: ``all`` parameter of :meth:`site.APISite.namespace()<pywikibot.site._apisite.APISite.namespace>` was renamed to
- ``all_ns``
+* 9.0.0: ``all`` parameter of :meth:`site.APISite.namespace()<pywikibot.site._apisite.APISite.namespace>`
+ was renamed to ``all_ns``
* 9.0.0: ``filter`` parameter of :func:`date.dh` was renamed to ``filter_func``
* 9.0.0: ``dict`` parameter of :class:`data.api.OptionSet` was renamed to ``data``
* 9.0.0: ``pywikibot.version.get_toolforge_hostname()`` is deprecated without replacement
@@ -69,7 +74,7 @@
* 8.0.0: :meth:`LoginManager.get_login_token<login.ClientLoginManager.get_login_token>` was
replaced by ``login.ClientLoginManager.site.tokens['login']``
* 8.0.0: ``data.api.LoginManager()`` is deprecated in favour of :class:`login.ClientLoginManager`
-* 8.0.0: :meth:`APISite.messages()<pywikibot.site._apisite.APISite.messages>` method is deprecated in favour of
- :attr:`userinfo['messages']<pywikibot.site._apisite.APISite.userinfo>`
+* 8.0.0: :meth:`APISite.messages()<pywikibot.site._apisite.APISite.messages>` method is deprecated in
+ favour of :attr:`userinfo['messages']<pywikibot.site._apisite.APISite.userinfo>`
* 8.0.0: :meth:`Page.editTime()<page.BasePage.editTime>` method is deprecated and should be replaced by
:attr:`Page.latest_revision.timestamp<page.BasePage.latest_revision>`
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 598a879..62f50ea 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -1,6 +1,23 @@
Scripts Changelog
=================
+10.3.0
+------
+
+* i18n updates
+
+archivebot
+^^^^^^^^^^
+
+* Use wikidata items for archive header templates (:phab:`T396399`)
+
+redirect
+^^^^^^^^
+
+* Try one more move to fix redirect targets (:phab:`T396473`)
+* Don't fix broken redirects if namespace of source and target are different (:phab:`T396456`)
+
+
10.2.0
------
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1164580?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: I26a23809991f73f96bdb1c77bd08b80561731c1a
Gerrit-Change-Number: 1164580
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/i18n/+/1162879?usp=email )
Change subject: Localisation updates from https://translatewiki.net.
......................................................................
Localisation updates from https://translatewiki.net.
Change-Id: Ic99e6379e17da2b01976148fe4c99225575af75a
---
M redirect/gl.json
M redirect/mk.json
2 files changed, 6 insertions(+), 6 deletions(-)
Approvals:
L10n-bot: Looks good to me, approved
jenkins-bot: Verified
diff --git a/redirect/gl.json b/redirect/gl.json
index cc457b4..6be069c 100644
--- a/redirect/gl.json
+++ b/redirect/gl.json
@@ -5,9 +5,9 @@
"Toliño"
]
},
- "redirect-fix-broken-moved": "Arranxo a redirección rota cara á páxina de destino trasladada \"%(to)s\"",
- "redirect-fix-double": "Arranxo a redirección dobre cara a \"%(to)s\"",
- "redirect-fix-loop": "Arranxo a redirección en bucle cara a \"%(to)s\"",
+ "redirect-fix-broken-moved": "Arranxo a redirección rota desde \"%(from)s\" cara á páxina de destino \"%(to)s\"",
+ "redirect-fix-double": "Arranxo a redirección dobre desde \"%(from)s\" cara a \"%(to)s\"",
+ "redirect-fix-loop": "Arranxo a redirección en bucle desde \"%(from)s\" cara a \"%(to)s\"",
"redirect-remove-broken": "Redirección cara a unha páxina eliminada ou que non existe",
"redirect-remove-loop": "O destino da redirección crea un bucle"
}
diff --git a/redirect/mk.json b/redirect/mk.json
index fd334c3..80edff8 100644
--- a/redirect/mk.json
+++ b/redirect/mk.json
@@ -6,9 +6,9 @@
"Xqt"
]
},
- "redirect-fix-broken-moved": "Исправка на прекинато пренасочување кон преместена целна страница %(to)s",
- "redirect-fix-double": "Исправка на двојни пренасочувања → %(to)s",
- "redirect-fix-loop": "Поправа јамка на пренасочување кон %(to)s",
+ "redirect-fix-broken-moved": "Исправка на прекинато пренасочување од %(from)s кон преместена целна страница %(to)s",
+ "redirect-fix-double": "Исправка на двојни пренасочувања од %(from)s кон %(to)s",
+ "redirect-fix-loop": "Поправа јамка на пренасочување од %(from)s кон %(to)s",
"redirect-remove-broken": "Пренасочување кон избришана или непостоечка страница",
"redirect-remove-loop": "Одредницата за пренасочување образува јамка"
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1162879?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/i18n
Gerrit-Branch: master
Gerrit-Change-Id: Ic99e6379e17da2b01976148fe4c99225575af75a
Gerrit-Change-Number: 1162879
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
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1157612?usp=email )
Change subject: IMPR: Add -cookies option to login script to login with cookies files only
......................................................................
IMPR: Add -cookies option to login script to login with cookies files only
Change-Id: If38a806c9b222d39b50f7b464c3a4fb7b5985ab9
---
M pywikibot/scripts/login.py
1 file changed, 11 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/scripts/login.py b/pywikibot/scripts/login.py
index a940fca..74c1583 100755
--- a/pywikibot/scripts/login.py
+++ b/pywikibot/scripts/login.py
@@ -9,6 +9,8 @@
-all Try to log in on all sites where a username is defined in
user config file (user-config.py).
+-cookies Only login from cookies file, don't ask for password
+
-logout Log out of the current site. Combine with ``-all`` to log
out of all sites, or with :ref:`global options` ``-family``,
``-lang`` or ``-site`` to log out of a specific site.
@@ -46,6 +48,8 @@
*-async* option was added.
.. versionchanged:: 10.2
wildcard site codes in ``usernames`` dict are supported.
+.. versionchanged:: 10.3
+ the -cookies option
"""
#
# (C) Pywikibot team, 2003-2025
@@ -95,7 +99,8 @@
)
-def login_one_site(code, family, oauth, logout, autocreate) -> None:
+def login_one_site(code: str, family: str, oauth: bool, logout: bool,
+ autocreate: bool, cookies: bool) -> None:
"""Login on one site."""
try:
site = pywikibot.Site(code, family)
@@ -112,7 +117,7 @@
site.logout()
else:
try:
- site.login(autocreate=autocreate)
+ site.login(autocreate=autocreate, cookie_only=cookies)
except NoUsernameError as e:
pywikibot.error(e)
@@ -137,6 +142,7 @@
oauth = False
autocreate = False
asynchronous = False
+ cookies = False
unknown_args = []
for arg in pywikibot.handle_args(args):
if arg == '-all':
@@ -149,6 +155,8 @@
autocreate = True
elif arg == '-async':
asynchronous = True
+ elif arg == '-cookies':
+ cookies = True
else:
unknown_args.append(arg)
@@ -161,7 +169,7 @@
site = pywikibot.Site()
namedict = {site.family.name: {site.code: None}}
- params = oauth, logout, autocreate
+ params = oauth, logout, autocreate, cookies
context = (nullcontext(),
BoundedPoolExecutor('ThreadPoolExecutor'))[asynchronous]
with context as executor:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1157612?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: If38a806c9b222d39b50f7b464c3a4fb7b5985ab9
Gerrit-Change-Number: 1157612
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot