[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Avoid empty blocks in textlib

2024-05-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025406?usp=email )

Change subject: [IMPR] Avoid empty blocks in textlib
..

[IMPR] Avoid empty blocks in textlib

Instead iterating over all elements to find the last match (and cnt),
create a list and extract the needed values from there.

Change-Id: Ia8fd6432771f7e721523212baa8e7672b3f450d3
---
M pywikibot/textlib.py
1 file changed, 14 insertions(+), 13 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 788df3a..b54d4f5 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1671,8 +1671,7 @@

 if under_categories:
 category = get_regexes('category', site)[0]
-for last_category in category.finditer(newtext):
-pass
+last_category = list(category.finditer(newtext))[-1]
 for reg in under_categories:
 special = reg.search(newtext)
 if special and not isDisabled(newtext, special.start()):
@@ -2112,29 +2111,31 @@
 """
 return to_latin_digits(line)

-def _last_match_and_replace(self, txt: str, pat):
+def _last_match_and_replace(self,
+txt: str,
+pat) -> tuple[str, Match[str] | None]:
 """Take the rightmost match and replace with marker.

 It does so to prevent spurious earlier matches.
 """
-m = None
-cnt = 0
-for cnt, m in enumerate(pat.finditer(txt), start=1):
-pass
+all_matches = list(pat.finditer(txt))
+cnt = len(all_matches)

-def marker(m):
+if not cnt:
+return (txt, None)
+
+m = all_matches[-1]
+
+def marker(m: Match[str]):
 """
 Replace exactly the same number of matched characters.

-Same number of chars shall be replaced, in order to be able to
-compare pos for matches reliably (absolute pos of a match
+Same number of chars shall be replaced, in order to be able
+to compare pos for matches reliably (absolute pos of a match
 is not altered by replacement).
 """
 return '@' * (m.end() - m.start())

-if not m:
-return (txt, None)
-
 # month and day format might be identical (e.g. see bug T71315),
 # avoid to wipe out day, after month is matched. Replace all matches
 # but the last two (i.e. allow to search for dd. mm.)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025406?usp=email
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: Ia8fd6432771f7e721523212baa8e7672b3f450d3
Gerrit-Change-Number: 1025406
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Matěj Suchánek 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: WikibasePage.exists: Add tests for PropertyPage.exists.

2024-05-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/322253?usp=email )

Change subject: WikibasePage.exists: Add tests for PropertyPage.exists.
..

WikibasePage.exists: Add tests for PropertyPage.exists.

Currently the tests fails with:
PropertyPage.get does not support any args or kwargs except `force`.

Bug: T145971
Change-Id: I8b2f77439789be8f3390f8510f8402147ca6b094
---
M tests/wikibase_tests.py
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 033be36..f3aa96e 100755
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1741,6 +1741,15 @@
 self.assertEqual(claim.type, 'wikibase-property')
 self.assertEqual(claim.target, property_page)

+@unittest.expectedFailure
+def test_exists(self):
+"""Test the exists method of PropertyPage."""
+wikidata = self.get_repo()
+property_page = PropertyPage(wikidata, 'P1687')
+self.assertTrue(property_page.exists())
+# Retry with cached _content.
+self.assertTrue(property_page.exists())
+

 class TestClaim(WikidataTestCase):


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/322253?usp=email
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: I8b2f77439789be8f3390f8510f8402147ca6b094
Gerrit-Change-Number: 322253
Gerrit-PatchSet: 3
Gerrit-Owner: Dalba 
Gerrit-Reviewer: Dalba 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Magul 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Remove empty body

2024-05-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025444?usp=email )

Change subject: [IMPR] Remove empty body
..

[IMPR] Remove empty body

- remove needless return statement in DryRequest._write_cache
- drop context manager functionality for textlib._GetDataHTML
  and use contextlib.closing instead in removeHTMLParts()
- update documentation

Change-Id: I38287c83a8e8d1cac45b0a0deb8064e153434b80
---
M pywikibot/textlib.py
M tests/utils.py
2 files changed, 44 insertions(+), 22 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 788df3a..60968c7 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -10,7 +10,7 @@
 import re
 from collections import OrderedDict
 from collections.abc import Sequence
-from contextlib import suppress
+from contextlib import closing, suppress
 from html.parser import HTMLParser
 from typing import NamedTuple

@@ -543,22 +543,26 @@


 def removeHTMLParts(text: str, keeptags: list[str] | None = None) -> str:
-"""
-Return text without portions where HTML markup is disabled.
+"""Return text without portions where HTML markup is disabled.

-Parts that can/will be removed are --
-* HTML and all wiki tags
+Parts that can/will be removed are HTML tags and all wiki tags. The
+exact set of parts which should NOT be removed can be passed as the
+*keeptags* parameter, which defaults to
+``['tt', 'nowiki', 'small', 'sup']``.

-The exact set of parts which should NOT be removed can be passed as the
-'keeptags' parameter, which defaults to ['tt', 'nowiki', 'small', 'sup'].
+**Example:**
+
+>>> removeHTMLParts('Hi all!')
+'Hi all!'
+
+.. seealso:: :class:`_GetDataHTML`
 """
-# try to merge with 'removeDisabledParts()' above into one generic function
-# thanks to:
-# https://www.hellboundhackers.org/articles/read-article.php?article_id=841
+# TODO: try to merge with 'removeDisabledParts()' above into one generic
+# function
 parser = _GetDataHTML()
 if keeptags is None:
 keeptags = ['tt', 'nowiki', 'small', 'sup']
-with parser:
+with closing(parser):
 parser.keeptags = keeptags
 parser.feed(text)
 return parser.textdata
@@ -568,20 +572,39 @@

 """HTML parser which removes html tags except they are listed in keeptags.

-This class is also a context manager which closes itself at exit time.
+The parser is used by :func:`removeHTMLParts` similar to this:

-.. seealso:: :pylib:`html.parser`
+.. code:: python
+
+   from contextlib import closing
+   from pywikibot.textlib import _GetDataHTML
+   with closing(_GetDataHTML()) as parser:
+   parser.keeptags = ['html']
+   parser.feed('Test'
+   ' me!')
+   print(parser.textdata)
+
+The result is:
+
+.. code:: text
+
+   Test me!
+
+.. versionchanged:: 9.2
+   This class is no longer a context manager;
+   :pylib:`contextlib.closing()`
+   should be used instead.
+
+.. seealso::
+   - :pylib:`html.parser`
+   - :pylib:`contextlib#contextlib.closing`
+
+:meta public:
 """

 textdata = ''
 keeptags: list[str] = []

-def __enter__(self) -> None:
-pass
-
-def __exit__(self, *exc_info) -> None:
-self.close()
-
 def handle_data(self, data) -> None:
 """Add data to text."""
 self.textdata += data
diff --git a/tests/utils.py b/tests/utils.py
index 445075a..7ea74d1 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -322,9 +322,8 @@
 """Never invalidate cached data."""
 return False

-def _write_cache(self, data):
-"""Never write data."""
-return
+def _write_cache(self, data) -> None:
+"""Never write data but just do nothing."""

 def submit(self):
 """Prevented method."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025444?usp=email
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: I38287c83a8e8d1cac45b0a0deb8064e153434b80
Gerrit-Change-Number: 1025444
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-05-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1028453?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Ia9ddc78d564e48d6a12ea957915240fddffcd403
---
M category/eu.json
M pywikibot/eu.json
2 files changed, 5 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  L10n-bot: Looks good to me, approved




diff --git a/category/eu.json b/category/eu.json
index 5ad9abc..773398d 100644
--- a/category/eu.json
+++ b/category/eu.json
@@ -19,6 +19,8 @@
"category-replacing": "Bot: %(oldcat)s kategoria %(newcat)s-(e)ngatik 
ordezkatu",
"category-section-title": "Ohiko %(oldcat)s-(e)n orrialde historia",
"category-strip-cfd-templates": "Bot: CFD ekintza burutzeko txantiloiak 
ezabatzen",
+   "category-strip-sort-keys": "Bot: amaitutako ekintzetarako 
ordenatze-giltzak kentzen",
+   "category-strip-both": "Bot: CFD txantiloiak eta ordenatzeko-irizpideak 
kentzeko amaitutako ekintzentzat",
"category-version-history": "Errobota: Antzinako %(oldcat)s bertsio 
historiala gordetzen",
"category-was-disbanded": "Bot: Kategoria ezabatu da",
"category-was-moved": "Robota: Kategoria 
«[[:Category:%(newcat)s|%(title)s]]» kategoriara aldatu da"
diff --git a/pywikibot/eu.json b/pywikibot/eu.json
index 202f6a1..76a3b71 100644
--- a/pywikibot/eu.json
+++ b/pywikibot/eu.json
@@ -4,6 +4,7 @@
"An13sa",
"EukeneFL",
"Subi",
+   "Theklan",
"Xabier Armendaritz"
]
},
@@ -19,5 +20,6 @@
"pywikibot-fixes-fckeditor": "Bot: html editore-aberastua konpontzen",
"pywikibot-fixes-isbn": "Robota: ISBNari formatua ematen",
"pywikibot-fixes-html": "Bot: HTMLa bihurtzen/konpontzen",
-   "pywikibot-fixes-syntax": "Bot: Wiki-sintaxia zuzentzen"
+   "pywikibot-fixes-syntax": "Bot: Wiki-sintaxia zuzentzen",
+   "pywikibot-touch": "Pywikibot artikulua ukituz aldatu"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1028453?usp=email
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: Ia9ddc78d564e48d6a12ea957915240fddffcd403
Gerrit-Change-Number: 1028453
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] update coverage for version.py

2024-05-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1027554?usp=email )

Change subject: [tests] update coverage for version.py
..

[tests] update coverage for version.py

Change-Id: Ie1dcfb1e0731428505e4ce67e63038b380fdaa00
---
M pywikibot/version.py
M tests/version_tests.py
2 files changed, 7 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/version.py b/pywikibot/version.py
index 0e3f35a..722a377 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -103,7 +103,7 @@
 exceptions[vcs_func] = vcs_func.__name__, e
 else:
 break
-else:
+else:  # pragma: no cover
 # nothing worked; version unknown (but suppress exceptions)
 # the value is most likely '$Id' + '$', it means that
 # pywikibot was imported without using version control at all.
@@ -114,14 +114,14 @@
 exceptions = None

 # Git and SVN can silently fail, as it may be a nightly.
-if exceptions:
+if exceptions:  # pragma: no cover
 pywikibot.debug(f'version algorithm exceptions:\n{exceptions!r}')

 if isinstance(date, str):
 datestring = date
 elif isinstance(date, time.struct_time):
 datestring = time.strftime('%Y/%m/%d, %H:%M:%S', date)
-else:
+else:  # pragma: no cover
 warn('Unable to detect package date', UserWarning)
 datestring = '-2 (unknown)'

@@ -258,7 +258,7 @@
 """
 file = Path(path or _get_program_dir())
 if not path:
-file /= 'pywikibot'
+file /= 'pywikibot'  # pragma: no cover
 file /= 'version'

 with file.open() as data:
@@ -267,7 +267,7 @@
 date = time.strptime(date[:19], '%Y-%m-%dT%H:%M:%S')

 if not date or not tag or not rev:
-raise VersionParseError
+raise VersionParseError  # pragma: no cover
 return (tag, rev, date, hsh)


@@ -299,7 +299,7 @@
 headers={'user-agent': '{pwb}'}).text[4:]
 try:
 return json.loads(buf)['revision']
-except Exception as e:
+except Exception as e:  # pragma: no cover
 raise VersionParseError(f'{e!r} while parsing {buf!r}')


diff --git a/tests/version_tests.py b/tests/version_tests.py
index 217bbd2..96a6de1 100644
--- a/tests/version_tests.py
+++ b/tests/version_tests.py
@@ -58,7 +58,7 @@
 hsh = version.getversion_onlinerepo('branches/' + branch)
 try:
 int(hsh, 16)
-except ValueError:
+except ValueError:  # pragma: no cover
 self.fail(
 f'{hsh!r} is not a valid hash of {branch} branch')


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1027554?usp=email
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: Ie1dcfb1e0731428505e4ce67e63038b380fdaa00
Gerrit-Change-Number: 1027554
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] fix description for version script

2024-05-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026714?usp=email )

Change subject: [doc] fix description for version script
..

[doc] fix description for version script

Change-Id: I0b52ac21517d547638036f2338a492f3e2f0ef12
---
M pywikibot/scripts/version.py
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/scripts/version.py b/pywikibot/scripts/version.py
index 3d02378..0905135 100755
--- a/pywikibot/scripts/version.py
+++ b/pywikibot/scripts/version.py
@@ -3,7 +3,8 @@

 The following option is supported:

--usernames  print usernames for each registered family
+-nouser  do not print usernames; otherwise they are printed for each
+ registered family

 .. versionchanged:: 7.0
version script was moved to the framework scripts folder

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026714?usp=email
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: I0b52ac21517d547638036f2338a492f3e2f0ef12
Gerrit-Change-Number: 1026714
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [9.2] Restore Pywikibot 9.2 for further developing

2024-05-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026709?usp=email )

Change subject: [9.2] Restore Pywikibot 9.2 for further developing
..

[9.2] Restore Pywikibot 9.2 for further developing

Change-Id: I6e1895685ae917095539f1a7efe93ab2130fbbd3
---
M .appveyor.yml
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
M scripts/__init__.py
5 files changed, 13 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index 6fb8acf..96d787b 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
 image: Visual Studio 2022
 clone_depth: 50
 skip_tags: true
-version: 9.1.{build}
+version: 9.2.{build}
 environment:

   PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/HISTORY.rst b/HISTORY.rst
index 3415a6d..fc240b8 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,15 @@
 Release history
 ===

+9.1.2
+-
+*03 May 2024*
+
+* Remove line endings in :func:`version.getversion_nightly` (:phab:`T363943`)
+* Provide ``-nouser`` option with :mod:`pywikibot.scripts.version`
+* i18n updates
+
+
 9.1.1
 -
 *27 April 2024*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 80c71e0..19cb97f 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,9 +1,7 @@
 Current release
 ---

-* Remove line endings in :func:`version.getversion_nightly` (:phab:`T363943`)
-* Provide ``-nouser`` option with :mod:`pywikibot.scripts.version`
-* i18n updates
+* (no changes yet)

 Deprecations
 
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index a4b4218..362e90a 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


-__version__ = '9.1.2'
+__version__ = '9.2.0.dev2'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = f'2003-{strftime("%Y")}, Pywikibot team'
diff --git a/scripts/__init__.py b/scripts/__init__.py
index 13b4564..01864c7 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -32,4 +32,4 @@
 #
 # Distributed under the terms of the MIT license.
 #
-__version__ = '9.1.2'
+__version__ = '9.2.0'

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026709?usp=email
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: I6e1895685ae917095539f1a7efe93ab2130fbbd3
Gerrit-Change-Number: 1026709
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[stable]: Merge branch 'master' into stable

2024-05-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026708?usp=email )

Change subject: Merge branch 'master' into stable
..

Merge branch 'master' into stable

Change-Id: I41f97108af8d0eb554d57766e14bfdb52c56d862
---
M scripts/__init__.py
2 files changed, 30 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/__init__.py b/scripts/__init__.py
index af4197d..13b4564 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -32,8 +32,4 @@
 #
 # Distributed under the terms of the MIT license.
 #
-<<< HEAD   (fdb76b Update git submodules)
-__version__ = '9.1.1'
-===
 __version__ = '9.1.2'
->>> BRANCH (cc9abc [9.1.2] Publish Pywikibot 9.1.2)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026708?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: stable
Gerrit-Change-Id: I41f97108af8d0eb554d57766e14bfdb52c56d862
Gerrit-Change-Number: 1026708
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [9.1.2] Publish Pywikibot 9.1.2

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026705?usp=email )

Change subject: [9.1.2] Publish Pywikibot 9.1.2
..

[9.1.2] Publish Pywikibot 9.1.2

Change-Id: I80f6d352b6a16fd8d6dfa12ac40d68a989c42077
---
M .appveyor.yml
M ROADMAP.rst
M pywikibot/__metadata__.py
M pywikibot/scripts/version.py
M scripts/__init__.py
5 files changed, 8 insertions(+), 6 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/.appveyor.yml b/.appveyor.yml
index 96d787b..6fb8acf 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
 image: Visual Studio 2022
 clone_depth: 50
 skip_tags: true
-version: 9.2.{build}
+version: 9.1.{build}
 environment:

   PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 19cb97f..80c71e0 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,9 @@
 Current release
 ---

-* (no changes yet)
+* Remove line endings in :func:`version.getversion_nightly` (:phab:`T363943`)
+* Provide ``-nouser`` option with :mod:`pywikibot.scripts.version`
+* i18n updates

 Deprecations
 
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 0eae51b..a4b4218 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


-__version__ = '9.2.0.dev1'
+__version__ = '9.1.2'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = f'2003-{strftime("%Y")}, Pywikibot team'
diff --git a/pywikibot/scripts/version.py b/pywikibot/scripts/version.py
index 0bc0af8..3d02378 100755
--- a/pywikibot/scripts/version.py
+++ b/pywikibot/scripts/version.py
@@ -7,7 +7,7 @@

 .. versionchanged:: 7.0
version script was moved to the framework scripts folder
-.. versionadded:: 9.2
+.. versionadded:: 9.1.2
the *-nouser* option.
 """
 #
@@ -59,7 +59,7 @@
 def main(*args: str) -> None:
 """Print pywikibot version and important settings.

-.. versionchanged:: 9.2
+.. versionchanged:: 9.1.2
usernames are not printed with ``-nouser`` option.
 """
 pywikibot.info('Pywikibot: ' + getversion())
diff --git a/scripts/__init__.py b/scripts/__init__.py
index 01864c7..13b4564 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -32,4 +32,4 @@
 #
 # Distributed under the terms of the MIT license.
 #
-__version__ = '9.2.0'
+__version__ = '9.1.2'

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026705?usp=email
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: I80f6d352b6a16fd8d6dfa12ac40d68a989c42077
Gerrit-Change-Number: 1026705
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] update version_tests.py

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026634?usp=email )

Change subject: [tests] update version_tests.py
..

[tests] update version_tests.py

Bug: T363943
Change-Id: I80ab8950507a6ebb4408cf619f99c094d151b293
Signed-off-by: Xqt 
---
M tests/version_tests.py
1 file changed, 2 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/version_tests.py b/tests/version_tests.py
index c9364f5..217bbd2 100644
--- a/tests/version_tests.py
+++ b/tests/version_tests.py
@@ -25,15 +25,14 @@

 net = False

-@unittest.expectedFailure  # T363943
 def test_nightly_version(self):
 """Test version file of nightly dump."""
 path = Path(__file__).parent / 'data'
 tag, rev, date, hsh, *dummy = version.getversion_nightly(path)
-self.assertEqual(tag, 'nightly/core')
+self.assertEqual(tag, 'nightly/core_stable')
 self.assertEqual(rev, '1')
 self.assertIsInstance(date, time.struct_time)
-self.assertEqual(hsh, '567a31d')
+self.assertEqual(hsh, 'e8f64f2')
 self.assertEqual(dummy, [])

 def test_package_version(self):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026634?usp=email
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: I80ab8950507a6ebb4408cf619f99c094d151b293
Gerrit-Change-Number: 1026634
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: version.py: Remove line endings in getversion_nightly

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026185?usp=email )

Change subject: version.py: Remove line endings in getversion_nightly
..

version.py: Remove line endings in getversion_nightly

The version strings are eventually passed into the user agent, and
having a linebreak results in a user agent such as:

  script (wikipedia:test; User:Bot) Pywikibot/9.2.0.dev1 (1\n)
requests/2.28.2 Python/3.9.2.final.0

This \n causes the result to fail with error:

  pywikibot.exceptions.FatalServerError: Invalid leading whitespace,
reserved character(s), or returncharacter(s) in header value.

Fix this by, instead of using readlines, which preserves the line
endings, read the entire file and split by linebreak, which implicitly
removes all the line endings.

Bug: T363943
Change-Id: I38f9b27d3339916dc6b784ecda602055924aa6bc
---
M pywikibot/version.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/version.py b/pywikibot/version.py
index 542c480..40793a0 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -259,7 +259,7 @@
 file = Path(path or _get_program_dir()) / 'pywikibot' / 'version'

 with file.open() as data:
-(tag, rev, date, hsh) = data.readlines()
+(tag, rev, date, hsh) = data.read().splitlines()

 date = time.strptime(date[:19], '%Y-%m-%dT%H:%M:%S')


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026185?usp=email
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: I38f9b27d3339916dc6b784ecda602055924aa6bc
Gerrit-Change-Number: 1026185
Gerrit-PatchSet: 3
Gerrit-Owner: Zhuyifei1999 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Add version_tests.py

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026462?usp=email )

Change subject: [tests] Add version_tests.py
..

[tests] Add version_tests.py

Currently test_nightly_version method will fail until T363943 is solved.

Bug: T363943
Change-Id: Ie3c26c84927d4561fadb2b23bcd94126f8216b6f
---
M docs/tests_ref/index.rst
A docs/tests_ref/version_tests.rst
M pywikibot/version.py
A tests/data/version
A tests/version_tests.py
5 files changed, 88 insertions(+), 3 deletions(-)

Approvals:
  Zhuyifei1999: Looks good to me, approved
  Framawiki: Looks good to me, but someone else must approve
  jenkins-bot: Verified




diff --git a/docs/tests_ref/index.rst b/docs/tests_ref/index.rst
index 7340817..2072f0e 100644
--- a/docs/tests_ref/index.rst
+++ b/docs/tests_ref/index.rst
@@ -81,6 +81,7 @@
 ui<./ui_tests>
 user<./user_tests>
 utils
+version<./version_tests>
 wikibase_edit<./wikibase_edit_tests>
 wikibase<./wikibase_tests>
 wikistats<./wikistats_tests>
diff --git a/docs/tests_ref/version_tests.rst b/docs/tests_ref/version_tests.rst
new file mode 100644
index 000..d08e1be
--- /dev/null
+++ b/docs/tests_ref/version_tests.rst
@@ -0,0 +1,8 @@
+***
+tests.version\_tests module
+***
+
+.. automodule:: tests.version_tests
+:members:
+:undoc-members:
+:show-inheritance:
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 542c480..db6a084 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -241,7 +241,7 @@
 return (tag, rev, date, hsh)


-def getversion_nightly(path: str | Path | None = None):  # pragma: no cover
+def getversion_nightly(path: str | Path | None = None):
 """Get version info for a nightly release.

 .. hint::
@@ -256,7 +256,10 @@
 - hash (git hash for the current revision)
 :rtype: ``tuple`` of three ``str`` and a ``time.struct_time``
 """
-file = Path(path or _get_program_dir()) / 'pywikibot' / 'version'
+file = Path(path or _get_program_dir())
+if not path:
+file /= 'pywikibot'
+file /= 'version'

 with file.open() as data:
 (tag, rev, date, hsh) = data.readlines()
@@ -287,7 +290,7 @@
 return (tag, rev, date, hsh)


-def getversion_onlinerepo(path: str = 'branches/master'):
+def getversion_onlinerepo(path: str = 'branches/master') -> str:
 """Retrieve current framework git hash from Gerrit."""
 # Gerrit API responses include )]}' at the beginning,
 # make sure to strip it out
diff --git a/tests/data/version b/tests/data/version
new file mode 100644
index 000..91f8372
--- /dev/null
+++ b/tests/data/version
@@ -0,0 +1,4 @@
+nightly/core_stable
+1
+2024-05-02T01:04:51
+e8f64f2
diff --git a/tests/version_tests.py b/tests/version_tests.py
new file mode 100644
index 000..c9364f5
--- /dev/null
+++ b/tests/version_tests.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+"""Test cases for the :mod:`version` module.
+
+.. versionadded:: 9.2
+"""
+#
+# (C) Pywikibot team, 2024
+#
+# Distributed under the terms of the MIT license.
+#
+from __future__ import annotations
+
+import time
+import unittest
+from contextlib import suppress
+from pathlib import Path
+
+from pywikibot import version
+from tests.aspects import TestCase
+
+
+class LocalVersionTestCase(TestCase):
+
+"""Test local version infomation."""
+
+net = False
+
+@unittest.expectedFailure  # T363943
+def test_nightly_version(self):
+"""Test version file of nightly dump."""
+path = Path(__file__).parent / 'data'
+tag, rev, date, hsh, *dummy = version.getversion_nightly(path)
+self.assertEqual(tag, 'nightly/core')
+self.assertEqual(rev, '1')
+self.assertIsInstance(date, time.struct_time)
+self.assertEqual(hsh, '567a31d')
+self.assertEqual(dummy, [])
+
+def test_package_version(self):
+"""Test package version."""
+tag, rev, date, hsh, *dummy = version.getversion_package()
+self.assertEqual(tag, 'pywikibot/__init__.py')
+self.assertEqual(rev, '-1 (unknown)')
+self.assertIsInstance(date, time.struct_time)
+self.assertEqual(hsh, '')
+self.assertEqual(dummy, [])
+
+
+class RemoteVersionTestCase(TestCase):
+
+"""Test remote version infomation."""
+
+net = True
+
+def test_onlinerepo_version(self):
+"""Test online repository hash."""
+for branch in ('master', 'stable'):
+with self.subTest(branch=branch):
+hsh = version.getversion_onlinerepo('branches/' + branch)
+try:
+int(hsh, 16)
+except ValueError:
+self.fail(
+f'{hsh!r} is not a valid hash of {branch} branch')
+
+
+if __name__ == '__main__':
+with suppress(SystemExit):
+unittest.main()

--
To view, visit 

[Pywikibot-commits] [Gerrit] ...core[master]: [cleanup] i18n.TranslationError was removed in Pywikibot 7

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026598?usp=email )

Change subject: [cleanup] i18n.TranslationError was removed in Pywikibot 7
..

[cleanup] i18n.TranslationError was removed in Pywikibot 7

Change-Id: I37be3ce061631b9a77db4c27d30fd7767ff87eac
---
M pywikibot/exceptions.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 998c2c8..9104e7b 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -77,11 +77,11 @@
   - NoUsernameError: Username is not in user config file, or it is invalid.
   - PageInUseError: Page cannot be reserved due to a lock
   - SectionError: The section specified by # does not exist
-  - TranslationError: no language translation found
+  - TranslationError: no language translation found, i18n/l10n message
+not available
   - UnknownExtensionError: Extension is not defined for this site
   - UserRightsError: insufficient rights for requested action
   - VersionParseError: failed to parse version information
-  - i18n.TranslationError: i18n/l10n message not available

 APIError: wiki API returned an error
 

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026598?usp=email
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: I37be3ce061631b9a77db4c27d30fd7767ff87eac
Gerrit-Change-Number: 1026598
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] upload_tests is a framework test rather than a script test

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026584?usp=email )

Change subject: [tests] upload_tests is a framework test rather than a script 
test
..

[tests] upload_tests is a framework test rather than a script test

Change-Id: Ic1a734bbce7e7e7ed22cf7a4036f6da91b027a45
---
M docs/tests_ref/index.rst
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/docs/tests_ref/index.rst b/docs/tests_ref/index.rst
index 7340817..22fed99 100644
--- a/docs/tests_ref/index.rst
+++ b/docs/tests_ref/index.rst
@@ -79,6 +79,7 @@
 tools<./tools_tests>
 ui_options<./ui_options_tests>
 ui<./ui_tests>
+upload<./upload_tests>
 user<./user_tests>
 utils
 wikibase_edit<./wikibase_edit_tests>
@@ -117,5 +118,4 @@
 reflinks<./reflinks_tests>
 replacebot<./replacebot_tests>
 template_bot<./template_bot_tests>
-upload<./upload_tests>
 uploadbot<./uploadbot_tests>

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1026584?usp=email
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: Ic1a734bbce7e7e7ed22cf7a4036f6da91b027a45
Gerrit-Change-Number: 1026584
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-05-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1026541?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: I7d952612f210a6014f3db8327d5514d59c148036
---
M category/tly.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/category/tly.json b/category/tly.json
index a2a795b..4813561 100644
--- a/category/tly.json
+++ b/category/tly.json
@@ -16,5 +16,5 @@
"category-section-title": "Сәһифә тарихи че канәку %(oldcat)s",
"category-version-history": "Робот: Тарихи чы kanə версијәку огәте 
%(oldcat)s",
"category-was-disbanded": "Bot: Kateqoriya ләғв кардә быә",
-   "category-was-moved": "Bot: Kateqoriya тожәдан ном ноә быә 
[[:Category:%(newcat)s|%(title)s]]"
+   "category-was-moved": "Bot: Bə kategorijə tožə nom noə byə 
[[:Category:%(newcat)s|%(title)s]]"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1026541?usp=email
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: I7d952612f210a6014f3db8327d5514d59c148036
Gerrit-Change-Number: 1026541
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] move OAuthEditTest from edit_tests.py to oauth_tests.py

2024-04-30 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025771?usp=email )

Change subject: [tests] move OAuthEditTest from edit_tests.py to oauth_tests.py
..

[tests] move OAuthEditTest from edit_tests.py to oauth_tests.py

Change-Id: I10a827744d7344114b03752b64ad34b510210477
---
M tests/edit_tests.py
M tests/oauth_tests.py
2 files changed, 42 insertions(+), 40 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/edit_tests.py b/tests/edit_tests.py
index 93e6cdb..415be0a 100755
--- a/tests/edit_tests.py
+++ b/tests/edit_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for editing pages."""
 #
-# (C) Pywikibot team, 2015-2022
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -12,10 +12,9 @@
 from contextlib import suppress

 import pywikibot
-from pywikibot import config, page_put_queue
+from pywikibot import page_put_queue
 from pywikibot.exceptions import Error
 from tests.aspects import TestCase, require_version
-from tests.oauth_tests import OAuthSiteTestCase


 called_back = False
@@ -176,42 +175,6 @@
 self.assertEqual(dest.revision_count(), 2)


-class OAuthEditTest(OAuthSiteTestCase):
-
-"""Run edit test with OAuth enabled."""
-
-family = 'wikipedia'
-code = 'test'
-
-write = True
-
-def setUp(self):
-"""Set up test by checking site and initialization."""
-super().setUp()
-self._authenticate = config.authenticate
-oauth_tokens = self.consumer_token + self.access_token
-config.authenticate[self.site.hostname()] = oauth_tokens
-
-def tearDown(self):
-"""Tear down test by resetting config.authenticate."""
-super().tearDown()
-config.authenticate = self._authenticate
-
-def test_edit(self):
-"""Test editing to a page."""
-self.site.login()
-self.assertTrue(self.site.logged_in())
-ts = str(time.time())
-p = pywikibot.Page(self.site,
-   f'User:{self.site.username()}/edit test')
-p.site.editpage(p, appendtext=ts)
-revision_id = p.latest_revision_id
-p = pywikibot.Page(self.site,
-   f'User:{self.site.username()}/edit test')
-self.assertEqual(revision_id, p.latest_revision_id)
-self.assertTrue(p.text.endswith(ts))
-
-
 if __name__ == '__main__':
 with suppress(SystemExit):
 unittest.main()
diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py
index 345d4f3..836b91a 100755
--- a/tests/oauth_tests.py
+++ b/tests/oauth_tests.py
@@ -1,15 +1,18 @@
 #!/usr/bin/env python3
 """Test OAuth functionality."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import annotations

 import os
+import time
 from contextlib import suppress

+import pywikibot
+from pywikibot import config
 from pywikibot.login import OauthLoginManager
 from tests.aspects import (
 DefaultSiteTestCase,
@@ -46,6 +49,42 @@
 self.access_token = tokens[2:]


+class OAuthEditTest(OAuthSiteTestCase):
+
+"""Run edit test with OAuth enabled."""
+
+family = 'wikipedia'
+code = 'test'
+
+write = True
+
+def setUp(self):
+"""Set up test by checking site and initialization."""
+super().setUp()
+self._authenticate = config.authenticate
+oauth_tokens = self.consumer_token + self.access_token
+config.authenticate[self.site.hostname()] = oauth_tokens
+
+def tearDown(self):
+"""Tear down test by resetting config.authenticate."""
+super().tearDown()
+config.authenticate = self._authenticate
+
+def test_edit(self):
+"""Test editing to a page."""
+self.site.login()
+self.assertTrue(self.site.logged_in())
+ts = str(time.time())
+p = pywikibot.Page(self.site,
+   f'User:{self.site.username()}/edit test')
+p.site.editpage(p, appendtext=ts)
+revision_id = p.latest_revision_id
+p = pywikibot.Page(self.site,
+   f'User:{self.site.username()}/edit test')
+self.assertEqual(revision_id, p.latest_revision_id)
+self.assertTrue(p.text.endswith(ts))
+
+
 class TestOauthLoginManger(DefaultSiteTestCase, OAuthSiteTestCase):

 """Test OAuth login manager."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025771?usp=email
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: I10a827744d7344114b03752b64ad34b510210477
Gerrit-Change-Number: 1025771
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged

[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Improvements for interwiki.py

2024-04-30 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025788?usp=email )

Change subject: [IMPR] Improvements for interwiki.py
..

[IMPR] Improvements for interwiki.py

- update documentation
- add typing hints
- raise RuntimeError in whatsNextPageBatch without preleading 'BUG:
  because 'RuntimeError:' is already shown
- site objects are processed not languages

Change-Id: I56984020c20a3c691ad5f40b73aac376b1797416
---
M scripts/interwiki.py
1 file changed, 9 insertions(+), 10 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 33102ef..61a13fe 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -750,19 +750,19 @@
 """
 return self.todo.iter_values_len()

-def whatsNextPageBatch(self, site):
-"""
-Return the next page batch.
+def whatsNextPageBatch(self, site) -> list[pywikibot.Page]:
+"""Return the next page batch.

-By calling this method, you 'promise' this instance that you will
-preload all the 'site' Pages that are in the todo list.
+By calling this method, you 'promise' this instance that you
+will preload all the *site* Pages that are in the todo list.

-This routine will return a list of pages that can be treated.
+:return: This routine will return a list of pages that can be
+treated.
 """
 # Bug-check: Isn't there any work still in progress? We can't work on
 # different sites at a time!
 if self.pending:
-raise RuntimeError(f"BUG: Can't start to work on {site}; still "
+raise RuntimeError(f"Can't start to work on {site}; still "
f'working on {self.pending}')
 # Prepare a list of suitable pages
 result = []
@@ -1402,8 +1402,7 @@
 pywikibot.info(f'Found link to {page2} in:')
 self.whereReport(page2, indent=4)

-# TODO: allow answer to repeat previous or go back
-# after a mistake
+# TODO: allow answer to repeat previous or go back after a mistake
 answer = 'a' if acceptall else pywikibot.input_choice(
 'What should be done?',
 [('accept', 'a'), ('reject', 'r'), ('give up', 'g'),
@@ -1921,7 +1920,7 @@
 Return the site that has the most open queries plus the number.

 If there is nothing left, return None.
-Only languages that are TODO for the first Subject are returned.
+Only sites that are todo for the first Subject are returned.
 """
 if not self.firstSubject():
 return None

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025788?usp=email
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: I56984020c20a3c691ad5f40b73aac376b1797416
Gerrit-Change-Number: 1025788
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] use subTest in xmlreader_tests.py and avoid code duplication

2024-04-30 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025782?usp=email )

Change subject: [tests] use subTest in xmlreader_tests.py and avoid code 
duplication
..

[tests] use subTest in xmlreader_tests.py and avoid code duplication

Change-Id: I0f4b801aac2b72c6166d33457aaa1eebe06f1f0d
---
M tests/xmlreader_tests.py
1 file changed, 22 insertions(+), 37 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py
index 758d921..8bf6daa 100755
--- a/tests/xmlreader_tests.py
+++ b/tests/xmlreader_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for xmlreader module."""
 #
-# (C) Pywikibot team, 2009-2022
+# (C) Pywikibot team, 2009-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -11,6 +11,7 @@
 from contextlib import suppress

 from pywikibot import xmlreader
+from pywikibot.tools import suppress_warnings
 from tests import join_xml_data_path
 from tests.aspects import TestCase

@@ -40,42 +41,26 @@
 self.assertEqual('Quercusrobur', pages[1].username)
 self.assertEqual('Pear', pages[0].title)

-def test_XmlDumpFirstFoundRev(self):
-"""Test loading the first found revision.
-
-To be deprecated.
-:phab: `T340804`
-"""
-pages = get_entries('article-pear.xml', revisions='first_found')
-self.assertLength(pages, 1)
-self.assertEqual('Automated conversion', pages[0].comment)
-self.assertEqual('Pear', pages[0].title)
-self.assertEqual('24278', pages[0].id)
-self.assertEqual('185185', pages[0].revisionid)
-self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of'))
-self.assertTrue(not pages[0].isredirect)
-
-def test_XmlDumpEarliestRev(self):
-"""Test loading the earliest revision."""
-pages = get_entries('article-pear.xml', revisions='earliest')
-self.assertLength(pages, 1)
-self.assertEqual('Automated conversion', pages[0].comment)
-self.assertEqual('Pear', pages[0].title)
-self.assertEqual('24278', pages[0].id)
-self.assertEqual('185185', pages[0].revisionid)
-self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of'))
-self.assertTrue(not pages[0].isredirect)
-
-def test_XmlDumpLatestRev(self):
-"""Test loading the latest revision."""
-pages = get_entries('article-pear.xml', revisions='latest')
-self.assertLength(pages, 1)
-self.assertEqual('sp', pages[0].comment)
-self.assertEqual('Pear', pages[0].title)
-self.assertEqual('24278', pages[0].id)
-self.assertEqual('188924', pages[0].revisionid)
-self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of'))
-self.assertTrue(not pages[0].isredirect)
+def test_XmlDumpFoundRev(self):
+"""Test loading the first, earliest and latest revision."""
+tests = {
+'first_found': ('Automated conversion', '185185'),
+'earliest': ('Automated conversion', '185185'),
+'latest': ('sp', '188924'),
+}
+for revisions, (comment, revid) in tests.items():
+with suppress_warnings(
+r".+'allrevisions' is deprecated since release 9\.0\.0"):
+pages = get_entries('article-pear.xml', revisions=revisions)
+with self.subTest(revisions=revisions):
+self.assertLength(pages, 1)
+page = pages[0]
+self.assertEqual(comment, page.comment)
+self.assertEqual('Pear', page.title)
+self.assertEqual('24278', page.id)
+self.assertEqual(revid, page.revisionid)
+self.assertTrue(page.text.startswith('Pears are [[tree]]s of'))
+self.assertTrue(not page.isredirect)

 def test_XmlDumpRedirect(self):
 """Test XmlDump correctly parsing whether a page is a redirect."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1025782?usp=email
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: I0f4b801aac2b72c6166d33457aaa1eebe06f1f0d
Gerrit-Change-Number: 1025782
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] update copyright string

2024-04-28 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024957?usp=email )

Change subject: [doc] update copyright string
..

[doc] update copyright string

Change-Id: I9139080fc23b061ec94da976722acec958a30ddd
---
M pywikibot/__metadata__.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 22070e6..0eae51b 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -14,4 +14,4 @@

 __version__ = '9.2.0.dev1'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
-__copyright__ = '(C) Pywikibot team, 2003-' + strftime('%Y')
+__copyright__ = f'2003-{strftime("%Y")}, Pywikibot team'

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024957?usp=email
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: I9139080fc23b061ec94da976722acec958a30ddd
Gerrit-Change-Number: 1024957
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] fix spelling mistakes

2024-04-28 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024934?usp=email )

Change subject: [doc] fix spelling mistakes
..

[doc] fix spelling mistakes

Change-Id: I06bc7c07d5b2e4cb344730dc45ee1c6a6e132a93
---
M HISTORY.rst
M pywikibot/tools/_deprecate.py
2 files changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/HISTORY.rst b/HISTORY.rst
index d8d60f1..3415a6d 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -5,8 +5,8 @@
 -
 *27 April 2024*

-* Add support for new wikis
-  (:phab:`T363272`, :phab:`T363265`, :phab:`T363258`, :phab:`T363251`, 
:phab:`T363245`, :phab:`T360312`, :phab:`T360305`)
+* Add support for new wikis (:phab:`T363272`, :phab:`T363265`, :phab:`T363258`,
+  :phab:`T363251`, :phab:`T363245`, :phab:`T360312`, :phab:`T360305`)
 * i18n updates


@@ -1094,7 +1094,7 @@
 * Property.getType() method has been removed
 * Family.server_time() method was removed; it is still available from Site 
object (:phab:`T89451`)
 * All HttpRequest parameters except of charset has been dropped 
(:phab:`T265206`)
-* A lot of methods and properties of HttpRequest are deprecared in favour of 
requests.Resonse attributes
+* A lot of methods and properties of HttpRequest are deprecated in favour of 
requests.Resonse attributes
   (:phab:`T265206`)
 * Method and properties of HttpRequest are delegated to requests.Response 
object (:phab:`T265206`)
 * comms.threadedhttp.HttpRequest.raw was replaced by HttpRequest.content 
property (:phab:`T265206`)
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index 74e2bcf..58409ac 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -313,7 +313,7 @@
 def my_function(bar='baz'): pass
 # replaces 'foo' keyword by 'bar' used by my_function

-@deprecare_arg('foo', None)
+@deprecate_arg('foo', None)
 def my_function(): pass
 # ignores 'foo' keyword no longer used by my_function


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024934?usp=email
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: I06bc7c07d5b2e4cb344730dc45ee1c6a6e132a93
Gerrit-Change-Number: 1024934
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] add site informaton to UserRightsError

2024-04-28 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024933?usp=email )

Change subject: [tests] add site informaton to UserRightsError
..

[tests] add site informaton to UserRightsError

Change-Id: I8ff7a1db8c87529b10b9e8a15c182dafbd7d732e
---
M pywikibot/site/_decorators.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_decorators.py b/pywikibot/site/_decorators.py
index 6539355..5d1a31b 100644
--- a/pywikibot/site/_decorators.py
+++ b/pywikibot/site/_decorators.py
@@ -89,7 +89,7 @@
 rights = '.'
 raise UserRightsError(
 f'User "{self.user()}" does not have required user right '
-f'"{right}"{rights}')
+f'"{right}" on site {self}{rights}')
 return fn(self, *args, **kwargs)

 manage_wrapping(callee, fn)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024933?usp=email
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: I8ff7a1db8c87529b10b9e8a15c182dafbd7d732e
Gerrit-Change-Number: 1024933
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] add missing commas

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024715?usp=email )

Change subject: [doc] add missing commas
..

[doc] add missing commas

Change-Id: I8133de1267206184b4e753710f885d9621134cef
Signed-off-by: Xqt 
---
M HISTORY.rst
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/HISTORY.rst b/HISTORY.rst
index 504d1b3..d8d60f1 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -6,7 +6,7 @@
 *27 April 2024*

 * Add support for new wikis
-  (:phab:`T363272`, 
:phab:`T363265`:phab:`T363258`:phab:`T363251`:phab:`T363245`:phab:`T360312`:phab:`T360305`)
+  (:phab:`T363272`, :phab:`T363265`, :phab:`T363258`, :phab:`T363251`, 
:phab:`T363245`, :phab:`T360312`, :phab:`T360305`)
 * i18n updates



--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024715?usp=email
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: I8133de1267206184b4e753710f885d9621134cef
Gerrit-Change-Number: 1024715
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] colorize version directives

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024883?usp=email )

Change subject: [doc] colorize version directives
..

[doc] colorize version directives

Change-Id: I504ed04d79338069b33441b7f0fbe5fa5c0a2217
---
M docs/_static/css/pywikibot.css
1 file changed, 45 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/docs/_static/css/pywikibot.css b/docs/_static/css/pywikibot.css
index 80e0450..0844f03 100644
--- a/docs/_static/css/pywikibot.css
+++ b/docs/_static/css/pywikibot.css
@@ -81,3 +81,48 @@
 padding: 0.2rem 0;
 border: 1px solid #fff5;
 }
+
+/** Version change directives **/
+:root {
+--versionadded: #246342;
+--versionchanged: #AC6600;
+--deprecated: #970302;
+
+--versionadded-border: #339966;
+--versionchanged-border: #F0BC00;
+--deprecated-border: #99;
+}
+
+div.versionadded,
+div.versionchanged,
+div.deprecated,
+div.versionremoved {
+border-left: 4px solid;
+padding: 0 1rem;
+}
+
+div.versionadded {
+border-left-color: var(--versionadded-border);
+}
+
+div.versionchanged {
+border-left-color: var(--versionchanged-border);
+}
+
+div.deprecated,
+div.versionremoved {
+border-left-color: var(--deprecated-border);
+}
+
+div.versionadded .versionmodified {
+color: var(--versionadded);
+}
+
+div.versionchanged .versionmodified {
+color: var(--versionchanged);
+}
+
+div.deprecated .versionmodified,
+div.versionremoved .versionmodified {
+color: var(--deprecated);
+}
\ No newline at end of file

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024883?usp=email
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: I504ed04d79338069b33441b7f0fbe5fa5c0a2217
Gerrit-Change-Number: 1024883
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] provide -nouser option with version.py

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024858?usp=email )

Change subject: [IMPR] provide -nouser option with version.py
..

[IMPR] provide -nouser option with version.py

Change-Id: Iea41605c5833de99a8f7441ff5ea750a8fa344cf
---
M pywikibot/scripts/version.py
1 file changed, 17 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/scripts/version.py b/pywikibot/scripts/version.py
index 1178caf..0bc0af8 100755
--- a/pywikibot/scripts/version.py
+++ b/pywikibot/scripts/version.py
@@ -1,8 +1,14 @@
 #!/usr/bin/env python3
 """Script to determine the Pywikibot version (tag, revision and date).

+The following option is supported:
+
+-usernames  print usernames for each registered family
+
 .. versionchanged:: 7.0
version script was moved to the framework scripts folder
+.. versionadded:: 9.2
+   the *-nouser* option.
 """
 #
 # (C) Pywikibot team, 2007-2024
@@ -51,7 +57,11 @@


 def main(*args: str) -> None:
-"""Print pywikibot version and important settings."""
+"""Print pywikibot version and important settings.
+
+.. versionchanged:: 9.2
+   usernames are not printed with ``-nouser`` option.
+"""
 pywikibot.info('Pywikibot: ' + getversion())
 pywikibot.info('Release version: ' + pywikibot.__version__)
 pywikibot.info('packaging version: ' + packaging.__version__)
@@ -90,7 +100,12 @@
 os.environ.get(environ_name, 'Not set') or "''"))

 pywikibot.info('Config base dir: ' + pywikibot.config.base_dir)
-for family, usernames in pywikibot.config.usernames.items():
+
+if '-nouser' in sys.argv:
+usernames_items = {}
+else:
+usernames_items = pywikibot.config.usernames.items()
+for family, usernames in usernames_items:
 if not usernames:
 continue
 pywikibot.info(f"Usernames for family '{family}':")

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024858?usp=email
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: Iea41605c5833de99a8f7441ff5ea750a8fa344cf
Gerrit-Change-Number: 1024858
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Update AUTHORS.rst

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024856?usp=email )

Change subject: [doc] Update AUTHORS.rst
..

[doc] Update AUTHORS.rst

Change-Id: I2fb862784a786335511c2ef744641c6ffa1c4963
---
M AUTHORS.rst
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/AUTHORS.rst b/AUTHORS.rst
index fa3654e..0f205ff 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -16,6 +16,7 @@
 Alex Shih-Han Lin
 Alexander Jones
 Alexander Shtyrov
+Alexander Vorwerk
 Alfio
 Allen Guo
 Amir Sarabadani

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024856?usp=email
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: I2fb862784a786335511c2ef744641c6ffa1c4963
Gerrit-Change-Number: 1024856
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [9.2] Update Pywikibot 9.2

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024853?usp=email )

Change subject: [9.2] Update Pywikibot 9.2
..

[9.2] Update Pywikibot 9.2

Change-Id: Ifdd77f67725bcbec7d5d4493d8b0ee3f8c27f4f1
---
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
3 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/HISTORY.rst b/HISTORY.rst
index 48d05a2..504d1b3 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,15 @@
 Release history
 ===

+9.1.1
+-
+*27 April 2024*
+
+* Add support for new wikis
+  (:phab:`T363272`, 
:phab:`T363265`:phab:`T363258`:phab:`T363251`:phab:`T363245`:phab:`T360312`:phab:`T360305`)
+* i18n updates
+
+
 9.1.0
 -
 *22 April 2024*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index dea6981..19cb97f 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,9 +1,7 @@
 Current release
 ---

-* Add support for new wikis
-  (:phab:`T363272`, 
:phab:`T363265`:phab:`T363258`:phab:`T363251`:phab:`T363245`:phab:`T360312`:phab:`T360305`)
-* i18n updates
+* (no changes yet)

 Deprecations
 
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 2e74a49..22070e6 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


-__version__ = '9.1.1'
+__version__ = '9.2.0.dev1'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = '(C) Pywikibot team, 2003-' + strftime('%Y')

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024853?usp=email
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: Ifdd77f67725bcbec7d5d4493d8b0ee3f8c27f4f1
Gerrit-Change-Number: 1024853
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[stable]: Merge branch 'master' into stable

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024850?usp=email )

Change subject: Merge branch 'master' into stable
..

Merge branch 'master' into stable

Change-Id: I445893ea3f11c954c25d83c593dfdf8d51bd77ed
---
M .appveyor.yml
M scripts/__init__.py
3 files changed, 17 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/.appveyor.yml b/.appveyor.yml
index 96d787b..6fb8acf 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
 image: Visual Studio 2022
 clone_depth: 50
 skip_tags: true
-version: 9.2.{build}
+version: 9.1.{build}
 environment:

   PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/scripts/__init__.py b/scripts/__init__.py
index 01864c7..8d50111 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -32,4 +32,4 @@
 #
 # Distributed under the terms of the MIT license.
 #
-__version__ = '9.2.0'
+__version__ = '9.1.1'

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024850?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: stable
Gerrit-Change-Id: I445893ea3f11c954c25d83c593dfdf8d51bd77ed
Gerrit-Change-Number: 1024850
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [9.1.1] Publish Pywikibot 9.1.1

2024-04-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024844?usp=email )

Change subject: [9.1.1] Publish Pywikibot 9.1.1
..

[9.1.1] Publish Pywikibot 9.1.1

Change-Id: Ie7ec36df4815a6f5ea7c8ee0c367849e7270620a
---
M ROADMAP.rst
M pywikibot/__metadata__.py
2 files changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/ROADMAP.rst b/ROADMAP.rst
index 19cb97f..dea6981 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,9 @@
 Current release
 ---

-* (no changes yet)
+* Add support for new wikis
+  (:phab:`T363272`, 
:phab:`T363265`:phab:`T363258`:phab:`T363251`:phab:`T363245`:phab:`T360312`:phab:`T360305`)
+* i18n updates

 Deprecations
 
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 1a8c5de..2e74a49 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


-__version__ = '9.2.0.dev0'
+__version__ = '9.1.1'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = '(C) Pywikibot team, 2003-' + strftime('%Y')

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1024844?usp=email
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: Ie7ec36df4815a6f5ea7c8ee0c367849e7270620a
Gerrit-Change-Number: 1024844
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-04-25 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1024380?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Ic0117459816a81546dc2eaf32ff75c0673b1d14b
---
M checkimages/be-tarask.json
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/checkimages/be-tarask.json b/checkimages/be-tarask.json
index 48ad854..1379a9a 100644
--- a/checkimages/be-tarask.json
+++ b/checkimages/be-tarask.json
@@ -9,6 +9,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": "Робат: пазначаю новазагружаны 
неадзначаны файл",

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1024380?usp=email
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: Ic0117459816a81546dc2eaf32ff75c0673b1d14b
Gerrit-Change-Number: 1024380
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Show user rights if UserRightsError is raised during tests

2024-04-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023474?usp=email )

Change subject: [tests] Show user rights if UserRightsError is raised during 
tests
..

[tests] Show user rights if UserRightsError is raised during tests

Bug: T363190
Change-Id: Ic46e899e0fdc07ee34e1b2cd855e2fdd51835ead
---
M pywikibot/site/_decorators.py
M tests/site_decorators_tests.py
2 files changed, 48 insertions(+), 46 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_decorators.py b/pywikibot/site/_decorators.py
index 3656e4e..6539355 100644
--- a/pywikibot/site/_decorators.py
+++ b/pywikibot/site/_decorators.py
@@ -1,15 +1,23 @@
 """Decorators used by site models."""
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
 from __future__ import annotations

+import os
+from textwrap import fill
+
 from pywikibot.exceptions import UnknownExtensionError, UserRightsError
 from pywikibot.tools import MediaWikiVersion, manage_wrapping


+CLOSED_WIKI_MSG = (
+'Site {site} has been closed. Only steward can perform requested action.'
+)
+
+
 def must_be(group: str | None = None):
 """Decorator to require a certain user status when method is called.

@@ -24,15 +32,11 @@
 grp = kwargs.pop('as_group', group)
 if self.obsolete:
 if not self.has_group('steward'):
-raise UserRightsError(
-'Site {} has been closed. Only steward '
-'can perform requested action.'
-.format(self.sitename))
+raise UserRightsError(CLOSED_WIKI_MSG.format(site=self))

 elif not self.has_group(grp):
-raise UserRightsError('User "{}" is not part of the required '
-  'user group "{}"'
-  .format(self.user(), grp))
+raise UserRightsError(f'User "{self.user()}" is not part of '
+  f'the required user group "{grp}"')

 return fn(self, *args, **kwargs)

@@ -53,8 +57,8 @@
 def callee(self, *args, **kwargs):
 if not self.has_extension(extension):
 raise UnknownExtensionError(
-'Method "{}" is not implemented without the extension {}'
-.format(fn.__name__, extension))
+f'Method "{fn.__name__}" is not implemented without the '
+f'extension {extension}')
 return fn(self, *args, **kwargs)

 manage_wrapping(callee, fn)
@@ -74,15 +78,18 @@
 def callee(self, *args, **kwargs):
 if self.obsolete:
 if not self.has_group('steward'):
-raise UserRightsError(
-'Site {} has been closed. Only stewards '
-'can perform the requested action.'
-.format(self.sitename))
+raise UserRightsError(CLOSED_WIKI_MSG.format(site=self))

 elif right is not None and not self.has_right(right):
-raise UserRightsError('User "{}" does not have required '
-  'user right "{}"'
-  .format(self.user(), right))
+if os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1':
+rights = ' but:\n' + fill(
+str(sorted(self.userinfo['rights'])),
+width=76, break_on_hyphens=False)
+else:
+rights = '.'
+raise UserRightsError(
+f'User "{self.user()}" does not have required user right '
+f'"{right}"{rights}')
 return fn(self, *args, **kwargs)

 manage_wrapping(callee, fn)
@@ -102,9 +109,8 @@
 def callee(self, *args, **kwargs):
 if MediaWikiVersion(self.version()) < MediaWikiVersion(version):
 raise NotImplementedError(
-'Method or function "{}"\n'
-"isn't implemented in MediaWiki version < {}"
-.format(fn.__name__, version))
+f'Method or function "{fn.__name__}"\n'
+f"isn't implemented in MediaWiki version < {version}")
 return fn(self, *args, **kwargs)

 manage_wrapping(callee, fn)
diff --git a/tests/site_decorators_tests.py b/tests/site_decorators_tests.py
index a1e3c71..8256132 100755
--- a/tests/site_decorators_tests.py
+++ b/tests/site_decorators_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests against a fake Site object."""
 #
-# (C) Pywikibot team, 2012-2023
+# (C) Pywikibot team, 2012-2024
 #
 # Distributed under the terms of the 

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Add two edit tests for WbTime

2024-04-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655524?usp=email )

Change subject: [tests] Add two edit tests for WbTime
..

[tests] Add two edit tests for WbTime

Adding the tests since I'm getting local "API error modification-failed: 
Malformed input" errors when using fromTimestr

Bug: T325860
Change-Id: I249e949c014455102b2f7c47da6a2bfb7d5eeaa3
---
M tests/wikibase_edit_tests.py
1 file changed, 36 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index d2e9fc5..3d9bb47 100755
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -6,7 +6,7 @@
 class in edit_failiure_tests.py
 """
 #
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -430,6 +430,41 @@
 claim = item.claims['P88936'][0]
 self.assertEqual(claim.getTarget(), target)

+def test_WbTime_edit_simple(self):
+"""Attempt adding a WbTime claim with valid input."""
+testsite = self.get_repo()
+item = self._clean_item(testsite, 'P66')
+
+# set new claim
+claim = pywikibot.page.Claim(
+testsite, 'P66', datatype='time')
+target = pywikibot.WbTime(year=2012)
+claim.setTarget(target)
+item.addClaim(claim)
+
+# confirm new claim
+item.get(force=True)
+claim = item.claims['P66'][0]
+self.assertEqual(claim.getTarget(), target)
+
+@unittest.expectedFailure  # T325860
+def test_WbTime_edit_fromTimestr(self):
+"""Attempt adding a WbTime claim with valid input."""
+testsite = self.get_repo()
+item = self._clean_item(testsite, 'P66')
+
+# set new claim
+claim = pywikibot.page.Claim(
+testsite, 'P66', datatype='time')
+target = pywikibot.WbTime.fromTimestr('+0002010-01-01T12:43:01Z')
+claim.setTarget(target)
+item.addClaim(claim)
+
+# confirm new claim
+item.get(force=True)
+claim = item.claims['P66'][0]
+self.assertEqual(claim.getTarget(), target)
+

 class TestWikibaseRemoveQualifier(WikibaseTestCase):


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/655524?usp=email
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: I249e949c014455102b2f7c47da6a2bfb7d5eeaa3
Gerrit-Change-Number: 655524
Gerrit-PatchSet: 5
Gerrit-Owner: Lokal Profil 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfic] Fix wikibase_(edit_)tests

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023107?usp=email )

Change subject: [bugfic] Fix wikibase_(edit_)tests
..

[bugfic] Fix wikibase_(edit_)tests

Bug: T363101
Change-Id: I3e50f7900e4f053f77ee85841efe8a8433c218d2
---
M tests/wikibase_edit_tests.py
M tests/wikibase_tests.py
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 307c4f5..d2e9fc5 100755
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -421,7 +421,7 @@
 # set new claim
 claim = pywikibot.page.Claim(
 testsite, 'P88936', datatype='musical-notation')
-target = "\relative c' { c d e f | g2 g | a4 a a a | g1 |})"
+target = "\\relative c' { c d e f | g2 g | a4 a a a | g1 |}"
 claim.setTarget(target)
 item.addClaim(claim)

diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index cea1677..033be36 100755
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -2014,7 +2014,7 @@
 wikidata = self.get_repo()
 claim = pywikibot.Claim(wikidata, 'P6604')
 self.assertEqual(claim.type, 'musical-notation')
-target = "\relative c' { c d e f | g2 g | a4 a a a | g1 |})"
+target = "\\relative c' { c d e f | g2 g | a4 a a a | g1 |}"
 claim.setTarget(target)
 self.assertEqual(claim.target, target)


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023107?usp=email
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: I3e50f7900e4f053f77ee85841efe8a8433c218d2
Gerrit-Change-Number: 1023107
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1023072?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Iff505ca3c991c318494a5cc4754cce3558fa8ae6
---
M protect/lb.json
M redirect/lb.json
M unprotect/lb.json
3 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/protect/lb.json b/protect/lb.json
index 64eca27..871f518 100644
--- a/protect/lb.json
+++ b/protect/lb.json
@@ -7,6 +7,6 @@
"protect-category": "Bot: All Säiten aus der Kategorie %(cat)s spären",
"protect-images": "Bot: All Biller op der Säit %(page)s spären",
"protect-links": "Bot: All Säite spären déi vun der Säit %(page)s 
verlinkt sinn",
-   "protect-ref": "Bot: All Säite spären, déi op d'Säit %(page)s linken",
+   "protect-ref": "Bot: All Säite spären, déi op d'Säit %(page)s 
referéieren",
"protect-simple": "Bot: Eng Lëscht vu Fichiere spären."
 }
diff --git a/redirect/lb.json b/redirect/lb.json
index 233edaa..ec5f69e 100644
--- a/redirect/lb.json
+++ b/redirect/lb.json
@@ -9,7 +9,7 @@
"redirect-broken-redirect-template": "{{Läschen|1=Defekt Viruleedung}}",
"redirect-fix-broken-moved": "Futtis Viruleedung op déi geréckelt 
Zilsäit %(to)s gouf gefléckt",
"redirect-fix-double": "Duebel Viruleedung gefléckt → %(to)s",
-   "redirect-fix-loop": "Viruleedungsschleef op %(to)s verbessert",
+   "redirect-fix-loop": "Verbesserung vun der Viruleedungsschleef op 
%(to)s",
"redirect-remove-broken": "Viruleedung op eng geläscht Säit oder eng 
Säit déi et net gëtt",
"redirect-remove-loop": "Viruleedung där hiert Zil zu enger endlos 
Schleef féiert"
 }
diff --git a/unprotect/lb.json b/unprotect/lb.json
index feecdfd..19aee01 100644
--- a/unprotect/lb.json
+++ b/unprotect/lb.json
@@ -7,6 +7,6 @@
"unprotect-category": "Bot: D'Spär vun alle Säiten aus der Kategorie 
%(cat)s gouf opgehuewen",
"unprotect-images": "Bot: D'Spär fir all Biller op der Säit %(page)s 
ophiewen",
"unprotect-links": "Bot: D'Spär vun alle Säiten, déi vu(n) %(page)s 
verlinkt sinn, gouf opgehuewen",
-   "unprotect-ref": "Bot: D'Spär vun alle Säite, déi op d'Säit %(page)s 
linken, gouf opgehuewen",
+   "unprotect-ref": "Bot: D'Spär vun alle Säite, déi op d'Säit %(page)s 
referéieren, gouf opgehuewen",
"unprotect-simple": "Bot: D'Spär fir eng Lëscht vu Fichiere ophiewen"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1023072?usp=email
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: Iff505ca3c991c318494a5cc4754cce3558fa8ae6
Gerrit-Change-Number: 1023072
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Do not show version hints with -help option in make_dist.py

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023059?usp=email )

Change subject: [doc] Do not show version hints with -help option in 
make_dist.py
..

[doc] Do not show version hints with -help option in make_dist.py

Change-Id: I5ba629de9535648430b156d8cd451bac092f13bf
---
M make_dist.py
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/make_dist.py b/make_dist.py
index 8dc2a13..8979c73 100755
--- a/make_dist.py
+++ b/make_dist.py
@@ -204,8 +204,11 @@
 uploaded
 """
 if '-help' in sys.argv:
+import re
 import setup
-info(__doc__)
+help_text = re.sub(r'^\.\. version(added|changed)::.+', '',
+   __doc__, flags=re.MULTILINE | re.DOTALL)
+info(help_text)
 info(setup.__doc__)
 sys.exit()


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023059?usp=email
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: I5ba629de9535648430b156d8cd451bac092f13bf
Gerrit-Change-Number: 1023059
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [9.2] Prepare next release

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023048?usp=email )

Change subject: [9.2] Prepare next release
..

[9.2] Prepare next release

Change-Id: I976f3464b606e3a9f8cbf54c613262667c07daeb
---
M .appveyor.yml
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
M scripts/__init__.py
5 files changed, 26 insertions(+), 19 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index 6fb8acf..96d787b 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
 image: Visual Studio 2022
 clone_depth: 50
 skip_tags: true
-version: 9.1.{build}
+version: 9.2.{build}
 environment:

   PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/HISTORY.rst b/HISTORY.rst
index 2104ff9..48d05a2 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,28 @@
 Release history
 ===

+9.1.0
+-
+*22 April 2024*
+
+* ``-usernames`` option was added to :mod:`version` 
script
+* Circumvent problems with *unique* and *prefix* parameters in 
:meth:`Site.alllinks()
+  ` (:phab:`T359427`)
+* Detect nighly version file with :func:`version.getversion_nightly` 
(:phab:`T362492`)
+* :mod:`version`.github_svn_rev2hash() was removed; it was no longer 
functional (:phab:`T362484`)
+* SVN support has been dropped; ``.svnprops`` property settings was removed 
(:phab:`T362484`)
+* Skip process that requires login to logout (:phab:`T326614`)
+* File title of :class:`specialbots.UploadRobot` must have a valid file 
extension (:phab:`T345786`)
+* Add a :attr:`post_processor` 
attribute to :class:`specialbots.UploadRobot`
+  which can be called after each upload (:phab:`T359766`)
+* Avoid using :meth:`pywikibot.handle_args` in private scripts;
+  use :mod:`pwb` wrapper instead (:phab:`T359766`)
+* Show upload count with :class:`specialbots.UploadRobot`
+* Use the same ``iiprop`` properties in :class:`data.api.PageGenerator` as in
+  :meth:`APISite.loadimageinfo` 
(:phab:`T360093`)
+* i18n updates
+
+
 9.0.0
 -
 *08 March 2024*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 854f7bc..19cb97f 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,22 +1,7 @@
 Current release
 ---

-* ``-usernames`` option was added to :mod:`version` 
script
-* Circumvent problems with *unique* and *prefix* parameters in 
:meth:`Site.alllinks()
-  ` (:phab:`T359427`)
-* Detect nighly version file with :func:`version.getversion_nightly` 
(:phab:`T362492`)
-* :mod:`version`.github_svn_rev2hash() was removed; it was no longer 
functional (:phab:`T362484`)
-* SVN support has been dropped; ``.svnprops`` property settings was removed 
(:phab:`T362484`)
-* Skip process that requires login to logout (:phab:`T326614`)
-* File title of :class:`specialbots.UploadRobot` must have a valid file 
extension (:phab:`T345786`)
-* Add a :attr:`post_processor` 
attribute to :class:`specialbots.UploadRobot`
-  which can be called after each upload (:phab:`T359766`)
-* Avoid using :meth:`pywikibot.handle_args` in private scripts;
-  use :mod:`pwb` wrapper instead (:phab:`T359766`)
-* Show upload count with :class:`specialbots.UploadRobot`
-* Use the same ``iiprop`` properties in :class:`data.api.PageGenerator` as in
-  :meth:`APISite.loadimageinfo` 
(:phab:`T360093`)
-* i18n updates
+* (no changes yet)

 Deprecations
 
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 0452c41..1a8c5de 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


-__version__ = '9.1.0'
+__version__ = '9.2.0.dev0'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = '(C) Pywikibot team, 2003-' + strftime('%Y')
diff --git a/scripts/__init__.py b/scripts/__init__.py
index d289690..01864c7 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -32,4 +32,4 @@
 #
 # Distributed under the terms of the MIT license.
 #
-__version__ = '9.1.0'
+__version__ = '9.2.0'

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023048?usp=email
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: I976f3464b606e3a9f8cbf54c613262667c07daeb
Gerrit-Change-Number: 1023048
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Fix table syntax

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022519?usp=email )

Change subject: [doc] Fix table syntax
..

[doc] Fix table syntax

Change-Id: I018f8bcafcb0395dd919c1e7dc7e50e9044e00d0
---
M CONTENT.rst
M pywikibot/CONTENT.rst
2 files changed, 5 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  Meno25: Looks good to me, approved




diff --git a/CONTENT.rst b/CONTENT.rst
index 4e1e329..124b051 100644
--- a/CONTENT.rst
+++ b/CONTENT.rst
@@ -1,7 +1,7 @@
 The contents of the package
 ---

-
+---+
+
+---+---+
 | README and config files: 
 |
 
+===+===+
 | AUTHORS.rst   | List of major contributors to this module
 |
@@ -41,7 +41,7 @@
 | user-fixes.py.sample  | Example user-fixes.py file for reference 
 |
 
+---+---+

-
+---+
+
+---+---+
 | Directories  
 |
 
+===+===+
 | pywikibot | Contains some libraries and control files
 |
diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst
index 9485220..17b5a60 100644
--- a/pywikibot/CONTENT.rst
+++ b/pywikibot/CONTENT.rst
@@ -1,7 +1,7 @@
 The contents of the package
 ---

-
+---+
+
++--+
 |  Library routines
 |
 
++==+
 | __init__.py| Initialization of the Pywikibot framework,  
 |
@@ -241,7 +241,7 @@
 
++--+
 

-
+---+
+
++--+
 | User Interface   
 |
 
++==+
 | _interface_base.py | Abstract base user interface module 
 |
@@ -260,7 +260,7 @@
 
++--+


-
+---+
+
++--+
 | Others   
 |
 
++==+
 | families (folder)  | Contains wiki-specific information like 
URLs,|

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022519?usp=email
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: I018f8bcafcb0395dd919c1e7dc7e50e9044e00d0
Gerrit-Change-Number: 1022519
Gerrit-PatchSet: 3
Gerrit-Owner: Meno25 
Gerrit-Reviewer: Meno25 
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Xqt 
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[stable]: Merge branch 'master' into stable

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023045?usp=email )

Change subject: Merge branch 'master' into stable
..

Merge branch 'master' into stable

Change-Id: Ibee5a9084d1a1d63170e3ae430a93cf7df35ed18
---
1 file changed, 69 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved





--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023045?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: stable
Gerrit-Change-Id: Ibee5a9084d1a1d63170e3ae430a93cf7df35ed18
Gerrit-Change-Number: 1023045
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [9.1] Publish Pywikibot 9.1

2024-04-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023044?usp=email )

Change subject: [9.1] Publish Pywikibot 9.1
..

[9.1] Publish Pywikibot 9.1

Change-Id: I1f0f1acd1a364dea4b119f42bbe52dee81811c98
---
M pywikibot/__metadata__.py
M scripts/CHANGELOG.rst
M tests/pagegenerators_tests.py
3 files changed, 10 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 472836c..0452c41 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


-__version__ = '9.1.0.dev0'
+__version__ = '9.1.0'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = '(C) Pywikibot team, 2003-' + strftime('%Y')
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 6ef1604..825505a 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -15,6 +15,13 @@
 * L10N updates
 * Show an error message and leave if script is not localized (:phab:`T362103`)

+replace
+^^^
+
+* Permit strings as exceptions for fixes
+* Do not apply replacements multiple times  (:phab:`T363047`)
+* Respect 'text-contains' from fixes dictionaries (:phab:`T142324`)
+

 9.0.0
 -
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 5575299..ecb4946 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1446,6 +1446,8 @@

 def test_wanted_files(self):
 """Test wantedfiles generator."""
+if self.site.sitename == 'wowwiki:uk':
+self.skipTest(f'skipping {self.site} due to T362384)')
 self.gf.handle_arg('-wantedfiles:5')
 for page in self._generator_with_tests():
 self.assertIsInstance(page, pywikibot.Page)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1023044?usp=email
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: I1f0f1acd1a364dea4b119f42bbe52dee81811c98
Gerrit-Change-Number: 1023044
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Permit strings as exceptions for fixes

2024-04-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022557?usp=email )

Change subject: [IMPR] Permit strings as exceptions for fixes
..

[IMPR] Permit strings as exceptions for fixes

In other words, allow:

fixes['key'] = {
  'exceptions': {
'text-contains': 'skip this text',
  },
  'replacements': [
...
  ],
}

Previously, a string was interpreted as a sequence (list)
of characters, each being a pattern to search for. Which
would cause silent skipping of pages.

Change-Id: I0f4d01fcf96f6b22d3ddc5970138ef4db8259f85
---
M scripts/replace.py
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/replace.py b/scripts/replace.py
index 5a809f4..f31fd40 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -178,6 +178,8 @@
 'title', 'require-title', 'text-contains', 'inside']:
 if exceptionCategory in exceptions:
 patterns = exceptions[exceptionCategory]
+if isinstance(patterns, str):
+patterns = [patterns]
 if not use_regex:
 patterns = [re.escape(pattern) for pattern in patterns]
 patterns = [re.compile(pattern, flags) for pattern in patterns]
@@ -1030,9 +1032,9 @@
 if not generators_given and 'generator' in fix:
 gen_args = fix['generator']
 if isinstance(gen_args, str):
-gen_args = [gen_args]
-for gen_arg in gen_args:
-genFactory.handle_arg(gen_arg)
+genFactory.handle_arg(gen_args)
+else:
+genFactory.handle_args(gen_args)
 replacement_set = ReplacementList(fix.get('regex'),
   fix.get('exceptions'),
   fix.get('nocase'),

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022557?usp=email
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: I0f4d01fcf96f6b22d3ddc5970138ef4db8259f85
Gerrit-Change-Number: 1022557
Gerrit-PatchSet: 2
Gerrit-Owner: Matěj Suchánek 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: Fix typos within docstrings

2024-04-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022555?usp=email )

Change subject: Fix typos within docstrings
..

Fix typos within docstrings

Change-Id: I6b273f32a84efc7e63b646a969af9b06ee539cae
---
M pywikibot/_wbtypes.py
M pywikibot/page/_filepage.py
M pywikibot/page/_wikibase.py
M pywikibot/site/_generators.py
M scripts/replace.py
5 files changed, 13 insertions(+), 12 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index bbda021..868b7e6 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -698,7 +698,7 @@
*normalize* parameter was added.
 .. versionchanged:: 8.2
*normalize* parameter was removed due to :phab:`T340495` and
-   :phab:`57755`
+   :phab:`T57755`
 
 :param force_iso: whether the output should be forced to ISO 8601
 :return: Timestamp in a format resembling ISO 8601
@@ -739,7 +739,7 @@
*normalize* parameter was added.
 .. versionchanged:: 8.2
*normalize* parameter was removed due to :phab:`T340495` and
-   :phab:`57755`
+   :phab:`T57755`

 :return: Wikibase JSON
 """
diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 94dc98f..eaed3dd 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -433,9 +433,9 @@
 """
 Convenience function to get the associated Wikibase item of the file.

-If WikibaseMediaInfo extension is available (e.g. on Commons),
+If WikibaseMediaInfo extension is available (e.g., on Commons),
 the method returns the associated mediainfo entity. Otherwise,
-it falls back to behavior of BasePage.data_item.
+it falls back to the behavior of :meth:`BasePage.data_item`.

 .. versionadded:: 6.5

diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index c242b2c..1f9ed9a 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -84,9 +84,10 @@
 Each entity is identified by a data repository it belongs to
 and an identifier.

-:cvar DATA_ATTRIBUTES: dictionary which maps data attributes (eg. 'labels',
-'claims') to appropriate collection classes (eg. LanguageDict,
-ClaimsCollection)
+:cvar DATA_ATTRIBUTES: dictionary which maps data attributes
+(e.g., 'labels', 'claims') to appropriate collection classes
+(e.g., :class:`LanguageDict`,
+:class:`ClaimCollection`)

 :cvar entity_type: entity type identifier
 :type entity_type: str
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 4b48de3..c695523 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -1001,7 +1001,7 @@
:ref:`Http Settings` in your ``user-config.py`` file. Or
increase it patially within your code like:

-   .. code:: pytkon
+   .. code:: python

   from pywikibot import config
   save_timeout = config.socket_timeout  # save the timeout config
diff --git a/scripts/replace.py b/scripts/replace.py
index 5a809f4..4f0303f 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -989,9 +989,9 @@
 replacement = Replacement(old, new)
 if not single_summary:
 single_summary = i18n.twtranslate(
-site, 'replace-replacing',
-{'description':
- f' (-{replacement.old} +{replacement.new})'}
+site,
+'replace-replacing',
+{'description': f' (-{replacement.old} +{replacement.new})'}
 )
 replacements.append(replacement)

@@ -1013,7 +1013,7 @@
 pywikibot.error(
 f'fixes[{fix_name!r}] is a {type(fix).__name__}, not a dict')
 if type(fix) is tuple:
-pywikibot.info('Maybe a trailing comma in your user_fixes.py?')
+pywikibot.info('Maybe a trailing comma in your user-fixes.py?')
 pywikibot.debug(fix)
 return


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022555?usp=email
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: I6b273f32a84efc7e63b646a969af9b06ee539cae
Gerrit-Change-Number: 1022555
Gerrit-PatchSet: 2
Gerrit-Owner: Matěj Suchánek 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] cleanup ReplaceRobot.treat(), move statements outside the loop

2024-04-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022465?usp=email )

Change subject: [bugfix] cleanup ReplaceRobot.treat(), move statements outside 
the loop
..

[bugfix] cleanup ReplaceRobot.treat(), move statements outside the loop

- test isTextExcepted() for the original_text instead for the modified
- replace text only once instead over and over again
- add the optionated category outside the loop
- leave treat method after opening the browser

Bug: T363047
Change-Id: I57417bfaf22627a76cc61db5ba58c4c35e3d77fd
---
M scripts/replace.py
1 file changed, 39 insertions(+), 40 deletions(-)

Approvals:
  jenkins-bot: Verified
  Matěj Suchánek: Looks good to me, approved
  Xqt: Looks good to me, approved




diff --git a/scripts/replace.py b/scripts/replace.py
index 5a809f4..7c91495 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -686,36 +686,37 @@
 except InvalidPageError as e:
 pywikibot.error(e)
 return
+
+if self.isTextExcepted(original_text):
+pywikibot.info(f'Skipping {page} because it contains text '
+   f'that is on the exceptions list.')
+return
+
 applied = set()
 new_text = original_text
 last_text = None
+while new_text != last_text:
+last_text = new_text
+new_text = self.apply_replacements(last_text, applied, page)
+if not self.opt.recursive:
+break
+
+if new_text == original_text:
+if not self.opt.quiet:
+pywikibot.info(f'No changes were necessary in {page}')
+return
+
+if self.opt.addcat:
+# Fetch only categories in wikitext, otherwise the others
+# will be explicitly added.
+cats = textlib.getCategoryLinks(new_text, site=page.site)
+if self.opt.addcat not in cats:
+cats.append(self.opt.addcat)
+new_text = textlib.replaceCategoryLinks(new_text, cats,
+site=page.site)
+
 context = 0
 while True:
-if self.isTextExcepted(new_text):
-pywikibot.info(f'Skipping {page} because it contains text '
-   f'that is on the exceptions list.')
-return
-
-while new_text != last_text:
-last_text = new_text
-new_text = self.apply_replacements(last_text, applied, page)
-if not self.opt.recursive:
-break
-
-if new_text == original_text:
-if not self.opt.quiet:
-pywikibot.info(f'No changes were necessary in {page}')
-return
-
-if self.opt.addcat:
-# Fetch only categories in wikitext, otherwise the others
-# will be explicitly added.
-cats = textlib.getCategoryLinks(new_text, site=page.site)
-if self.opt.addcat not in cats:
-cats.append(self.opt.addcat)
-new_text = textlib.replaceCategoryLinks(new_text,
-cats,
-site=page.site)
 # Show the title of the page we're working on.
 # Highlight the title in purple.
 self.current_page = page
@@ -729,9 +730,11 @@
  ('edit Latest', 'l'), ('open in Browser', 'b'),
  ('More context', 'm'), ('All', 'a')],
 default='N')
+
 if choice == 'm':
 context = context * 3 if context else 3
 continue
+
 if choice in ('e', 'l'):
 text_editor = editor.TextEditor()
 edit_text = original_text if choice == 'e' else new_text
@@ -739,32 +742,28 @@
 # if user didn't press Cancel
 if as_edited and as_edited != new_text:
 new_text = as_edited
-if choice == 'l':
-# prevent changes from being applied again
-last_text = new_text
 continue
+
 if choice == 'b':
+# open in browser and leave
 pywikibot.bot.open_webbrowser(page)
 try:
-original_text = page.get(get_redirect=True, force=True)
+page.get(get_redirect=True, force=True)
 except NoPageError:
 pywikibot.info(f'Page {page.title()} has been deleted.')
-break
-new_text = original_text
-last_text = None
-continue
+return
+
+if choice == 'n':
+return
+
 if 

[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Respect 'text-contains' from fixes dictionaries

2024-04-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022503?usp=email )

Change subject: [IMPR] Respect 'text-contains' from fixes dictionaries
..

[IMPR] Respect 'text-contains' from fixes dictionaries

They were completely ignored, despite being documented.

Bug: T142324
Change-Id: I417e3c52c79346797ad62bfff1609f7be7d6b46b
---
M scripts/replace.py
1 file changed, 12 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/replace.py b/scripts/replace.py
index 0302473..5a809f4 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -575,11 +575,14 @@
 return True
 return False

-def isTextExcepted(self, original_text) -> bool:
+def isTextExcepted(self, text, exceptions=None) -> bool:
 """Return True iff one of the exceptions applies for the given text."""
-if 'text-contains' in self.exceptions:
-return any(exc.search(original_text)
-   for exc in self.exceptions['text-contains'])
+if exceptions is None:
+exceptions = self.exceptions
+
+if 'text-contains' in exceptions:
+return any(exc.search(text) for exc in exceptions['text-contains'])
+
 return False

 def apply_replacements(self, original_text, applied, page=None):
@@ -601,6 +604,7 @@
 if (replacement.container
 and replacement.container.name in skipped_containers):
 continue
+
 if page is not None and self.isTitleExcepted(
 page.title(), replacement.exceptions):
 if replacement.container:
@@ -616,6 +620,10 @@
 'the title is on the exceptions list.'.format(
 replacement.description, page.title(as_link=True)))
 continue
+
+if self.isTextExcepted(original_text, replacement.exceptions):
+continue
+
 old_text = new_text
 new_text = textlib.replaceExcept(
 new_text, replacement.old_regex, replacement.new,

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022503?usp=email
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: I417e3c52c79346797ad62bfff1609f7be7d6b46b
Gerrit-Change-Number: 1022503
Gerrit-PatchSet: 3
Gerrit-Owner: Matěj Suchánek 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Update ROADMAP.rst and CHANGELOG.rst

2024-04-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022502?usp=email )

Change subject: [doc] Update ROADMAP.rst and CHANGELOG.rst
..

[doc] Update ROADMAP.rst and CHANGELOG.rst

Change-Id: Ia15768dbb3598ef09196d4789f6a0f7a8b4971df
---
M ROADMAP.rst
M scripts/CHANGELOG.rst
2 files changed, 4 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/ROADMAP.rst b/ROADMAP.rst
index 1e7751a..854f7bc 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,9 @@
 Current release
 ---

+* ``-usernames`` option was added to :mod:`version` 
script
+* Circumvent problems with *unique* and *prefix* parameters in 
:meth:`Site.alllinks()
+  ` (:phab:`T359427`)
 * Detect nighly version file with :func:`version.getversion_nightly` 
(:phab:`T362492`)
 * :mod:`version`.github_svn_rev2hash() was removed; it was no longer 
functional (:phab:`T362484`)
 * SVN support has been dropped; ``.svnprops`` property settings was removed 
(:phab:`T362484`)
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 98733d3..6ef1604 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -12,6 +12,7 @@
 noreferences
 

+* L10N updates
 * Show an error message and leave if script is not localized (:phab:`T362103`)



--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022502?usp=email
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: Ia15768dbb3598ef09196d4789f6a0f7a8b4971df
Gerrit-Change-Number: 1022502
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [fix] Increase read timeout for alllinks tests.

2024-04-21 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022548?usp=email )

Change subject: [fix] Increase read timeout for alllinks tests.
..

[fix] Increase read timeout for alllinks tests.

Using *namespace* option different from ``0`` needs a lot of time on
Wikidata site. Increase this value to 60s for tests and add an important
note to documentation.

Bug: T359427
Change-Id: I0b6c56883612fb165b9b792bcc00323d0a25b41a
---
M pywikibot/site/_generators.py
M tests/site_generators_tests.py
2 files changed, 29 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index eaed600..4b48de3 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -428,7 +428,9 @@
 ) -> Generator[pywikibot.Page, None, None]:
 """Yield internal wikilinks contained (or transcluded) on page.

-.. seealso:: :api:`Links`
+.. seealso::
+   - :api:`Links`
+   - :meth:`page.BasePage.linkedPages`

 :param namespaces: Only iterate pages in these namespaces
 (default: all)
@@ -993,7 +995,27 @@
:func:`tools.itertools.filter_unique` in that case which
might be memory intensive. Use it with care.

-.. seealso:: :api:`Alllinks`
+.. important:: Using *namespace* option different from ``0``
+   needs a lot of time on Wikidata site. You have to increase
+   the **read** timeout part of ``socket_timeout`` in
+   :ref:`Http Settings` in your ``user-config.py`` file. Or
+   increase it patially within your code like:
+
+   .. code:: pytkon
+
+  from pywikibot import config
+  save_timeout = config.socket_timeout  # save the timeout config
+  config.socket_timeout = save_timeout[0], 60
+  ... # your code here
+  config.socket_timeout = save_timeout  # restore timeout config
+
+   The minimum read timeout value should be 60 seconds in that
+   case.
+
+.. seealso::
+   - :api:`Alllinks`
+   - :meth:`pagebacklinks`
+   - :meth:`pagelinks`

 :param start: Start at this title (page need not exist).
 :param prefix: Only yield pages starting with this string.
diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 3fae8e7..189943c 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -363,10 +363,15 @@
 msg=f"{page.title()} does not start with 'Fix'"
 )

+# increase timeout due to T359427/T359425
+# ~ 47s are required on wikidata
+config_timeout = pywikibot.config.socket_timeout
+pywikibot.config.socket_timeout = (config_timeout[0], 60)
 with self.subTest(msg='Test namespace parameter'):
 for page in mysite.alllinks(namespace=1, total=5):
 self.assertIsInstance(page, pywikibot.Page)
 self.assertEqual(page.namespace(), 1)
+pywikibot.config.socket_timeout = config_timeout

 with self.subTest(msg='Test with fromids parameter'):
 for page in mysite.alllinks(start='From', namespace=4,

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022548?usp=email
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: I0b6c56883612fb165b9b792bcc00323d0a25b41a
Gerrit-Change-Number: 1022548
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] use alfrom instead of alstart option un alllinks()

2024-04-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022468?usp=email )

Change subject: [bugfix] use alfrom instead of alstart option un alllinks()
..

[bugfix] use alfrom instead of alstart option un alllinks()

Bug: T359427
Change-Id: Id8e5429a9805588a3cb565ae0d9847cd2c9a5f74
---
M pywikibot/site/_generators.py
1 file changed, 4 insertions(+), 5 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 846e626..eaed600 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -1011,8 +1011,7 @@
 if unique and fromids:
 raise Error('alllinks: unique and fromids cannot both be True.')
 algen = self._generator(api.ListGenerator, type_arg='alllinks',
-namespaces=namespace, alfrom=start,
-total=total)
+namespaces=namespace, total=total)
 if fromids:
 algen.request['alprop'] = 'title|ids'

@@ -1022,13 +1021,13 @@
 algen.request['alprefix'] = prefix
 prefix = ''  # don't break the loop later
 if start:
-algen.request['alstart'] = start
+algen.request['alfrom'] = start
 algen.request['alunique'] = unique
 else:
 if prefix:
-algen.request['alstart'] = prefix
+algen.request['alfrom'] = prefix
 elif start:
-algen.request['alstart'] = start
+algen.request['alfrom'] = start
 if unique:
 algen = filter_unique(
 algen, key=lambda link: (link['title'], link['ns']))

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022468?usp=email
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: Id8e5429a9805588a3cb565ae0d9847cd2c9a5f74
Gerrit-Change-Number: 1022468
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] Fix getversion_nightly() function and deprecate svn support

2024-04-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019421?usp=email )

Change subject: [bugfix] Fix getversion_nightly() function and deprecate svn 
support
..

[bugfix] Fix getversion_nightly() function and deprecate svn support

Get nighly dump version for compat release. The version file was moved
from main to pywikibot folder in core branch. See:
https://github.com/pywikibot/Pywikibot-nightly-creator/blame/628c197c389bf2ed9431b9b9bffeacc22bffba64/nightly

Deprecate svn support because github has desupported it and no svn
checkout be done for Pywikibot any longer. Older places on
wikimedia.org are given up for years and redirects to phabricator.

- remove .svnprops property file
- deprecate version.svn_rev_info() function and remove support for svn
  older than 1.7
- remove version.github_svn_rev2hash() function which is no longer
  functional because svn support was dropped at github
- deprecate version.getversion_svn() function and remove hsh check
- fix version.getversion_nightly() to use the right path for version
  file
- update ROADMAP.rst

Bug: T362492
Bug: T362484
Change-Id: I8b859bab98d1ea95c4c1e9996ef827b42c1d3a61
---
D .svnprops
M ROADMAP.rst
M pywikibot/version.py
3 files changed, 42 insertions(+), 71 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/.svnprops b/.svnprops
deleted file mode 100644
index 3fed37c..000
--- a/.svnprops
+++ /dev/null
Binary files differ
diff --git a/ROADMAP.rst b/ROADMAP.rst
index e0cecfc..1e7751a 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,9 @@
 Current release
 ---

+* Detect nighly version file with :func:`version.getversion_nightly` 
(:phab:`T362492`)
+* :mod:`version`.github_svn_rev2hash() was removed; it was no longer 
functional (:phab:`T362484`)
+* SVN support has been dropped; ``.svnprops`` property settings was removed 
(:phab:`T362484`)
 * Skip process that requires login to logout (:phab:`T326614`)
 * File title of :class:`specialbots.UploadRobot` must have a valid file 
extension (:phab:`T345786`)
 * Add a :attr:`post_processor` 
attribute to :class:`specialbots.UploadRobot`
@@ -64,6 +67,8 @@
 Will be removed in Pywikibot 10
 ^^^

+* 9.1.0: :func:`version.svn_rev_info` and :func:`version.getversion_svn` will 
be removed. SVN is no longer supported.
+  (:phab:`T362484`)
 * 7.7.0: :mod:`tools.threading` classes should no longer imported from 
:mod:`tools`
 * 7.6.0: :mod:`tools.itertools` datatypes should no longer imported from 
:mod:`tools`
 * 7.6.0: :mod:`tools.collections` datatypes should no longer imported from 
:mod:`tools`
diff --git a/pywikibot/version.py b/pywikibot/version.py
index ae872d9..542c480 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -1,6 +1,6 @@
 """Module to determine the pywikibot version (tag, revision and date)."""
 #
-# (C) Pywikibot team, 2007-2022
+# (C) Pywikibot team, 2007-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -11,14 +11,14 @@
 import os
 import pathlib
 import socket
+import sqlite3
 import subprocess
 import sys
 import sysconfig
 import time
-import xml.dom.minidom
 from contextlib import closing, suppress
 from importlib import import_module
-from io import BytesIO
+from pathlib import Path
 from warnings import warn

 import pywikibot
@@ -26,7 +26,8 @@
 from pywikibot.backports import cache
 from pywikibot.comms.http import fetch
 from pywikibot.exceptions import VersionParseError
-from pywikibot.tools import deprecated
+from pywikibot.tools import deprecated, suppress_warnings
+from pywikibot.tools._deprecate import _NotImplementedWarning


 def _get_program_dir() -> str:
@@ -67,7 +68,7 @@
 data['cmp_ver'] = 'UNKNOWN'
 else:
 for branch, path in branches.items():
-with suppress(Exception):
+with suppress(VersionParseError):
 hsh[getversion_onlinerepo(path)] = branch
 if hsh:
 data['cmp_ver'] = hsh.get(local_hsh, 'OUTDATED')
@@ -94,9 +95,12 @@
  getversion_nightly,
  getversion_package):
 try:
-(tag, rev, date, hsh) = vcs_func(_program_dir)
+with suppress_warnings(
+f'.*({vcs_func.__name__}|svn_rev_info) is deprecated since '
+'release 9.1.', _NotImplementedWarning):
+tag, rev, date, hsh = vcs_func(_program_dir)
 except Exception as e:
-exceptions[vcs_func] = e
+exceptions[vcs_func] = vcs_func.__name__, e
 else:
 break
 else:
@@ -105,8 +109,8 @@
 # pywikibot was imported without using version control at all.
 tag, rev, date, hsh = (
 '', '-1 (unknown)', '0 (unknown)', '(unknown)')
-warn('Unable to detect version; exceptions raised:\n{!r}'
-   

[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] add a new -usernames option to scripts.version.py

2024-04-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019575?usp=email )

Change subject: [IMPR] add a new -usernames option to scripts.version.py
..

[IMPR] add a new -usernames option to scripts.version.py

only show usernames for registered families if -usernames option is given.

Change-Id: Iaf6fda90b784fc6edd0cbd56e7b03196b2f1874f
---
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
M .github/workflows/sysop_write_tests-ci.yml
M pywikibot/scripts/version.py
6 files changed, 22 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml
index fae76f3..fd33f88 100644
--- a/.github/workflows/doctest.yml
+++ b/.github/workflows/doctest.yml
@@ -67,7 +67,7 @@
 - name: doctest with pytest
   timeout-minutes: 5
   run: |
-python pwb.py version
+python pwb.py version -usernames
 pytest --version
 coverage run -m pytest pywikibot --doctest-modules 
--ignore-glob="*gui.py" --ignore-glob="*memento.py"

diff --git a/.github/workflows/login_tests-ci.yml 
b/.github/workflows/login_tests-ci.yml
index 5cc02a2..5554e7d 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -110,7 +110,7 @@
 - name: Test with unittest
   timeout-minutes: 2
   run: |
-python pwb.py version
+python pwb.py version -usernames
 coverage run -m unittest -vv tests/site_login_logout_tests.py

 - name: Show coverage statistics
diff --git a/.github/workflows/oauth_tests-ci.yml 
b/.github/workflows/oauth_tests-ci.yml
index f93c6dd..eb8a221 100644
--- a/.github/workflows/oauth_tests-ci.yml
+++ b/.github/workflows/oauth_tests-ci.yml
@@ -101,7 +101,7 @@
   env:
 PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', 
steps.token.outputs.uppercase)] }}
   run: |
-python pwb.py version
+python pwb.py version -usernames
 coverage run -m unittest -vv tests/oauth_tests.py

 - name: Show coverage statistics
diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index c57535b..1da1d35 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -124,7 +124,7 @@
   ${{ (matrix.site == 'wikisource:zh' || matrix.test_no_rc) && 1 || 0 
}}
 PYWIKIBOT_TEST_PROD_ONLY: ${{ matrix.test_prod_only && 1 || 0 }}
   run: |
-python pwb.py version
+python pwb.py version -usernames
 if [ ${{matrix.site || 0}} != 'wikipedia:test' ]; then
   coverage run -m unittest discover -vv -p \"*_tests.py\";
 else
diff --git a/.github/workflows/sysop_write_tests-ci.yml 
b/.github/workflows/sysop_write_tests-ci.yml
index a2bde6f..1986705 100644
--- a/.github/workflows/sysop_write_tests-ci.yml
+++ b/.github/workflows/sysop_write_tests-ci.yml
@@ -80,7 +80,7 @@
 PYWIKIBOT_TEST_OAUTH: ${{ secrets[format('{0}', 
steps.token.outputs.uppercase)] }}
 PYWIKIBOT_TEST_WRITE: ${{ matrix.domain == 'test.wikipedia.org' && 1 
|| 0}}
   run: |
-python pwb.py version
+python pwb.py version -usernames
 pytest -s -r A -a "rights or write" --cov=.;

 - name: Show coverage statistics
diff --git a/pywikibot/scripts/version.py b/pywikibot/scripts/version.py
index 1178caf..e18b658 100755
--- a/pywikibot/scripts/version.py
+++ b/pywikibot/scripts/version.py
@@ -1,8 +1,14 @@
 #!/usr/bin/env python3
 """Script to determine the Pywikibot version (tag, revision and date).

+The following option is supported:
+
+-usernames  print usernames for each registered family
+
 .. versionchanged:: 7.0
version script was moved to the framework scripts folder
+.. versionadded:: 9.1
+   the *-usernames* option.
 """
 #
 # (C) Pywikibot team, 2007-2024
@@ -51,7 +57,11 @@


 def main(*args: str) -> None:
-"""Print pywikibot version and important settings."""
+"""Print pywikibot version and important settings.
+
+.. versionchanged:: 9.1
+   usernames are printed with ``-usernames`` option only.
+"""
 pywikibot.info('Pywikibot: ' + getversion())
 pywikibot.info('Release version: ' + pywikibot.__version__)
 pywikibot.info('packaging version: ' + packaging.__version__)
@@ -90,7 +100,12 @@
 os.environ.get(environ_name, 'Not set') or "''"))

 pywikibot.info('Config base dir: ' + pywikibot.config.base_dir)
-for family, usernames in pywikibot.config.usernames.items():
+
+if '-usernames' in sys.argv:
+usernames_items = pywikibot.config.usernames.items()
+else:
+usernames_items = {}
+for family, usernames in usernames_items:
 if not usernames:
 continue
 

[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] circumvent problems with unique and prefix parameters (T359425)

2024-04-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022453?usp=email )

Change subject: [bugfix] circumvent problems with unique and prefix parameters 
(T359425)
..

[bugfix] circumvent problems with unique and prefix parameters (T359425)

Bug: T359427
Change-Id: Iee4c51f934efc446b493c5c98afe1d0f103e38a5
---
M pywikibot/site/_generators.py
M tests/site_generators_tests.py
2 files changed, 24 insertions(+), 11 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index a1be9e6..846e626 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -975,7 +975,7 @@

 def alllinks(
 self,
-start: str = '!',
+start: str = '',
 prefix: str = '',
 namespace: SingleNamespaceType = 0,
 unique: bool = False,
@@ -1013,20 +1013,30 @@
 algen = self._generator(api.ListGenerator, type_arg='alllinks',
 namespaces=namespace, alfrom=start,
 total=total)
-if prefix:
-algen.request['alprefix'] = prefix
 if fromids:
 algen.request['alprop'] = 'title|ids'
-if not unique:
-pass
-elif self.mw_version < '1.43':
-algen.request['alunique'] = True
+
+# circumvent problems with unique and prefix due to T359425 and T359427
+if self.mw_version < '1.43':
+if prefix:
+algen.request['alprefix'] = prefix
+prefix = ''  # don't break the loop later
+if start:
+algen.request['alstart'] = start
+algen.request['alunique'] = unique
 else:
-# unique filter for mw >= 1.43, use (title, ns) as key
-# See: T359425, T359427
-algen = filter_unique(algen, key=lambda x: (x['title'], x['ns']))
+if prefix:
+algen.request['alstart'] = prefix
+elif start:
+algen.request['alstart'] = start
+if unique:
+algen = filter_unique(
+algen, key=lambda link: (link['title'], link['ns']))
+
 for link in algen:
 p = pywikibot.Page(self, link['title'], link['ns'])
+if prefix and p.title() > prefix:  # T359425, T359427
+break
 if fromids:
 p._fromid = link['fromid']  # type: ignore[attr-defined]
 yield p
diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 5ca8748..3fae8e7 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -358,7 +358,10 @@
 for page in mysite.alllinks(prefix='Fix', total=5):
 self.assertIsInstance(page, pywikibot.Page)
 self.assertEqual(page.namespace(), 0)
-self.assertTrue(page.title().startswith('Fix'))
+self.assertTrue(
+page.title().startswith('Fix'),
+msg=f"{page.title()} does not start with 'Fix'"
+)

 with self.subTest(msg='Test namespace parameter'):
 for page in mysite.alllinks(namespace=1, total=5):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022453?usp=email
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: Iee4c51f934efc446b493c5c98afe1d0f103e38a5
Gerrit-Change-Number: 1022453
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Use subTest for TestSiteGenerators.test_all_links

2024-04-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022450?usp=email )

Change subject: [tests] Use subTest for TestSiteGenerators.test_all_links
..

[tests] Use subTest for TestSiteGenerators.test_all_links

Use subTest for TestSiteGenerators.test_all_links to determine
steps where tests fails due to T359425/T359427

Bug: T359427
Change-Id: I5a6ee44fbb5ae005b11edef1443409baf80a453d
---
M tests/site_generators_tests.py
1 file changed, 35 insertions(+), 23 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index bc56f4a..5ca8748 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -341,30 +341,42 @@
 fwd = list(mysite.alllinks(total=10))
 uniq = list(mysite.alllinks(total=10, unique=True))

-self.assertLessEqual(len(fwd), 10)
+with self.subTest(msg='Test that unique links are in all links'):
+self.assertLessEqual(len(fwd), 10)
+self.assertLessEqual(len(uniq), len(fwd))
+for link in fwd:
+self.assertIsInstance(link, pywikibot.Page)
+self.assertIn(link, uniq)

-for link in fwd:
-self.assertIsInstance(link, pywikibot.Page)
-self.assertIn(link, uniq)
-for page in mysite.alllinks(start='Link', total=5):
-self.assertIsInstance(page, pywikibot.Page)
-self.assertEqual(page.namespace(), 0)
-self.assertGreaterEqual(page.title(), 'Link')
-for page in mysite.alllinks(prefix='Fix', total=5):
-self.assertIsInstance(page, pywikibot.Page)
-self.assertEqual(page.namespace(), 0)
-self.assertTrue(page.title().startswith('Fix'))
-for page in mysite.alllinks(namespace=1, total=5):
-self.assertIsInstance(page, pywikibot.Page)
-self.assertEqual(page.namespace(), 1)
-for page in mysite.alllinks(start='From', namespace=4, fromids=True,
-total=5):
-self.assertIsInstance(page, pywikibot.Page)
-self.assertGreaterEqual(page.title(with_ns=False), 'From')
-self.assertTrue(hasattr(page, '_fromid'))
-errgen = mysite.alllinks(unique=True, fromids=True)
-with self.assertRaises(Error):
-next(errgen)
+with self.subTest(msg='Test with start parameter'):
+for page in mysite.alllinks(start='Link', total=5):
+self.assertIsInstance(page, pywikibot.Page)
+self.assertEqual(page.namespace(), 0)
+self.assertGreaterEqual(page.title(), 'Link')
+
+with self.subTest(msg='Test with prefix parameter'):
+for page in mysite.alllinks(prefix='Fix', total=5):
+self.assertIsInstance(page, pywikibot.Page)
+self.assertEqual(page.namespace(), 0)
+self.assertTrue(page.title().startswith('Fix'))
+
+with self.subTest(msg='Test namespace parameter'):
+for page in mysite.alllinks(namespace=1, total=5):
+self.assertIsInstance(page, pywikibot.Page)
+self.assertEqual(page.namespace(), 1)
+
+with self.subTest(msg='Test with fromids parameter'):
+for page in mysite.alllinks(start='From', namespace=4,
+fromids=True, total=5):
+self.assertIsInstance(page, pywikibot.Page)
+self.assertGreaterEqual(page.title(with_ns=False), 'From')
+self.assertTrue(hasattr(page, '_fromid'))
+
+with self.subTest(
+msg='Test that Error is raised with unique and fromids'):
+errgen = mysite.alllinks(unique=True, fromids=True)
+with self.assertRaises(Error):
+next(errgen)

 def test_all_categories(self):
 """Test the site.allcategories() method."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022450?usp=email
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: I5a6ee44fbb5ae005b11edef1443409baf80a453d
Gerrit-Change-Number: 1022450
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [fix] use filter_unique() in Site.alllinks() for MW >= 1.43

2024-04-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022005?usp=email )

Change subject: [fix] use filter_unique() in Site.alllinks() for MW >= 1.43
..

[fix] use filter_unique() in Site.alllinks() for MW >= 1.43

unique parameter is not supported with MW 1.43 currently and it might
be dropped in misermode. Therefore use filter_unique() to ensure
getting unique pages.

Bug: T359427
Change-Id: I16b7bd439dccfcc67b814e913955dea02a2700b4
---
M pywikibot/site/_generators.py
M tests/site_generators_tests.py
2 files changed, 26 insertions(+), 14 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 457ae3c..a1be9e6 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -984,33 +984,47 @@
 ) -> Generator[pywikibot.Page, None, None]:
 """Iterate all links to pages (which need not exist) in one namespace.

-Note that, in practice, links that were found on pages that have
-been deleted may not have been removed from the links table, so this
-method can return false positives.
+.. note:: In practice, links that were found on pages that have
+   been deleted may not have been removed from the links table,
+   so this method can return false positives.
+
+.. caution:: *unique* parameter is no longer supported by
+   MediaWiki 1.43 or higher. Pywikibot uses
+   :func:`tools.itertools.filter_unique` in that case which
+   might be memory intensive. Use it with care.

 .. seealso:: :api:`Alllinks`

 :param start: Start at this title (page need not exist).
 :param prefix: Only yield pages starting with this string.
 :param namespace: Iterate pages from this (single) namespace
-:param unique: If True, only iterate each link title once (default:
-iterate once for each linking page)
-:param fromids: if True, include the pageid of the page containing
-each link (default: False) as the '_fromid' attribute of the Page;
-cannot be combined with unique
-:raises KeyError: the namespace identifier was not resolved
-:raises TypeError: the namespace identifier has an inappropriate
-type such as bool, or an iterable with more than one namespace
+:param unique: If True, only iterate each link title once
+(default: False)
+:param fromids: if True, include the pageid of the page
+containing each link (default: False) as the '_fromid'
+attribute of the Page; cannot be combined with *unique*
+:raises KeyError: the *namespace* identifier was not resolved
+:raises TypeError: the *namespace* identifier has an
+inappropriate type such as bool, or an iterable with more
+than one namespace
 """
 if unique and fromids:
 raise Error('alllinks: unique and fromids cannot both be True.')
 algen = self._generator(api.ListGenerator, type_arg='alllinks',
 namespaces=namespace, alfrom=start,
-total=total, alunique=unique)
+total=total)
 if prefix:
 algen.request['alprefix'] = prefix
 if fromids:
 algen.request['alprop'] = 'title|ids'
+if not unique:
+pass
+elif self.mw_version < '1.43':
+algen.request['alunique'] = True
+else:
+# unique filter for mw >= 1.43, use (title, ns) as key
+# See: T359425, T359427
+algen = filter_unique(algen, key=lambda x: (x['title'], x['ns']))
 for link in algen:
 p = pywikibot.Page(self, link['title'], link['ns'])
 if fromids:
diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 87f97ba..bc56f4a 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -338,8 +338,6 @@
 def test_all_links(self):
 """Test the site.alllinks() method."""
 mysite = self.get_site()
-if mysite.sitename in ('wikipedia:de', 'wikipedia:en'):
-self.skipTest(f'skipping test on {mysite} due to T359427')
 fwd = list(mysite.alllinks(total=10))
 uniq = list(mysite.alllinks(total=10, unique=True))


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022005?usp=email
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: I16b7bd439dccfcc67b814e913955dea02a2700b4
Gerrit-Change-Number: 1022005
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: 

[Pywikibot-commits] [Gerrit] ...core[master]: [i18n] update known_languages doctest

2024-04-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022015?usp=email )

Change subject: [i18n] update known_languages doctest
..

[i18n] update known_languages doctest

Change-Id: I57be1bdcb41f617f9e5b425dfabe7b18d5622e9e
---
M pywikibot/i18n.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 675c87b..51146cc 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -913,7 +913,7 @@
 >>> i18n.known_languages()[-10:]
 ['vo', 'vro', 'wa', 'war', 'xal', 'xmf', 'yi', 'yo', 'yue', 'zh']
 >>> len(i18n.known_languages())
-254
+255

 The implementation is roughly equivalent to:


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1022015?usp=email
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: I57be1bdcb41f617f9e5b425dfabe7b18d5622e9e
Gerrit-Change-Number: 1022015
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-04-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1021450?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: I1287c594b49cc32ba340aca8ba504c0b815ff0d6
---
A pywikibot/syl.json
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/syl.json b/pywikibot/syl.json
new file mode 100644
index 000..0dd8061
--- /dev/null
+++ b/pywikibot/syl.json
@@ -0,0 +1,8 @@
+{
+   "@metadata": {
+   "authors": [
+   "ꠢꠣꠍꠘ ꠞꠣꠎꠣ"
+   ]
+   },
+   "pywikibot-bot-prefix": "ꠀꠙꠌꠣ ꠪"
+}

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1021450?usp=email
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: I1287c594b49cc32ba340aca8ba504c0b815ff0d6
Gerrit-Change-Number: 1021450
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] alllinks fails for en-wiki too

2024-04-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1020927?usp=email )

Change subject: [tests] alllinks fails for en-wiki too
..

[tests] alllinks fails for en-wiki too

Bug: T359427
Change-Id: I7989075774cfd50c8bc7167551ddb8890a87e264
Signed-off-by: Xqt 
---
M tests/site_generators_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index e595eed..406bea0 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -337,7 +337,7 @@
 def test_all_links(self):
 """Test the site.alllinks() method."""
 mysite = self.get_site()
-if mysite.sitename == 'wikipedia:de':
+if mysite.sitename in ('wikipedia:de', 'wikipedia:en'):
 self.skipTest(f'skipping test on {mysite} due to T359427')
 fwd = list(mysite.alllinks(total=10))
 uniq = list(mysite.alllinks(total=10, unique=True))

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1020927?usp=email
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: I7989075774cfd50c8bc7167551ddb8890a87e264
Gerrit-Change-Number: 1020927
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Fix user-config.py filename

2024-04-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1020869?usp=email )

Change subject: [doc] Fix user-config.py filename
..

[doc] Fix user-config.py filename

Bug: T362673
Change-Id: Ibb56e979a35331a5417c79ee92dd73cbdc124e41
---
M pywikibot/cosmetic_changes.py
M pywikibot/login.py
M pywikibot/specialbots/_upload.py
3 files changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 27650ef..e18a3ae 100644
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -28,7 +28,7 @@

 You may disable cosmetic changes by adding the all unwanted languages to
 the `dictionary cosmetic_changes_disable` in your user config file
-(`user_config.py`). It should contain a tuple of languages for each site
+(`user-config.py`). It should contain a tuple of languages for each site
 where you wish to disable cosmetic changes. You may use it with
 `cosmetic_changes_mylang_only` is False, but you can also disable your
 own language. This also overrides the settings in the dictionary
@@ -51,7 +51,7 @@
  'your_script_name_2']
 """
 #
-# (C) Pywikibot team, 2006-2023
+# (C) Pywikibot team, 2006-2024
 #
 # Distributed under the terms of the MIT license.
 #
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 17c6924..c109a21 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -1,6 +1,6 @@
 """Library to log the bot in to a wiki account."""
 #
-# (C) Pywikibot team, 2003-2023
+# (C) Pywikibot team, 2003-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -105,7 +105,7 @@
 'ERROR: '
 'username for {site.family.name}:{site.code} is undefined.'
 '\nIf you have a username for that site, please add a '
-'line to user config file (user_config.py) as follows:\n'
+'line to user config file (user-config.py) as follows:\n'
 "usernames['{site.family.name}']['{site.code}'] = "
 "'myUsername'".format(site=site))
 self.password = password
diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index 1695873..7e3a8d8 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -88,7 +88,7 @@
 would be overwritten or another mistake would be risked. Set it to
 an array of warning codes to selectively ignore specific warnings.
 :param target_site: Set the site to upload to. If target site is not
-given it's taken from user config file (user_config.py).
+given it's taken from user config file (user-config.py).
 :type target_site: object
 :param aborts: List of the warning types to abort upload on. Set to
 True to abort on any warning.

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1020869?usp=email
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: Ibb56e979a35331a5417c79ee92dd73cbdc124e41
Gerrit-Change-Number: 1020869
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [L10N] localize noreferences.py for simple-wiki

2024-04-17 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1018947?usp=email )

Change subject: [L10N] localize noreferences.py for simple-wiki
..

[L10N] localize noreferences.py for simple-wiki

Bug: T362103
Change-Id: Ia0dc3a565f3c8f1dc629aa05b2889e59253af6f8
---
M scripts/noreferences.py
1 file changed, 58 insertions(+), 18 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index e1313da..eb63165 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -52,12 +52,15 @@
 '': pagegenerators.parameterHelp,
 }

-# References sections are usually placed before further reading / external
-# link sections. This dictionary defines these sections, sorted by priority.
-# For example, on an English wiki, the script would place the "References"
-# section in front of the "Further reading" section, if that existed.
-# Otherwise, it would try to put it in front of the "External links" section,
-# or if that fails, the "See also" section, etc.
+placeBeforeSections: dict[str, list[str]]
+"""References sections are usually placed before further reading /
+external link sections. This dictionary defines these sections, sorted
+by priority. For example, on an English wiki, the script would place the
+"References" section in front of the "Further reading" section, if that
+existed. Otherwise, it would try to put it in front of the
+"External links" section, or if that fails, the "See also" section, etc.
+"""
+
 placeBeforeSections = {
 'ar': [  # no explicit policy on where to put the references
 'وصلات خارجية',
@@ -208,6 +211,10 @@
 'حوالا',
 'خارجي ڳنڌڻا',
 ],
+'simple': [
+'Other websites',
+'Sources',
+],
 'sk': [
 'Pozri aj',
 ],
@@ -241,10 +248,30 @@
 ],
 }

-# Titles of sections where a reference tag would fit into.
-# The first title should be the preferred one: It's the one that will be
-# used when a new section has to be created. Section titles can be regex
-# patterns except of the first.
+PLACE_AFTER_SECTIONS: dict[str, list[str]]
+"""References sections can also be placed after a given section. This
+dictionary defines these sections, sorted by priority. For example, on
+Simple wiki, the script would place the "References" section after the
+"Notes" section, if that existed. The PLACE_AFTER_SECTIONS is priorized
+over the placing of the "placeBeforeSections" sections.
+
+.. attention:: not implemented yet.
+"""
+
+# TODO: not implemented yet.
+PLACE_AFTER_SECTIONS = {
+'simple': [
+'Notes',
+],
+}
+
+referencesSections: dict[str, dict[str, list[str]]]
+"""Titles of sections where a reference tag would fit into. The first
+title should be the preferred one: It's the one that will be used when
+a new section has to be created. Section titles can be regex patterns
+except of the first.
+"""
+
 referencesSections = {
 'wikipedia': {
 'ar': [ # not sure about which ones are preferred.
@@ -385,6 +412,9 @@
 'sd': [
 'حوالا',
 ],
+'simple': [
+'References',
+],
 'sk': [
 'Referencie',
 ],
@@ -419,8 +449,11 @@
 referencesSections['wiktionary'] = dict(referencesSections['wikipedia'])
 referencesSections['wiktionary'].update(cs=['poznámky', 'reference'])

-# Templates which include a  tag. If there is no such template
-# on your wiki, you don't have to enter anything here.
+referencesTemplates: dict[str, dict[str, list[str]]]
+"""Templates which include a  tag. If there is no such
+template on your wiki, you don't have to enter anything here.
+"""
+
 referencesTemplates = {
 'wikipedia': {
 'ar': ['مراجع', 'المراجع', 'ثبت المراجع',
@@ -469,6 +502,7 @@
'Сноска', 'Сноски'],
 'sd': ['Reflist', 'Refs', 'Reference',
'حوالا'],
+'simple': ['Reflist'],
 'sr': ['Reflist', 'Референце', 'Извори', 'Рефлист'],
 'szl': ['Przipisy', 'Připisy'],
 'th': ['รายการอ้างอิง'],
@@ -478,8 +512,11 @@
 },
 }

-# Text to be added instead of the  tag.
-# Define this only if required by your wiki.
+referencesSubstitute: dict[str, dict[str, list[str]]]
+"""Text to be added instead of the  tag. Define this only
+if required by your wiki.
+"""
+
 referencesSubstitute = {
 'wikipedia': {
 'ar': '{{مراجع}}',
@@ -498,6 +535,7 @@
 'pl': '{{Przypisy}}',
 'ru': '{{примечания}}',
 'sd': '{{حوالا}}',
+'simple': '{{reflist}}',
 'sr': '{{reflist}}',
 'szl': '{{Przipisy}}',
 'th': '{{รายการอ้างอิง}}',
@@ -506,11 +544,13 @@
 },
 }

-# Sites where no title is required for references template
-# as it is already included there
-noTitleRequired = ['be', 'szl']
+noTitleRequired: 

[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-04-15 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1019746?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: I50ac1563b6cbe9ff2954df221b0525c0a4547e05
---
M redirect/eu.json
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/redirect/eu.json b/redirect/eu.json
index d8cb2df..36e464b 100644
--- a/redirect/eu.json
+++ b/redirect/eu.json
@@ -2,12 +2,13 @@
"@metadata": {
"authors": [
"An13sa",
+   "Atzerritik",
"MarcoAurelio",
"Sator",
"Xabier Armendaritz"
]
},
-   "redirect-broken-redirect-template": "{{ezabatu|1=Bot-ak: hautsitako 
birzuzenketa}}",
+   "redirect-broken-redirect-template": "{{db-r1}}",
"redirect-fix-broken-moved": "%(to)s orrira doan hautsitako 
birzuzenketa konpontzen",
"redirect-fix-double": "«%(to)s» orriranzko birbideratze bikoitza 
konpontzea",
"redirect-fix-loop": "Birzuzenketa ziklikoen konpontzea %(to)s",

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1019746?usp=email
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: I50ac1563b6cbe9ff2954df221b0525c0a4547e05
Gerrit-Change-Number: 1019746
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] fix Sphinx versionchanged directive

2024-04-14 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019419?usp=email )

Change subject: [doc] fix Sphinx versionchanged directive
..

[doc] fix Sphinx versionchanged directive

Change-Id: Ib4e503dc72df4b872ab917f88cdbf323add766b1
---
M pywikibot/data/api/_requests.py
M tests/utils.py
2 files changed, 11 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index ee9b4de..2cc5cb7 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -950,7 +950,7 @@

 Also reset last API error with wait cycles.

-.. versionadded: 9.0
+.. versionadded:: 9.0

 :param delay: Minimum time in seconds to wait. Overwrites
 ``retry_wait`` variable if given. The delay doubles each
diff --git a/tests/utils.py b/tests/utils.py
index 1458c09..445075a 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -418,7 +418,7 @@
 def login(self, *args, cookie_only=False, **kwargs):
 """Overwrite login which is called when a site is initialized.

-.. versionadded: 8.0.4
+.. versionadded:: 8.0.4
 """
 if cookie_only:
 return

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019419?usp=email
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: Ib4e503dc72df4b872ab917f88cdbf323add766b1
Gerrit-Change-Number: 1019419
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] Fix TestFactoryGeneratorWikibase.test_searchitem_language ()

2024-04-14 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019422?usp=email )

Change subject: [bugfix] Fix 
TestFactoryGeneratorWikibase.test_searchitem_language ()
..

[bugfix] Fix TestFactoryGeneratorWikibase.test_searchitem_language ()

Bug: T362493
Change-Id: I0a04be3505763b4f9208819c4d73f7f6472a395c
---
M tests/pagegenerators_tests.py
1 file changed, 10 insertions(+), 9 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 779e859..5575299 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -1515,15 +1515,6 @@
 def test_searchitem_language(self):
 """Test -searchitem with custom language specified."""
 gf = pagegenerators.GeneratorFactory(site=self.site)
-gf.handle_arg('-searchitem:pl:abc')
-gf.handle_arg('-limit:1')
-gen = gf.getCombinedGenerator()
-self.assertIsNotNone(gen)
-# alphabet, also known as ABC
-page1 = next(gen)
-self.assertEqual(page1.title(), 'Q9779')
-
-gf = pagegenerators.GeneratorFactory(site=self.site)
 gf.handle_arg('-searchitem:en:abc')
 gf.handle_arg('-limit:2')
 gen = gf.getCombinedGenerator()

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019422?usp=email
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: I0a04be3505763b4f9208819c4d73f7f6472a395c
Gerrit-Change-Number: 1019422
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Update ROADMAP.rst, CHANGELOG.rst and AUTHORS.rst

2024-04-11 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019070?usp=email )

Change subject: [doc] Update ROADMAP.rst, CHANGELOG.rst and AUTHORS.rst
..

[doc] Update ROADMAP.rst, CHANGELOG.rst and AUTHORS.rst

Change-Id: I51c37a19ea24d979ca1c997766719a87495d8c43
---
M AUTHORS.rst
M ROADMAP.rst
M scripts/CHANGELOG.rst
3 files changed, 26 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/AUTHORS.rst b/AUTHORS.rst
index 1fad649..fa3654e 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -93,6 +93,7 @@
 Egon
 Enag2000
 Eranroz
+Eric Pien
 Erwin
 Evrifaessa

diff --git a/ROADMAP.rst b/ROADMAP.rst
index 850f0a3..e0cecfc 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,7 @@
 Current release
 ---

+* Skip process that requires login to logout (:phab:`T326614`)
 * File title of :class:`specialbots.UploadRobot` must have a valid file 
extension (:phab:`T345786`)
 * Add a :attr:`post_processor` 
attribute to :class:`specialbots.UploadRobot`
   which can be called after each upload (:phab:`T359766`)
@@ -9,6 +10,7 @@
 * Show upload count with :class:`specialbots.UploadRobot`
 * Use the same ``iiprop`` properties in :class:`data.api.PageGenerator` as in
   :meth:`APISite.loadimageinfo` 
(:phab:`T360093`)
+* i18n updates

 Deprecations
 
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 975b13a..98733d3 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -1,6 +1,20 @@
 Scripts Changelog
 =

+9.1.0
+-
+
+colors
+^^
+
+* Fix TypeError with :func:`backports.batched` (:phab:`T362035`)
+
+noreferences
+
+
+* Show an error message and leave if script is not localized (:phab:`T362103`)
+
+
 9.0.0
 -


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1019070?usp=email
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: I51c37a19ea24d979ca1c997766719a87495d8c43
Gerrit-Change-Number: 1019070
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [FIX] Skip process that requires login to logout

2024-04-11 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1018821?usp=email )

Change subject: [FIX] Skip process that requires login to logout
..

[FIX] Skip process that requires login to logout

Getting self.tokens['crsf'] triggers a login when not already logged in.
Checks LoginStatus and only continue the steps if still logged in.

Bug: T326614
Change-Id: I50e49e9ea8dbf2ef29c7606b4cd318ac02f8c33c
---
M pywikibot/site/_apisite.py
1 file changed, 19 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 340d82e..4924b60 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -471,10 +471,12 @@
 if self.is_oauth_token_available():
 pywikibot.warning('Using OAuth suppresses logout function')

-req_params = {'action': 'logout', 'token': self.tokens['csrf']}
-uirequest = self.simple_request(**req_params)
-uirequest.submit()
-self._loginstatus = login.LoginStatus.NOT_LOGGED_IN
+# check if already logged out to avoid requiring logging in
+if not self._loginstatus == login.LoginStatus.NOT_LOGGED_IN:
+req_params = {'action': 'logout', 'token': self.tokens['csrf']}
+uirequest = self.simple_request(**req_params)
+uirequest.submit()
+self._loginstatus = login.LoginStatus.NOT_LOGGED_IN

 # Reset tokens and user properties
 del self.userinfo

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1018821?usp=email
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: I50e49e9ea8dbf2ef29c7606b4cd318ac02f8c33c
Gerrit-Change-Number: 1018821
Gerrit-PatchSet: 1
Gerrit-Owner: Ericpien 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Show an error message and leave if script is not localized

2024-04-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1018643?usp=email )

Change subject: [IMPR] Show an error message and leave if script is not 
localized
..

[IMPR] Show an error message and leave if script is not localized

If this script is not localized for a given site
- raise TranslationError in createReferenceSection()
- catch TranslationError in treat_page, print the error message and
  close the generator

Also ignore if referencesSections or placeBeforeSections is missing and
place the references section before interwiki links, categories, and
bottom templates in such case.

Bug: T362103
Change-Id: I308be486356ec86d8475a3b841e8c0f219643d40
---
M scripts/noreferences.py
1 file changed, 58 insertions(+), 18 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index a0cc0e8..e1313da 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -29,7 +29,7 @@
 a list of affected articles
 """
 #
-# (C) Pywikibot team, 2007-2023
+# (C) Pywikibot team, 2007-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -37,11 +37,12 @@

 import re
 from functools import partial
+from pathlib import Path

 import pywikibot
 from pywikibot import i18n, pagegenerators, textlib
 from pywikibot.bot import AutomaticTWSummaryBot, ExistingPageBot, SingleSiteBot
-from pywikibot.exceptions import LockedPageError
+from pywikibot.exceptions import LockedPageError, TranslationError
 from pywikibot.pagegenerators import XMLDumpPageGenerator


@@ -611,7 +612,7 @@
 # Is there an existing section where we can add the references tag?
 # Set the edit summary key for this case
 self.summary_key = 'noreferences-add-tag'
-for section in i18n.translate(self.site, referencesSections):
+for section in i18n.translate(self.site, referencesSections) or []:
 sectionR = re.compile(fr'\r?\n=+ *{section} *=+ *\r?\n')
 index = 0
 while index < len(oldText):
@@ -637,7 +638,7 @@
 break

 # Create a new section for the references tag
-for section in i18n.translate(self.site, placeBeforeSections):
+for section in i18n.translate(self.site, placeBeforeSections) or []:
 # Find out where to place the new section
 sectionR = re.compile(r'\r?\n(?P=+) *{} *(?P=ident) *\r?\n'
   .format(section))
@@ -699,24 +700,34 @@
 index = len(tmpText)
 return self.createReferenceSection(oldText, index)

-def createReferenceSection(self, oldText, index, ident: str = '==') -> str:
+def createReferenceSection(self,
+   oldText: str,
+   index: int,
+   ident: str = '==') -> str:
 """Create a reference section and insert it into the given text.

+.. versionchanged:: 9.1
+   raise :exc:`exceptions.TranslationError` if script is not
+   localized for the current site.
+
 :param oldText: page text that is going to be be amended
-:type oldText: str
-:param index: the index of oldText where the reference section should
-be inserted at
-:type index: int
-:param ident: symbols to be inserted before and after reference section
-title
+:param index: the index of oldText where the reference section
+should be inserted at
+:param ident: symbols to be inserted before and after reference
+section title
 :return: the amended page text with reference section added
+:raises TranslationError: script is not localized for the
+current site
 """
+title = i18n.translate(self.site, referencesSections)
 if self.site.code in noTitleRequired:
 ref_section = f'\n\n{self.referencesText}\n'
+elif title:
+ref_section = (f'\n\n{ident} {title[0]} {ident}\n'
+   f'{self.referencesText}\n')
 else:
-ref_section = '\n\n{ident} {title} {ident}\n{text}\n'.format(
-title=i18n.translate(self.site, referencesSections)[0],
-ident=ident, text=self.referencesText)
+raise TranslationError(f'{Path(__file__).name} script is not '
+   f'localized for {self.site}')
 return oldText[:index].rstrip() + ref_section + oldText[index:]

 def skip_page(self, page):
@@ -726,14 +737,18 @@

 if self.site.sitename == 'wikipedia:en' and page.isIpEdit():
 pywikibot.warning(
-'Page {} is edited by IP. Possible vandalized'
-.format(page.title(as_link=True)))
+f'Page {page} is edited by IP. Possible vandalized')
   

[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Simplify takesettings

2024-04-09 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/281610?usp=email )

Change subject: [IMPR] Simplify takesettings
..

[IMPR] Simplify takesettings

- set self.settingsData to None on top of the method. It is no longer
  necessary to set them to None later except we got an empty list.
- remove inner try/exeption and use page.text property which catch the
  NoPage exception and returns an empty string instead.
- return after a wrong setting message has been printed.
- remove comment which repeats the printed message.

Change-Id: Ia37362980d35cf26d4bccf35e1731e79f76eaeef
---
M scripts/checkimages.py
1 file changed, 50 insertions(+), 36 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 3eb9d17..b105b16 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1057,45 +1057,43 @@

 def takesettings(self) -> None:
 """Function to take the settings from the wiki."""
+self.settings_data = None
+
 settings_page = i18n.translate(self.site, PAGE_WITH_SETTINGS)
-
 if not settings_page:
-self.settings_data = None
-else:
-page = pywikibot.Page(self.site, settings_page)
-self.settings_data = []
-try:
-testo = page.get()
-
-for number, m in enumerate(SETTINGS_REGEX.finditer(testo),
-   start=1):
-name = str(m[1])
-find_tipe = str(m[2])
-find = str(m[3])
-imagechanges = str(m[4])
-summary = str(m[5])
-head = str(m[6])
-text = str(m[7])
-mexcatched = str(m[8])
-tupla = [number, name, find_tipe, find, imagechanges,
- summary, head, text, mexcatched]
-self.settings_data += [tupla]
-
-if not self.settings_data:
-pywikibot.info(
-"You've set wrongly your settings, please take a "
-'look to the relative page. (run without them)')
-self.settings_data = None
-except NoPageError:
-pywikibot.info("The settings' page doesn't exist!")
-self.settings_data = None
-
-# Real-Time page loaded
-if self.settings_data:
-pywikibot.info('>> Loaded the real-time page... <<')
-else:
-self.settings_data = None
 pywikibot.info('>> No additional settings found! <<')
+return
+
+page = pywikibot.Page(self.site, settings_page)
+page_text = page.text
+if not page_text:
+pywikibot.info(
+'Either the settings page does not exist or is empty!')
+return
+
+self.settings_data = []
+for number, m in enumerate(SETTINGS_REGEX.finditer(page_text),
+   start=1):
+name = str(m[1])
+find_tipe = str(m[2])
+find = str(m[3])
+imagechanges = str(m[4])
+summary = str(m[5])
+head = str(m[6])
+text = str(m[7])
+mexcatched = str(m[8])
+settings = [number, name, find_tipe, find, imagechanges, summary,
+head, text, mexcatched]
+self.settings_data.append(settings)
+
+if not self.settings_data:
+pywikibot.info(
+"You've set wrongly your settings, please take a look to the "
+'relative page. (run without them)')
+self.settings_data = None
+return
+
+pywikibot.info('>> Loaded the real-time page... <<')

 def load_licenses(self) -> set[pywikibot.Page]:
 """Load the list of the licenses.

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/281610?usp=email
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: Ia37362980d35cf26d4bccf35e1731e79f76eaeef
Gerrit-Change-Number: 281610
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Magul 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Improvement for CheckImagesBot.takesettings()

2024-04-09 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1018197?usp=email )

Change subject: [IMPR] Improvement for CheckImagesBot.takesettings()
..

[IMPR] Improvement for CheckImagesBot.takesettings()

remove outer exception handling. It is unclear what error may
occur there. Errors should never pass silently.

Patch detached from e1eabc9

Change-Id: If65b36cbb3d13b12924c90750f3aec3eaa70e779
---
M scripts/checkimages.py
1 file changed, 44 insertions(+), 35 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 7950b79..3eb9d17 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -71,7 +71,7 @@
Welcome messages are imported from :mod:`scripts.welcome` script.
 """
 #
-# (C) Pywikibot team, 2006-2023
+# (C) Pywikibot team, 2006-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -1058,42 +1058,37 @@
 def takesettings(self) -> None:
 """Function to take the settings from the wiki."""
 settings_page = i18n.translate(self.site, PAGE_WITH_SETTINGS)
-try:
-if not settings_page:
-self.settings_data = None
-else:
-page = pywikibot.Page(self.site, settings_page)
-self.settings_data = []
-try:
-testo = page.get()

-for number, m in enumerate(SETTINGS_REGEX.finditer(testo),
-   start=1):
-name = str(m[1])
-find_tipe = str(m[2])
-find = str(m[3])
-imagechanges = str(m[4])
-summary = str(m[5])
-head = str(m[6])
-text = str(m[7])
-mexcatched = str(m[8])
-tupla = [number, name, find_tipe, find, imagechanges,
- summary, head, text, mexcatched]
-self.settings_data += [tupla]
-
-if not self.settings_data:
-pywikibot.info(
-"You've set wrongly your settings, please take a "
-'look to the relative page. (run without them)')
-self.settings_data = None
-except NoPageError:
-pywikibot.info("The settings' page doesn't exist!")
-self.settings_data = None
-except Error:
-pywikibot.info(
-'Problems with loading the settigs, run without them.')
+if not settings_page:
 self.settings_data = None
-self.some_problem = False
+else:
+page = pywikibot.Page(self.site, settings_page)
+self.settings_data = []
+try:
+testo = page.get()
+
+for number, m in enumerate(SETTINGS_REGEX.finditer(testo),
+   start=1):
+name = str(m[1])
+find_tipe = str(m[2])
+find = str(m[3])
+imagechanges = str(m[4])
+summary = str(m[5])
+head = str(m[6])
+text = str(m[7])
+mexcatched = str(m[8])
+tupla = [number, name, find_tipe, find, imagechanges,
+ summary, head, text, mexcatched]
+self.settings_data += [tupla]
+
+if not self.settings_data:
+pywikibot.info(
+"You've set wrongly your settings, please take a "
+'look to the relative page. (run without them)')
+self.settings_data = None
+except NoPageError:
+pywikibot.info("The settings' page doesn't exist!")
+self.settings_data = None

 # Real-Time page loaded
 if self.settings_data:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1018197?usp=email
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: If65b36cbb3d13b12924c90750f3aec3eaa70e779
Gerrit-Change-Number: 1018197
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] simplify code for self.settings_data in checkimages.py

2024-04-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017881?usp=email )

Change subject: [IMPR] simplify code for self.settings_data in checkimages.py
..

[IMPR] simplify code for self.settings_data in checkimages.py

Change-Id: Ic0f85f07d53ac32247ff807d5574c132e17be441
---
M scripts/checkimages.py
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 351a814..7950b79 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1095,13 +1095,11 @@
 self.settings_data = None
 self.some_problem = False

-if not self.settings_data:
-self.settings_data = None
-
 # Real-Time page loaded
 if self.settings_data:
 pywikibot.info('>> Loaded the real-time page... <<')
 else:
+self.settings_data = None
 pywikibot.info('>> No additional settings found! <<')

 def load_licenses(self) -> set[pywikibot.Page]:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017881?usp=email
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: Ic0f85f07d53ac32247ff807d5574c132e17be441
Gerrit-Change-Number: 1017881
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Improve api._generators and avoid similar code

2024-04-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/904743?usp=email )

Change subject: [IMPR] Improve api._generators and avoid similar code
..

[IMPR] Improve api._generators and avoid similar code

Change-Id: I5959bfe9686d918774529b98d45a3ac084848366
---
M pywikibot/data/api/_generators.py
1 file changed, 39 insertions(+), 34 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 e32ed2e..de6f011 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -19,7 +19,7 @@

 import pywikibot
 from pywikibot import config
-from pywikibot.backports import Callable
+from pywikibot.backports import Callable, Iterable
 from pywikibot.exceptions import Error, InvalidTitleError, UnsupportedPageError
 from pywikibot.site import Namespace
 from pywikibot.tools import deprecated
@@ -963,25 +963,42 @@
 page._coords = coords


-def update_page(page, pagedict: dict, props=None):
-"""Update attributes of Page object page, based on query data in pagedict.
+def update_page(page: pywikibot.Page,
+pagedict: dict[str, Any],
+props: Iterable[str] | None = None) -> None:
+"""
+Update attributes of Page object *page*, based on query data in *pagedict*.
 
 :param page: object to be updated
-:type page: pywikibot.page.Page
-:param pagedict: the contents of a "page" element of a query response
-:param props: the property names which resulted in pagedict. If a missing
-value in pagedict can indicate both 'false' and 'not present' the
-property which would make the value present must be in the props
-parameter.
-:type props: iterable of string
-:raises pywikibot.exceptions.InvalidTitleError: Page title is invalid
-:raises pywikibot.exceptions.UnsupportedPageError: Page with namespace < 0
-is not supported yet
+:param pagedict: the contents of a *page* element of a query
+response
+:param props: the property names which resulted in *pagedict*. If a
+missing value in *pagedict* can indicate both 'false' and
+'not present' the property which would make the value present
+must be in the *props* parameter.
+:raises InvalidTitleError: Page title is invalid
+:raises UnsupportedPageError: Page with namespace < 0 is not
+supported yet
 """
 _update_pageid(page, pagedict)
 _update_contentmodel(page, pagedict)

 props = props or []
+
+# test for pagedict content only and call updater function
+for element in ('coordinates', 'revisions'):
+if element in pagedict:
+updater = globals()['_update_' + element]
+updater(page, pagedict[element])
+
+# test for pagedict and props contents, call updater or set attribute
+for element in ('categories', 'langlinks', 'templates'):
+if element in pagedict:
+updater = globals()['_update_' + element]
+updater(page, pagedict[element])
+elif element in props:
+setattr(page, '_' + element, set())
+
 if 'info' in props:
 page._isredir = 'redirect' in pagedict

@@ -991,9 +1008,6 @@
 if 'protection' in pagedict:
 _update_protection(page, pagedict)

-if 'revisions' in pagedict:
-_update_revisions(page, pagedict['revisions'])
-
 if 'lastrevid' in pagedict:
 page.latest_revision_id = pagedict['lastrevid']

@@ -1006,24 +1020,6 @@
 if 'categoryinfo' in pagedict:
 page._catinfo = pagedict['categoryinfo']

-if 'templates' in pagedict:
-_update_templates(page, pagedict['templates'])
-elif 'templates' in props:
-page._templates = set()
-
-if 'categories' in pagedict:
-_update_categories(page, pagedict['categories'])
-elif 'categories' in props:
-page._categories = set()
-
-if 'langlinks' in pagedict:
-_update_langlinks(page, pagedict['langlinks'])
-elif 'langlinks' in props:
-page._langlinks = set()
-
-if 'coordinates' in pagedict:
-_update_coordinates(page, pagedict['coordinates'])
-
 if 'pageimage' in pagedict:
 page._pageimage = pywikibot.FilePage(page.site, pagedict['pageimage'])


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/904743?usp=email
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: I5959bfe9686d918774529b98d45a3ac084848366
Gerrit-Change-Number: 904743
Gerrit-PatchSet: 12
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To 

[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-04-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1017835?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Iccc1b4eae7bbdc3e9f35d57ffdcd174b37dc7982
---
M checkimages/de.json
1 file changed, 15 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  L10n-bot: Looks good to me, approved




diff --git a/checkimages/de.json b/checkimages/de.json
index 923f9c3..0812037 100644
--- a/checkimages/de.json
+++ b/checkimages/de.json
@@ -3,6 +3,7 @@
"authors": [
"Filnik",
"Metalhead64",
+   "TomatoCake",
"Xqt"
]
},
@@ -10,13 +11,13 @@
"checkimages-doubles-file-comment": "Bot: Datei liegt bereits auf 
Commons, kann gelöscht werden",
"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-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 du es für angebrachter hältst, die Datei als sofort zu löschend 
markiert zu belassen, kannst du 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": "('''erzwungener Modus''')",
+   "checkimages-has-duplicates": "hat die folgenden Duplikate%(force)s:",
+   "checkimages-log-comment": "Bot: Log wird aktualisiert",
"checkimages-no-license-head": "Bild ohne Lizenz",
"checkimages-source-tag-comment": "Bot: Markiere zur Dateiüberprüfung, 
da keine Lizenzvorlage gefunden.",
-   "checkimages-source-notice-comment": "Bot: Benachrichtigung über 
Lizenzprobleme.",
+   "checkimages-source-notice-comment": "Bot: Quellinformationen 
anfordern.",
"checkimages-unknown-extension-head": "Unbekannte Erweiterung!",
"checkimages-unknown-extension-msg": "Die Datei %(file)s scheint eine 
falsche Erweiterung zu haben. Bitte überprüfen."
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1017835?usp=email
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: Iccc1b4eae7bbdc3e9f35d57ffdcd174b37dc7982
Gerrit-Change-Number: 1017835
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] Fix TypeError in colors.py with backports.batched

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017485?usp=email )

Change subject: [bugfix] Fix TypeError in colors.py with backports.batched
..

[bugfix] Fix TypeError in colors.py with backports.batched

Bug: T362035
Change-Id: I68d7a7c3451fce91e13385a57138c0ed50f26d64
Signed-off-by: Xqt 
---
M pywikibot/backports.py
M scripts/maintenance/colors.py
2 files changed, 19 insertions(+), 6 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 155effd..8b9d989 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -177,9 +177,13 @@
 :param strict: raise a ValueError if the final batch is shorter
 than *n*.
 :raise ValueError: batched(): incomplete batch
+:raise TypeError: *n* cannot be interpreted as an integer
 """
 msg = 'batched(): incomplete batch'
 if PYTHON_VERSION < (3, 12):
+if not isinstance(n, int):
+raise TypeError(f'{type(n),__name__!r} object cannot be'
+' interpreted as an integer')
 group = []
 for item in iterable:
 group.append(item)
diff --git a/scripts/maintenance/colors.py b/scripts/maintenance/colors.py
index bf73742..63c46a5 100755
--- a/scripts/maintenance/colors.py
+++ b/scripts/maintenance/colors.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Utility to show pywikibot colors."""
 #
-# (C) Pywikibot team, 2016-2023
+# (C) Pywikibot team, 2016-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -17,10 +17,8 @@
 fg_colors = [col for col in colors if col != 'default']
 bg_colors = fg_colors[:]
 n_fg_colors = len(fg_colors)
-fg_colors.insert(3 * int(n_fg_colors / 4), 'default')
-fg_colors.insert(2 * int(n_fg_colors / 4), 'default')
-fg_colors.insert(int(n_fg_colors / 4), 'default')
-fg_colors.insert(0, 'default')
+for i in range(4):
+fg_colors.insert((3 - i) * (n_fg_colors // 4), 'default')

 # Max len of color names for padding.
 max_len_fg_colors = len(max(fg_colors, key=len))
@@ -28,7 +26,7 @@

 for bg_col in bg_colors:
 # Three lines per each backgoung color.
-for fg_col_group in batched(fg_colors, n_fg_colors / 4 + 1):
+for fg_col_group in batched(fg_colors, n_fg_colors // 4 + 1):
 line = ''
 for fg_col in fg_col_group:
 line += ' '

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017485?usp=email
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: I68d7a7c3451fce91e13385a57138c0ed50f26d64
Gerrit-Change-Number: 1017485
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Meno25 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Update pip first to prevent installing the wrong codecov-cli ...

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017513?usp=email )

Change subject: [tests] Update pip first to prevent installing the wrong 
codecov-cli release
..

[tests] Update pip first to prevent installing the wrong codecov-cli release

Bug: T361999
Change-Id: I937435daa3013293e979d0a3d02d8dd47bd9ed51
---
M .appveyor.yml
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index 4cba969..d81a168 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -64,6 +64,7 @@
   - mkdir appveyor
   - python --version
   - python -c "import struct; print('PYTHON_ARCH:', struct.calcsize('P') << 3)"
+  - pip install --upgrade pip
   - pip --version
   - if [%PYTHON_VERSION%]==[3.7.0] pip install "urllib3<2.0"
   - if [%PYTHON_VERSION%]==[3.7.0] pip install -U setuptools

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017513?usp=email
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: I937435daa3013293e979d0a3d02d8dd47bd9ed51
Gerrit-Change-Number: 1017513
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] update ROADMAP.rst

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017512?usp=email )

Change subject: [doc] update ROADMAP.rst
..

[doc] update ROADMAP.rst

Change-Id: I992550ef6b9b82e3819a48b44599485c42bc2b0a
---
M ROADMAP.rst
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/ROADMAP.rst b/ROADMAP.rst
index b00b932..850f0a3 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,14 @@
 Current release
 ---

-* (no changes yet)
+* File title of :class:`specialbots.UploadRobot` must have a valid file 
extension (:phab:`T345786`)
+* Add a :attr:`post_processor` 
attribute to :class:`specialbots.UploadRobot`
+  which can be called after each upload (:phab:`T359766`)
+* Avoid using :meth:`pywikibot.handle_args` in private scripts;
+  use :mod:`pwb` wrapper instead (:phab:`T359766`)
+* Show upload count with :class:`specialbots.UploadRobot`
+* Use the same ``iiprop`` properties in :class:`data.api.PageGenerator` as in
+  :meth:`APISite.loadimageinfo` 
(:phab:`T360093`)

 Deprecations
 

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017512?usp=email
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: I992550ef6b9b82e3819a48b44599485c42bc2b0a
Gerrit-Change-Number: 1017512
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [fix] file title must have a valid file extension

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015994?usp=email )

Change subject: [fix] file title must have a valid file extension
..

[fix] file title must have a valid file extension

An invalid file extension will lead to a ValueError.
Skip the current file or retry to enter a valid filename.

Bug: T345786
Change-Id: Ie95c837156d893e2e8faa6eaac96fc95a63531a8
---
M pywikibot/specialbots/_upload.py
1 file changed, 20 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index ce8bd29..0aad35d 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -3,7 +3,7 @@
 Do not import classes directly from here but from specialbots.
 """
 #
-# (C) Pywikibot team, 2003-2023
+# (C) Pywikibot team, 2003-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -270,13 +270,13 @@
 if self.opt.always:
 pywikibot.info('File format is not one of [{}]'
.format(' '.join(allowed_formats)))
-continue

-if not pywikibot.input_yn(
-'File format is not one of [{}], but {!r}. Continue?'
-.format(' '.join(allowed_formats), ext),
-default=False):
-continue
+elif pywikibot.input_yn(
+'File format is not one of [{}], but {!r}. Skip?'
+.format(' '.join(allowed_formats), ext)):
+return None
+
+continue

 potential_file_page = pywikibot.FilePage(self.target_site,
  filename)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015994?usp=email
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: Ie95c837156d893e2e8faa6eaac96fc95a63531a8
Gerrit-Change-Number: 1015994
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] update UploadRobot documentation

2024-04-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017109?usp=email )

Change subject: [doc] update UploadRobot documentation
..

[doc] update UploadRobot documentation

Change-Id: I07a428bf4476214179a5ea5d9981755b1d9e94fb
---
M pywikibot/specialbots/_upload.py
1 file changed, 14 insertions(+), 8 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index 9c217db..128d9bd 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -31,10 +31,10 @@
 """Upload bot."""

 post_processor: Callable[[str, str | None], None] | None = None
-"""If this attribute is set to a callable, the :meth:`run` method calls it
-after upload. The parameter passed to the callable is the origin *file_url*
-passed to the :meth:`upload` method and the filename returned from that
-method. It can be used like this:
+"""If this attribute is set to a callable, the :meth:`run` method
+calls it after upload. The parameters passed to the callable is the
+origin *file_url* passed to the :meth:`upload` method and the
+*filename* returned from that method. It can be used like this:

 .. code:: python

@@ -70,7 +70,6 @@

 .. versionchanged:: 6.2
asynchronous upload is used if *asynchronous* parameter is set
-
 .. versionchanged:: 6.4
*force_if_shared* parameter was added

@@ -78,7 +77,6 @@
 to local files.
 :param description: Description of file for its page. If multiple files
 are uploading the same description is used for every file.
-:type description: str
 :param use_filename: Specify title of the file's page. If multiple
 files are uploading it asks to change the name for second, third,
 etc. files, otherwise the last file will overwrite the other.
@@ -104,11 +102,10 @@
 :param force_if_shared: Upload the file even if it's currently
 shared to the target site (e.g. when moving from Commons to another
 wiki)
-:keyword always: Disables any input, requires that either
+:keyword bool always: Disables any input, requires that either
 ignore_warning or aborts are set to True and that the
 description is also set. It overwrites verify_description to
 False and keep_filename to True.
-:type always: bool
 """
 super().__init__(**kwargs)
 if self.opt.always:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017109?usp=email
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: I07a428bf4476214179a5ea5d9981755b1d9e94fb
Gerrit-Change-Number: 1017109
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Fix Sphinx directive

2024-04-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016782?usp=email )

Change subject: [doc] Fix Sphinx directive
..

[doc] Fix Sphinx directive

Change-Id: I6829569e29abf12fcc4dbb7278a2f131bcc4f17e
Signed-off-by: Xqt 
---
M pywikibot/specialbots/_upload.py
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index e34f601..9c217db 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -474,7 +474,7 @@
 def run(self):
 """Run bot.

-.. versionchanged: 9.1
+.. versionchanged:: 9.1
count uploads.
 """
 if self.skip_run():

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016782?usp=email
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: I6829569e29abf12fcc4dbb7278a2f131bcc4f17e
Gerrit-Change-Number: 1016782
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR} Add a post_processing attribute to UploadRobot

2024-04-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015990?usp=email )

Change subject: [IMPR} Add a post_processing attribute to UploadRobot
..

[IMPR} Add a post_processing attribute to UploadRobot

If this attribute is set to a callable, the run method calls it
after upload. The parameter passed to the callable is the origin file_url
passed to the upload method and the filename returned from that method.

- use this feature with imagetransfer  and use bot.run() mehtod instead
  of bot.upload_file()

Bug: T360837
Change-Id: I4a9c6182a87a601ce770ebb5e84c8898d2a4563d
---
M pywikibot/specialbots/_upload.py
M scripts/imagetransfer.py
M tests/uploadbot_tests.py
3 files changed, 75 insertions(+), 29 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index ce8bd29..e34f601 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -3,7 +3,7 @@
 Do not import classes directly from here but from specialbots.
 """
 #
-# (C) Pywikibot team, 2003-2023
+# (C) Pywikibot team, 2003-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -21,6 +21,7 @@
 import pywikibot
 import pywikibot.comms.http as http
 from pywikibot import config
+from pywikibot.backports import Callable
 from pywikibot.bot import BaseBot, QuitKeyboardInterrupt
 from pywikibot.exceptions import APIError, FatalServerError, NoPageError

@@ -29,6 +30,27 @@

 """Upload bot."""

+post_processor: Callable[[str, str | None], None] | None = None
+"""If this attribute is set to a callable, the :meth:`run` method calls it
+after upload. The parameter passed to the callable is the origin *file_url*
+passed to the :meth:`upload` method and the filename returned from that
+method. It can be used like this:
+
+.. code:: python
+
+   def summarize(old: str, new: str | None) -> None:
+   if new is None:
+   print(f'{old} was ignored')
+   else:
+   print(f'{old} was uploaded as {new}')
+
+   bot = UploadRobot('Myfile.bmp')
+   bot.post_processor = summarize
+   bot.run()
+
+.. versionadded:: 9.1
+"""
+
 def __init__(self, url: list[str] | str, *,
  url_encoding=None,
  description: str = '',
@@ -464,6 +486,8 @@
 self.counter['read'] += 1
 if filename:
 self.counter['upload'] += 1
+if callable(self.post_processor):
+self.post_processor(file_url, filename)
 except QuitKeyboardInterrupt:
 pywikibot.info(f'\nUser quit {type(self).__name__} bot run...')
 except KeyboardInterrupt:
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index eb4bf8c..7cf4836 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -37,7 +37,7 @@
 
 """
 #
-# (C) Pywikibot team, 2004-2022
+# (C) Pywikibot team, 2004-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -201,6 +201,34 @@

 :return: the filename which was used to upload the image
 """
+def delete_source(old_filename, target_filename):
+"""Delete source image or tag nowCommons template to it.
+
+This function is called when upload to Commons was
+successful.
+"""
+if not target_filename \
+   or self.opt.target.sitename != 'commons:commons':
+return
+
+reason = i18n.twtranslate(sourceSite,
+  'imagetransfer-nowcommons_notice')
+# try to delete the original image if we have a sysop account
+if sourceSite.has_right('delete') \
+   and sourceImagePage.delete(reason):
+return
+
+if sourceSite.lang in nowCommonsTemplate \
+   and sourceSite.family.name in config.usernames \
+   and sourceSite.lang in config.usernames[sourceSite.family.name]:
+# add the nowCommons template.
+pywikibot.info('Adding nowCommons template to '
+   + sourceImagePage.title())
+sourceImagePage.put(sourceImagePage.get() + '\n\n'
++ nowCommonsTemplate[sourceSite.code]
+% target_filename,
+summary=reason)
+
 sourceSite = sourceImagePage.site
 pywikibot.info(
 '\n>>> Transfer {source} from {source.site} to {target}\n'
@@ -246,32 +274,8 @@
   force_if_shared=self.opt.force_if_shared,
   asynchronous=self.opt.asynchronous,
   chunk_size=self.opt.chunk_size)
-
-# try to upload
-

[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Add admoniton and hint for pywikibot.handle_args() usage

2024-04-03 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016793?usp=email )

Change subject: [doc] Add admoniton and hint for pywikibot.handle_args() usage
..

[doc] Add admoniton and hint for pywikibot.handle_args() usage

Bug: T359766
Change-Id: Idf3d76406590dd0a39cc08dd47c39d45c6b32c60
---
M pywikibot/bot.py
M pywikibot/scripts/wrapper.py
2 files changed, 35 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 04606a0..935886d 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -672,6 +672,26 @@
 ['-myoption']
 >>> for arg in local_args: pass  # do whatever is wanted with local_args

+.. caution::
+   Global options might be introduced without warning period. It is
+   up to developers to verify that global options do not interfere
+   with local script options of private scripts.
+
+.. tip::
+   Avoid using this method in your private scripts and use the
+   :mod:`pwb` wrapper instead. In
+   directory mode::
+
+   python pwb.py   
+
+   With installed site package::
+
+   pwb   
+
+   .. note:: the :mod:`pwb` wrapper can
+  be used even if the `handle_args` method is used within the
+  script.
+
 .. versionchanged:: 5.2
*-site* global option was added
 .. versionchanged:: 7.1
diff --git a/pywikibot/scripts/wrapper.py b/pywikibot/scripts/wrapper.py
index ba63b8d..32eaa8f 100755
--- a/pywikibot/scripts/wrapper.py
+++ b/pywikibot/scripts/wrapper.py
@@ -30,12 +30,14 @@

 python pwb.py -lang:de bot_tests -v

+.. seealso:: :mod:`pwb` entry point
 .. versionchanged:: 7.0
-   pwb wrapper was added to the Python site package lib
+   pwb wrapper was added to the Python site package lib.
 .. versionchanged:: 7.7
-   pwb wrapper is able to set ``PYWIKIBOT_TEST_...`` environment variables
+   pwb wrapper is able to set ``PYWIKIBOT_TEST_...`` environment variables,
+   see :ref:`Environment variables`.
 .. versionchanged:: 8.0
-   renamed to wrapper.py
+   renamed to wrapper.py.
 """
 #
 # (C) Pywikibot team, 2012-2024

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016793?usp=email
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: Idf3d76406590dd0a39cc08dd47c39d45c6b32c60
Gerrit-Change-Number: 1016793
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Update documentation for BasePage.get() and BasePage.text

2024-04-02 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016331?usp=email )

Change subject: [doc] Update documentation for BasePage.get() and BasePage.text
..

[doc] Update documentation for BasePage.get() and BasePage.text

The argument of IsRedirectPageError is the page itself since Pywikibot
core release. With compat release it was the redirect target page.
The reason for this change in core release is documented in
rPWBC1585a990e3d1:

   "... getting the redirect target requires an additional API request
... Knowing that we have a redirect page without knowing its target
is sometimes enough."

Bug: T361531
Change-Id: I07f9ff7b270d561020fdf72c999df3641e3eda18
---
M pywikibot/page/_basepage.py
1 file changed, 66 insertions(+), 14 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 6af8970..8eaeeb0 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -358,19 +358,31 @@
 """Return the wiki-text of the page.

 This will retrieve the page from the server if it has not been
-retrieved yet, or if force is True. This can raise the following
-exceptions that should be caught by the calling code:
+retrieved yet, or if force is True. Exceptions should be caught
+by the calling code.

-:exception pywikibot.exceptions.NoPageError: The page does not exist
-:exception pywikibot.exceptions.IsRedirectPageError: The page is a
-redirect. The argument of the exception is the title of the page
-it redirects to.
-:exception pywikibot.exceptions.SectionError: The section does not
-exist on a page with a # link
+**Example:**

-:param force:   reload all page attributes, including errors.
-:param get_redirect:return the redirect text, do not follow the
-redirect, do not raise an exception.
+>>> import pywikibot
+>>> site = pywikibot.Site('mediawiki')
+>>> page = pywikibot.Page(site, 'Pywikibot')
+>>> page.get(get_redirect=True)
+'#REDIRECT[[Manual:Pywikibot]]'
+>>> page.get()
+Traceback (most recent call last):
+ ...
+pywikibot.exceptions.IsRedirectPageError: ... is a redirect page.
+
+.. seealso:: :attr:`text` property
+
+:param force: reload all page attributes, including errors.
+:param get_redirect: return the redirect text, do not follow the
+redirect, do not raise an exception.
+
+:raises NoPageError: The page does not exist.
+:raises IsRedirectPageError: The page is a redirect.
+:raises SectionError: The section does not exist on a page with
+a # link.
 """
 if force:
 del self.latest_revision_id
@@ -519,8 +531,29 @@

 @property
 def text(self) -> str:
-"""
-Return the current (edited) wikitext, loading it if necessary.
+"""Return the current (edited) wikitext, loading it if necessary.
+
+This property should be prefered over :meth:`get`. If the page
+does not exist, an empty string will be returned. For a redirect
+it returns the redirect page content and does not raise an
+:exc:`exceptions.IsRedirectPageError` exception.
+
+**Example:**
+
+>>> import pywikibot
+>>> site = pywikibot.Site('mediawiki')
+>>> page = pywikibot.Page(site, 'Pywikibot')
+>>> page.text
+'#REDIRECT[[Manual:Pywikibot]]'
+>>> page.text = 'PWB Framework'
+>>> page.text
+'PWB Framework'
+>>> page.text = None  # reload from wiki
+>>> page.text
+'#REDIRECT[[Manual:Pywikibot]]'
+>>> del page.text  # other way to reload from wiki
+
+To save the modified text :meth:`save` is one possible method.

 :return: text of the page
 """
@@ -534,7 +567,7 @@
 return ''

 @text.setter
-def text(self, value: str | None):
+def text(self, value: str | None) -> None:
 """Update the current (edited) wikitext.

 :param value: New value or None

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016331?usp=email
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: I07f9ff7b270d561020fdf72c999df3641e3eda18
Gerrit-Change-Number: 1016331
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt 
Gerrit-Reviewer: RoySmith 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to 

[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Fix table syntax

2024-04-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016027?usp=email )

Change subject: [doc] Fix table syntax
..

[doc] Fix table syntax

Change-Id: I36805667eecef7a2a2cbfce05183767e3b51d753
---
M scripts/README.rst
1 file changed, 10 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Meno25: Looks good to me, approved




diff --git a/scripts/README.rst b/scripts/README.rst
index 0b12f8d..162933a 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -18,7 +18,7 @@
 Bots and scripts
 

-++
++--+-+
 | Bots and Scripts 
  |
 
+==+=+
 | add_text.py  | Adds text at the top or end of pages. 
  |

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1016027?usp=email
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: I36805667eecef7a2a2cbfce05183767e3b51d753
Gerrit-Change-Number: 1016027
Gerrit-PatchSet: 2
Gerrit-Owner: Meno25 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Meno25 
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Xqt 
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] show upload count with UploadRobot

2024-04-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015981?usp=email )

Change subject: [IMPR] show upload count with UploadRobot
..

[IMPR] show upload count with UploadRobot

Also update doc strings and replace format strings

Change-Id: Id46329e9f60669087e4ee8673717500acd557289
---
M pywikibot/specialbots/_upload.py
1 file changed, 39 insertions(+), 19 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index 9096957..ce8bd29 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -216,11 +216,13 @@
 default=False, automatic_quit=False)
 return answer

-def process_filename(self, file_url):
-"""Return base filename portion of file_url."""
+def process_filename(self, file_url: str) -> str | None:
+"""Return base filename portion of *file_url*.
+
+:param file_url: either a URL or a local file path
+"""
 # Isolate the pure name
 filename = file_url
-# Filename may be either a URL or a local file path
 if '://' in filename:
 # extract the path portion of the URL
 filename = urlparse(filename).path
@@ -288,10 +290,10 @@
 if potential_file_page.has_permission():
 if overwrite is None:
 overwrite = not pywikibot.input_yn(
-'File with name {} already exists. '
-'Would you like to change the name? '
-'(Otherwise file will be overwritten.)'
-.format(filename), default=True,
+f'File with name {filename} already exists.'
+' Would you like to change the name?'
+' (Otherwise file will be overwritten.)',
+default=True,
 automatic_quit=False)
 if not overwrite:
 continue
@@ -361,7 +363,7 @@
 """
 return self.ignore_warning is True or warn_code in self.ignore_warning

-def upload_file(self, file_url):
+def upload_file(self, file_url: str) -> str | None:
 """
 Upload the image at file_url to the target wiki.

@@ -374,6 +376,8 @@
 .. versionchanged:: 7.0
If 'copyuploadbaddomain' API error occurred in first step,
download the file and upload it afterwards
+
+:param file_url: either a URL or a local file path
 """
 filename = self.process_filename(file_url)
 if not filename:
@@ -432,36 +436,41 @@
 """Check whether processing is to be skipped."""
 # early check that upload is enabled
 if self.target_site.is_uploaddisabled():
-pywikibot.error(
-'Upload error: Local file uploads are disabled on {}.'
-.format(self.target_site))
+pywikibot.error(f'Upload error: Local file uploads are disabled '
+f'on {self.target_site}.')
 return True

 # early check that user has proper rights to upload
 self.target_site.login()
 if not self.target_site.has_right('upload'):
-pywikibot.error(
-"User '{}' does not have upload rights on site {}."
-.format(self.target_site.user(), self.target_site))
+pywikibot.error(f"User '{self.target_site.user()}' does not have "
+f'upload rights on site {self.target_site}.')
 return True

 return False

 def run(self):
-"""Run bot."""
+"""Run bot.
+
+.. versionchanged: 9.1
+   count uploads.
+"""
 if self.skip_run():
 return
+
 try:
 for file_url in self.url:
-self.upload_file(file_url)
+filename = self.upload_file(file_url)
 self.counter['read'] += 1
+if filename:
+self.counter['upload'] += 1
 except QuitKeyboardInterrupt:
-pywikibot.info(f'\nUser quit {self.__class__.__name__} bot run...')
+pywikibot.info(f'\nUser quit {type(self).__name__} bot run...')
 except KeyboardInterrupt:
 if config.verbose_output:
 raise

-pywikibot.info('\nKeyboardInterrupt during {} bot run...'
-   .format(self.__class__.__name__))
+pywikibot.info(
+f'\nKeyboardInterrupt during {type(self).__name__} bot run...')
 finally:
 self.exit()

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015981?usp=email
To 

[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-04-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1015961?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Ia1e2e1a3aedea86ce02283f2eff6fd79ebd8fe0b
---
M fixing_redirects/sd.json
M interwikidata/sd.json
M redirect/pl.json
A replicate_wiki/pl.json
4 files changed, 23 insertions(+), 4 deletions(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/fixing_redirects/sd.json b/fixing_redirects/sd.json
index 9f6c109..9ca820f 100644
--- a/fixing_redirects/sd.json
+++ b/fixing_redirects/sd.json
@@ -1,8 +1,9 @@
 {
"@metadata": {
"authors": [
-   "BukhariSaeed"
+   "BukhariSaeed",
+   "Kaleem Bhatti"
]
},
-   "fixing_redirects-fixing": "بوٽ: چوريو جي درستي"
+   "fixing_redirects-fixing": "بوٽ: چوريو جي درستگي"
 }
diff --git a/interwikidata/sd.json b/interwikidata/sd.json
index fa50a8b..f83592a 100644
--- a/interwikidata/sd.json
+++ b/interwikidata/sd.json
@@ -4,5 +4,5 @@
"Kaleem Bhatti"
]
},
-   "interwikidata-clean-summary": "خودڪار:وڪي ڊيٽا ۾ بین الویڪی ڳنڍڻن جي 
خودڪار منتقلي"
+   "interwikidata-clean-summary": "بوٽ:وڪي ڊيٽا ۾ بین الویڪی ڳنڍڻن جي 
خودڪار منتقلي"
 }
diff --git a/redirect/pl.json b/redirect/pl.json
index f7db6f1..c950d9e 100644
--- a/redirect/pl.json
+++ b/redirect/pl.json
@@ -2,6 +2,7 @@
"@metadata": {
"authors": [
"BeginaFelicysym",
+   "Chrumps",
"Derbeth",
"Nemo bis",
"Sp5uhe",
@@ -12,6 +13,6 @@
"redirect-fix-broken-moved": "Poprawa urwanych przekierowań - 
przeniesiono cel do %(to)s",
"redirect-fix-double": "Robot naprawił podwójne przekierowanie do 
%(to)s",
"redirect-fix-loop": "Naprawa pętli przekierowań do %(to)s",
-   "redirect-remove-broken": "przekierowanie do usuniętej lub 
nieistniejącej strony",
+   "redirect-remove-broken": "Przekierowanie do usuniętej lub 
nieistniejącej strony",
"redirect-remove-loop": "pętla przekierowań"
 }
diff --git a/replicate_wiki/pl.json b/replicate_wiki/pl.json
new file mode 100644
index 000..3758c93
--- /dev/null
+++ b/replicate_wiki/pl.json
@@ -0,0 +1,8 @@
+{
+   "@metadata": {
+   "authors": [
+   "Chrumps"
+   ]
+   },
+   "replicate_wiki-headline": "Strony różniące się od oryginalnych"
+}

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1015961?usp=email
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: Ia1e2e1a3aedea86ce02283f2eff6fd79ebd8fe0b
Gerrit-Change-Number: 1015961
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] Use the same iiprop in PageGenerator as in APISite.loadimage...

2024-04-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1013713?usp=email )

Change subject: [bugfix] Use the same iiprop in PageGenerator as in 
APISite.loadimageinfo()
..

[bugfix] Use the same iiprop in PageGenerator as in APISite.loadimageinfo()

Bug: T360093
Change-Id: I00e5ea66aa6401c6b9c000e9e19a5a35fbc8f4bc
---
M pywikibot/data/api/_generators.py
M pywikibot/site/__init__.py
M pywikibot/site/_apisite.py
M tests/pagegenerators_tests.py
M tests/site_generators_tests.py
5 files changed, 67 insertions(+), 48 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/data/api/_generators.py 
b/pywikibot/data/api/_generators.py
index 78df271..e32ed2e 100644
--- a/pywikibot/data/api/_generators.py
+++ b/pywikibot/data/api/_generators.py
@@ -6,7 +6,7 @@
:class:`tools.collections.GeneratorWrapper`
 """
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -675,23 +675,28 @@
 g_content: bool = False,
 **kwargs
 ) -> None:
-"""
-Initializer.
+"""Initializer.

-Required and optional parameters are as for ``Request``, except that
-action=query is assumed and generator is required.
+Required and optional parameters are as for ``Request``, except
+that ``action=query`` is assumed and generator is required.
+
+.. versionchanged:: 9.1
+   retrieve the same imageinfo properties as in
+   :meth:`APISite.loadimageinfo()
+   ` with default
+   parameters.

 :param generator: the "generator=" type from api.php
 :param g_content: if True, retrieve the contents of the current
 version of each Page (default False)
-
 """
-# If possible, use self.request after __init__ instead of appendParams
+# If possible, use self.request after __init__ instead of append_params
 def append_params(params, key, value) -> None:
 if key in params:
 params[key] += '|' + value
 else:
 params[key] = value
+
 kwargs = self._clean_kwargs(kwargs)
 parameters = kwargs['parameters']
 # get some basic information about every page generated
@@ -704,8 +709,7 @@
 if not ('inprop' in parameters
 and 'protection' in parameters['inprop']):
 append_params(parameters, 'inprop', 'protection')
-append_params(parameters, 'iiprop',
-  'timestamp|user|comment|url|size|sha1')
+append_params(parameters, 'iiprop', pywikibot.site._IIPROP)
 append_params(parameters, 'iilimit', 'max')  # T194233
 parameters['generator'] = generator
 super().__init__(**kwargs)
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index 6824eb1..9cfcbf4 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -1,6 +1,6 @@
 """Library module representing MediaWiki sites (wikis)."""
 #
-# (C) Pywikibot team, 2021-2022
+# (C) Pywikibot team, 2021-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -21,3 +21,9 @@

 __all__ = ('APISite', 'BaseSite', 'ClosedSite', 'DataSite', 'RemovedSite',
'Namespace', 'NamespacesDict', 'Siteinfo', 'TokenWallet')
+
+# iiprop file information to get, used in several places
+_IIPROP = (
+'timestamp', 'user', 'comment', 'url', 'size', 'sha1', 'mime', 'mediatype',
+'archivename', 'bitdepth',
+)
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 33af282..340d82e 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -1488,11 +1488,10 @@

 The following properties are loaded: ``timestamp``, ``user``,
 ``comment``, ``url``, ``size``, ``sha1``, ``mime``, ``mediatype``,
-``archivename`` and ``bitdepth``.
-``metadata``is loaded only if history is False.
-If *url_width*, *url_height* or *url_param* is given, additional
-properties ``thumbwidth``, ``thumbheight``, ``thumburl`` and
-``responsiveUrls`` are given.
+``archivename`` and ``bitdepth``. ``metadata`` is loaded only if
+*history* is False. If *url_width*, *url_height* or *url_param*
+is given, additional properties ``thumbwidth``, ``thumbheight``,
+``thumburl`` and ``responsiveUrls`` are given.

 .. note:: Parameters validation and error handling left to the
API call.
@@ -1508,7 +1507,7 @@
 :param url_height: get info for a thumbnail with given height
 :param url_param:  get info for a thumbnail with given param
 :param timestamp: timestamp of the image's version to retrieve.
-It has effect only if history is False.
+It has effect only if *history* is False.
 If 

[Pywikibot-commits] [Gerrit] ...core[master]: [fix] Update user_tests

2024-04-01 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015956?usp=email )

Change subject: [fix] Update user_tests
..

[fix] Update user_tests

Change-Id: Ied9c5a395eeb5514b03bdea04df3bc1ecdb3273a
---
M tests/user_tests.py
1 file changed, 10 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/user_tests.py b/tests/user_tests.py
index de30fcd..9242e8b 100755
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -97,7 +97,7 @@
 self.assertIsNone(user.registration())
 self.assertIsNone(user.getprops()['registration'])
 self.assertGreater(user.editCount(), 0)
-self.assertEqual(user.gender(), 'male')
+self.assertEqual(user.gender(), 'unknown')
 self.assertIn('userid', user.getprops())
 self.assertTrue(user.is_thankable)


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015956?usp=email
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: Ied9c5a395eeb5514b03bdea04df3bc1ecdb3273a
Gerrit-Change-Number: 1015956
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-03-28 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1015305?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Id23d57cce64641242b333e2bfa400ceeb9c95bf5
---
M checkimages/fa.json
M imagetransfer/fa.json
2 files changed, 13 insertions(+), 2 deletions(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/checkimages/fa.json b/checkimages/fa.json
index 153bc80..6572dc8 100644
--- a/checkimages/fa.json
+++ b/checkimages/fa.json
@@ -2,6 +2,7 @@
"@metadata": {
"authors": [
"Amir Sarabadani",
+   "Ebraminio",
"FarsiNevis",
"Huji",
"Reza1615",
@@ -17,5 +18,5 @@
"checkimages-source-tag-comment": "ربات: حق تکثیر تصویر تازه بارگذاری 
شده نامعلوم است.",
"checkimages-source-notice-comment": "ربات: درخواست منبع اطلاعات.",
"checkimages-unknown-extension-head": "بارگذاری تصاویر موجود در انبار",
-   "checkimages-unknown-extension-msg": "به نظر می‌آید تصویر %(file)s مسیر 
نادرستی داشته باشد لطفا بررسی کنید."
+   "checkimages-unknown-extension-msg": "به نظر می‌آید تصویر %(file)s مسیر 
نادرستی داشته باشد لطفاً بررسی کنید."
 }
diff --git a/imagetransfer/fa.json b/imagetransfer/fa.json
index 6802b50..350dc24 100644
--- a/imagetransfer/fa.json
+++ b/imagetransfer/fa.json
@@ -2,9 +2,10 @@
"@metadata": {
"authors": [
"Amir Sarabadani",
+   "Ebraminio",
"Reza1615"
]
},
-   "imagetransfer-file_page_message": "تصویر از %(site)s کپی شده‌است که 
توضیحات اصلیش این بود:\n\n%(description)s",
+   "imagetransfer-file_page_message": "تصویر از %(site)s کپی شده است که 
توضیحات اصلیش این بود:\n\n%(description)s",
"imagetransfer-nowcommons_notice": "پرونده اکنون در انبار است"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1015305?usp=email
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: Id23d57cce64641242b333e2bfa400ceeb9c95bf5
Gerrit-Change-Number: 1015305
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-03-14 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1011106?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: I0156d7a961084461dd0576ce9917b84933c16c4d
---
M archivebot/hi.json
M blockpageschecker/hi.json
M category/hi.json
M category_redirect/hi.json
M checkimages/hi.json
5 files changed, 17 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  L10n-bot: Looks good to me, approved




diff --git a/archivebot/hi.json b/archivebot/hi.json
index c08104b..b533f09 100644
--- a/archivebot/hi.json
+++ b/archivebot/hi.json
@@ -8,6 +8,6 @@
},
"archivebot-archive-full": "(पुरालेख पूर्ण)",
"archivebot-archive-summary": "बॉट: %(count)d 
{{PLURAL:%(count)d|सूत्र|सूत्रों}} को [[%(from)s]] से संग्रहीत किया जा रहा है",
-   "archivebot-older-than": "%(duration)s से पुराना",
+   "archivebot-older-than": "%(duration)s से {{PLURAL:%(count)d|पुराना}}",
"archivebot-page-summary": "बॉट:%(count)d 
{{PLURAL:%(count)d|सूत्र|सूत्रों}} को (%(why)s) %(archives)s में संग्रहीत किया 
जा रहा है"
 }
diff --git a/blockpageschecker/hi.json b/blockpageschecker/hi.json
index 33ae2cf..556124f 100644
--- a/blockpageschecker/hi.json
+++ b/blockpageschecker/hi.json
@@ -2,8 +2,11 @@
"@metadata": {
"authors": [
"Shubhamkanodia",
-   "Siddhartha Ghai"
+   "Siddhartha Ghai",
+   "संजीव कुमार"
]
},
+   "blockpageschecker-adding": "बॉट: पृष्ठ लॉक साँचा जोड़ा",
+   "blockpageschecker-modifying": "बॉट: पुराना पड़ा साँचा अद्यतन किया",
"blockpageschecker-deleting": "बॉट: पुराने साँचे को हटाया जा रहा है"
 }
diff --git a/category/hi.json b/category/hi.json
index e9e42c9..ade92ba 100644
--- a/category/hi.json
+++ b/category/hi.json
@@ -7,6 +7,7 @@
},
"category-adding": "बॉट: [[:Category:%(newcat)s|%(newcat)s]] श्रेणी 
जोड़ रहा है",
"category-also-in": "(%(alsocat)s में भी)",
+   "category-clean": "बॉट: %(category)s को हटाया जा रहा है क्योंकि यह इसके 
अंतर्गत %(child)s उपयोग में है।",
"category-listifying": "बॉट: %(fromcat)s से listify ({{PLURAL:%(num)d|1 
प्रविष्टि|%(num)d प्रविष्टियाँ}})",
"category-removing": "बॉट: %(oldcat)s से हटा रहा है",
"category-renamed": "बॉट: %(oldcat)s से स्थानांतरित। लेखक: %(authors)s",
diff --git a/category_redirect/hi.json b/category_redirect/hi.json
index 777fca2..a4e0b4d 100644
--- a/category_redirect/hi.json
+++ b/category_redirect/hi.json
@@ -16,7 +16,7 @@
"category_redirect-log-add-failed": "* %(oldcat)s में 
[[%(ns)s%(template)s]] जोड़ना असफल रहा।",
"category_redirect-log-double": "* द्वि-अनुप्रेषण ठीक किया: %(oldcat)s 
-> %(newcat)s -> %(targetcat)s",
"category_redirect-log-failed": "** असफल: %(error)s",
-   "category_redirect-log-false-positive": "* असत्य सकारात्मक: %(oldcat)s",
+   "category_redirect-log-false-positive": "* अप्रत्यासित गैर-अनुप्रेषित: 
%(oldcat)s",
"category_redirect-log-ignoring": "* उपेक्षित %(oldcat)s",
"category_redirect-log-loop": "* %(oldcat)s से अनुप्रेषण पाश",
"category_redirect-log-moved": "* %(oldcat)s: %(found)d मिला, %(moved)d 
स्थानान्तरित किया",
diff --git a/checkimages/hi.json b/checkimages/hi.json
index 5ee4e7e..963a81f 100644
--- a/checkimages/hi.json
+++ b/checkimages/hi.json
@@ -4,6 +4,7 @@
"संजीव कुमार"
]
},
+   "checkimages-deletion-comment": "बॉट: %(adding)s जोड़ रहा है",
"checkimages-source-tag-comment": "बॉट: चिप्पि रहित हाल ही में अपलोड की 
हुई फाइलों को चिह्नित किया जा रहा है।",
"checkimages-source-notice-comment": "बॉट: स्रोत सूचना की जानकारी का 
अनुरोध।"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1011106?usp=email
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: I0156d7a961084461dd0576ce9917b84933c16c4d
Gerrit-Change-Number: 1011106
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-03-11 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1010175?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: Id45da42612c06a1412a26f5e7bdc89f8042e5b99
---
M category/ko.json
M checkimages/ko.json
M checkimages/ku.json
M protect/ko.json
M redirect/ku.json
M replicate_wiki/ko.json
6 files changed, 20 insertions(+), 8 deletions(-)

Approvals:
  L10n-bot: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/category/ko.json b/category/ko.json
index d82265a..602ffd9 100644
--- a/category/ko.json
+++ b/category/ko.json
@@ -7,13 +7,14 @@
"IRTC1015",
"Nuevo Paso",
"Revi",
+   "Ykhwong",
"그냥기여자",
"아라"
]
},
"category-adding": "봇: [[:Category:%(newcat)s|%(newcat)s]] 분류 추가",
"category-also-in": "(%(alsocat)s에도 들어 있습니다)",
-   "category-clean": "봇: %(child)s에 이미 속해서 %(category)s 범주 제거 중",
+   "category-clean": "봇: %(child)s에 이미 속해 있으므로 %(category)s 분류를 제거함",
"category-listifying": "봇: %(fromcat)s에서 목록화 ({{PLURAL:%(num)d|항목 1개|항목 
%(num)d개}})",
"category-removing": "봇: %(oldcat)s 제거",
"category-renamed": "봇: %(oldcat)s에서 이동됨. 저자: %(authors)s",
diff --git a/checkimages/ko.json b/checkimages/ko.json
index b2928df..82a7b05 100644
--- a/checkimages/ko.json
+++ b/checkimages/ko.json
@@ -13,9 +13,9 @@
"checkimages-doubles-file-comment": "봇: 파일이 이미 공용에 존재하므로 삭제될 수 있음",
"checkimages-doubles-head": "중복 파일",
"checkimages-doubles-talk-comment": "봇: 파일이 이미 공용에 존재함을 알림",
-   "checkimages-doubles-talk-text": "%(upload)s를 올려줘서 고마워. 그런데 이 파일은 
%(image)s의 복제본이야. 봇이 덜 사용되거나 가장 최근의 파일을 복제본로 표시했어. 이 파일이 빠르게 제거되어야 함으로 표시하는 게 더 
적절하다고 여기면, 복제본 파일을 제거하고 남겨질 파일에 제거 틀을 없애도 돼. 이것은 %(bot)s의 자동화된 문자임.",
+   "checkimages-doubles-talk-text": "%(upload)s 항목을 업로드해 주셔서 고맙습니다. 그러나 이 
파일은 %(image)s의 사본입니다. 봇은 사용 빈도가 가장 적거나 최근의 것으로 확인된 해당 파일을 중복으로 표시했습니다. 해당 파일을 
즉시 삭제로 표시한 채로 두는 것이 더 적절하다고 생각되시면 중복 파일을 삭제한 다음 남겨진 항목으로부터 삭제 틀을 제거해도 됩니다. 이는 
%(bot)s의 자동화된 메시지입니다.",
"checkimages-forced-mode": "('''강제 모드''')",
-   "checkimages-has-duplicates": "다음의 복제본이 있음%(force)s:",
+   "checkimages-has-duplicates": "항목은 다음의 중복%(force)s이 있음:",
"checkimages-log-comment": "봇: 기록 업데이트",
"checkimages-no-license-head": "라이선스 없는 이미지",
"checkimages-source-tag-comment": "봇: 새로 업로드된 태그 없는 파일을 표시",
diff --git a/checkimages/ku.json b/checkimages/ku.json
index a11eec7..8144b15 100644
--- a/checkimages/ku.json
+++ b/checkimages/ku.json
@@ -4,5 +4,6 @@
"Balyozxane"
]
},
-   "checkimages-deletion-comment": "Bot: %(adding)s lê hat zêdekirin"
+   "checkimages-deletion-comment": "Bot: %(adding)s lê hat zêdekirin",
+   "checkimages-log-comment": "Bot: Qeyd hat rojanekirin"
 }
diff --git a/protect/ko.json b/protect/ko.json
index f4b0d2a..689ec08 100644
--- a/protect/ko.json
+++ b/protect/ko.json
@@ -3,12 +3,13 @@
"authors": [
"Dr1t jg",
"IRTC1015",
-   "Revi"
+   "Revi",
+   "Ykhwong"
]
},
"protect-category": "봇: %(cat)s의 모든 문서를 보호",
"protect-images": "봇: %(page)s 문서에 사용된 모든 그림 보호",
"protect-links": "봇: %(page)s에 연결한 모든 문서 보호",
-   "protect-ref": "봇: %(page)s에 가리키는 모든 문서 보호",
+   "protect-ref": "봇: %(page)s 문서를 가리키는 모든 문서 보호",
"protect-simple": "봇: 파일의 목록을 보호합니다."
 }
diff --git a/redirect/ku.json b/redirect/ku.json
index 37ed56f..8d2969d 100644
--- a/redirect/ku.json
+++ b/redirect/ku.json
@@ -6,7 +6,7 @@
]
},
"redirect-fix-broken-moved": "Beralîkirina şikestî li rûpela hedefê ya 
ku hatiye barkirin %(to)s hat rastkirin",
-   "redirect-fix-double": "Fixing double redirect to %(to)s",
+   "redirect-fix-double": "Beralîkirina ducarî li ser %(to)s hat 
sererastkirin",
"redirect-fix-loop": "Çerxa beralîkirinê li ser %(to)s hat rastkirin",
"redirect-remove-broken": "Beralîkirina li ser rûpeleke jêbirî yan jî 
ya ku tine ye",
"redirect-remove-loop": "Hedefa beralîkirinê çerxa beralîkirinê çêdike"
diff --git a/replicate_wiki/ko.json b/replicate_wiki/ko.json
index 41093d2..7f4ef9e 100644
--- a/replicate_wiki/ko.json
+++ b/replicate_wiki/ko.json
@@ -7,7 +7,7 @@
]
},
"replicate_wiki-headline": "원본과 다른 페이지",
-   "replicate_wiki-missing-users": "여기에 없는 원본 관리자",
+   "replicate_wiki-missing-users": "원본 위키에는 있으나 이곳에는 없는 관리자",
"replicate_wiki-same-pages": "중요한 모든 문서가 동일합니다",
"replicate_wiki-same-users": "원 위치의 모든 사용자는 이 위키에도 존재합니다",

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] pass all PwbTestCase.execute() parameters to utils.execute_pwb()

2024-03-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009771?usp=email )

Change subject: [tests] pass all PwbTestCase.execute() parameters to 
utils.execute_pwb()
..

[tests] pass all PwbTestCase.execute() parameters to utils.execute_pwb()

also make parameters of utils.execute and utils.execute_pwb keyword only
except command/args. Make PwbTestCase._execute() public and add it to the
documentation.

Change-Id: Ibc3ecbdca9abb501b4c8eaf2d58235932a1494fa
---
M tests/aspects.py
M tests/i18n_tests.py
M tests/script_tests.py
M tests/utils.py
4 files changed, 35 insertions(+), 12 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/aspects.py b/tests/aspects.py
index efd5616..157210c 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1286,8 +1286,7 @@

 class PwbTestCase(TestCase):

-"""
-Test cases use pwb.py to invoke scripts.
+"""Test cases use :mod:`pwb` to invoke scripts.

 Test cases which use pwb typically also access a site, and use the network.
 Even during initialisation, scripts may call pywikibot.handle_args, which
@@ -1320,12 +1319,19 @@
 if self.orig_pywikibot_dir:
 os.environ['PYWIKIBOT_DIR'] = self.orig_pywikibot_dir

-def _execute(self, args, data_in=None, timeout=None):
+def execute(self, args: list[str], **kwargs):
+"""Run :func:`tests.utils.execute_pwb` with default site.
+
+.. versionchanged:: 9.1
+   pass all arguments to :func:`tests.utils.execute_pwb`; make
+   this method public.
+
+:param args: :mod:`pwb` warapper script arguments
+:param kwargs: keyword arguments of :func:`tests.utils.execute_pwb`
+"""
 site = self.get_site()
-
-args += ['-family:' + site.family.name, '-lang:' + site.code]
-
-return execute_pwb(args, data_in, timeout)
+args.append(f'-site:{site.sitename}')
+return execute_pwb(args, **kwargs)

 
 class RecentChangesTestCase(WikimediaDefaultSiteTestCase):
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 7f4853a..c57a196 100755
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -312,8 +312,8 @@
 def test_pagegen_i18n_input(self):
 """Test i18n.input fallback via pwb."""
 expect = i18n.twtranslate(self.alt_code, self.message, fallback=False)
-result = self._execute(args=['listpages', '-cat'],
-   data_in='non-existant-category\r\n')
+result = self.execute(args=['listpages', '-cat'],
+  data_in='non-existant-category\r\n')
 self.assertIn(expect, result['stderr'])


diff --git a/tests/script_tests.py b/tests/script_tests.py
index 60dc88b..665479a 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -224,7 +224,7 @@
 test_overrides['pywikibot.Site'] = 'lambda *a, **k: None'

 # run the script
-result = execute_pwb(cmd, data_in, timeout=timeout,
+result = execute_pwb(cmd, data_in=data_in, timeout=timeout,
  overrides=test_overrides)

 err_result = result['stderr']
diff --git a/tests/utils.py b/tests/utils.py
index 9465863..1458c09 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -466,11 +466,13 @@
 """Ignore password changes."""


-def execute(command: list[str], data_in=None, timeout=None):
+def execute(command: list[str], *, data_in=None, timeout=None):
 """Execute a command and capture outputs.

 .. versionchanged:: 8.2
*error* parameter was removed.
+.. versionchanged:: 9.1
+   parameters except *command* are keyword only.

 :param command: executable to run and arguments to use
 """
@@ -512,7 +514,7 @@
 'stderr': stderr_data.decode(config.console_encoding)}


-def execute_pwb(args: list[str],
+def execute_pwb(args: list[str], *,
 data_in: Sequence[str] | None = None,
 timeout: int | float | None = None,
 overrides: dict[str, str] | None = None) -> dict[str, Any]:
@@ -520,6 +522,8 @@

 .. versionchanged:: 8.2
the *error* parameter was removed.
+.. versionchanged:: 9.1
+   parameters except *args* are keyword only.

 :param args: list of arguments for pwb.py
 :param overrides: mapping of pywikibot symbols to test replacements

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009771?usp=email
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: Ibc3ecbdca9abb501b4c8eaf2d58235932a1494fa
Gerrit-Change-Number: 1009771
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged

[Pywikibot-commits] [Gerrit] ...core[master]: [9.1] Prepare next release

2024-03-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009719?usp=email )

Change subject: [9.1] Prepare next release
..

[9.1] Prepare next release

Change-Id: Idc5c83c906205b0521bc7412918634254afe93f0
---
M .appveyor.yml
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
M scripts/__init__.py
5 files changed, 106 insertions(+), 91 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index 7ec6f33..cf2b780 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,7 +1,7 @@
 image: Visual Studio 2022
 clone_depth: 50
 skip_tags: true
-version: 9.0.{build}
+version: 9.1.{build}
 environment:

   PYWIKIBOT_DIR: "%appdata%\\Pywikibot"
diff --git a/HISTORY.rst b/HISTORY.rst
index 94482fd..2104ff9 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,98 @@
 Release history
 ===

+9.0.0
+-
+*08 March 2024*
+
+Improvements
+
+
+* Python 3.13 is supported
+* Update :mod:`tools`._unidata._category_cf from Unicodedata version 15.1.0
+* :meth:`Timestamp.nowutc()` and
+  :meth:`Timestamp.utcnow()` were added 
(:phab:`T337748`)
+* Remove content parameter of :meth:`proofreadpage.IndexPage.page_gen` method. 
(:phab:`T358635`)
+* Backport ``itertools.batched`` from Python 3.13 to :func:`backports.batched`
+* A copy button was added to the sphinx documentation.
+* Make :attr:`languages_by_size` 
dynamic (:phab:`T78396`). The property is
+  only available for :class:`family.WikimediaFamily` families. The 
``wikimedia_sites.py`` maintenance script was
+  removed.
+* Add :func:`config.base_dir` to scripts search path with 
:mod:`pwb` wrapper (:phab:`T324287`)
+* :meth:`pywikibot.WbTime.equal_instant` was added (:phab:`T325248`)
+* ``revisions`` parameter of :class:`xmlreader.XmlDump` was introduced to 
specify parsing method
+  (:phab:`T340804`)
+* Pass global -nolog argument into bot script from wrapper (:phab:`T328900`)
+* Add 
:meth:`site.APISite.ratelimit()` 
method
+  and :class:`tools.collections.RateLimit` NamedTuple (:phab:`T304808`)
+* L10N and i18n updates
+* Add :class:`pagegenerators.PagePilePageGenerator` (:phab:`T353086`)
+
+Bugfixes
+
+
+* :meth:`Timestamp.now()` and
+  :meth:`Timestamp.fromtimestamp()` 
also returns a
+  :class:`Timestamp` object with Python 3.7
+* Populate :class:`pywikibot.MediaInfo`._content with expected attributes when 
loaded (:phab:`T357608`)
+* Raise :exc:`exceptions.APIError` if the same error comes twice within 
:meth:`data.api.Request.submit` loop
+  (:phab:`T357870`)
+* Only delegate :mod:`site` methods to public :class:`family.Family` methods 
which have *code* as first parameter.
+* Use ``str`` instead of ``repr`` for several messages with 
:class:`family.Family` objects (:phab:`T356782`)
+* Add ``hy`` to special languages in :class:`textlib.TimeStripper` 
(:phab:`T356175`)
+* Pass login token when using ``action=login`` (:phab:`T309898`)
+* Detect range blocks with :meth:`pywikibot.User.is_blocked` (:phab:`T301282`)
+* Use only ``end`` tags in ElementTree.iterparse in :mod:`xmlreader` module 
(:phab:`T354095`)
+* Suppress error in 
:meth:`cosmetic_changes.CosmeticChangesToolkit.cleanUpLinks` (:phab:`T337045`)
+* :func:`pywikibot.input_choice` validates *default* parameter 
(:phab:`T353097`)
+* Remove typing imports from user-config.py file (:phab:`T352965`)
+
+Breaking changes and code cleanups
+^^
+
+* Cache directory was renamed from ``apicache-py3`` to ``apicache`` due to 
timestamp changes. (:phab:`T337748`)
+  **Warning:** Do not use Pywikibot 9+ together with Pywikibot 3.0.20181203 
and below.
+* Raise ``TypeError`` instead of ``AttributeError`` in 
:meth:`Site.randompages()
+  ` if *redirects* 
parameter is invalid.
+* A RuntimeError will be raised if a :class:`family.Family` subclass has an 
``__init__`` initializer method.
+  :meth:`family.Family.__post_init__` classmethod can be used instead.
+* :class:`InteractiveReplace` was moved from 
:mod:`bot` to :mod:`bot_choice` module
+* ``userinterfaces.transliteration.transliterator`` was renamed to 
:class:`Transliterator
+  `
+* ``pywikibot.BaseSite`` and ``pywikibotAPISite`` were dropped. 
:func:`pywikibot.Site` has to be used to create a
+  :mod:`site` object.
+* ``next`` parameter of 
:meth:`userinterfaces.transliteration.Transliterator.transliterate` was renamed 
to ``succ``
+* ``type`` parameter of 
:meth:`site.APISite.protectedpages()`
+  was renamed to ``protect_type``
+* ``all`` parameter of 
:meth:`site.APISite.namespace()` was 
renamed to
+  ``all_ns``
+* ``filter`` parameter of :func:`date.dh` was renamed to ``filter_func``
+* ``dict`` parameter of :class:`data.api.OptionSet` was renamed to ``data``
+* ``setuptools`` package is no longer mandatory but required for tests
+  (:phab:`T340640`, :phab:`T347052`, :phab:`T354515`)
+* ``root`` attribute of 

[Pywikibot-commits] [Gerrit] ...core[stable]: Merge branch 'master' into stable

2024-03-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009715?usp=email )

Change subject: Merge branch 'master' into stable
..

Merge branch 'master' into stable

Change-Id: Ifef4a7a92d3dadf230b7a4909dcd738801cb6b8c
---
1 file changed, 291 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified





--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009715?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: stable
Gerrit-Change-Id: Ifef4a7a92d3dadf230b7a4909dcd738801cb6b8c
Gerrit-Change-Number: 1009715
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: (9.0] Publish Pywikibot 9

2024-03-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009636?usp=email )

Change subject: (9.0] Publish Pywikibot 9
..

(9.0] Publish Pywikibot 9

Bug: T347020
Change-Id: I00f10c3dbc96798bdfe703f2a69da38e61f627d9
---
M ROADMAP.rst
M pywikibot/__metadata__.py
2 files changed, 13 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/ROADMAP.rst b/ROADMAP.rst
index a7e5b9e..30c6c32 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,6 +4,8 @@
 Improvements
 

+* Python 3.13 is supported
+* Update :mod:`tools`._unidata._category_cf from Unicodedata version 15.1.0
 * :meth:`Timestamp.nowutc()` and
   :meth:`Timestamp.utcnow()` were added 
(:phab:`T337748`)
 * Remove content parameter of :meth:`proofreadpage.IndexPage.page_gen` method. 
(:phab:`T358635`)
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 9460e54..c190742 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -10,6 +10,6 @@
 from time import strftime


-__version__ = '9.0.0.dev0'
+__version__ = '9.0.0'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = '(C) Pywikibot team, 2003-' + strftime('%Y')

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009636?usp=email
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: I00f10c3dbc96798bdfe703f2a69da38e61f627d9
Gerrit-Change-Number: 1009636
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: sort imports

2024-03-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009637?usp=email )

Change subject: sort imports
..

sort imports

plus minor syntax upgrades

Change-Id: I9216361424ef5339454f94e372ad2be372feffca
---
M ROADMAP.rst
M docs/conf.py
M pywikibot/__init__.py
M pywikibot/__metadata__.py
M pywikibot/site/_generators.py
M pywikibot/time.py
M pywikibot/tools/__init__.py
M setup.py
M tests/setup_tests.py
9 files changed, 26 insertions(+), 18 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/ROADMAP.rst b/ROADMAP.rst
index a7e5b9e..23ce3ae 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -103,7 +103,7 @@
 * 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
-* 9.0.0: ``allrevisions`` parameter of :class:`xmlreader.XmpDump` is 
deprecated, use ``revisions`` instead
+* 9.0.0: ``allrevisions`` parameter of :class:`xmlreader.XmpDump` is 
deprecated, use ``revisions`` instead
   (:phab:`T340804`)
 * 9.0.0: ``iteritems`` method of :class:`data.api.Request` will be removed in 
favour of ``items``
 * 9.0.0: ``SequenceOutputter.output()`` is deprecated in favour of 
:attr:`tools.formatter.SequenceOutputter.out`
diff --git a/docs/conf.py b/docs/conf.py
index 050b0ad..2ccabf7 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -24,10 +24,11 @@
 import os
 import re
 import sys
-import tomli
 import warnings
 from pathlib import Path

+import tomli
+

 # Deprecated classes will generate warnings as Sphinx processes them.
 # Ignoring them.
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 0639acd..f03fef5 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -14,7 +14,7 @@
 from contextlib import suppress
 from queue import Queue
 from time import sleep as time_sleep
-from typing import Any, TYPE_CHECKING, cast
+from typing import TYPE_CHECKING, Any, cast
 from urllib.parse import urlparse
 from warnings import warn
 
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 9460e54..8f92c6c 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -7,6 +7,8 @@
 #
 # Distributed under the terms of the MIT license.
 #
+from __future__ import annotations
+
 from time import strftime


diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 50cf999..457ae3c 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -35,6 +35,7 @@

 if TYPE_CHECKING:
 from data.api import ParamInfo, Request
+
 from pywikibot.site._apisite import _RequestWrapperT
 from pywikibot.site._namespace import NamespacesDict, SingleNamespaceType
 from pywikibot.site._tokenwallet import TokenWallet
diff --git a/pywikibot/time.py b/pywikibot/time.py
index c26082b..002ce51 100644
--- a/pywikibot/time.py
+++ b/pywikibot/time.py
@@ -19,10 +19,10 @@

 import pywikibot
 from pywikibot.tools import (
-classproperty,
-deprecated,
 PYTHON_VERSION,
 SPHINX_RUNNING,
+classproperty,
+deprecated,
 )


@@ -361,7 +361,7 @@
 return self.isoformat()

 @classmethod
-def nowutc(cls, *, with_tz: bool = True) -> 'Timestamp':
+def nowutc(cls, *, with_tz: bool = True) -> Timestamp:
 """Return the current UTC date and time.

 If *with_tz* is True it returns an aware :class:`Timestamp`
@@ -403,7 +403,7 @@
 return cls(*gmt[:6], us)

 @classmethod
-def utcnow(cls) -> 'Timestamp':
+def utcnow(cls) -> Timestamp:
 """Return the current UTC date and time, with `tzinfo` ``None``.

 This is like :meth:`Timestamp.now`, but returns the current UTC
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index a5ddcd6..586684e 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -42,10 +42,10 @@

 import pywikibot  # T306760
 from pywikibot.backports import (
-Callable,
-importlib_metadata,
 PYTHON_VERSION,
 SPHINX_RUNNING,
+Callable,
+importlib_metadata,
 )
 from pywikibot.tools._deprecate import (
 ModuleDeprecationWrapper,
diff --git a/setup.py b/setup.py
index e37e1f1..5428b45 100755
--- a/setup.py
+++ b/setup.py
@@ -34,12 +34,6 @@
 from pathlib import Path


-if sys.version_info[:3] >= (3, 9):
-List = list
-else:
-from typing import List
-
-
 # --- setup extra_requires --- #
 extra_deps = {
 # Core library dependencies
@@ -168,7 +162,7 @@

 try:
 tags = run(['git', 'tag'], check=True, stdout=PIPE,
-   universal_newlines=True).stdout.splitlines()
+   text=True).stdout.splitlines()
 except Exception as e:
 print(e)
 sys.exit('Creating source distribution canceled.')
@@ -223,7 

[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-03-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1009508?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: I878ade7e5794aad68ce75576d3ef233d51c548da
---
M replicate_wiki/ko.json
M unprotect/ko.json
2 files changed, 15 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  L10n-bot: Looks good to me, approved




diff --git a/replicate_wiki/ko.json b/replicate_wiki/ko.json
index 480155c..41093d2 100644
--- a/replicate_wiki/ko.json
+++ b/replicate_wiki/ko.json
@@ -8,5 +8,7 @@
},
"replicate_wiki-headline": "원본과 다른 페이지",
"replicate_wiki-missing-users": "여기에 없는 원본 관리자",
-   "replicate_wiki-same-pages": "중요한 모든 문서가 동일합니다"
+   "replicate_wiki-same-pages": "중요한 모든 문서가 동일합니다",
+   "replicate_wiki-same-users": "원 위치의 모든 사용자는 이 위키에도 존재합니다",
+   "replicate_wiki-summary": "봇: %(source)s와 위키 동기화"
 }
diff --git a/unprotect/ko.json b/unprotect/ko.json
index caecc34..637703f 100644
--- a/unprotect/ko.json
+++ b/unprotect/ko.json
@@ -2,12 +2,13 @@
"@metadata": {
"authors": [
"IRTC1015",
-   "Revi"
+   "Revi",
+   "Ykhwong"
]
},
"unprotect-category": "봇: %(cat)s 분류의 모든 문서를 보호 해제",
"unprotect-images": "봇: %(page)s 문서에 사용된 모든 그림을 보호 해제",
"unprotect-links": "봇: %(page)s 문서에서 가리키는 모든 문서를 보호 해제",
-   "unprotect-ref": "봇: %(page)s 문서에서 가리키는 모든 문서를 보호 해제",
+   "unprotect-ref": "봇: %(page)s 문서를 가리키는 모든 문서의 보호를 해제",
"unprotect-simple": "봇: 파일 목록을 보호 해제"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1009508?usp=email
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: I878ade7e5794aad68ce75576d3ef233d51c548da
Gerrit-Change-Number: 1009508
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Always reduce max_retries to 3 for tests

2024-03-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009483?usp=email )

Change subject: [tests] Always reduce max_retries to 3 for tests
..

[tests] Always reduce max_retries to 3 for tests

Change-Id: Ie93bd991b5a6f4b3c7e2da771ba018d8609fe4b6
---
M .appveyor.yml
M .github/workflows/login_tests-ci.yml
M .github/workflows/oauth_tests-ci.yml
M .github/workflows/pywikibot-ci.yml
M .github/workflows/sysop_write_tests-ci.yml
M tests/__init__.py
6 files changed, 15 insertions(+), 11 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index fa5353e..7ec6f33 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -81,7 +81,7 @@

   - "mkdir %PYWIKIBOT_DIR%"
   - "python -Werror::UserWarning -m pwb generate_user_files 
-dir:%PYWIKIBOT_DIR% -family:wikipedia -lang:en -v -debug 
-user:%PYWIKIBOT_USERNAME%"
-  - ps: "[IO.File]::AppendAllText($env:PYWIKIBOT_USER_CONFIG, 'max_retries = 
2; maximum_GET_length = 5000; transliteration_target = None;')"
+  - ps: "[IO.File]::AppendAllText($env:PYWIKIBOT_USER_CONFIG, 
'maximum_GET_length = 5000; transliteration_target = None;')"
   - ps: "[IO.File]::AppendAllText($env:PYWIKIBOT_USER_CONFIG, 'noisysleep = 
float(''inf'');')"
   - ps: "[IO.File]::AppendAllText($env:PYWIKIBOT_USER_CONFIG, 
'usernames[''wikipedia''][''test''] = ''{0}'';' -f $env:PYWIKIBOT_USERNAME)"
   - ps: "[IO.File]::AppendAllText($env:PYWIKIBOT_USER_CONFIG, 
'usernames[''wikidata''][''test''] = ''{0}'';' -f $env:PYWIKIBOT_USERNAME)"
diff --git a/.github/workflows/login_tests-ci.yml 
b/.github/workflows/login_tests-ci.yml
index 5e17d16..5cc02a2 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -100,7 +100,6 @@
 echo "usernames['wikidata']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" 
>> user-config.py
 echo "usernames['commons']['commons'] = '${{ env.PYWIKIBOT_USERNAME 
}}'" >> user-config.py
 echo "usernames['meta']['meta'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> 
user-config.py
-echo "max_retries = 3" >> user-config.py
 echo "noisysleep = float('inf')" >> user-config.py
 echo "maximum_GET_length = 5000" >> user-config.py
 echo "console_encoding = 'utf8'" >> user-config.py
diff --git a/.github/workflows/oauth_tests-ci.yml 
b/.github/workflows/oauth_tests-ci.yml
index 62ecf9a..f93c6dd 100644
--- a/.github/workflows/oauth_tests-ci.yml
+++ b/.github/workflows/oauth_tests-ci.yml
@@ -92,7 +92,6 @@
   run: |
 python -Werror::UserWarning -m pwb generate_user_files 
-family:${{matrix.family}} -lang:${{matrix.code}} -user:${{ 
env.PYWIKIBOT_USERNAME }} -v -debug;
 echo "authenticate['${{ matrix.domain }}'] = ('${{ 
steps.split.outputs._0 }}', '${{ steps.split.outputs._1 }}', '${{ 
steps.split.outputs._2 }}', '${{ steps.split.outputs._3 }}')" >> user-config.py
-echo "max_retries = 3" >> user-config.py
 echo "noisysleep = float('inf')" >> user-config.py
 echo "maximum_GET_length = 5000" >> user-config.py
 echo "console_encoding = 'utf8'" >> user-config.py
diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index 7b3bc30..c57535b 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -108,7 +108,6 @@
 echo "usernames['wikidata']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" 
>> user-config.py
 echo "usernames['commons']['commons'] = '${{ env.PYWIKIBOT_USERNAME 
}}'" >> user-config.py
 echo "usernames['meta']['meta'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> 
user-config.py
-echo "max_retries = 3" >> user-config.py
 echo "noisysleep = float('inf')" >> user-config.py
 echo "maximum_GET_length = 5000" >> user-config.py
 echo "console_encoding = 'utf8'" >> user-config.py
diff --git a/.github/workflows/sysop_write_tests-ci.yml 
b/.github/workflows/sysop_write_tests-ci.yml
index 4aafdd2..a2bde6f 100644
--- a/.github/workflows/sysop_write_tests-ci.yml
+++ b/.github/workflows/sysop_write_tests-ci.yml
@@ -68,7 +68,6 @@
 python -Werror::UserWarning -m pwb generate_user_files 
-family:${{matrix.family}} -lang:${{matrix.code}} -user:${{ 
env.PYWIKIBOT_USERNAME }} -v -debug;
 echo "authenticate['${{ matrix.domain }}'] = ('${{ 
steps.split.outputs._0 }}', '${{ steps.split.outputs._1 }}', '${{ 
steps.split.outputs._2 }}', '${{ steps.split.outputs._3 }}')" >> user-config.py
 echo "usernames['wikipedia']['test'] = '${{ env.PYWIKIBOT_USERNAME 
}}'" >> user-config.py
-echo "max_retries = 3" >> user-config.py
 echo "noisysleep = float('inf')" >> user-config.py
 echo "maximum_GET_length = 5000" >> user-config.py
 echo "console_encoding = 'utf8'" >> user-config.py
diff --git a/tests/__init__.py b/tests/__init__.py
index b9d2308..0660f96 100644

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Allow category_redirect to fail TestScriptSimulate

2024-03-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009460?usp=email )

Change subject: [tests] Allow category_redirect to fail TestScriptSimulate
..

[tests] Allow category_redirect to fail TestScriptSimulate

Bug: T359508
Change-Id: I8885f0e1f1ee29a0766b0be35d551c9b513a3652
---
M tests/script_tests.py
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/script_tests.py b/tests/script_tests.py
index b0ebd3e..60dc88b 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -369,6 +369,7 @@

 _allowed_failures = {
 'blockpageschecker',  # not localized for some test sites
+'category_redirect',
 'clean_sandbox',
 'delinker',
 'disambredir',

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009460?usp=email
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: I8885f0e1f1ee29a0766b0be35d551c9b513a3652
Gerrit-Change-Number: 1009460
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Skip TestSiteGenerators test_all_links for wikipedia:de

2024-03-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009308?usp=email )

Change subject: [tests] Skip TestSiteGenerators test_all_links for wikipedia:de
..

[tests] Skip TestSiteGenerators test_all_links for wikipedia:de

Bug: T359427
Change-Id: Ieedd416b7551b0b724b1c856296215c5b534e1ce
---
M tests/site_generators_tests.py
1 file changed, 12 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py
index 0ef1683..e595eed 100755
--- a/tests/site_generators_tests.py
+++ b/tests/site_generators_tests.py
@@ -337,6 +337,8 @@
 def test_all_links(self):
 """Test the site.alllinks() method."""
 mysite = self.get_site()
+if mysite.sitename == 'wikipedia:de':
+self.skipTest(f'skipping test on {mysite} due to T359427')
 fwd = list(mysite.alllinks(total=10))
 uniq = list(mysite.alllinks(total=10, unique=True))


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009308?usp=email
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: Ieedd416b7551b0b724b1c856296215c5b534e1ce
Gerrit-Change-Number: 1009308
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] Warning: Do not use Pywikibot >= 9 together with Pywikibot <= 3...

2024-03-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009207?usp=email )

Change subject: [doc] Warning: Do not use Pywikibot >= 9 together with 
Pywikibot <= 3.0.20181203
..

[doc] Warning: Do not use Pywikibot >= 9 together with Pywikibot <= 3.0.20181203

Change-Id: I7bd02088c1968eea383813e020586f5d3ac126cb
---
M ROADMAP.rst
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/ROADMAP.rst b/ROADMAP.rst
index 7f96ce1..a7e5b9e 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -45,6 +45,7 @@
 ^^

 * Cache directory was renamed from ``apicache-py3`` to ``apicache`` due to 
timestamp changes. (:phab:`T337748`)
+  **Warning:** Do not use Pywikibot 9+ together with Pywikibot 3.0.20181203 
and below.
 * Raise ``TypeError`` instead of ``AttributeError`` in 
:meth:`Site.randompages()
   ` if *redirects* 
parameter is invalid.
 * A RuntimeError will be raised if a :class:`family.Family` subclass has an 
``__init__`` initializer method.

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009207?usp=email
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: I7bd02088c1968eea383813e020586f5d3ac126cb
Gerrit-Change-Number: 1009207
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: Revert "[tests] Skip tests on infogalactic.com"

2024-03-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008762?usp=email )

Change subject: Revert "[tests] Skip tests on infogalactic.com"
..

Revert "[tests] Skip tests on infogalactic.com"

This reverts commit 16f1b12721059c26065def17372bb5af0807094b.

Reason for revert: solved upstream

Bug: T358986
Change-Id: I5378630bf4cce07220e57533dbeea6d54cf59d30
---
M tests/logentries_tests.py
1 file changed, 21 insertions(+), 9 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/logentries_tests.py b/tests/logentries_tests.py
index 00e43ae..2e92474 100755
--- a/tests/logentries_tests.py
+++ b/tests/logentries_tests.py
@@ -13,7 +13,7 @@

 import pywikibot
 from pywikibot.exceptions import HiddenKeyError, NoMoveTargetError
-# from pywikibot.family import AutoFamily  (T358986)
+from pywikibot.family import AutoFamily
 from pywikibot.logentries import (
 LogEntryFactory,
 OtherLogEntry,
@@ -52,13 +52,12 @@
 'code': 'en',
 'target': None,
 },
-# Deactivated due to T358986
-# 'old': {
-# 'family': AutoFamily('infogalactic',
-#  'https://infogalactic.com/info/Main_Page'),
-# 'code': 'en',
-# 'target': None,
-# }
+'old': {
+'family': AutoFamily('infogalactic',
+ 'https://infogalactic.com/info/Main_Page'),
+'code': 'en',
+'target': None,
+}
 }

 def _get_logentry(self, logtype):
@@ -256,7 +255,6 @@
 # main page was moved back again, we test it.
 self.assertEqual(mainpage, target.moved_target())

-@unittest.expectedFailure  # T358986
 def test_moved_target_fail_old(self):
 """Test moved_target method failing on older wiki."""
 site = self.get_site('old')

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008762?usp=email
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: I5378630bf4cce07220e57533dbeea6d54cf59d30
Gerrit-Change-Number: 1008762
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Ensure that FamilyTestGenerator.getapis does not get duplicates

2024-03-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008845?usp=email )

Change subject: [tests] Ensure that FamilyTestGenerator.getapis does not get 
duplicates
..

[tests] Ensure that FamilyTestGenerator.getapis does not get duplicates

Bug: T359156
Change-Id: I78017a988c3b9ae3b4f22c6a5889ad64924c087a
---
M tests/generate_family_file_tests.py
1 file changed, 26 insertions(+), 4 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/tests/generate_family_file_tests.py 
b/tests/generate_family_file_tests.py
index 6058930..844a535 100755
--- a/tests/generate_family_file_tests.py
+++ b/tests/generate_family_file_tests.py
@@ -26,13 +26,25 @@
 def getapis(self):
 """Only load up to additional ten different wikis randomly."""
 save = self.langs
-self.langs = sample(save, min(len(save), 10))
-for wiki in save:  # add closed wiki due to T334714
-if wiki['prefix'] == 'ii' and 'ii' not in self.langs:
+
+prefixes = {lang['prefix'] for lang in self.langs}
+tests = set(sample(list(prefixes), min(len(prefixes), 10)))
+# add closed wiki due to T334714
+if 'ii' in prefixes and 'ii' not in tests:
+tests.add('ii')
+
+# collect wikis
+self.langs = []
+for wiki in save:
+code = wiki['prefix']
+if code in tests:
 self.langs.append(wiki)
-break
+tests.remove(code)
+if not tests:
+break

 super().getapis()
+# super().getapis() might change self.langs
 self.prefixes = [item['prefix'] for item in self.langs]
 self.langs = save


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008845?usp=email
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: I78017a988c3b9ae3b4f22c6a5889ad64924c087a
Gerrit-Change-Number: 1008845
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] remove bugs.python.org bug tracker

2024-03-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008819?usp=email )

Change subject: [doc] remove bugs.python.org bug tracker
..

[doc] remove bugs.python.org bug tracker

The Python bug tracker is at https://github.com/python/cpython/issues
now.

Change-Id: Ia81c431b567601829c9c72454f219613e4cd5854
---
M docs/conf.py
M pywikibot/diff.py
2 files changed, 14 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/docs/conf.py b/docs/conf.py
index b4dac2b..050b0ad 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -492,8 +492,6 @@
 # MediaWiki API
 'api': ('https://www.mediawiki.org/wiki/API:%s', 'API:%s'),
 # Python bug tracker
-'bug': ('https://bugs.python.org/issue%s', 'Python issue %s'),
-# Python bug tracker
 'issue': ('https://github.com/python/cpython/issues/%s',
   'Python issue %s'),
 # Phabricator tasks
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 80fc5c6..fe9091c 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -1,6 +1,6 @@
 """Diff module."""
 #
-# (C) Pywikibot team, 2014-2023
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -89,7 +89,7 @@
 """Generator of diff text for this hunk, without formatting.

 Check each line ends with line feed to prevent behaviour like
-:bug:`2142`
+:issue:`46395`
 """
 def check_line(line: str) -> str:
 r"""Make sure each line ends with '\n'."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008819?usp=email
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: Ia81c431b567601829c9c72454f219613e4cd5854
Gerrit-Change-Number: 1008819
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Update DeprecatorTestCase.test_deprecated_function_docstring

2024-03-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008811?usp=email )

Change subject: [tests] Update 
DeprecatorTestCase.test_deprecated_function_docstring
..

[tests] Update DeprecatorTestCase.test_deprecated_function_docstring

The multiline docstring behaviour was change in Python 3.13:
https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes

Add a new test mehtod test_deprecated_function_multiline_docstring to
take into accoutn that there is a difference.

Bug: T359069
Change-Id: I7aa1f53fc8612bfe6f40ad098d2dcbb6d3d74c80
---
M tests/tools_deprecate_tests.py
1 file changed, 29 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/tools_deprecate_tests.py b/tests/tools_deprecate_tests.py
index 2cf1f87..c4024b1 100755
--- a/tests/tools_deprecate_tests.py
+++ b/tests/tools_deprecate_tests.py
@@ -19,7 +19,6 @@
 remove_last_args,
 )
 from tests.aspects import DeprecationTestCase
-from tests.utils import expected_failure_if


 @add_full_name
@@ -299,8 +298,6 @@
 self.assertOneDeprecationParts(__name__ + '.deprecated_func_instead',
'baz')

-# deprecated_func_docstring_arg2 fails with Python 3.13
-@expected_failure_if(PYTHON_VERSION >= (3, 13))
 def test_deprecated_function_docstring(self):
 """Test @deprecated docstring modification."""
 testcases = [
@@ -315,13 +312,24 @@
  'this. Deprecated function.'),
 (deprecated_func_docstring_arg, 'Deprecated.\n\n'
  ':param foo: Foo. DEPRECATED.'),
-(deprecated_func_docstring_arg2, '\nDEPRECATED.\n\n'
- ':param foo: Foo. DEPRECATED.\n'),
 ]
 for rv, doc in testcases:
 with self.subTest(function=rv.__name__):
 self.assertEqual(rv.__doc__, doc)

+def test_deprecated_function_multiline_docstring(self):
+"""Test @deprecated docstring modification on multiline docstring.
+
+Python 3.13 strips the doc string, see
+https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes
+"""
+doc = '\nDEPRECATED.\n\n:param foo: Foo. DEPRECATED.\n'
+if PYTHON_VERSION < (3, 13):
+self.assertEqual(deprecated_func_docstring_arg2.__doc__, doc)
+else:
+self.assertEqual(deprecated_func_docstring_arg2.__doc__,
+ doc.replace(' ' * 4, ''))
+
 def test_deprecated_function_bad_args(self):
 """Test @deprecated function with bad arguments."""
 rv = deprecated_func_bad_args(None)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008811?usp=email
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: I7aa1f53fc8612bfe6f40ad098d2dcbb6d3d74c80
Gerrit-Change-Number: 1008811
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Add input for category_redirect script_tests

2024-03-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008515?usp=email )

Change subject: [tests] Add input for category_redirect script_tests
..

[tests] Add input for category_redirect script_tests

Change-Id: I0798a97e9514ef0846d693a6a24872bd4c3f8e43
---
M tests/script_tests.py
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/script_tests.py b/tests/script_tests.py
index ce38ef8..b0ebd3e 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -64,6 +64,7 @@

 script_input = {
 'create_isbn_edition': '\n',
+'category_redirect': 'q\nn\n',
 'interwiki': 'Test page that should not exist\n',
 'misspelling': 'q\n',
 'pagefromfile': 'q\n',

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008515?usp=email
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: I0798a97e9514ef0846d693a6a24872bd4c3f8e43
Gerrit-Change-Number: 1008515
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] Fix old Page.title parameter as_link

2024-03-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008488?usp=email )

Change subject: [bugfix] Fix old Page.title parameter as_link
..

[bugfix] Fix old Page.title parameter as_link

Change-Id: I38b3b98bda5d70e1bd60563357cb35799fb449a7
---
M scripts/category_redirect.py
1 file changed, 15 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 895949b..6f1b1e5 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -157,9 +157,9 @@
 moved += 1
 else:
 self.edit_requests.append({
-'title': article.title(asLink=True, textlink=True),
-'oldcat': old_cat.title(asLink=True, textlink=True),
-'newcat': new_cat.title(asLink=True, textlink=True)}
+'title': article.title(as_link=True, textlink=True),
+'oldcat': old_cat.title(as_link=True, textlink=True),
+'newcat': new_cat.title(as_link=True, textlink=True)}
 )

 if article.namespace() != 10:
@@ -178,9 +178,9 @@
 moved += 1
 else:
 self.edit_requests.append({
-'title': doc.title(asLink=True, textlink=True),
-'oldcat': old_cat.title(asLink=True, textlink=True),
-'newcat': new_cat.title(asLink=True, textlink=True)}
+'title': doc.title(as_link=True, textlink=True),
+'oldcat': old_cat.title(as_link=True, textlink=True),
+'newcat': new_cat.title(as_link=True, textlink=True)}
 )

 if found:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008488?usp=email
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: I38b3b98bda5d70e1bd60563357cb35799fb449a7
Gerrit-Change-Number: 1008488
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...i18n[master]: Localisation updates from https://translatewiki.net.

2024-03-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1008430?usp=email )

Change subject: Localisation updates from https://translatewiki.net.
..

Localisation updates from https://translatewiki.net.

Change-Id: I3c7641c5ec39f210990201be19139fe359bdcec8
---
M checkimages/ia.json
1 file changed, 10 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  L10n-bot: Looks good to me, approved




diff --git a/checkimages/ia.json b/checkimages/ia.json
index 5a3fbcd..1aa628e 100644
--- a/checkimages/ia.json
+++ b/checkimages/ia.json
@@ -8,7 +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-doubles-talk-text": "Gratias pro haber incargate 
%(upload)s. Nonobstante, iste file es un copia de:%(image)sLe 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",

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1008430?usp=email
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: I3c7641c5ec39f210990201be19139fe359bdcec8
Gerrit-Change-Number: 1008430
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


  1   2   3   4   5   6   7   8   9   10   >