[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] replace requests.utils.urlparse with urllib.parse.urlparse

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

Change subject: [IMPR] replace requests.utils.urlparse with 
urllib.parse.urlparse
..

[IMPR] replace requests.utils.urlparse with urllib.parse.urlparse

requests.utils.urlparse is not part of the official API and it is used
within requests for Python 3 support,

Bug: T367649
Change-Id: If29b1fd6e3cceb64163ae0662e69ac31fc685b19
---
M pywikibot/comms/http.py
1 file changed, 10 insertions(+), 11 deletions(-)

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




diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 65f1333..ef4cc61 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -26,7 +26,7 @@
Cookies are lazy loaded when logging to site.
 """
 #
-# (C) Pywikibot team, 2007-2023
+# (C) Pywikibot team, 2007-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -286,26 +286,25 @@


 def get_authentication(uri: str) -> tuple[str, str] | None:
-"""
-Retrieve authentication token.
+"""Retrieve authentication token.

 :param uri: the URI to access
 :return: authentication token
 """
-parsed_uri = requests.utils.urlparse(uri)
+parsed_uri = urlparse(uri)
 netloc_parts = parsed_uri.netloc.split('.')
 netlocs = [parsed_uri.netloc] + ['.'.join(['*'] + netloc_parts[i + 1:])
  for i in range(len(netloc_parts))]
 for path in netlocs:
 if path in config.authenticate:
-if len(config.authenticate[path]) in [2, 4]:
+length = len(config.authenticate[path])
+if length in (2, 4):
 return config.authenticate[path]
-warn('config.authenticate["{path}"] has invalid value.\n'
- 'It should contain 2 or 4 items, not {length}.\n'
- 'See {url}/OAuth for more info.'
- .format(path=path,
- length=len(config.authenticate[path]),
- url=pywikibot.__url__))
+
+warn(f'config.authenticate[{path!r}] has invalid value.\n'
+ f'It should contain 2 or 4 items, not {length}.\n'
+ f'See {pywikibot.__url__}/OAuth for more info.')
+
 return None



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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If29b1fd6e3cceb64163ae0662e69ac31fc685b19
Gerrit-Change-Number: 1045496
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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]: Raise import error and add appropriate message

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

Change subject: Raise import error and add appropriate message
..

Raise import error and add appropriate message

Bug: T353387
Change-Id: I93d1c8ce96e37a25973b35ddfd3767226d82fe68
---
M pywikibot/comms/http.py
1 file changed, 2 insertions(+), 3 deletions(-)

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




diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 7e2..65f1333 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -433,9 +433,8 @@
 auth = get_authentication(uri)
 if auth is not None and len(auth) == 4:
 if isinstance(requests_oauthlib, ImportError):
-warn(str(requests_oauthlib), ImportWarning)
-error(f'OAuth authentication not supported: {requests_oauthlib}')
-auth = None
+pywikibot.error(requests_oauthlib)
+sys.exit(1)
 else:
 auth = requests_oauthlib.OAuth1(*auth)


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I93d1c8ce96e37a25973b35ddfd3767226d82fe68
Gerrit-Change-Number: 1035850
Gerrit-PatchSet: 7
Gerrit-Owner: Ssm.allrounder 
Gerrit-Reviewer: Ssm.allrounder 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: DannyS712 
Gerrit-CC: Framawiki 
Gerrit-CC: JJMC89 
Gerrit-CC: Mpaa 
___
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] Markup and references fixes

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

Change subject: [doc] Markup and references fixes
..

[doc] Markup and references fixes

Change-Id: I84cff595df13bc5e56a9f50174a3ddae327fb9dd
---
M pywikibot/site/_apisite.py
M pywikibot/site/_generators.py
2 files changed, 4 insertions(+), 2 deletions(-)

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




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 5ca39e4..9a2037c 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2013,6 +2013,7 @@
 * unwatch --- remove the page from the watchlist
 * preferences --- use the preference settings (default)
 * nochange --- don't change the watchlist
+
 If None (default), follow bot account's default settings
 :param bot: if True, mark edit with bot flag

@@ -2028,7 +2029,7 @@
 :raises AbuseFilterDisallowedError: This action has been
 automatically identified as harmful, and therefore disallowed
 :raises CaptchaError: :ref:`config.solve_captcha
-` is False and saving the
+` is False and saving the
 page requires solving a captcha
 :raises CascadeLockedPageError: The page is protected with
 protection cascade
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 4544e8c..8b1221d 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -2310,7 +2310,8 @@
 'query+protectedtitles' module.

 .. versionchanged:: 9.0
-*type* parameter was renamed to *protect_type*.
+   *type* parameter was renamed to *protect_type*.
+
 .. seealso:: :api:`Protectedtitles`

 :param namespace: The searched namespace.

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I84cff595df13bc5e56a9f50174a3ddae327fb9dd
Gerrit-Change-Number: 1044742
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] split tools in documentation, show titles only

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

Change subject: [doc] split tools in documentation, show titles only
..

[doc] split tools in documentation, show titles only

Change-Id: Ic097e4b8b6a7104a67a31b2ab9417e0376a9abad
---
M docs/api_ref/index.rst
D docs/api_ref/pywikibot.tools.rst
A docs/api_ref/tools/pywikibot.tools.rst
A docs/api_ref/tools/tools.chars.rst
A docs/api_ref/tools/tools.collections.rst
A docs/api_ref/tools/tools.djvu.rst
A docs/api_ref/tools/tools.formatter.rst
A docs/api_ref/tools/tools.itertools.rst
A docs/api_ref/tools/tools.threading.rst
9 files changed, 55 insertions(+), 55 deletions(-)

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




diff --git a/docs/api_ref/index.rst b/docs/api_ref/index.rst
index 5db1b21..80a967a 100644
--- a/docs/api_ref/index.rst
+++ b/docs/api_ref/index.rst
@@ -21,7 +21,7 @@

 .. toctree::
:glob:
-   :maxdepth: 2
+   :titlesonly:

pywikibot
pywikibot.config
@@ -44,3 +44,4 @@
pywikibot.userinterfaces
logging
*
+   tools/*
diff --git a/docs/api_ref/pywikibot.tools.rst b/docs/api_ref/pywikibot.tools.rst
deleted file mode 100644
index c126021..000
--- a/docs/api_ref/pywikibot.tools.rst
+++ /dev/null
@@ -1,54 +0,0 @@
-***
-:mod:`tools` --- Miscellaneous Helper Functions
-***
-
-.. automodule:: tools
-   :synopsis: Miscellaneous helper functions (not wiki-dependent)
-
-:mod:`tools.chars` --- Character Based Helper Functions
-===
-
-.. automodule:: tools.chars
-   :synopsis: Character based helper functions (not wiki-dependent)
-
-:mod:`tools.collections` --- Container datatypes
-
-
-.. automodule:: tools.collections
-   :synopsis: Collections datatypes
-
-:mod:`tools.deprecate` --- Deprecating Decorators and Classes
-=
-
-.. automodule:: tools._deprecate
-   :synopsis: Module providing deprecation decorators
-
-:mod:`tools.djvu` --- DJVU files wrapper
-
-
-.. automodule:: tools.djvu
-   :synopsis: Wrapper around djvulibre to access djvu files properties and 
content
-
-:mod:`tools.formatter` --- Formatting Related Functions and Classes
-===
-
-.. automodule:: tools.formatter
-   :synopsis: Module containing various formatting related utilities
-
-:mod:`tools.itertools` --- Iterators for Efficient Looping
-==
-
-.. automodule:: tools.itertools
-   :synopsis: Iterator functions
-
-:mod:`tools.threading` --- Thread-based Classes
-===
-
-.. automodule:: tools.threading
-   :synopsis: Threading classes
-
-:mod:`tools.\_logging` --- logging.Formatter Subclass
-=
-
-.. automodule:: tools._logging
-   :synopsis: Logging tools
diff --git a/docs/api_ref/tools/pywikibot.tools.rst 
b/docs/api_ref/tools/pywikibot.tools.rst
new file mode 100644
index 000..957c3e0
--- /dev/null
+++ b/docs/api_ref/tools/pywikibot.tools.rst
@@ -0,0 +1,18 @@
+***
+:mod:`tools` --- Miscellaneous Helper Functions
+***
+
+.. automodule:: tools
+   :synopsis: Miscellaneous helper functions (not wiki-dependent)
+
+:mod:`tools.deprecate` --- Deprecating Decorators and Classes
+=
+
+.. automodule:: tools._deprecate
+   :synopsis: Module providing deprecation decorators
+
+:mod:`tools.\_logging` --- logging.Formatter Subclass
+=
+
+.. automodule:: tools._logging
+   :synopsis: Logging tools
diff --git a/docs/api_ref/tools/tools.chars.rst 
b/docs/api_ref/tools/tools.chars.rst
new file mode 100644
index 000..7d8ea18
--- /dev/null
+++ b/docs/api_ref/tools/tools.chars.rst
@@ -0,0 +1,6 @@
+***
+:mod:`tools.chars` --- Character Based Helper Functions
+***
+
+.. automodule:: tools.chars
+   :synopsis: Character based helper functions (not wiki-dependent)
diff --git a/docs/api_ref/tools/tools.collections.rst 
b/docs/api_ref/tools/tools.collections.rst
new file mode 100644
index 000..730cf89
--- /dev/null
+++ b/docs/api_ref/tools/tools.collections.rst
@@ -0,0 +1,6 @@
+
+:mod:`tools.collections` --- Container datatypes
+
+
+.. automodule:: tools.collections
+   :synopsis: Collections datatypes
diff --git 

[Pywikibot-commits] [Gerrit] ...core[master]: [doc] adjust logging functions in documentation

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

Change subject: [doc] adjust logging functions in documentation
..

[doc] adjust logging functions in documentation

Change-Id: Ic035554ed64a492f6ddd8dffa0dcb24c40a7e017
---
M HISTORY.rst
M ROADMAP.rst
M pywikibot/bot.py
M pywikibot/tools/formatter.py
4 files changed, 6 insertions(+), 5 deletions(-)

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




diff --git a/HISTORY.rst b/HISTORY.rst
index 472eddc..1a23884 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -583,7 +583,7 @@
 * L10N updates
 * Circumvent circular import in tools module (:phab:`T306760`)
 * Don't fix html inside syntaxhighlight parts in fixes.py (:phab:`T306723`)
-* Make layer parameter optional in `pywikibot.debug()` (:phab:`T85620`)
+* Make layer parameter optional in 
:func:`pywikibot.debug()` (:phab:`T85620`)
 * Retry for internal_api_error_DBQueryTimeoutError errors due to 
:phab:`T297708`
 * Handle ParserError within xmlreader.XmlDump.parse() instead of raising an 
exception (:phab:`T306134`)
 * XMLDumpOldPageGenerator is deprecated in favour of a `content` parameter 
(:phab:`T306134`)
diff --git a/ROADMAP.rst b/ROADMAP.rst
index ed7c20a..0f5073b 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -75,7 +75,7 @@
   ` instead
 * 7.2.0: Positional arguments *decoder*, *layer* and *newline* for 
:mod:`logging` functions where dropped; keyword 
   arguments must be used instead.
-* 7.2.0: ``tb`` parameter of :func:`exception()` function 
was renamed to ``exc_info``
+* 7.2.0: ``tb`` parameter of :func:`exception()` 
function was renamed to ``exc_info``
 * 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` 
parameter of
   :func:`XMLDumpPageGenerator` 
(:phab:`T306134`)
 * 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes are deprecated in 
favour of
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index cff70ef..a993a1a 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -366,8 +366,8 @@
 * :python:`Python Logging Levels`

 Accordingly, do **not** use print statements in bot code; instead,
-use :func:`pywikibot.output` function and other functions from
-:mod:`pywikibot.logging` module.
+use :func:`pywikibot.info()` function and
+other functions from :mod:`pywikibot.logging` module.

 .. versionchanged:: 6.2
Different logfiles are used if multiple processes of the same
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index 6ad82f5..59c3ace 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -60,7 +60,8 @@
 """Output the text of the current sequence.

 .. deprecated:: 9.0
-   Use :func:`pywikibot.info` with *out* property
+   Use :func:`pywikibot.info()` with
+   :attr:`out` property.
 """
 info(self.out)


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic035554ed64a492f6ddd8dffa0dcb24c40a7e017
Gerrit-Change-Number: 1044726
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] keyword arguments are strictly recommended for logging functions.

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

Change subject: [doc] keyword arguments are strictly recommended for logging 
functions.
..

[doc] keyword arguments are strictly recommended for logging functions.

Change-Id: I75bc98248125e4c20490ce7bb363c9f07930ded5
---
M ROADMAP.rst
M pywikibot/logging.py
2 files changed, 30 insertions(+), 20 deletions(-)

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index e407eb6..ed7c20a 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -73,6 +73,8 @@
 * 7.3.0: Old color escape sequences like ``\03{color}`` is deprecated in 
favour of new color format like <>
 * 7.3.0: ``linktrail`` method of :class:`family.Family` is deprecated; use 
:meth:`APISite.linktrail()
   ` instead
+* 7.2.0: Positional arguments *decoder*, *layer* and *newline* for 
:mod:`logging` functions where dropped; keyword
+  arguments must be used instead.
 * 7.2.0: ``tb`` parameter of :func:`exception()` function 
was renamed to ``exc_info``
 * 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` 
parameter of
   :func:`XMLDumpPageGenerator` 
(:phab:`T306134`)
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 6965fd6..225b30f 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -18,6 +18,10 @@
 The function :func:`debug` only logs its messages, they are never
 displayed on the user console. :func:`debug()` takes a required second
 argument, which is a string indicating the debugging layer.
+
+.. seealso::
+   - :pyhow:`Logging HOWTO`
+   - :python:`Logging Cookbook`
 """
 #
 # (C) Pywikibot team, 2010-2024
@@ -85,9 +89,9 @@
   **kwargs: Any) -> None:
 """Format output and send to the logging module.

-Helper function used by all the user-output convenience functions.
-It can be used to implement your own high-level output function with
-a different logging level.
+Dispatch helper function used by all the user-output convenience
+functions. It can be used to implement your own high-level output
+function with a different logging level.

 `msg` can contain special sequences to create colored output. These
 consist of the color name in angle bracket, e. g. <>.
@@ -97,21 +101,21 @@
 the only argument that is useful is ``exc_info=True``, which causes
 the log message to include an exception traceback.

+.. versionchanged:: 7.2
+   Positional arguments for *decoder* and *newline* are deprecated;
+   keyword arguments should be used.
+
 :param msg: The message to be printed.
 :param args: Not used yet; prevents positional arguments except `msg`.
 :param level: The logging level; supported by :func:`logoutput` only.
-:keyword newline: If newline is True (default), a line feed will be
-added after printing the msg.
-:type newline: bool
-:keyword layer: Suffix of the logger name separated by dot. By
+:keyword bool newline: If newline is True (default), a line feed
+will be added after printing the msg.
+:keyword str layer: Suffix of the logger name separated by dot. By
 default no suffix is used.
-:type layer: str
-:keyword decoder: If msg is bytes, this decoder is used to decode.
-Default is 'utf-8', fallback is 'iso8859-1'
-:type decoder: str
+:keyword str decoder: If msg is bytes, this decoder is used to
+decode. Default is 'utf-8', fallback is 'iso8859-1'
 :param kwargs: For the other keyword arguments refer
 :python:`Logger.debug()`
-and :pyhow:`logging-cookbook`
 """
 # invoke any init routines
 if _init_routines:
@@ -174,7 +178,9 @@
 The arguments are interpreted as for :func:`logoutput`.

 .. versionadded:: 7.2
-   was renamed from :func:`output`.
+   was renamed from :func:`output`. Positional arguments for
+   *decoder* and *newline* are deprecated; keyword arguments should
+   be used. Keyword parameter *layer* was added.

 .. seealso::
:python:`Logger.info()`
@@ -189,7 +195,7 @@
 .. versionchanged:: 7.2
was renamed to :func:`info`; `text` was renamed to `msg`; `msg`
paramerer may be omitted; only keyword arguments are allowed except
-   for `msg`.
+   for `msg`. Keyword parameter *layer* was added.
 .. seealso::
:python:`Logger.info()`
 """
@@ -209,7 +215,8 @@

 .. versionchanged:: 7.2
`text` was renamed to `msg`; `msg` parameter may be omitted;
-   only keyword arguments are allowed except for `msg`.
+   only keyword arguments are allowed except for `msg`. Keyword
+   parameter *layer* was added.
 .. seealso::
- :python:`Logger.log()`
- https://en.wikipedia.org/wiki/Pipeline_%28Unix%29
@@ -227,7 +234,7 @@

 .. versionchanged:: 7.2
`text` was renamed to `msg`; only keyword 

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Update TestProtectionBot.test_summary() test in test_protect

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

Change subject: [tests] Update TestProtectionBot.test_summary() test in 
test_protect
..

[tests] Update TestProtectionBot.test_summary() test in test_protect

The order may change in comment.

Bug: T367259
Change-Id: I20d8d3e9df6f4729cc4437f25cfd92fa0e708b66
---
M tests/protectbot_tests.py
1 file changed, 8 insertions(+), 5 deletions(-)

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




diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index aa3d5f9..30e46f6 100755
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -53,12 +53,15 @@
 'Unprotecting all pages from category Pywikibot Protect Test')

 self.maxDiff = None
-self.assertEqual(
-rev[0].comment,
+comment = rev[0].comment
+self.assertTrue(comment.startswith(
 'Protected "[[User:Sn1per/ProtectTest2]]": Bot: '
-'Protecting all pages from category Pywikibot Protect Test ('
-'[Move=Allow only administrators] (indefinite) '
-'[Edit=Allow only administrators] (indefinite))')
+'Protecting all pages from category Pywikibot Protect Test'
+))
+# the order may change, see T367259
+for ptype in ('Edit', 'Move'):
+self.assertIn(f'[{ptype}=Allow only administrators] (indefinite)',
+  comment)


 if __name__ == '__main__':

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I20d8d3e9df6f4729cc4437f25cfd92fa0e708b66
Gerrit-Change-Number: 1044631
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] mark TestFlowHide.test_hide as expectedFailure

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

Change subject: [tests] mark TestFlowHide.test_hide as expectedFailure
..

[tests] mark TestFlowHide.test_hide as expectedFailure

Bug: T367303
Change-Id: I90ff07e5a756d90c98aaea411771d9c85c88261d
---
M tests/flow_edit_tests.py
1 file changed, 1 insertion(+), 0 deletions(-)

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




diff --git a/tests/flow_edit_tests.py b/tests/flow_edit_tests.py
index f722524..8e6f303 100755
--- a/tests/flow_edit_tests.py
+++ b/tests/flow_edit_tests.py
@@ -256,6 +256,7 @@

 """Hiding topics and posts."""

+@unittest.expectedFailure  # T367303
 def test_hide(self):
 """Hide and restore a test topic and post."""
 for flow in (self.topic, self.post):

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I90ff07e5a756d90c98aaea411771d9c85c88261d
Gerrit-Change-Number: 1044601
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 -always option to illustrate_wikidata.py

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

Change subject: [IMPR] Add -always option to illustrate_wikidata.py
..

[IMPR] Add -always option to illustrate_wikidata.py

Bug: T367518
Change-Id: Idfc2f2825797dc520c893f97cd4b6a2ba527b1d3
---
M scripts/illustrate_wikidata.py
1 file changed, 30 insertions(+), 25 deletions(-)

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




diff --git a/scripts/illustrate_wikidata.py b/scripts/illustrate_wikidata.py
index bf6730f..67ca848 100755
--- a/scripts/illustrate_wikidata.py
+++ b/scripts/illustrate_wikidata.py
@@ -1,10 +1,15 @@
 #!/usr/bin/env python3
-"""
-Bot to add images to Wikidata items.
+"""Bot to add images to Wikidata items.

 The image is extracted from the page_props. For this to be available the
-PageImages extension (https://www.mediawiki.org/wiki/Extension:PageImages)
-needs to be installed
+PageImages extension
+(https://www.mediawiki.org/wiki/Extension:PageImages) needs to be
+installed.
+
+The following options are provided:
+
+-alwaysDon't prompt to make changes, just do them.
+-property  The property to add. Should be of type commonsMedia.

 Usage:

@@ -30,19 +35,19 @@

 """A bot to add Wikidata image claims."""

-def __init__(self, wdproperty: str = 'P18', **kwargs) -> None:
-"""Initializer.
+update_options = {
+'property': 'P18',
+}

-:param wdproperty: The property to add. Should be of type commonsMedia
-"""
+def __init__(self, **kwargs) -> None:
+"""Initializer."""
 super().__init__(**kwargs)
-self.wdproperty = wdproperty
 self.cacheSources()

-claim = pywikibot.Claim(self.repo, self.wdproperty)
+claim = pywikibot.Claim(self.repo, self.opt.property)
 if claim.type != 'commonsMedia':
-raise ValueError('{} is of type {}, should be commonsMedia'
- .format(self.wdproperty, claim.type))
+raise ValueError(f'{self.opt.property} is of type {claim.type},'
+ ' should be commonsMedia')

 def treat_page_and_item(self, page, item) -> None:
 """Treat a page / item."""
@@ -53,12 +58,12 @@
 return

 claims = item.get().get('claims')
-if self.wdproperty in claims:
-pywikibot.info('Item {} already contains image ({})'
-   .format(item.title(), self.wdproperty))
+if self.opt.property in claims:
+pywikibot.info(f'Item {item.title()} already contains image '
+   f'({self.opt.property})')
 return

-newclaim = pywikibot.Claim(self.repo, self.wdproperty)
+newclaim = pywikibot.Claim(self.repo, self.opt.property)
 commonssite = pywikibot.Site('commons')
 imagelink = pywikibot.Link(imagename, source=commonssite,
default_namespace=6)
@@ -87,20 +92,20 @@
 local_args = pywikibot.handle_args(args)
 generator_factory = pagegenerators.GeneratorFactory()

-wdproperty = 'P18'
+options = {}

 for arg in local_args:
-if arg.startswith('-property'):
-if len(arg) == 9:
-wdproperty = pywikibot.input(
-'Please enter the property you want to add:')
-else:
-wdproperty = arg[10:]
+opt, _, value = arg.partition(':')
+if opt == '-property':
+options['property'] = value or pywikibot.input(
+'Please enter the property you want to add:')
+elif opt == '-always':
+options[opt[1:]] = True
 else:
 generator_factory.handle_arg(arg)
 
-generator = generator_factory.getCombinedGenerator(preload=True)
-bot = IllustrateRobot(wdproperty, generator=generator)
+options['generator'] = generator_factory.getCombinedGenerator(preload=True)
+bot = IllustrateRobot(**options)
 bot.run()



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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Idfc2f2825797dc520c893f97cd4b6a2ba527b1d3
Gerrit-Change-Number: 1044480
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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]: [cleanup] deprecate logging functions in pywikibot.bot

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

Change subject: [cleanup] deprecate logging functions in pywikibot.bot
..

[cleanup] deprecate logging functions in pywikibot.bot

logging functions were moved from pywikibot.bot module to
pywikibot.logging module somewhere in Pywikibot 2.0. Therefore
deprecate these functions; they should not imported from pywikibot.bot
but either from pywikibot.logging or directly from pywikibot module
like pywikibot.info().

logging functions calls where updated as well as the documentation.
This change also prevents having multiple logging functions entries
in documentation made by Sphinx.

Change-Id: I56674141ac2fc5944d5d9e1044aeac754b87ebd9
---
M pywikibot/bot.py
M pywikibot/logging.py
2 files changed, 183 insertions(+), 129 deletions(-)

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




diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index bb732d8..cff70ef 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1,30 +1,30 @@
-"""
-User-interface related functions for building bots.
+"""User-interface related functions for building bots.

 This module supports several different bot classes which could be used in
 conjunction. Each bot should subclass at least one of these four classes:

-* :py:obj:`BaseBot`: Basic bot class in case where the site is handled
+* :class:`BaseBot`: Basic bot class in case where the site is handled
   differently, like working on multiple sites in parallel. No site
   attribute is provided. Instead site of the current page should be used.
   This class should normally not be used directly.

-* :py:obj:`SingleSiteBot`: Bot class which should only be run on a
-  single site. They usually store site specific content and thus can't
-  be easily run when the generator returns a page on another site. It
-  has a property ``site`` which can also be changed. If the generator
-  returns a page of a different site it'll skip that page.
+* :class:`SingleSiteBot`: Bot class which should only be run on a single
+  site. They usually store site specific content and thus can't be
+  easily run when the generator returns a page on another site. It has a
+  property ``site`` which can also be changed. If the generator returns
+  a page of a different site it'll skip that page.

-* :py:obj:`MultipleSitesBot`: An alias of :py:obj:`BaseBot`. Should not
+* :class:`MultipleSitesBot`: An alias of :class:`BaseBot`. Should not
   be used if any other bot class is used.

-* :py:obj:`ConfigParserBot`: Bot class which supports reading options from a
-  scripts.ini configuration file. That file consists of sections, led by a
-  ``[section]`` header and followed by ``option: value`` or ``option=value``
-  entries. The section is the script name without .py suffix. All options
-  identified must be predefined in available_options dictionary.
+* :class:`ConfigParserBot`: Bot class which supports reading options
+  from a ``scripts.ini`` configuration file. That file consists of
+  sections, led by a ``[section]`` header and followed by
+  ``option: value`` or ``option=value`` entries. The section is the
+  script name without .py suffix. All options identified must be
+  predefined in available_options dictionary.

-* :py:obj:`Bot`: The previous base class which should be avoided. This
+* :class:`Bot`: The previous base class which should be avoided. This
   class is mainly used for bots which work with Wikibase or together
   with an image repository.

@@ -34,27 +34,50 @@
 ``treat`` and ``put_current`` instead of ``userPut``. It by default
 subclasses the ``BaseBot`` class.

-With :py:obj:`CurrentPageBot` it's possible to subclass one of the
+With :class:`CurrentPageBot` it's possible to subclass one of the
 following classes to filter the pages which are ultimately handled by
-``treat_page``:
+:meth:`CurrentPageBot.treat_page`:

-* :py:obj:`ExistingPageBot`: Only handle pages which do exist.
-* :py:obj:`CreatingPageBot`: Only handle pages which do not exist.
-* :py:obj:`RedirectPageBot`: Only handle pages which are redirect pages.
-* :py:obj:`NoRedirectPageBot`: Only handle pages which are not redirect pages.
-* :py:obj:`FollowRedirectPageBot`: If the generator returns a redirect
-  page it'll follow the redirect and instead work on the redirected class.
+* :class:`ExistingPageBot`: Only handle pages which do exist.
+* :class:`CreatingPageBot`: Only handle pages which do not exist.
+* :class:`FollowRedirectPageBot`: If the generator returns a redirect
+  page it'll follow the redirect and instead work on the redirected
+  class.

-It is possible to combine filters by subclassing multiple of them. They are
-new-style classes so when a class is first subclassing
-:py:obj:`ExistingPageBot` and then :py:obj:`FollowRedirectPageBot` it
+It is possible to combine filters by subclassing multiple of them. They
+are 

[Pywikibot-commits] [Gerrit] ...core[master]: [test] let TestWikibaseWriteGeneral.test_edit_entity_new_property fail

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

Change subject: [test] let 
TestWikibaseWriteGeneral.test_edit_entity_new_property fail
..

[test] let TestWikibaseWriteGeneral.test_edit_entity_new_property fail

Bug: T367323
Change-Id: Ifbdc76352ebf945be8d4555a6c3b72abe0b2a1ab
---
M tests/wikibase_edit_tests.py
1 file changed, 1 insertion(+), 0 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 72b93f9..1ee33de 100755
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -161,6 +161,7 @@
 self.assertSame(qual.on_item, item)
 self.assertSame(ref.on_item, item)

+@unittest.expectedFailure  # T367323
 def test_edit_entity_new_property(self):
 """Test creating a new property using ``PropertyPage.editEntity``."""
 testsite = self.get_repo()

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ifbdc76352ebf945be8d4555a6c3b72abe0b2a1ab
Gerrit-Change-Number: 1043151
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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]: retry internal_api_error_DBUnexpectedError

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

Change subject: retry internal_api_error_DBUnexpectedError
..

retry internal_api_error_DBUnexpectedError

Bug: T367383
Change-Id: I21e065a1ecada189dc7e6122029edf26a84d0ddf
---
M make_dist.py
M pywikibot/data/api/_requests.py
2 files changed, 2 insertions(+), 0 deletions(-)

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




diff --git a/make_dist.py b/make_dist.py
index 8979c73..cc498e2 100755
--- a/make_dist.py
+++ b/make_dist.py
@@ -205,6 +205,7 @@
 """
 if '-help' in sys.argv:
 import re
+
 import setup
 help_text = re.sub(r'^\.\. version(added|changed)::.+', '',
__doc__, flags=re.MULTILINE | re.DOTALL)
diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index b6afb6b..8ce916d 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -901,6 +901,7 @@
 retry = class_name in ['DBConnectionError',  # T64974
'DBQueryError',  # T60158
'DBQueryTimeoutError',  # T297708
+   'DBUnexpectedError',  # T360930
'ReadOnlyError',  # T61227
'readonly',  # T154011
]

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I21e065a1ecada189dc7e6122029edf26a84d0ddf
Gerrit-Change-Number: 1043156
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 
Gerrit-Reviewer: JJMC89 
Gerrit-Reviewer: jenkins-bot
___
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] prevent multiple entries in Sphinx documentation

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

Change subject: [doc] prevent multiple entries in Sphinx documentation
..

[doc] prevent multiple entries in Sphinx documentation

Some classes and functions of i18n, logging, page and time modules are
imported in pywikibot and can also be used as pywikibot members. Remove
the documentation from pywikibot and add a reference to bot module for
them.

Change-Id: I391e057eaf368b3a01e6c7df96f2ae3dd95e4e49
---
M docs/api_ref/bot.rst
M docs/api_ref/date_time.rst
M docs/api_ref/i18n.rst
M docs/api_ref/logging.rst
M docs/api_ref/pywikibot.page.rst
M docs/api_ref/pywikibot.rst
6 files changed, 122 insertions(+), 9 deletions(-)

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




diff --git a/docs/api_ref/bot.rst b/docs/api_ref/bot.rst
index 2e17aa9..ce8117d 100644
--- a/docs/api_ref/bot.rst
+++ b/docs/api_ref/bot.rst
@@ -7,6 +7,7 @@
:member-order: bysource

.. admonition:: Imports in :mod:`pywikibot` module
+  :class: note

   The following classes and functions are inported in :mod:`pywikibot`
   module and can also be used as :mod:`pywikibot` members:
diff --git a/docs/api_ref/date_time.rst b/docs/api_ref/date_time.rst
index 7741b6e..f6c65d8 100644
--- a/docs/api_ref/date_time.rst
+++ b/docs/api_ref/date_time.rst
@@ -3,3 +3,11 @@
 **

 .. automodule:: pywikibot.time
+
+   .. admonition:: Imports in :mod:`pywikibot` module
+  :class: note
+
+  The following class is imported in :mod:`time` module but
+  can also be used as :mod:`pywikibot` members:
+
+  - :class:`pywikibot.Timestamp`
diff --git a/docs/api_ref/i18n.rst b/docs/api_ref/i18n.rst
index 9b41287..f682e73 100644
--- a/docs/api_ref/i18n.rst
+++ b/docs/api_ref/i18n.rst
@@ -3,4 +3,12 @@
 

 .. automodule:: i18n
-   :synopsis: Various i18n functions
\ No newline at end of file
+   :synopsis: Various i18n functions
+
+   .. admonition:: Imports in :mod:`pywikibot` module
+  :class: note
+
+  The following function is inported in :mod:`pywikibot` module but can 
also
+  be used as :mod:`pywikibot` members:
+
+  - :class:`pywikibot.translate()`
diff --git a/docs/api_ref/logging.rst b/docs/api_ref/logging.rst
index 842c542..1266f2e 100644
--- a/docs/api_ref/logging.rst
+++ b/docs/api_ref/logging.rst
@@ -7,3 +7,19 @@

 .. automodule:: pywikibot.logging
:member-order: bysource
+
+   .. admonition:: Imports in :mod:`pywikibot` module
+  :class: note
+
+  The following functions are inported in :mod:`pywikibot` module and can
+  also be used as :mod:`pywikibot` members:
+
+  - :func:`pywikibot.critical()`
+  - :func:`pywikibot.debug()`
+  - :func:`pywikibot.error()`
+  - :func:`pywikibot.exception()`
+  - :func:`pywikibot.info()`
+  - :func:`pywikibot.log()`
+  - :func:`pywikibot.output()`
+  - :func:`pywikibot.stdout()`
+  - :func:`pywikibot.warning()`
diff --git a/docs/api_ref/pywikibot.page.rst b/docs/api_ref/pywikibot.page.rst
index f3712ad..7d38815 100644
--- a/docs/api_ref/pywikibot.page.rst
+++ b/docs/api_ref/pywikibot.page.rst
@@ -5,6 +5,27 @@
 .. automodule:: page
:synopsis: Interface of various types of MediaWiki pages

+   .. admonition:: Imports in :mod:`pywikibot` module
+  :class: note
+
+  The following classes and function are inported in :mod:`pywikibot` 
module
+  and can also be used as :mod:`pywikibot` members:
+
+  - :class:`pywikibot.Category`
+  - :class:`pywikibot.Claim`
+  - :class:`pywikibot.FilePage`
+  - :class:`pywikibot.ItemPage`
+  - :class:`pywikibot.LexemeForm`
+  - :class:`pywikibot.LexemePage`
+  - :class:`pywikibot.LexemeSense`
+  - :class:`pywikibot.Link`
+  - :class:`pywikibot.Page`
+  - :class:`pywikibot.PropertyPage`
+  - :class:`pywikibot.SiteLink`
+  - :class:`pywikibot.User`
+  - :func:`pywikibot.html2unicode()`
+
+
 :mod:`page.\_collections` Wikibase Entity Structures
 

diff --git a/docs/api_ref/pywikibot.rst b/docs/api_ref/pywikibot.rst
index b3e6b92..804cd7e 100644
--- a/docs/api_ref/pywikibot.rst
+++ b/docs/api_ref/pywikibot.rst
@@ -3,10 +3,17 @@
 ***

 .. automodule:: pywikibot
-   :exclude-members: Bot, CurrentPageBot, WikidataBot, calledModuleName,
-   handle_args, input, input_choice, input_yn, show_help
+   :exclude-members:
+   Bot, CurrentPageBot, WikidataBot, calledModuleName, handle_args, input,
+   input_choice, input_yn, show_help,
+   translate,
+   critical, debug, error, exception, info, log, output, stdout, warning,
+   Category, Claim, FilePage, ItemPage, LexemeForm, LexemePage, 
LexemeSense,
+   Link, MediaInfo, Page, PropertyPage, SiteLink, User, 

[Pywikibot-commits] [Gerrit] ...core[master]: [doc] update some :math: roles in _wbtypes.py

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

Change subject: [doc] update some :math: roles in _wbtypes.py
..

[doc] update some :math: roles in _wbtypes.py

Change-Id: I9c6c1b05e0491ff633bab52b7f8837be5045df67
---
M pywikibot/_wbtypes.py
1 file changed, 25 insertions(+), 16 deletions(-)

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




diff --git a/pywikibot/_wbtypes.py b/pywikibot/_wbtypes.py
index 868b7e6..cd24060 100644
--- a/pywikibot/_wbtypes.py
+++ b/pywikibot/_wbtypes.py
@@ -188,32 +188,34 @@

 @property
 def precision(self) -> float | None:
-"""
-Return the precision of the geo coordinate.
+"""Return the precision of the geo coordinate.

 The precision is calculated if the Coordinate does not have a
 precision, and self._dim is set.

 When no precision and no self._dim exists, None is returned.

-The biggest error (in degrees) will be given by the longitudinal error;
-the same error in meters becomes larger (in degrees) further up north.
-We can thus ignore the latitudinal error.
+The biggest error (in degrees) will be given by the longitudinal
+error; the same error in meters becomes larger (in degrees)
+further up north. We can thus ignore the latitudinal error.

 The longitudinal can be derived as follows:

 In small angle approximation (and thus in radians):

-M{Δλ ≈ Δpos / r_φ}, where r_φ is the radius of earth at the given
-latitude.
-Δλ is the error in longitude.
+:math:`M{Δλ ≈ Δpos / r_φ}`, where :math:`r_φ` is the radius of
+earth at the given latitude. :math:`Δλ` is the error in
+longitude.

-M{r_φ = r cos φ}, where r is the radius of earth, φ the latitude
+:math:`M{r_φ = r cos(φ)}`, where :math:`r` is the radius of
+earth, :math:`φ` the latitude

-Therefore::
+Therefore:

-precision = math.degrees(
-self._dim/(radius*math.cos(math.radians(self.lat
+.. code-block:: python
+
+   precision = math.degrees(
+   self._dim / (radius * math.cos(math.radians(self.lat
 """
 if self._dim is None and self._precision is None:
 return None
@@ -236,11 +238,18 @@
 is thrown.

 Carrying on from the earlier derivation of precision, since
-precision = math.degrees(dim/(radius*math.cos(math.radians(self.lat
-we get::

-dim = math.radians(
-precision)*radius*math.cos(math.radians(self.lat))
+.. code-block::
+
+   precision = math.degrees(
+   dim / (radius * math.cos(math.radians(self.lat
+
+we get:
+
+.. code-block:: python
+
+   dim = math.radians(
+   precision) * radius * math.cos(math.radians(self.lat))

 But this is not valid, since it returns a float value for dim which is
 an integer. We must round it off to the nearest integer.

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9c6c1b05e0491ff633bab52b7f8837be5045df67
Gerrit-Change-Number: 1043069
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] prevent multiple entries in Sphinx documentation

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

Change subject: [doc] prevent multiple entries in Sphinx documentation
..

[doc] prevent multiple entries in Sphinx documentation

Some classes and functions of bot module are imported in pywikibot and
can also be used as pywikibot members. Remove the documentation from
pywikibot and add a reference to bot module for them.

Change-Id: Ic9ac9604023828017e15a7854ef71ebecc29091c
---
M docs/api_ref/bot.rst
M docs/api_ref/pywikibot.rst
2 files changed, 32 insertions(+), 0 deletions(-)

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




diff --git a/docs/api_ref/bot.rst b/docs/api_ref/bot.rst
index 640902f..2e17aa9 100644
--- a/docs/api_ref/bot.rst
+++ b/docs/api_ref/bot.rst
@@ -6,6 +6,21 @@
:synopsis: User-interface related functions for building bots
:member-order: bysource

+   .. admonition:: Imports in :mod:`pywikibot` module
+
+  The following classes and functions are inported in :mod:`pywikibot`
+  module and can also be used as :mod:`pywikibot` members:
+
+  - :class:`pywikibot.Bot`
+  - :class:`pywikibot.CurrentPageBot`
+  - :class:`pywikibot.WikidataBot`
+  - :func:`pywikibot.calledModuleName`
+  - :func:`pywikibot.handle_args`
+  - :func:`pywikibot.input`
+  - :func:`pywikibot.input_choice`
+  - :func:`pywikibot.input_yn`
+  - :func:`pywikibot.show_help`
+
.. autoclass:: BaseBot

   .. attribute:: generator
diff --git a/docs/api_ref/pywikibot.rst b/docs/api_ref/pywikibot.rst
index 3e87817..b3e6b92 100644
--- a/docs/api_ref/pywikibot.rst
+++ b/docs/api_ref/pywikibot.rst
@@ -3,3 +3,20 @@
 ***

 .. automodule:: pywikibot
+   :exclude-members: Bot, CurrentPageBot, WikidataBot, calledModuleName,
+   handle_args, input, input_choice, input_yn, show_help
+
+   .. admonition:: Imports from :mod:`bot` module
+
+  The following classes and functions are inported from :mod:`bot` module
+  but can also be used as :mod:`pywikibot` members:
+
+  - :class:`pywikibot.Bot`
+  - :class:`pywikibot.CurrentPageBot`
+  - :class:`pywikibot.WikidataBot`
+  - :func:`pywikibot.calledModuleName`
+  - :func:`pywikibot.handle_args`
+  - :func:`pywikibot.input`
+  - :func:`pywikibot.input_choice`
+  - :func:`pywikibot.input_yn`
+  - :func:`pywikibot.show_help`

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic9ac9604023828017e15a7854ef71ebecc29091c
Gerrit-Change-Number: 1042937
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] mark failing write tests as expectedFailure

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

Change subject: [tests] mark failing write tests as expectedFailure
..

[tests] mark failing write tests as expectedFailure

Let tests pass until they are solved. All issues are documented
within code.

Bug: T367260
Change-Id: Ib7326c041e8e8486fcdbf3c31d7270f9b73222a9
---
M tests/deletionbot_tests.py
M tests/edit_tests.py
M tests/flow_edit_tests.py
M tests/flow_thanks_tests.py
M tests/site_tests.py
M tests/thanks_tests.py
M tests/upload_tests.py
M tests/wikibase_edit_tests.py
8 files changed, 18 insertions(+), 3 deletions(-)

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




diff --git a/tests/deletionbot_tests.py b/tests/deletionbot_tests.py
index 912e84a..e548ace 100755
--- a/tests/deletionbot_tests.py
+++ b/tests/deletionbot_tests.py
@@ -78,6 +78,7 @@
 cls.page.text = 'Pywikibot deletion test.'
 cls.page.save('Pywikibot unit test', botflag=True)

+@unittest.expectedFailure  # T367299
 def test_delete_mark(self):
 """Test marking User:Unicodesnowman/DeleteMark for deletion."""
 delete.main('-page:User:Unicodesnowman/DeleteMark', '-always',
diff --git a/tests/edit_tests.py b/tests/edit_tests.py
index 7ac9fcb..bc1c108 100755
--- a/tests/edit_tests.py
+++ b/tests/edit_tests.py
@@ -149,6 +149,7 @@
 except Error as err:
 self.assertEqual(str(err), error_msg)

+@unittest.expectedFailure  # T367300
 def test_merge_history(self):
 """Test Site.merge_history functionality."""
 site = self.get_site()
diff --git a/tests/flow_edit_tests.py b/tests/flow_edit_tests.py
index 0fce47a..f722524 100755
--- a/tests/flow_edit_tests.py
+++ b/tests/flow_edit_tests.py
@@ -183,6 +183,7 @@
 code = 'test'
 write = True

+@unittest.expectedFailure  # T367301
 def test_lock_unlock_topic(self):
 """Lock and unlock a test topic."""
 # Setup
diff --git a/tests/flow_thanks_tests.py b/tests/flow_thanks_tests.py
index f280c0e..258f837 100755
--- a/tests/flow_thanks_tests.py
+++ b/tests/flow_thanks_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for thanks-related code."""
 #
-# (C) Pywikibot team, 2016-2023
+# (C) Pywikibot team, 2016-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -32,6 +32,7 @@
 super().setUpClass()
 cls._topic_title = 'Topic:Tvkityksg1ukyrrw'

+@unittest.expectedFailure  # T367308
 def test_thank_post(self):
 """Test thanks for Flow posts."""
 site = self.get_site()
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 6df2d92..415dcd4 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -709,6 +709,7 @@
 show='content|comment|user',
 reason='pywikibot unit tests')

+@unittest.expectedFailure  # T367309
 def test_revdel_file(self):
 """Test deleting and undeleting file revisions."""
 site = pywikibot.Site('test')
diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py
index 5d81520..f0300a0 100755
--- a/tests/thanks_tests.py
+++ b/tests/thanks_tests.py
@@ -25,6 +25,7 @@
 code = 'test'
 write = True

+@unittest.expectedFailure  # T367311
 def test_thank_revision(self):
 """Test thanks for normal revisions.

diff --git a/tests/upload_tests.py b/tests/upload_tests.py
index 0cb1464..3a41724 100755
--- a/tests/upload_tests.py
+++ b/tests/upload_tests.py
@@ -5,7 +5,7 @@
 These tests write to the wiki.
 """
 #
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -31,6 +31,7 @@
 sounds_png = join_images_path('MP_sounds.png')
 arrow_png = join_images_path('1rightarrow.png')

+@unittest.expectedFailure  # T367319
 def test_png(self):
 """Test uploading a png using Site.upload."""
 page = pywikibot.FilePage(self.site, 'MP_sounds-pwb.png')
@@ -38,6 +39,7 @@
  comment='pywikibot test',
  ignore_warnings=True)

+@unittest.expectedFailure  # T367320
 def test_png_chunked(self):
 """Test uploading a png in two chunks using Site.upload."""
 page = pywikibot.FilePage(self.site, 'MP_sounds-pwb-chunked.png')
@@ -106,15 +108,17 @@
 'info ({}) did not start with '
 '"File not found"'.format(cm.exception.info))

+@unittest.expectedFailure  # T367314
 def test_continue_filekey_once(self):
 """Test continuing to upload a file without using chunked mode."""
 self._test_continue_filekey(0)

-@unittest.expectedFailure  # see T112416
+@unittest.expectedFailure  # T133288
 def test_continue_filekey_chunked(self):
 """Test continuing to upload a file with using chunked mode."""
  

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Reorder protection result

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

Change subject: [tests] Reorder protection result
..

[tests] Reorder protection result

Bug: T367259
Change-Id: Ib22bb3b667d19c6c136b5681ef81ae210e8a3fef
---
M tests/protectbot_tests.py
1 file changed, 3 insertions(+), 4 deletions(-)

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




diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index c8339c7..aa3d5f9 100755
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -21,7 +21,6 @@

 family = 'wikipedia'
 code = 'test'
-
 rights = 'protect'
 write = True

@@ -57,9 +56,9 @@
 self.assertEqual(
 rev[0].comment,
 'Protected "[[User:Sn1per/ProtectTest2]]": Bot: '
-'Protecting all pages from category Pywikibot Protect Test '
-'([Edit=Allow only administrators] (indefinite) [Move=Allow only '
-'administrators] (indefinite))')
+'Protecting all pages from category Pywikibot Protect Test ('
+'[Move=Allow only administrators] (indefinite) '
+'[Edit=Allow only administrators] (indefinite))')


 if __name__ == '__main__':

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib22bb3b667d19c6c136b5681ef81ae210e8a3fef
Gerrit-Change-Number: 1042244
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] 'move' token is no longer supported, no longer skip here

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

Change subject: [bugfix] 'move' token is no longer supported, no longer skip 
here
..

[bugfix] 'move' token is no longer supported, no longer skip here

Change-Id: I687daf491216638970b222cb49a33dfd350d1236
---
M tests/edit_failure_tests.py
1 file changed, 0 insertions(+), 4 deletions(-)

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




diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py
index a9eab69..c485d1c 100755
--- a/tests/edit_failure_tests.py
+++ b/tests/edit_failure_tests.py
@@ -116,10 +116,6 @@
 """Test that site.movepage raises the appropriate exceptions."""
 mysite = self.get_site()
 mainpage = self.get_mainpage()
-if 'move' not in mysite.tokens:
-self.skipTest(
-"movepage test requires 'move' token not given to user on {}"
-.format(self.site))

 with self.assertRaises(Error):
 mysite.movepage(mainpage, mainpage.title(), 'test')

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I687daf491216638970b222cb49a33dfd350d1236
Gerrit-Change-Number: 1042295
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] fix invalid level test in TestSiteSysopWrite.test_protect_exc...

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

Change subject: [tests] fix invalid level test in 
TestSiteSysopWrite.test_protect_exception()
..

[tests] fix invalid level test in TestSiteSysopWrite.test_protect_exception()

Bug: T367296
Change-Id: I619163e1330939498921ea20881bf72f56a0e562
---
M tests/site_tests.py
1 file changed, 2 insertions(+), 1 deletion(-)

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




diff --git a/tests/site_tests.py b/tests/site_tests.py
index f613729..6df2d92 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -19,6 +19,7 @@
 from pywikibot import config
 from pywikibot.exceptions import (
 APIError,
+Error,
 IsNotRedirectPageError,
 NoPageError,
 PageInUseError,
@@ -630,7 +631,7 @@
  page=page, reason='Pywikibot unit test')

 with self.subTest(test='anInvalidLevel'), \
- self.assertRaises(AssertionError):
+ self.assertRaisesRegex(Error, 'Invalid protection level'):
 site.protect(protections={'edit': 'anInvalidLevel'},
  page=page, reason='Pywikibot unit test')


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I619163e1330939498921ea20881bf72f56a0e562
Gerrit-Change-Number: 1042246
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] set maxDiff to None in TestProtectionBot.test_summary()

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

Change subject: [tests] set maxDiff to None in TestProtectionBot.test_summary()
..

[tests] set maxDiff to None in TestProtectionBot.test_summary()

This does not solve the problem but shows the difference.

Bug: T367259
Change-Id: Ie6f61bd5134406c43a8d7e123e59d927d62e44f6
---
M tests/protectbot_tests.py
1 file changed, 2 insertions(+), 0 deletions(-)

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




diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index ebf16ca..c8339c7 100755
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -52,6 +52,8 @@
 rev[1].comment,
 'Removed protection from "[[User:Sn1per/ProtectTest2]]": Bot: '
 'Unprotecting all pages from category Pywikibot Protect Test')
+
+self.maxDiff = None
 self.assertEqual(
 rev[0].comment,
 'Protected "[[User:Sn1per/ProtectTest2]]": Bot: '

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie6f61bd5134406c43a8d7e123e59d927d62e44f6
Gerrit-Change-Number: 1041867
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] restore saved token wallet in TokenTestBase

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

Change subject: [fix] restore saved token wallet in TokenTestBase
..

[fix] restore saved token wallet in TokenTestBase

Site.token is a property and does not have a setter to prevent
changes to the attribute; for tests use the underlying _tokens
attribute.

Bug: T367257
Change-Id: I368a936ce35e3eb0e958b0cd3815181d381c2296
---
M tests/token_tests.py
1 file changed, 4 insertions(+), 7 deletions(-)

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




diff --git a/tests/token_tests.py b/tests/token_tests.py
index b86d005..4a86a57 100755
--- a/tests/token_tests.py
+++ b/tests/token_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for tokens."""
 #
-# (C) Pywikibot team, 2015-2022
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -11,7 +11,6 @@
 from contextlib import suppress

 from pywikibot.exceptions import APIError, Error
-from pywikibot.site import TokenWallet
 from tests.aspects import (
 DefaultSiteTestCase,
 DeprecationTestCase,
@@ -71,11 +70,11 @@

 self.token = token
 self._orig_wallet = self.site.tokens
-self.site.tokens = TokenWallet(self.site)
+self.site.tokens.clear()

 def tearDown(self):
 """Restore site tokens."""
-self.site.tokens = self._orig_wallet
+self.site._tokens = self._orig_wallet
 super().tearDown()
 

@@ -85,11 +84,9 @@

 family = 'wikipedia'
 code = 'test'
-token_type = 'patrol'
-
-login = True
 write = True
 rights = 'patrol'
+token_type = 'patrol'

 def test_patrol(self):
 """Test the site.patrol() method."""

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I368a936ce35e3eb0e958b0cd3815181d381c2296
Gerrit-Change-Number: 1041851
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] Fix TestPageDelete.test_delete()

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

Change subject: [fix] Fix TestPageDelete.test_delete()
..

[fix] Fix TestPageDelete.test_delete()

Page._pageid may be deleted, so load it.

Change-Id: I3ee601c2ce327ed38c40e40f06dfb1e05c708ac8
---
M tests/page_tests.py
1 file changed, 1 insertion(+), 2 deletions(-)

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




diff --git a/tests/page_tests.py b/tests/page_tests.py
index 07c4f0c..f840f85 100755
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -1064,7 +1064,6 @@

 family = 'wikipedia'
 code = 'test'
-
 write = True
 rights = 'delete'

@@ -1078,7 +1077,7 @@

 # Test deletion
 res = p.delete(reason='Pywikibot unit test', prompt=False, mark=False)
-self.assertEqual(p._pageid, 0)
+self.assertEqual(p.pageid, 0)
 self.assertEqual(res, 1)
 with self.assertRaisesRegex(NoPageError, NO_PAGE_RE):
 p.get(force=True)

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3ee601c2ce327ed38c40e40f06dfb1e05c708ac8
Gerrit-Change-Number: 1041862
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] Fix TestSiteSysopWrite.test_protect_exception

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

Change subject: [fix] Fix TestSiteSysopWrite.test_protect_exception
..

[fix] Fix TestSiteSysopWrite.test_protect_exception

Bug: T367185
Change-Id: I1e0b6f5e2ae49d7a643b5dacb13595fe5e6eb005
---
M tests/site_tests.py
1 file changed, 13 insertions(+), 7 deletions(-)

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




diff --git a/tests/site_tests.py b/tests/site_tests.py
index 7dfa510..f613729 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -18,6 +18,7 @@
 import pywikibot
 from pywikibot import config
 from pywikibot.exceptions import (
+APIError,
 IsNotRedirectPageError,
 NoPageError,
 PageInUseError,
@@ -620,13 +621,18 @@
 def test_protect_exception(self):
 """Test that site.protect() throws an exception for invalid args."""
 site = self.get_site()
-p1 = pywikibot.Page(site, 'User:Unicodesnowman/ProtectTest')
-with self.assertRaises(AssertionError):
-site.protect(protections={'anInvalidValue': 'sysop'},
- page=p1, reason='Pywikibot unit test')
-with self.assertRaises(AssertionError):
-site.protect(protections={'edit': 'anInvalidValue'},
- page=p1, reason='Pywikibot unit test')
+page = pywikibot.Page(site, 'User:Unicodesnowman/ProtectTest')
+
+with self.subTest(test='anInvalidType'), \
+ self.assertRaisesRegex(APIError,
+'Invalid protection type "anInvalidType"'):
+site.protect(protections={'anInvalidType': 'sysop'},
+ page=page, reason='Pywikibot unit test')
+
+with self.subTest(test='anInvalidLevel'), \
+ self.assertRaises(AssertionError):
+site.protect(protections={'edit': 'anInvalidLevel'},
+ page=page, reason='Pywikibot unit test')

 def test_delete(self):
 """Test the site.delete() and site.undelete() methods."""

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1e0b6f5e2ae49d7a643b5dacb13595fe5e6eb005
Gerrit-Change-Number: 1041667
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] pass None instead or an empty string for expiry argument

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

Change subject: [fix] pass None instead or an empty string for expiry argument
..

[fix] pass None instead or an empty string for expiry argument

Bug: T367176
Change-Id: I12617d6d709cc37a8d5e9465f0422a26117f25b1
---
M pywikibot/page/_basepage.py
M pywikibot/site/_apisite.py
2 files changed, 17 insertions(+), 11 deletions(-)

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




diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 51d8438..9890e8d 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -2148,8 +2148,9 @@
 protections dictionary.

 Expiry of protections can be set via *kwargs*, see
-:meth:`Site.protect()` for
-details. By default there is no expiry for the protection types.
+:meth:`Site.protect()`
+for details. By default there is no expiry for the protection
+types.

 .. seealso::
- :meth:`Site.protect()
@@ -2162,10 +2163,10 @@
 Defaults to protections is None, which means unprotect all
 protection types.
 
-Example: ``{'move': 'sysop', 'edit': 'autoconfirmed'}``
+Example: :code:`{'move': 'sysop', 'edit': 'autoconfirmed'}`

-:param reason: Reason for the action, default is None and will set an
-empty string.
+:param reason: Reason for the action, default is None and will
+set an empty string.
 """
 protections = protections or {}  # protections is converted to {}
 reason = reason or ''  # None is converted to ''
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 417fb99..5ca39e4 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2760,9 +2760,10 @@
 """(Un)protect a wiki page. Requires *protect* right.

 .. seealso::
-   - :api:`Protect`
+   - :meth:`page.BasePage.protect`
- :meth:`protection_types`
- :meth:`protection_levels`
+   - :api:`Protect`

 :param protections: A dict mapping type of protection to
 protection level of that type. Refer :meth:`protection_types`
@@ -2781,11 +2782,15 @@
 protections_list = [ptype + '=' + level
 for ptype, level in protections.items()
 if level is not None]
-parameters = merge_unique_dicts(kwargs, action='protect', title=page,
-token=token,
-protections=protections_list,
-reason=reason,
-expiry=expiry)
+parameters = merge_unique_dicts(
+kwargs,
+action='protect',
+title=page,
+token=token,
+protections=protections_list,
+reason=reason,
+expiry=expiry or None,  # pass None instead of empty str
+)

 req = self.simple_request(**parameters)
 try:

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I12617d6d709cc37a8d5e9465f0422a26117f25b1
Gerrit-Change-Number: 1041651
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 test_titleblacklist when running test as sysop

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

Change subject: [tests] skip test_titleblacklist when running test as sysop
..

[tests] skip test_titleblacklist when running test as sysop

Bug: T367166
Change-Id: Iafcc1646f3c5080c5919f4814d9658508307f82f
---
M tests/edit_failure_tests.py
1 file changed, 4 insertions(+), 0 deletions(-)

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




diff --git a/tests/edit_failure_tests.py b/tests/edit_failure_tests.py
index ce984cb..a9eab69 100755
--- a/tests/edit_failure_tests.py
+++ b/tests/edit_failure_tests.py
@@ -59,6 +59,10 @@

 def test_titleblacklist(self):
 """Test that title blacklist raise the appropriate exception."""
+user = pywikibot.User(self.site, self.site.user())
+if 'sysop' in user.groups():
+self.skipTest(f'{user} is member of the sysop group')
+
 page = pywikibot.Page(self.site, 'User:UpsandDowns1234/Blacklisttest')
 with self.assertRaises(TitleblacklistError):
 page.save()

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iafcc1646f3c5080c5919f4814d9658508307f82f
Gerrit-Change-Number: 1041631
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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-06-11 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1041554?usp=email )

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

Localisation updates from https://translatewiki.net.

Change-Id: Iedacc71aaeca7bf6dd05db9a2b2964b662b32518
---
M add_text/pt-br.json
M archivebot/pt-br.json
M basic/pt-br.json
M category/pt-br.json
M category/pt.json
M category_redirect/pt-br.json
M clean_sandbox/pt-br.json
M cosmetic_changes/pt-br.json
M delete/pt-br.json
M fixing_redirects/pt-br.json
M interwiki/pt-br.json
M movepages/pt-br.json
M noreferences/pt-br.json
M pywikibot/pt-br.json
M redirect/pt-br.json
M replace/pt-br.json
M solve_disambiguation/pt-br.json
M template/pt-br.json
M weblinkchecker/pt-br.json
M welcome/pt-br.json
20 files changed, 20 insertions(+), 20 deletions(-)

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




diff --git a/add_text/pt-br.json b/add_text/pt-br.json
index 4cdb9ae..c57cde4 100644
--- a/add_text/pt-br.json
+++ b/add_text/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555
+   "555"
]
},
"add_text-adding": "Bot: Adicionando %(adding)s"
diff --git a/archivebot/pt-br.json b/archivebot/pt-br.json
index d5740fc..08f1fa2 100644
--- a/archivebot/pt-br.json
+++ b/archivebot/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555,
+   "555",
"Dr03ramos",
"Eduardo Addad de Oliveira",
"Eduardoaddad",
diff --git a/basic/pt-br.json b/basic/pt-br.json
index d56ec1f..512061d 100644
--- a/basic/pt-br.json
+++ b/basic/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555
+   "555"
]
},
"basic-changing": "Bot: Alterando..."
diff --git a/category/pt-br.json b/category/pt-br.json
index 8c38d1e..4a1f19e 100644
--- a/category/pt-br.json
+++ b/category/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555,
+   "555",
"Eduardo Addad de Oliveira",
"Eduardoaddad",
"Hamilton Abreu",
diff --git a/category/pt.json b/category/pt.json
index 00095f1..d9bf8fc 100644
--- a/category/pt.json
+++ b/category/pt.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555,
+   "555",
"Hamilton Abreu",
"Waldir",
"Waldyrious"
diff --git a/category_redirect/pt-br.json b/category_redirect/pt-br.json
index 0534977..5dc23f1 100644
--- a/category_redirect/pt-br.json
+++ b/category_redirect/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555,
+   "555",
"Eduardo Addad de Oliveira",
"Eduardoaddad",
"Giro720"
diff --git a/clean_sandbox/pt-br.json b/clean_sandbox/pt-br.json
index d4df6e2..6700f84 100644
--- a/clean_sandbox/pt-br.json
+++ b/clean_sandbox/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555
+   "555"
]
},
"clean_sandbox-cleaned": "Bot: Limpeza automática"
diff --git a/cosmetic_changes/pt-br.json b/cosmetic_changes/pt-br.json
index de7e1ab..c156f1a 100644
--- a/cosmetic_changes/pt-br.json
+++ b/cosmetic_changes/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555,
+   "555",
"Giro720"
]
},
diff --git a/delete/pt-br.json b/delete/pt-br.json
index c0be6fc..bd98b70 100644
--- a/delete/pt-br.json
+++ b/delete/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555,
+   "555",
"Prilopes"
]
},
diff --git a/fixing_redirects/pt-br.json b/fixing_redirects/pt-br.json
index d539243..21b6c6b 100644
--- a/fixing_redirects/pt-br.json
+++ b/fixing_redirects/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555
+   "555"
]
},
"fixing_redirects-fixing": "Bot: Corrigindo redirecionamentos"
diff --git a/interwiki/pt-br.json b/interwiki/pt-br.json
index 970886c..1930312 100644
--- a/interwiki/pt-br.json
+++ b/interwiki/pt-br.json
@@ -1,7 +1,7 @@
 {
"@metadata": {
"authors": [
-   555
+   

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] add scripts to _allowed_failure set in TestScriptSimulate

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

Change subject: [tests] add scripts to _allowed_failure set in 
TestScriptSimulate
..

[tests] add scripts to _allowed_failure set in TestScriptSimulate

Change-Id: Ic4d5dfaac78119e90ff99dadde70e38ba13bc4a3
---
M tests/script_tests.py
1 file changed, 3 insertions(+), 1 deletion(-)

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




diff --git a/tests/script_tests.py b/tests/script_tests.py
index 5f35226..811b0b5 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -366,10 +366,12 @@
 _allowed_failures = {
 'blockpageschecker',  # not localized for some test sites
 'category_redirect',
+'claimit',
 'clean_sandbox',
+'coordinate_import',
 'delinker',
 'disambredir',
-'interwiki_data',
+'illustrate_wikidata',
 'misspelling',  # T94681
 'noreferences',
 'nowcommons',

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic4d5dfaac78119e90ff99dadde70e38ba13bc4a3
Gerrit-Change-Number: 1041546
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] discard PYWIKIBOT_TEST_WRITE_FAIL and use PYWIKIBOT_TEST_WRI...

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

Change subject: [tests] discard PYWIKIBOT_TEST_WRITE_FAIL and use  
PYWIKIBOT_TEST_WRITE instead
..

[tests] discard PYWIKIBOT_TEST_WRITE_FAIL and use  PYWIKIBOT_TEST_WRITE instead

no reason found for this additional environemt variable except that
such tests  "are much safer than the other 'write' tests."

- remove environment variable from github write_tests action
- update SiteWriteMixin.setUpClass
- update documentation
- update tests, 'login' test attribute is implicit with 'write'

Change-Id: I31dd1a14df43d6ccc84371fe73908530b3d00aaa
---
M .github/workflows/write_tests-ci.yml
M tests/README.rst
M tests/aspects.py
M tests/edit_failure_tests.py
M tests/flow_edit_tests.py
M tests/thanks_tests.py
6 files changed, 43 insertions(+), 68 deletions(-)

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




diff --git a/.github/workflows/write_tests-ci.yml 
b/.github/workflows/write_tests-ci.yml
index 7a923ed..6e6a661 100644
--- a/.github/workflows/write_tests-ci.yml
+++ b/.github/workflows/write_tests-ci.yml
@@ -63,7 +63,6 @@
   timeout-minutes: 90
   env:
 PYWIKIBOT_TEST_WRITE: ${{ matrix.site == 'wikipedia:test' && 1 || 0}}
-PYWIKIBOT_TEST_WRITE_FAIL: ${{ matrix.site == 'wikipedia:test' && 1 || 
0}}
   run: |
 python pwb.py version
 pytest -s -r A -a "rights or write" --cov=.;
diff --git a/tests/README.rst b/tests/README.rst
index 11d526b..626875b 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -158,8 +158,12 @@
 **PYWIKIBOT_TEST_WRITE**
   There are also several other 'write' tests which also attempt to perform
   write operations successfully.  These **will** write to the wikis, and they
-  should always only write to 'test' wikis. Enabling them won't enable 'edit
-  failure' tests.
+  should always only write to 'test' wikis.
+
+  .. versionchanged:: 9.2
+ Enabling them will also enable 'edit failure' tests which attempt to write
+ to the wikis and **should** fail. If there is a bug in pywikibot or
+ MediaWiki, these tests **may** actually perform a write operation.

   To enable 'write' tests, set::

@@ -174,8 +178,9 @@

 PYWIKIBOT_TEST_WRITE_FAIL=1

-.. note:: Enabling only 'edit failure' tests or 'write' tests won't enable the
-   other tests automatically.
+  .. deprecated:: 9.2
+ this environment variable no longer has any effect; use
+ :envvar:`PYWIKIBOT_TEST_WRITE` instead.

 Instead of setting the environment by the os (or `os.environ` as well) you can 
use the :mod:`pwb`
 wrapper script to set it::
diff --git a/tests/aspects.py b/tests/aspects.py
index 039542a..18da72f 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -507,55 +507,48 @@

 class SiteWriteMixin(TestCaseBase):

-"""
-Test cases involving writing to the server.
+"""Test cases involving writing to the server.
 
-When editing, the API should not be patched to use
-CachedRequest. This class prevents that.
+When editing, the API should not be patched to use CachedRequest.
+This class prevents that.
 """

 @classmethod
-def setUpClass(cls):
-"""
-Set up the test class.
+def setUpClass(cls) -> None:
+"""Set up the test class.

-Reject write test classes configured with non-test wikis, or caching.
+Reject write test classes configured with non-test wikis, or
+caching. Prevent test classes from writing to the site by
+default.

-Prevent test classes from writing to the site by default.
+The test class is skipped unless environment variable
+:envvar:`PYWIKIBOT_TEST_WRITE` is set to 1.

-If class attribute 'write' is -1, the test class is skipped unless
-environment variable PYWIKIBOT_TEST_WRITE_FAIL is set to 1.
+.. versionchanged:: 9.2
+   :envvar:`PYWIKIBOT_TEST_WRITE_FAIL` environment variable was
+   discarded, see :ref:`Environment variables`.

-Otherwise the test class is skipped unless environment variable
-PYWIKIBOT_TEST_WRITE is set to 1.
+:raises Exception: test class cannot use *write* attribute
+together with *cached* and must be run on test sites only.
 """
 if issubclass(cls, ForceCacheMixin):
-raise Exception(
-'{} cannot be a subclass of both '
-'SiteWriteMixin and ForceCacheMixin'
-.format(cls.__name__))
+raise Exception(f'{cls.__name__} cannot be a subclass of both'
+' SiteWriteMixin and ForceCacheMixin')

 super().setUpClass()
-
 site = cls.get_site()

-if cls.write == -1:
-env_var = 'PYWIKIBOT_TEST_WRITE_FAIL'
-else:
-env_var = 'PYWIKIBOT_TEST_WRITE'
-
-if 

[Pywikibot-commits] [Gerrit] ...core[master]: tests: allow interwiki_data and speedy_delete to fail in script_tests

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

Change subject: tests: allow interwiki_data and speedy_delete to fail in 
script_tests
..

tests: allow interwiki_data and speedy_delete to fail in script_tests

Change-Id: If977c962c6e059d973c0233f82798902236086ea
---
M tests/script_tests.py
1 file changed, 2 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 0cc3e0d..5f35226 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -369,11 +369,13 @@
 'clean_sandbox',
 'delinker',
 'disambredir',
+'interwiki_data',
 'misspelling',  # T94681
 'noreferences',
 'nowcommons',
 'patrol',
 'shell',
+'speedy_delete',
 'unusedfiles',  # not localized for default sites
 'upload',  # raises custom ValueError
 'watchlist',  # not logged in

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If977c962c6e059d973c0233f82798902236086ea
Gerrit-Change-Number: 1041400
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] protection are given as 'infinite' instead 'infinity' in tests

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

Change subject: [tests] protection are given as 'infinite' instead 'infinity' 
in tests
..

[tests] protection are given as 'infinite' instead 'infinity' in tests

Change-Id: I5f6b174807864e4570f6a6affd4c63bd6613a9a5
---
M tests/page_tests.py
M tests/site_tests.py
2 files changed, 11 insertions(+), 11 deletions(-)

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




diff --git a/tests/page_tests.py b/tests/page_tests.py
index ea4dfd8..07c4f0c 100755
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -1139,8 +1139,8 @@
 p1.protect(protections={'edit': 'sysop', 'move': 'autoconfirmed'},
reason='Pywikibot unit test')
 self.assertEqual(p1.protection(),
- {'edit': ('sysop', 'infinity'),
-  'move': ('autoconfirmed', 'infinity')})
+ {'edit': ('sysop', 'infinite'),
+  'move': ('autoconfirmed', 'infinite')})

 p1.protect(protections={'edit': '', 'move': ''},
reason='Pywikibot unit test')
@@ -1154,8 +1154,8 @@
 p1.protect(protections={'edit': 'sysop', 'move': 'autoconfirmed'},
reason='Pywikibot unit test')
 self.assertEqual(p1.protection(),
- {'edit': ('sysop', 'infinity'),
-  'move': ('autoconfirmed', 'infinity')})
+ {'edit': ('sysop', 'infinite'),
+  'move': ('autoconfirmed', 'infinite')})

 p1.protect(reason='Pywikibot unit test')
 self.assertEqual(p1.protection(), {})
@@ -1168,8 +1168,8 @@
 p1.protect(protections={'edit': 'sysop', 'move': 'autoconfirmed'},
reason='Pywikibot unit test')
 self.assertEqual(p1.protection(),
- {'edit': ('sysop', 'infinity'),
-  'move': ('autoconfirmed', 'infinity')})
+ {'edit': ('sysop', 'infinite'),
+  'move': ('autoconfirmed', 'infinite')})
 # workaround
 p1 = pywikibot.Page(site, 'User:Unicodesnowman/ProtectTest')
 p1.protect(protections={'edit': '', 'move': ''},
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3933ae2..7dfa510 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for the site module."""
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -568,8 +568,8 @@
  reason='Pywikibot unit test')
 self.assertIsNone(r)
 self.assertEqual(site.page_restrictions(page=p1),
- {'edit': ('sysop', 'infinity'),
-  'move': ('autoconfirmed', 'infinity')})
+ {'edit': ('sysop', 'infinite'),
+  'move': ('autoconfirmed', 'infinite')})

 expiry = pywikibot.Timestamp.fromISOformat('2050-01-01T00:00:00Z')
 site.protect(protections={'edit': 'sysop', 'move': 'autoconfirmed'},
@@ -597,8 +597,8 @@
  reason='Pywikibot unit test')
 self.assertIsNone(r)
 self.assertEqual(site.page_restrictions(page=p1),
- {'edit': ('sysop', 'infinity'),
-  'move': ('autoconfirmed', 'infinity')})
+ {'edit': ('sysop', 'infinite'),
+  'move': ('autoconfirmed', 'infinite')})

 p1 = pywikibot.Page(site, 'User:Unicodesnowman/ProtectTest')
 expiry = pywikibot.Timestamp.fromISOformat('2050-01-01T00:00:00Z')

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5f6b174807864e4570f6a6affd4c63bd6613a9a5
Gerrit-Change-Number: 1041125
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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-06-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1041079?usp=email )

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

Localisation updates from https://translatewiki.net.

Change-Id: I107f9003c506652db84b725efe0caf6caefc4022
---
M category_redirect/ne.json
M fixing_redirects/ne.json
M pagefromfile/ce.json
M pywikibot/ce.json
M replace/ce.json
5 files changed, 7 insertions(+), 5 deletions(-)

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




diff --git a/category_redirect/ne.json b/category_redirect/ne.json
index 4cf94b7..e8b7d27 100644
--- a/category_redirect/ne.json
+++ b/category_redirect/ne.json
@@ -2,6 +2,7 @@
"@metadata": {
"authors": [
"Njsubedi",
+   "पर्वत सुबेदी",
"राम प्रसाद जोशी",
"सरोज कुमार ढकाल"
]
@@ -11,5 +12,5 @@
"category_redirect-comment": "श्रेणी अनुप्रेषण मर्मत रोबोट",
"category_redirect-edit-request": "निम्न सुरक्षित पृष्ठहरूमा अरु श्रेणी 
सम्पादनको आवश्यकता देखिएको छ: %(itemlist)s",
"category_redirect-edit-request-item": "* %(title)s , %(oldcat)s मा 
रहेको छ, जसलाई %(newcat)sमा अनुप्रेषण गरियो",
-   "category_redirect-fix-double": "रोबोट: दोहोरो रिडाइरेक्टहरू मिलाउँदै"
+   "category_redirect-fix-double": "रोबोट: दोहोरो अनुप्रेषणहरू मिलाउँदै"
 }
diff --git a/fixing_redirects/ne.json b/fixing_redirects/ne.json
index ae54648..a7673e5 100644
--- a/fixing_redirects/ne.json
+++ b/fixing_redirects/ne.json
@@ -1,8 +1,9 @@
 {
"@metadata": {
"authors": [
+   "पर्वत सुबेदी",
"सरोज कुमार ढकाल"
]
},
-   "fixing_redirects-fixing": "रोबोट: रिडाइरेक्टहरू मिलाउँदै"
+   "fixing_redirects-fixing": "रोबोट: अनुप्रेषणहरू मिलाउँदै"
 }
diff --git a/pagefromfile/ce.json b/pagefromfile/ce.json
index 79d19d5..b5e26e7 100644
--- a/pagefromfile/ce.json
+++ b/pagefromfile/ce.json
@@ -6,6 +6,6 @@
},
"pagefromfile-msg": "Бот: йаззамаш авто-импорт бар",
"pagefromfile-msg_bottom": "чаккхе тӀетохар",
-   "pagefromfile-msg_force": "долуш долу йоза йуха дӀайаздина",
+   "pagefromfile-msg_force": "йолуш йолу текст йуха дӀайазйина",
"pagefromfile-msg_top": "лакхахьа тӀетохар"
 }
diff --git a/pywikibot/ce.json b/pywikibot/ce.json
index b2cd4c4..8ffd9be 100644
--- a/pywikibot/ce.json
+++ b/pywikibot/ce.json
@@ -10,7 +10,7 @@
"pywikibot-enter-file-links-processing": "Муьлхачу файлан хьажоргаш 
кечйан йезаш йу?",
"pywikibot-enter-finished-browser": "Браузер чохь хийцам бинчултӀехьа 
таӀае Enter.",
"pywikibot-enter-namespace-number": "Дехар до, цӀерийн меттиигийн 
лоьмар йазйе:",
-   "pywikibot-enter-new-text": "Дехар до, керла йоза йазде:",
+   "pywikibot-enter-new-text": "Дехар до, керла текст йазйе:",
"pywikibot-enter-page-processing": "Муьлха агӀо кечйан йезаш йу?",
"pywikibot-enter-xml-filename": "Дехар до, дампа XML файлан цӀе йазйе:",
"pywikibot-fixes-isbn": "бот: йухакхоллар → ISBN"
diff --git a/replace/ce.json b/replace/ce.json
index 11b4ff8..159c56b 100644
--- a/replace/ce.json
+++ b/replace/ce.json
@@ -4,5 +4,5 @@
"Умар"
]
},
-   "replace-replacing": "бот: авто йоза хийцар %(description)s"
+   "replace-replacing": "бот: текст авто хийцар %(description)s"
 }

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Change-Id: I107f9003c506652db84b725efe0caf6caefc4022
Gerrit-Change-Number: 1041079
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot 
Gerrit-Reviewer: L10n-bot 
Gerrit-Reviewer: jenkins-bot
___
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 -summary arguments in deletionbot_tests

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

Change subject: [bugfix] Fix -summary arguments in deletionbot_tests
..

[bugfix] Fix -summary arguments in deletionbot_tests

Change-Id: Ia5c9f08d27b47e9b2d93ded068e315b664a4acef
---
M tests/deletionbot_tests.py
1 file changed, 4 insertions(+), 4 deletions(-)

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




diff --git a/tests/deletionbot_tests.py b/tests/deletionbot_tests.py
index 645d482..912e84a 100755
--- a/tests/deletionbot_tests.py
+++ b/tests/deletionbot_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for scripts/delete.py."""
 #
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -33,9 +33,9 @@
 delete.main('-cat:Pywikibot_Delete_Test', '-always')
 self.assertIsEmpty(list(cat.members()))
 delete.main('-page:User:Unicodesnowman/DeleteTest1', '-always',
-'-undelete', '-summary=pywikibot unit tests')
+'-undelete', '-summary:pywikibot unit tests')
 delete.main('-page:User:Unicodesnowman/DeleteTest2', '-always',
-'-undelete', '-summary=pywikibot unit tests')
+'-undelete', '-summary:pywikibot unit tests')
 self.assertLength(list(cat.members()), 2)

 def test_undelete_existing(self):
@@ -46,7 +46,7 @@
 p1.text = 'pywikibot unit test page'
 p1.save('unit test', botflag=True)
 delete.main('-page:User:Unicodesnowman/ExistingPage', '-always',
-'-undelete', '-summary=pywikibot unit tests')
+'-undelete', '-summary:pywikibot unit tests')


 class TestDeletionBotUser(ScriptMainTestCase):

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia5c9f08d27b47e9b2d93ded068e315b664a4acef
Gerrit-Change-Number: 1041067
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: DannyS712 
Gerrit-Reviewer: jenkins-bot
___
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] test alldeletedrevisions tests

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

Change subject: [tests] test alldeletedrevisions tests
..

[tests] test alldeletedrevisions tests

'user' keyword must be given with 'start' or 'end', see
https://www.mediawiki.org/wiki/API:Alldeletedrevisions

Change-Id: Ifc691162a360ce00ab8785b483f376199ed3f139
---
M pywikibot/site/_generators.py
M tests/site_tests.py
2 files changed, 15 insertions(+), 9 deletions(-)

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




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index af2aa43..4544e8c 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -1795,22 +1795,26 @@
 Yield all deleted revisions.

 .. seealso:: :api:`Alldeletedrevisions`
+.. warning:: *user* keyword argument must be given together with
+   *start* or *end*.

 :param namespaces: Only iterate pages in these namespaces
 :param reverse: Iterate oldest revisions first (default: newest)
 :param content: If True, retrieve the content of each revision
 :param total: Number of revisions to retrieve
-:keyword from: Start listing at this title
-:keyword to: Stop listing at this title
-:keyword prefix: Search for all page titles that begin with this value
-:keyword excludeuser: Exclude revisions by this user
-:keyword tag: Only list revisions tagged with this tag
-:keyword user: List revisions by this user
+
+:keyword str from: Start listing at this title
+:keyword str to: Stop listing at this title
+:keyword str prefix: Search for all page titles that begin with this
+value
+:keyword str excludeuser: Exclude revisions by this user
+:keyword str tag: Only list revisions tagged with this tag
+:keyword str user: List revisions by this user
 :keyword start: Iterate revisions starting at this Timestamp
 :keyword end: Iterate revisions ending at this Timestamp
-:keyword prop: Which properties to get. Defaults are ids, timestamp,
-flags, user, and comment (if you have the right to view).
-:type prop: list[str]
+:keyword list[str] prop: Which properties to get. Defaults are
+``ids``, ``timestamp``, ``flags``, ``user``, and ``comment``
+(if the bot has the right to view).
 """
 if 'start' in kwargs and 'end' in kwargs:
 self.assert_valid_iter_params('alldeletedrevisions',
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 9014d0e..3933ae2 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -506,6 +506,7 @@
   prop=prop):
 for item in mysite.alldeletedrevisions(
 start='2008-10-11T01:02:03Z',
+user=myuser,
 total=5
 ):
 for drev in item['revisions']:
@@ -517,6 +518,7 @@
   prop=prop):
 for item in mysite.alldeletedrevisions(
 start='2008-10-11T01:02:03Z',
+user=myuser,
 total=5
 ):
 for drev in item['revisions']:

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ifc691162a360ce00ab8785b483f376199ed3f139
Gerrit-Change-Number: 1041059
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 -summary arguments in protectbot_tests

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

Change subject: [bugfix] Fix -summary arguments in protectbot_tests
..

[bugfix] Fix -summary arguments in protectbot_tests

Change-Id: Ic5bef904d0ea75be04613a29858fe1478a02bedf
---
M tests/protectbot_tests.py
1 file changed, 5 insertions(+), 5 deletions(-)

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




diff --git a/tests/protectbot_tests.py b/tests/protectbot_tests.py
index 4688512..ebf16ca 100755
--- a/tests/protectbot_tests.py
+++ b/tests/protectbot_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for scripts/protect.py."""
 #
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -28,12 +28,12 @@
 def test_protect(self):
 """Test ProtectionBot protect/unprotect on the test wiki."""
 site = self.get_site()
-protect.main('-page:User:Sn1per/ProtectTest1', '-always',
- '-unprotect', '-summary=Pywikibot protect.py unit tests')
+protect.main('-page:User:Sn1per/ProtectTest1', '-always', '-unprotect',
+ '-summary:Pywikibot protect.py unit tests')
 page = pywikibot.Page(site, 'User:Sn1per/ProtectTest1')
 self.assertIsEmpty(list(page.protection()))
-protect.main('-page:User:Sn1per/ProtectTest1', '-always',
- '-default', '-summary=Pywikibot protect.py unit tests')
+protect.main('-page:User:Sn1per/ProtectTest1', '-always', '-default',
+ '-summary:Pywikibot protect.py unit tests')
 page = pywikibot.Page(site, 'User:Sn1per/ProtectTest1')
 self.assertLength(list(page.protection()), 2)


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic5bef904d0ea75be04613a29858fe1478a02bedf
Gerrit-Change-Number: 1041054
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 keyword argument in BaseSite.undelete when calling site....

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

Change subject: [bugfix] fix keyword argument in BaseSite.undelete when calling 
site.undelete
..

[bugfix] fix keyword argument in BaseSite.undelete when calling site.undelete

Also update docstrings

Bug: T367037
Change-Id: I46a460dbf3cdc503530fc217b77f27707dd28a84
---
M pywikibot/page/_basepage.py
1 file changed, 27 insertions(+), 16 deletions(-)

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




diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 4883639..51d8438 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -2028,8 +2028,7 @@
 return self._has_deleted_revisions

 def loadDeletedRevisions(self, total: int | None = None, **kwargs):
-"""
-Retrieve deleted revisions for this Page.
+"""Retrieve deleted revisions for this Page.

 Stores all revisions' timestamps, dates, editors and comments in
 self._deletedRevs attribute.
@@ -2074,8 +2073,11 @@
 return []

 def markDeletedRevision(self, timestamp, undelete: bool = True):
-"""
-Mark the revision identified by timestamp for undeletion.
+"""Mark the revision identified by timestamp for undeletion.
+
+.. seealso::
+   - :meth:`undelete`
+   - :meth:`loadDeletedRevisions`

 :param undelete: if False, mark the revision to remain deleted.
 """
@@ -2087,24 +2089,33 @@
 self._deletedRevs[timestamp]['marked'] = undelete

 def undelete(self, reason: str | None = None) -> None:
-"""
-Undelete revisions based on the markers set by previous calls.
+"""Undelete revisions based on the markers set by previous calls.

-If no calls have been made since loadDeletedRevisions(), everything
-will be restored.
+If no calls have been made since :meth:`loadDeletedRevisions`,
+everything will be restored.

-Simplest case::
+Simplest case:
+
+.. code-block:: python

 Page(...).undelete('This will restore all revisions')

-More complex::
+More complex:

-pg = Page(...)
-revs = pg.loadDeletedRevisions()
+.. code-block:: Python
+
+page = Page(...)
+revs = page.loadDeletedRevisions()
 for rev in revs:
-if ... #decide whether to undelete a revision
-pg.markDeletedRevision(rev) #mark for undeletion
-pg.undelete('This will restore only selected revisions.')
+if ...  # decide whether to undelete a revision
+page.markDeletedRevision(rev)  # mark for undeletion
+page.undelete('This will restore only selected revisions.')
+
+.. seealso::
+   - :meth:`loadDeletedRevisions`
+   - :meth:`markDeletedRevision`
+   - :meth:`site.APISite.undelete
+ `

 :param reason: Reason for the action.
 """
@@ -2119,7 +2130,7 @@
 pywikibot.info(f'Undeleting {self.title(as_link=True)}.')
 reason = pywikibot.input(
 'Please enter a reason for the undeletion:')
-self.site.undelete(self, reason, revision=undelete_revs)
+self.site.undelete(self, reason, revisions=undelete_revs)

 def protect(self,
 reason: str | None = None,

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I46a460dbf3cdc503530fc217b77f27707dd28a84
Gerrit-Change-Number: 1041050
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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-06-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041035?usp=email )

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

[doc] Update ROADMAP.rst and CHANGELOG.rst

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

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index 8450056..e407eb6 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,11 +1,16 @@
 Current Release Changes
 ===

+* Check whether :attr:`BaseBot.generator` is None in 
:meth:`run()` method
+* Add *namespaces* parameter to 
:meth:`Page.templates()` and
+  :meth:`Page.itertemplates()` and require 
keyword arguments;
+  only use TEMPLATE namespace for 
meth:`Page.isDisambig()` (:phab:`T365199`)
+* Drop pheetools support for :mod:`proofreadpage` which is no longer available 
upstreams (:phab:`T366036`)
 * Raise :exc:`exceptions.SectionError` if a section does not exists on a page 
(:phab:`T107141`)
 * Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)

-New Deprecations
-
+Current Deprecations
+

 * 9.2.0: *total* argument in ``-logevents`` pagegenerators option is 
deprecated;
   use ``-limit`` instead (:phab:`T128981`)
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index a7b5e4c..608b830 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -11,6 +11,11 @@
 * Use transclusions of Information template as default generator
 * Preload pages to make the script upto 10 times faster

+interwikidata
+^
+
+* Do not create an option named None (:phab:`T366409`)
+
 noreferences
 


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ibfdc6ef2bea41ee6d149696f632c08e940176085
Gerrit-Change-Number: 1041035
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: D3r1ck01 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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] check whether BaseBot.generator is None in treat method

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

Change subject: [IMPR] check whether BaseBot.generator is None in treat method
..

[IMPR] check whether BaseBot.generator is None in treat method

- check whether BaseBot.generator is None in treat method,
  call suggest_help in such case and leave the run method.
- update documentation for BaseBot
- remove suggest_help calls from several scripts where
  Bot.run() calls it already.

Change-Id: I935218ef1c1c18ff8b4f1219e5ffdb371613750f
---
M docs/api_ref/bot.rst
M pywikibot/bot.py
M scripts/add_text.py
M scripts/change_pagelang.py
M scripts/claimit.py
M scripts/clean_sandbox.py
M scripts/coordinate_import.py
M scripts/fixing_redirects.py
M scripts/illustrate_wikidata.py
M scripts/interwikidata.py
M scripts/noreferences.py
M scripts/replace.py
M scripts/solve_disambiguation.py
M tests/interwikidata_tests.py
14 files changed, 142 insertions(+), 90 deletions(-)

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




diff --git a/docs/api_ref/bot.rst b/docs/api_ref/bot.rst
index 6901de0..640902f 100644
--- a/docs/api_ref/bot.rst
+++ b/docs/api_ref/bot.rst
@@ -5,3 +5,18 @@
 .. automodule:: bot
:synopsis: User-interface related functions for building bots
:member-order: bysource
+
+   .. autoclass:: BaseBot
+
+  .. attribute:: generator
+ :type: Iterable
+
+ Instance variable to hold the Iterbale processed by :meth:`run`
+ method. The is added to the class with *generator* keyword
+ argument and the proposed type is a ``Generator``. If not,
+ :meth:`run` upcast the generator attribute to become a
+ ``Generator`` type. If a :class:`BaseBot` subclass has its own
+ ``generator`` attribute, a warning will be thrown when an
+ object is passed to *generator* keyword parameter.
+
+ .. warning:: this is just a sample
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 935886d..bb732d8 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1069,17 +1069,15 @@
 This class provides a :meth:`run` method for basic processing of a
 generator one page at a time.

-If the subclass places a page generator in
-:attr:`self.generator`, Bot will process each page in the
-generator, invoking the method :meth:`treat` which must then be
-implemented by subclasses.
+If the subclass places a page generator in :attr:`generator`, Bot
+will process each page in the generator, invoking the method
+:meth:`treat` which must then be implemented by subclasses.

-Each item processed by :meth:`treat` must be a
-:class:`page.BasePage` type. Use :meth:`init_page` to
-upcast the type. To enable other types, set
-:attr:`BaseBot.treat_page_type` to an appropriate type; your bot
-should derive from :class:`BaseBot` in that case and handle site
-properties.
+Each item processed by :meth:`treat` must be a :class:`page.BasePage`
+type. Use :meth:`init_page` to upcast the type. To enable other
+types, set :attr:`BaseBot.treat_page_type` to an appropriate type;
+your bot should derive from :class:`BaseBot` in that case and handle
+site properties.

 If the subclass does not set a generator, or does not override
 :meth:`treat` or :meth:`run`, `NotImplementedError` is raised.
@@ -1133,15 +1131,14 @@
 """Initializer.

 :param kwargs: bot options
-:keyword generator: a :attr:`generator` processed by :meth:`run` method
+:keyword generator: a :attr:`generator` processed by :meth:`run`
+method
 """
 if 'generator' in kwargs:
 if hasattr(self, 'generator'):
-pywikibot.warn('{} has a generator already. Ignoring argument.'
-   .format(self.__class__.__name__))
+pywikibot.warn(f'{type(self).__name__} has a generator'
+   ' already. Ignoring argument.')
 else:
-#: instance variable to hold the generator processed by
-#: :meth:`run` method
 self.generator: Iterable = kwargs.pop('generator')

 self.available_options.update(self.update_options)
@@ -1149,7 +1146,8 @@

 self.counter: Counter = Counter()
 """Instance variable which holds counters. The default counters
-are 'read', 'write' and 'skip'. You can use your own counters like::
+are 'read', 'write' and 'skip'. All of them are printed within
+:meth:`exit`. You can use your own counters like::

 self.counter['delete'] += 1

@@ -1159,21 +1157,30 @@
 """

 self.generator_completed: bool = False
-"""Instance attribute which is True if the generator is completed.
+"""
+Instance attribute which is True if the :attr:`generator` is completed.

[Pywikibot-commits] [Gerrit] ...core[master]: [family] test_family.py was dropped, use wikipedia:test instead

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

Change subject: [family] test_family.py was dropped, use wikipedia:test instead
..

[family] test_family.py was dropped, use wikipedia:test instead

Also _ignore_from_url attribute, initially introduced for test_family,
is no longer available

Change-Id: I6cebf48245e386d6dd70793b7955316aa85f0006
---
M pywikibot/config.py
M tests/edit_tests.py
M tests/family_tests.py
3 files changed, 6 insertions(+), 8 deletions(-)

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




diff --git a/pywikibot/config.py b/pywikibot/config.py
index 7f12bcc..2daf484 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -128,7 +128,7 @@
 # The language code of the site we're working on.
 mylang = 'language'
 # If family and mylang are not modified from the above, the default is changed
-# to test:test, which is test.wikipedia.org, at the end of this module.
+# to wikipedia:test, which is test.wikipedia.org, at the end of this module.

 # The dictionary usernames should contain a username for each site where you
 # have a bot account. Please set your usernames by adding such lines to your
diff --git a/tests/edit_tests.py b/tests/edit_tests.py
index 415be0a..7ac9fcb 100755
--- a/tests/edit_tests.py
+++ b/tests/edit_tests.py
@@ -129,7 +129,7 @@
 },
 'Cannot merge revisions from source '
 '[[test:User:Sn1per/Nonexistent]] because it does not exist '
-'on test:test'
+'on wikipedia:test'
 ),
 (
 {  # nonexistent dest
@@ -138,7 +138,7 @@
 },
 'Cannot merge revisions to destination '
 '[[test:User:Sn1per/Nonexistent]] because it does not exist '
-'on test:test'
+'on wikipedia:test'
 ),
 ]

diff --git a/tests/family_tests.py b/tests/family_tests.py
index f790687..18ed841 100755
--- a/tests/family_tests.py
+++ b/tests/family_tests.py
@@ -218,11 +218,9 @@
 family = Family.load(family)
 for code in family.codes:
 self.current_code = code
-url = ('{}://{}{}/$1'.format(family.protocol(code),
- family.hostname(code),
- family.path(code)))
-# Families can switch off if they want to be detected using
-# URL. This applies for test:test (there is test:wikipedia)
+url = '{}://{}{}/$1'.format(family.protocol(code),
+family.hostname(code),
+family.path(code))
 with self.subTest(url=url):
 self.assertEqual(family.from_url(url), code)


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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6cebf48245e386d6dd70793b7955316aa85f0006
Gerrit-Change-Number: 1040993
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 tests/README.rst

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

Change subject: [doc] Update tests/README.rst
..

[doc] Update tests/README.rst

Change-Id: Id8815de7dd9f49fe0b88e5526501192168edf489
---
M tests/README.rst
1 file changed, 6 insertions(+), 12 deletions(-)

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




diff --git a/tests/README.rst b/tests/README.rst
index c4c8b9a..11d526b 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -158,11 +158,8 @@
 **PYWIKIBOT_TEST_WRITE**
   There are also several other 'write' tests which also attempt to perform
   write operations successfully.  These **will** write to the wikis, and they
-  should always only write to 'test' wikis.
-
-  These 'write' tests are disabled by default, and currently cannot be
-  run on Travis or AppVeyor as they require interaction using a terminal. Also
-  enabling them won't enable 'edit failure' tests.
+  should always only write to 'test' wikis. Enabling them won't enable 'edit
+  failure' tests.

   To enable 'write' tests, set::
 
@@ -173,15 +170,12 @@
   and **should** fail. If there is a bug in pywikibot or MediaWiki, these
   tests **may** actually perform a write operation.

-  These 'edit failure' tests are disabled by default. On Travis they are 
enabled
-  by default on builds by any other GitHub account except 'wikimedia'.
+  To enable 'edit failure' tests, set::

-  To disable 'edit failure' tests, set::
+PYWIKIBOT_TEST_WRITE_FAIL=1

-PYWIKIBOT_TEST_WRITE_FAIL=0
-
-.. note:: Enabling only 'edit failure' tests or 'write' tests won't enable the 
other tests
-   automatically.
+.. note:: Enabling only 'edit failure' tests or 'write' tests won't enable the
+   other tests automatically.

 Instead of setting the environment by the os (or `os.environ` as well) you can 
use the :mod:`pwb`
 wrapper script to set it::

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id8815de7dd9f49fe0b88e5526501192168edf489
Gerrit-Change-Number: 1040876
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 doctest for User.contributions

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

Change subject: [tests] update doctest for User.contributions
..

[tests] update doctest for User.contributions

The oldest edit of Pywikibot-test account was deleted during write
tests with sysop account. Update the doctest result accordingly.

Change-Id: Ic94445a2b0ca68aaf31e5be86ed5d05e8b870579
---
M pywikibot/page/_user.py
1 file changed, 4 insertions(+), 4 deletions(-)

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




diff --git a/pywikibot/page/_user.py b/pywikibot/page/_user.py
index 4dd9aa4..8047772 100644
--- a/pywikibot/page/_user.py
+++ b/pywikibot/page/_user.py
@@ -345,13 +345,13 @@
 >>> len(contrib)
 4
 >>> contrib[0].title()
-'User:Unicodesnowman/DeleteMark'
+'User:John Vandenberg/appendtext test'
 >>> contrib[1]
-504586
+504588
 >>> str(contrib[2])
-'2022-03-04T17:35:41Z'
+'2022-03-04T17:36:02Z'
 >>> contrib[3]
-'pywikibot unit test. Do NOT actually delete.'
+''

 .. seealso:: :meth:`Site.usercontribs()
`

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic94445a2b0ca68aaf31e5be86ed5d05e8b870579
Gerrit-Change-Number: 1040995
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
___
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 documentation for APISite.editpage

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

Change subject: [IMPR] improve documentation for APISite.editpage
..

[IMPR] improve documentation for APISite.editpage

- add type hints for keyword parameters
- add raised exceptions
- rename submit response "result" to "response"
- raise KeyError insted od AssertionError if 'result' is missing in API
  response

Change-Id: I88893746d04f46ddc6facad94ab23d7354b5b77a
---
M pywikibot/site/_apisite.py
1 file changed, 116 insertions(+), 65 deletions(-)

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




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 729a7ec..417fb99 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -10,6 +10,7 @@
 import re
 import time
 import typing
+import webbrowser
 from collections import OrderedDict, defaultdict
 from contextlib import suppress
 from textwrap import fill
@@ -1968,7 +1969,6 @@
 'spamblacklist': SpamblacklistError,
 'abusefilter-disallowed': AbuseFilterDisallowedError,
 }
-_ep_text_overrides = {'appendtext', 'prependtext', 'undo'}

 @need_right('edit')
 def editpage(
@@ -1986,47 +1986,80 @@
 ) -> bool:
 """Submit an edit to be saved to the wiki.

-.. seealso:: :api:`Edit`
+.. seealso::
+   - :api:`Edit`
+   - :meth:`BasePage.save()`
+ (should be preferred)

 :param page: The Page to be saved.
 By default its .text property will be used
 as the new text to be saved to the wiki
-:param summary: the edit summary
+:param summary: The edit summary for the modification (optional,
+but most wikis strongly encourage its use)
 :param minor: if True (default), mark edit as minor
-:param notminor: if True, override account preferences to mark edit
-as non-minor
+:param notminor: if True, override account preferences to mark
+edit as non-minor
 :param recreate: if True (default), create new page even if this
 title has previously been deleted
 :param createonly: if True, raise an error if this title already
 exists on the wiki
-:param nocreate: if True, raise an error if the page does not exist
-:param watch: Specify how the watchlist is affected by this edit, set
-to one of "watch", "unwatch", "preferences", "nochange":
-* watch: add the page to the watchlist
-* unwatch: remove the page from the watchlist
-* preferences: use the preference settings (default)
-* nochange: don't change the watchlist
+:param nocreate: if True, raise a :exc:`exceptions.NoCreateError`
+exception if the page does not exist
+:param watch: Specify how the watchlist is affected by this edit,
+set to one of ``watch``, ``unwatch``, ``preferences``,
+``nochange``:
+
+* watch --- add the page to the watchlist
+* unwatch --- remove the page from the watchlist
+* preferences --- use the preference settings (default)
+* nochange --- don't change the watchlist
+If None (default), follow bot account's default settings
 :param bot: if True, mark edit with bot flag
-:keyword text: Overrides Page.text
-:type text: str
-:keyword section: Edit an existing numbered section or
+
+:keyword str text: Overrides Page.text
+:keyword int | str section: Edit an existing numbered section or
 a new section ('new')
-:type section: int or str
-:keyword prependtext: Prepend text. Overrides Page.text
-:type text: str
-:keyword appendtext: Append text. Overrides Page.text.
-:type text: str
-:keyword undo: Revision id to undo. Overrides Page.text
-:type undo: int
+:keyword str prependtext: Prepend text. Overrides Page.text
+:keyword str appendtext: Append text. Overrides Page.text.
+:keyword int undo: Revision id to undo. Overrides Page.text
+
 :return: True if edit succeeded, False if it failed
-:raises pywikibot.exceptions.Error: No text to be saved
-:raises pywikibot.exceptions.NoPageError: recreate is disabled and page
-does not exist
-:raises pywikibot.exceptions.CaptchaError: config.solve_captcha is
-False and saving the page requires solving a captcha
+
+:raises AbuseFilterDisallowedError: This action has been
+automatically identified as harmful, and therefore disallowed
+:raises CaptchaError: :ref:`config.solve_captcha
+` is False and saving the
+page requires solving a captcha
+:raises 

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] take into account that test page is modified in meantime

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

Change subject: [tests] take into account that test page is modified in meantime
..

[tests] take into account that test page is modified in meantime

Bug: T367006
Change-Id: I053c69438aedd5977fa438150f75e30c03f7e232
---
M tests/oauth_tests.py
1 file changed, 6 insertions(+), 3 deletions(-)

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




diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py
index 6a7cc5e..a39c528 100755
--- a/tests/oauth_tests.py
+++ b/tests/oauth_tests.py
@@ -79,14 +79,17 @@
 ts = str(time.time())
 p = pywikibot.Page(self.site, title)
 try:
-p.site.editpage(p, appendtext=ts)
+p.site.editpage(p, appendtext='\n' + ts)
 except EditConflictError as e:
 self.assertEqual(e.page, p)
 else:
 revision_id = p.latest_revision_id
 p = pywikibot.Page(self.site, title)
-self.assertEqual(revision_id, p.latest_revision_id)
-self.assertTrue(p.text.endswith(ts))
+t = p.text
+if revision_id == p.latest_revision_id:
+self.assertTrue(p.text.endswith(ts))
+else:
+self.assertIn(ts, t)


 class TestOauthLoginManger(DefaultSiteTestCase, OAuthSiteTestCase):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1040812?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: I053c69438aedd5977fa438150f75e30c03f7e232
Gerrit-Change-Number: 1040812
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] fix require_modules usage

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

Change subject: [tests] fix require_modules usage
..

[tests] fix require_modules usage

https://doc.wikimedia.org/pywikibot/master/_modules/tests/aspects.html#require_modules

Change-Id: I2f524a3907247b1c1bd9cb7427bce3b6ed0dcee6
---
M tests/README.rst
M tests/gui_tests.py
2 files changed, 2 insertions(+), 3 deletions(-)

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




diff --git a/tests/README.rst b/tests/README.rst
index e72ecd7..c4c8b9a 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -228,7 +228,7 @@

   from tests.aspects import require_modules
   [..]
-  @require_modules(['important1', 'musthave2'])
+  @require_modules('important1', 'musthave2')
   def test_require_modules(self):

 @tests.aspects.require_version
diff --git a/tests/gui_tests.py b/tests/gui_tests.py
index 53044fa..428ba2e 100755
--- a/tests/gui_tests.py
+++ b/tests/gui_tests.py
@@ -55,8 +55,7 @@
 self.assertIn('Main Page', text)


-@require_modules('tkinter')
-@require_modules('PIL')
+@require_modules('tkinter', 'PIL')
 def setUpModule():
 """Skip tests if tkinter or PIL is not installed.


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1040776?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: I2f524a3907247b1c1bd9cb7427bce3b6ed0dcee6
Gerrit-Change-Number: 1040776
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]: [cleanup] Remove setting __test__ to script test

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

Change subject: [cleanup] Remove setting __test__ to script test
..

[cleanup] Remove setting __test__ to script test

unrunnable tests aren't collected.

Change-Id: Ia9c1412fa09170caab4eeb1e187afb6327f85dd7
---
M tests/script_tests.py
1 file changed, 0 insertions(+), 6 deletions(-)

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




diff --git a/tests/script_tests.py b/tests/script_tests.py
index 9f9df0a..0cc3e0d 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -319,12 +319,6 @@
 f'{script_name} has dependencies; skipping'
 )(dct[test_name])

-# Disable test by default in pytest
-if script_name in unrunnable_script_set:
-# flag them as an expectedFailure due to py.test (T135594)
-dct[test_name] = unittest.expectedFailure(dct[test_name])
-dct[test_name].__test__ = False
-
 return super().__new__(cls, name, bases, dct)

 

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1040704?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: Ia9c1412fa09170caab4eeb1e187afb6327f85dd7
Gerrit-Change-Number: 1040704
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-06-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1039695?usp=email )

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

Localisation updates from https://translatewiki.net.

Change-Id: I0374fdda93655f502727510dfef177cc19cb8161
---
M archivebot/pt-br.json
M category/pt-br.json
M category/pt.json
M category_redirect/pt-br.json
M cosmetic_changes/pt-br.json
M delete/pt-br.json
M noreferences/pt-br.json
M pywikibot/pt-br.json
M redirect/pt-br.json
M solve_disambiguation/pt-br.json
M weblinkchecker/pt-br.json
M welcome/ce.json
M welcome/pt-br.json
13 files changed, 25 insertions(+), 25 deletions(-)

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




diff --git a/archivebot/pt-br.json b/archivebot/pt-br.json
index 050ad90..d5740fc 100644
--- a/archivebot/pt-br.json
+++ b/archivebot/pt-br.json
@@ -1,12 +1,12 @@
 {
"@metadata": {
"authors": [
+   555,
"Dr03ramos",
"Eduardo Addad de Oliveira",
"Eduardoaddad",
"Pedroca cerebral",
-   "Rodrigo codignoli",
-   555
+   "Rodrigo codignoli"
]
},
"archivebot-archive-full": "(ARQUIVO COMPLETO)",
diff --git a/category/pt-br.json b/category/pt-br.json
index 7a3bb12..8c38d1e 100644
--- a/category/pt-br.json
+++ b/category/pt-br.json
@@ -1,11 +1,11 @@
 {
"@metadata": {
"authors": [
+   555,
"Eduardo Addad de Oliveira",
"Eduardoaddad",
"Hamilton Abreu",
-   "YuriNikolai",
-   555
+   "YuriNikolai"
]
},
"category-adding": "Bot: Adicionando categoria 
[[:Category:%(newcat)s|%(newcat)s]]",
diff --git a/category/pt.json b/category/pt.json
index 66ec67f..00095f1 100644
--- a/category/pt.json
+++ b/category/pt.json
@@ -1,10 +1,10 @@
 {
"@metadata": {
"authors": [
+   555,
"Hamilton Abreu",
"Waldir",
-   "Waldyrious",
-   555
+   "Waldyrious"
]
},
"category-adding": "Robô: adição da categoria 
[[:Category:%(newcat)s|%(newcat)s]]",
diff --git a/category_redirect/pt-br.json b/category_redirect/pt-br.json
index f614809..0534977 100644
--- a/category_redirect/pt-br.json
+++ b/category_redirect/pt-br.json
@@ -1,10 +1,10 @@
 {
"@metadata": {
"authors": [
+   555,
"Eduardo Addad de Oliveira",
"Eduardoaddad",
-   "Giro720",
-   555
+   "Giro720"
]
},
"category_redirect-add-template": "Bot: Adicionando predefinição de 
redirecionamento de categoria",
diff --git a/cosmetic_changes/pt-br.json b/cosmetic_changes/pt-br.json
index 8794634..de7e1ab 100644
--- a/cosmetic_changes/pt-br.json
+++ b/cosmetic_changes/pt-br.json
@@ -1,8 +1,8 @@
 {
"@metadata": {
"authors": [
-   "Giro720",
-   555
+   555,
+   "Giro720"
]
},
"cosmetic_changes-append": "; mudanças triviais",
diff --git a/delete/pt-br.json b/delete/pt-br.json
index 77485f4..c0be6fc 100644
--- a/delete/pt-br.json
+++ b/delete/pt-br.json
@@ -1,8 +1,8 @@
 {
"@metadata": {
"authors": [
-   "Prilopes",
-   555
+   555,
+   "Prilopes"
]
},
"delete-from-category": "Bot: Apagando todas as páginas da categoria 
%(page)s",
diff --git a/noreferences/pt-br.json b/noreferences/pt-br.json
index c03ff78..27c8477 100644
--- a/noreferences/pt-br.json
+++ b/noreferences/pt-br.json
@@ -1,9 +1,9 @@
 {
"@metadata": {
"authors": [
+   555,
"Eduardo Addad de Oliveira",
-   "Eduardoaddad",
-   555
+   "Eduardoaddad"
]
},
"noreferences-add-tag": "Bot: Adicionando tag ",
diff --git a/pywikibot/pt-br.json b/pywikibot/pt-br.json
index f4b5286..bccf85c 100644
--- a/pywikibot/pt-br.json
+++ b/pywikibot/pt-br.json
@@ -1,11 +1,11 @@
 {
"@metadata": {
"authors": [
+   555,
"Eduardo Addad de Oliveira",
"Eduardoaddad",
"Felipe L. Ewald",
-   "Giro720",
-   

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

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

Change subject: [doc] Update documentation
..

[doc] Update documentation

- remove 4th level sections in changelog to prevent sphinx section warnings
- remove "Roadmap" section and level up "Current release" and "Deprecations"
- add a new exlinks role ":source:" to link to Pywikibot's source on phab.
- use :source: in tests/README.rst to avoid references to recently removed
  test documentations.

Change-Id: Ic40ef5e8d875a7fa3046b52d47ee755d92201b4c
---
M HISTORY.rst
M ROADMAP.rst
M docs/changelog.rst
M docs/conf.py
M docs/tests_ref/index.rst
M tests/README.rst
M tox.ini
7 files changed, 81 insertions(+), 103 deletions(-)

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




diff --git a/HISTORY.rst b/HISTORY.rst
index 3135942..472eddc 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,4 +1,4 @@
-Release history
+Release History
 ===

 9.1.3
@@ -51,8 +51,7 @@
 -
 *08 March 2024*

-Improvements
-
+**Improvements**

 * Python 3.13 is supported
 * Update :mod:`tools`._unidata._category_cf from Unicodedata version 15.1.0
@@ -74,8 +73,7 @@
 * L10N and i18n updates
 * Add :class:`pagegenerators.PagePilePageGenerator` (:phab:`T353086`)

-Bugfixes
-
+**Bugfixes**

 * :meth:`Timestamp.now()` and
   :meth:`Timestamp.fromtimestamp()` 
also returns a
@@ -93,8 +91,7 @@
 * :func:`pywikibot.input_choice` validates *default* parameter 
(:phab:`T353097`)
 * Remove typing imports from user-config.py file (:phab:`T352965`)

-Breaking changes and code cleanups
-^^
+**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.
@@ -350,8 +347,7 @@
 -
 *21 January 2023*

-Improvements
-
+**Improvements**

 * Allow copying timezone from timestamp in :class:`pywikibot.WbTime` 
(:phab:`T325864`)
 * Support federated Wikibase (:phab:`T173195`)
@@ -390,8 +386,7 @@
 * Adjust subprocess args in :mod:`tools.djvu`
 * Short site value can be given if site code is equal to family like 
``-site:meta`` or ``-site:commons``

-Documentation improvements
-^^
+**Documentation improvements**

 * Add highlighting to targeted code snippet within documentation 
(:phab:`T323800`)
 * Add previous, next, index, and modules links to documentation sidebar 
(:phab:`T323803`)
@@ -400,8 +395,7 @@
 * Use ``Furo`` sphinx theme instead of ``Natural`` and improve documentation 
look and feel (:phab:`T322212`)
 * MediaWiki API cross reference was added to the documentation

-Bugfixes
-
+**Bugfixes**

 * Fix representation string for :class:`page.Claim` stub instances 
(:phab:`T326453`)
 * Don't raise StopIteration in :meth:`login.LoginManager.check_user_exists`
@@ -413,8 +407,7 @@
 * Fix disolving script_paths for site-package (:phab:`T320530`)
 * Respect limit argument with Board.topics() (:phab:`T138215`, :phab:`T138307`)

-Breaking changes
-
+**Breaking changes**

 * ``mwparserfromhell`` package is mandatory (:phab:`T326498`)
 * Several package dependencies were updated
@@ -430,8 +423,7 @@
 * Python 3.5 support was dropped (:phab:`T301908`)
 * *See also Code cleanups below*

-Code cleanups
-^
+**Code cleanups**

 * ``maintenance/sorting_order`` script was removed (:phab:`T325426`)
 * ``alphabetic_sv`` and ``interwiki_putfirst`` attributes of
@@ -649,8 +641,7 @@
 -
 *26 February 2022*

-Improvements
-
+**Improvements**

 * i18n updates for date.py
 * Add number transliteration of 'lo', 'ml', 'pa', 'te' to NON_LATIN_DIGITS
@@ -695,8 +686,7 @@
 * Adjust groupsize within pagegenerators.PreloadingGenerator (:phab:`T291770`)
 * New "maxlimit" property was added to APISite (:phab:`T291770`)

-Bugfixes
-
+**Bugfixes**

 * Don't raise an exception if BlockEntry initializer found a hidden title 
(:phab:`T78152`)
 * Fix KeyError in create_warnings_list (:phab:`T301610`)
@@ -716,16 +706,14 @@
 * Make site parameter of textlib.replace_links() mandatory (:phab:`T294649`)
 * Raise a generic ServerError if the http status code is unofficial 
(:phab:`T293208`)

-Breaking changes
-
+**Breaking changes**

 * Support of Python 3.5.0 - 3.5.2 has been dropped (:phab:`T286867`)
 * generate_user_files.py, generate_user_files.py, shell.py and version.py were 
moved to pywikibot/scripts and must be
   used with pwb wrapper script
 * *See also Code cleanups below*

-Code cleanups
-^
+**Code cleanups**

 * Deprecated  http.get_fake_user_agent() function was removed
 * FilePage.fileIsShared() was removed in favour of FilePage.file_is_shared()
@@ -894,8 +882,7 @@
 -
 *28 May 2021*

-Improvements and Bugfixes

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] remove code duplication in link_tests.py

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

Change subject: [tests] remove code duplication in link_tests.py
..

[tests] remove code duplication in link_tests.py

remove code duplication in TestFullyQualifiedNoLangFamilyExplicitLinkParser,
use subtest for Main, Talkpage variants.

Change-Id: Ieec523cd3e9b1eba3f2aa55a83031d715c9793c7
---
M tests/link_tests.py
1 file changed, 18 insertions(+), 30 deletions(-)

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




diff --git a/tests/link_tests.py b/tests/link_tests.py
index 2c753f9..5816fef 100755
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -506,37 +506,25 @@
 config.mylang = 'en'
 config.family = 'wikipedia'

-def test_fully_qualified_NS0_code(self):
-"""Test ':testwiki:wikidata:Q6' on enwp is namespace 0."""
-link = Link(':testwiki:wikidata:Q6')
-link.parse()
-self.assertEqual(link.site, self.get_site('wikidata'))
-self.assertEqual(link.title, 'Q6')
-self.assertEqual(link.namespace, 0)
+def test_fully_qualified_NS_code(self):
+"""Test ':testwiki:wikidata:Q6' on enwp."""
+for ns, title in enumerate(['Q6', 'Talk:Q6']):
+with self.subTest(title=title):
+link = Link(f':testwiki:wikidata:{title}')
+link.parse()
+self.assertEqual(link.site, self.get_site('wikidata'))
+self.assertEqual(link.title, 'Q6')
+self.assertEqual(link.namespace, ns)
 
-def test_fully_qualified_NS1_code(self):
-"""Test ':testwiki:wikidata:Talk:Q6' on enwp is namespace 1."""
-link = Link(':testwiki:wikidata:Talk:Q6')
-link.parse()
-self.assertEqual(link.site, self.get_site('wikidata'))
-self.assertEqual(link.title, 'Q6')
-self.assertEqual(link.namespace, 1)
-
-def test_fully_qualified_NS0_family(self):
-"""Test ':wikidata:testwiki:Q6' on enwp is namespace 0."""
-link = Link(':wikidata:testwiki:Q6')
-link.parse()
-self.assertEqual(link.site, self.get_site('test'))
-self.assertEqual(link.title, 'Q6')
-self.assertEqual(link.namespace, 0)
-
-def test_fully_qualified_NS1_family(self):
-"""Test ':wikidata:testwiki:Talk:Q6' on enwp is namespace 1."""
-link = Link(':wikidata:testwiki:Talk:Q6')
-link.parse()
-self.assertEqual(link.site, self.get_site('test'))
-self.assertEqual(link.title, 'Q6')
-self.assertEqual(link.namespace, 1)
+def test_fully_qualified_NS_family(self):
+"""Test ':wikidata:testwiki:Q6' on enwp."""
+for ns, title in enumerate(['Q6', 'Talk:Q6']):
+with self.subTest(title=title):
+link = Link(f':wikidata:testwiki:{title}')
+link.parse()
+self.assertEqual(link.site, self.get_site('test'))
+self.assertEqual(link.title, 'Q6')
+self.assertEqual(link.namespace, ns)


 class TestFullyQualifiedOneSiteFamilyExplicitLinkParser(LinkTestCase):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1037894?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: Ieec523cd3e9b1eba3f2aa55a83031d715c9793c7
Gerrit-Change-Number: 1037894
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] Remove superfluous assignment to config.family

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

Change subject: [tests] Remove superfluous assignment to config.family
..

[tests] Remove superfluous assignment to config.family

This is already done in setUp() method.

Change-Id: I102b14c4921f37b71f2d475ed17fc2325189387e
---
M tests/link_tests.py
1 file changed, 0 insertions(+), 1 deletion(-)

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




diff --git a/tests/link_tests.py b/tests/link_tests.py
index 05756fc..2c753f9 100755
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -524,7 +524,6 @@

 def test_fully_qualified_NS0_family(self):
 """Test ':wikidata:testwiki:Q6' on enwp is namespace 0."""
-config.family = 'wikipedia'
 link = Link(':wikidata:testwiki:Q6')
 link.parse()
 self.assertEqual(link.site, self.get_site('test'))

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1037893?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: I102b14c4921f37b71f2d475ed17fc2325189387e
Gerrit-Change-Number: 1037893
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] Do not create an option named None

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

Change subject: [bugfix] Do not create an option named None
..

[bugfix] Do not create an option named None

Bug: T366409
Change-Id: I3f37b5f220daecc45a6ff35f9aafc5e54733d4ff
---
M scripts/interwikidata.py
1 file changed, 5 insertions(+), 1 deletion(-)

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




diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py
index a20f72f..f31a66e 100755
--- a/scripts/interwikidata.py
+++ b/scripts/interwikidata.py
@@ -249,7 +249,11 @@
 options = {}
 for arg in local_args:
 option, _, value = arg.partition(':')
-option = option[1:] if option.startswith('-') else None
+if option.startswith('-'):
+option = option[1:]
+else:
+continue
+
 if option == 'summary':
 options[option] = value
 else:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1037892?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: I3f37b5f220daecc45a6ff35f9aafc5e54733d4ff
Gerrit-Change-Number: 1037892
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]: [Fix] Add namespaces parameter to BasePage.templates and itertemplates

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

Change subject: [Fix] Add namespaces parameter to BasePage.templates and 
itertemplates
..

[Fix] Add namespaces parameter to BasePage.templates and itertemplates

- add namespaces parameter to BasePage.templates() and require
  keyworded arguments. Retrieve all pages from API:Templates and filter
  namespace on return. Update documentation.
- add namespaces parameter to BasePage.itertemplates() and require
  keyworded arguments except for total (otherwise the positional
  arguments cannot be deprecated if the total will be the last argument
  later like in APISite.pagetemplates().
- only use pages in TEMPLATE namespaces within BasePage.isDisambig()
  because the other pages are also in that namespace. Use tempates()
  instead of itertemplates() here to cache. Use site method disambig()
  instead of Family.disambig(). Update documentations.
- Update documentation in APISite.pagetemplates(), reorder keyword
  parameters which are keyword only.
- use TEMPLATE namespace to get templates in Page.templatesWithParams
  because the namespace of the links to be compared is TEMPLATE too.
  Use itertemplates here because the result can be cached by the
  calling method. This solves T365199.
- use TEMPLATE namespace to get templates in commonscat.py and
  solve_disambiguation.py scripts because "real" templates are
  requuired here.
- update utils.DryParamInfo class for pg tests

Bug: T365199
Change-Id: I0e82e889039f3e9cbf36f5faf038331d8a17d3fe
---
M docs/api_ref/pywikibot.site.rst
M pywikibot/family.py
M pywikibot/page/_basepage.py
M pywikibot/page/_page.py
M pywikibot/site/_generators.py
M scripts/commonscat.py
M scripts/solve_disambiguation.py
M tests/utils.py
8 files changed, 129 insertions(+), 58 deletions(-)

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




diff --git a/docs/api_ref/pywikibot.site.rst b/docs/api_ref/pywikibot.site.rst
index 1380d73..347430b 100644
--- a/docs/api_ref/pywikibot.site.rst
+++ b/docs/api_ref/pywikibot.site.rst
@@ -61,12 +61,15 @@
  :rtype: tuple[str, ...]


-  .. method:: disambig(fallback: str = '_default')
+  .. method:: disambig(fallback = '_default')

  Return list of disambiguation templates.

  .. seealso:: :meth:`family.Family.disambig`

+ :param str | None fallback:
+ :rtype: list[str]
+

   .. method:: protocol()

diff --git a/pywikibot/family.py b/pywikibot/family.py
index 79042e7..22961fd 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -453,8 +453,11 @@
 """
 return self.archived_page_templates.get(code, ())

-def disambig(self, code, fallback: str = '_default'):
-"""Return list of disambiguation templates."""
+def disambig(self, code, fallback: str | None = '_default') -> list[str]:
+"""Return list of disambiguation templates.
+
+:raises KeyError: unknown title for disambig template
+"""
 if code in self.disambiguationTemplates:
 return self.disambiguationTemplates[code]

diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 61623b6..de45151 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -39,6 +39,7 @@
 ComparableMixin,
 cached,
 deprecated,
+deprecate_positionals,
 first_upper,
 issue_deprecation_warning,
 remove_last_args,
@@ -900,18 +901,19 @@
 return self.namespace() == Namespace.FILE

 def isDisambig(self) -> bool:
-"""
-Return True if this is a disambiguation page, False otherwise.
+"""Return True if this is a disambiguation page, False otherwise.

 By default, it uses the Disambiguator extension's result. The
-identification relies on the presence of the __DISAMBIG__ magic word
-which may also be transcluded.
+identification relies on the presence of the ``__DISAMBIG__``
+magic word which may also be transcluded.

-If the Disambiguator extension isn't activated for the given site,
-the identification relies on the presence of specific templates.
-First load a list of template names from the Family file;
-if the value in the Family file is None or no entry was made, look for
-the list on [[MediaWiki:Disambiguationspage]]. If this page does not
+If the Disambiguator extension isn't activated for the given
+site, the identification relies on the presence of specific
+templates. First load a list of template names from the
+:class:`Family` file via :meth:`BaseSite.disambig()
+`; if the value in
+the Family file not found, look for the list on
+``[[MediaWiki:Disambiguationspage]]``. If this page does not
 exist, take the MediaWiki message. 'Template:Disambig' is always
  

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

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

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

Localisation updates from https://translatewiki.net.

Change-Id: Icd674d489c8aaabb3be800195766e1dc0513f18d
---
M archivebot/bn.json
M checkimages/br.json
M replicate_wiki/br.json
M undelete/br.json
4 files changed, 14 insertions(+), 6 deletions(-)

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




diff --git a/archivebot/bn.json b/archivebot/bn.json
index cac05f7..4cf006a 100644
--- a/archivebot/bn.json
+++ b/archivebot/bn.json
@@ -5,6 +5,7 @@
"Al Riaz Uddin Ripon",
"Bellayet",
"Nasir8891",
+   "RiazACU",
"Tahmid",
"Tahmid02016",
"Xqt",
diff --git a/checkimages/br.json b/checkimages/br.json
index d5f91bc..196517c 100644
--- a/checkimages/br.json
+++ b/checkimages/br.json
@@ -2,14 +2,17 @@
"@metadata": {
"authors": [
"Adriendelucca",
-   "Fulup"
+   "Fulup",
+   "Huñvreüs"
]
},
"checkimages-deletion-comment": "Robot : Ouzhpennet %(adding)s",
"checkimages-doubles-file-comment": "Robot : emañ ar restr war Commons 
c'hoazh, gallout a ra bezañ diverket",
"checkimages-doubles-head": "Restr eilet",
"checkimages-doubles-talk-comment": "Robot : Kemmennadur emañ ar restr 
war Commons c'hoazh",
+   "checkimages-doubles-talk-text": "Trugarez deoc'h da vezañ pellgaset 
%(upload)s. Met un eilstumm a:%(image)s eo ar restr-mañ. Merket en deus ar 
robot ar restr implijet an nebeutañ pe an nevesañ evel un eilstumm. Ma kavit 
dereatoc’h lezel ar restr merket evel da vezañ diverket raktal, diverkit ar 
restroù eilet ha dilamit al patrom diverkañ diouzh an hini a chomo. Ur 
gemennadenn emgefre eus %(bot)s eo homañ.",
"checkimages-forced-mode": "('''mod forset''')",
+   "checkimages-has-duplicates": "en deus an eilvedadoù%(force)s da heul:",
"checkimages-log-comment": "Robot : o hizivaat ar marilh",
"checkimages-no-license-head": "Skeudenn hep aotre-implijout",
"checkimages-source-tag-comment": "Robot : o verkañ ar restroù hep 
tikedenn pellgarget nevez zo",
diff --git a/replicate_wiki/br.json b/replicate_wiki/br.json
index abf0985..5222f7c 100644
--- a/replicate_wiki/br.json
+++ b/replicate_wiki/br.json
@@ -1,10 +1,13 @@
 {
"@metadata": {
"authors": [
-   "Adriendelucca"
+   "Adriendelucca",
+   "Huñvreüs"
]
},
"replicate_wiki-headline": "Pajennoù disheñvel diouzh an hini orin",
+   "replicate_wiki-missing-users": "Merourien eus orin a vank amañ",
"replicate_wiki-same-pages": "An holl bajennoù a-bouez a zo heñvel",
+   "replicate_wiki-same-users": "Emañ an holl implijerien eus orin er 
wiki-mañ ivez",
"replicate_wiki-summary": "Robot: Goubredañ ar wiki diwar %(source)s"
 }
diff --git a/undelete/br.json b/undelete/br.json
index 6f88c6d..7866d90 100644
--- a/undelete/br.json
+++ b/undelete/br.json
@@ -2,10 +2,11 @@
"@metadata": {
"authors": [
"Adriendelucca",
-   "Gwenn-Ael"
+   "Gwenn-Ael",
+   "Huñvreüs"
]
},
-   "undelete-from-file": "Robot : nullañ dilamadur ul listennad pajennoù",
-   "undelete-images": "Robot : O nullañ dilamadur an holl skeudennoù diwar 
ar bajenn %(page)s",
-   "undelete-linked-pages": "Robot : O tiverkañ dilamadur an holl bajennoù 
liammet adalek %(page)s"
+   "undelete-from-file": "Robot : o tiziverkañ ur roll pajennoù",
+   "undelete-images": "Robot : O tiziverkañ an holl skeudennoù diwar ar 
bajenn %(page)s",
+   "undelete-linked-pages": "Robot : O tiziverkañ an holl bajennoù liammet 
adalek %(page)s"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1037519?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: Icd674d489c8aaabb3be800195766e1dc0513f18d
Gerrit-Change-Number: 1037519
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] ignore TestDjVuFile from coverage

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

Change subject: [tests] ignore TestDjVuFile from coverage
..

[tests] ignore TestDjVuFile from coverage

TestDjVuFile can only be runned if djvulibre library is installed locally

Change-Id: I88d5603cb9b05d07c143dffbb1380ab658df2892
---
M tests/djvu_tests.py
1 file changed, 41 insertions(+), 45 deletions(-)

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




diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py
index 1888b8d..8a021e5 100755
--- a/tests/djvu_tests.py
+++ b/tests/djvu_tests.py
@@ -42,69 +42,64 @@
   stderr=subprocess.PIPE)
 dp.communicate()

-def test_number_of_images(self):
-"""Test page number generator."""
-djvu = DjVuFile(file_djvu)
-self.assertEqual(djvu.number_of_images(), 4)
+def setUp(self):
+"""Set up test."""
+super().setUp()
+self.djvu = DjVuFile(file_djvu)

-def test_page_info(self):
+def test_number_of_images(self):  # pragma: no cover
+"""Test page number generator."""
+self.assertEqual(self.djvu.number_of_images(), 4)
+
+def test_page_info(self):  # pragma: no cover
 """Test page info retrieval."""
-djvu = DjVuFile(file_djvu)
-self.assertEqual(djvu.page_info(1),
+self.assertEqual(self.djvu.page_info(1),
  ('{myfile.djvu}', ('1092x221', 600)))

-def test_get_most_common_info(self):
+def test_get_most_common_info(self):  # pragma: no cover
 """Test that most common (size, dpi) are returned."""
-djvu = DjVuFile(file_djvu)
-self.assertEqual(djvu.get_most_common_info(), ('1092x221', 600))
+self.assertEqual(self.djvu.get_most_common_info(), ('1092x221', 600))

-def test_has_text(self):
+def test_has_text(self):  # pragma: no cover
 """Test if djvu file contains text."""
-djvu = DjVuFile(file_djvu)
-self.assertTrue(djvu.has_text())
+self.assertTrue(self.djvu.has_text())
 djvu = DjVuFile(self.file_djvu_wo_text)
 self.assertFalse(djvu.has_text())

-def test_get_existing_page_number(self):
+def test_get_existing_page_number(self):  # pragma: no cover
 """Test text is returned for existing page number."""
-djvu = DjVuFile(file_djvu)
-self.assertTrue(djvu.has_text())
-txt = djvu.get_page(1)
+self.assertTrue(self.djvu.has_text())
+txt = self.djvu.get_page(1)
 self.assertEqual(txt, self.test_txt)

-def test_get_not_existing_page_number(self):
+def test_get_not_existing_page_number(self):  # pragma: no cover
 """Test error is raised if djvu page number is out of range."""
-djvu = DjVuFile(file_djvu)
-self.assertTrue(djvu.has_text())
+self.assertTrue(self.djvu.has_text())
 with self.assertRaises(ValueError):
-djvu.get_page(100)
+self.djvu.get_page(100)

-def test_get_not_existing_page(self):
+def test_get_not_existing_page(self):  # pragma: no cover
 """Test error is raised if djvu file has no text."""
-djvu = DjVuFile(self.file_djvu_wo_text)
-self.assertFalse(djvu.has_text())
+self.assertFalse(self.djvu.has_text())
 with self.assertRaises(ValueError):
-djvu.get_page(1)
+self.djvu.get_page(1)

-def test_whiten_not_existing_page_number(self):
+def test_whiten_not_existing_page_number(self):  # pragma: no cover
 """Test djvu page cannot be whitend if page number is out of range."""
-djvu = DjVuFile(file_djvu)
 with self.assertRaises(ValueError):
-djvu.whiten_page(100)
+self.djvu.whiten_page(100)

-def test_delete_not_existing_page_number(self):
+def test_delete_not_existing_page_number(self):  # pragma: no cover
 """Test djvu page cannot be deleted if page number is out of range."""
-djvu = DjVuFile(file_djvu)
 with self.assertRaises(ValueError):
-djvu.delete_page(100)
+self.djvu.delete_page(100)

-def test_clear_cache(self):
+def test_clear_cache(self):  # pragma: no cover
 """Test if djvu file contains text."""
-djvu = DjVuFile(file_djvu)
-self.assertTrue(djvu.has_text())
-djvu._has_text = False
-self.assertFalse(djvu.has_text())
-self.assertTrue(djvu.has_text(force=True))
+self.assertTrue(self.djvu.has_text())
+self.djvu._has_text = False
+self.assertFalse(self.djvu.has_text())
+self.assertTrue(self.djvu.has_text(force=True))


 class TestDjVuFileWithoutLib(TestCase):
@@ -115,24 +110,25 @@

 file_djvu_not_existing = join_djvu_data_path('not_existing.djvu')

+def setUp(self):
+"""Set up test."""
+ 

[Pywikibot-commits] [Gerrit] ...core[master]: [cleanup] pheetools is no longer available upstreams

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

Change subject: [cleanup] pheetools is no longer available upstreams
..

[cleanup] pheetools is no longer available upstreams

- remove pheetools support
- check whether  ocr_tool is in _OCR_CMDS dict instead of _OCR_METHODS
  list
- new default of ocr_tool in ProofreadPage.ocr is wmfOCR now
- Do not show any deprecation warning, the pheetools fails anyway;
  just give some hints in the documentation of ocr method. Do not care
  about private methods.
- Update tests, remove tests for error condition because test is
  skipped anyway in this case.

Bug: T366036
Change-Id: I4eecee8a034ef889857071c82d27fcb5ca5b7db8
---
M pywikibot/proofreadpage.py
M tests/proofreadpage_tests.py
2 files changed, 52 insertions(+), 142 deletions(-)

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




diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 84d4e60..90e2a03 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -1,24 +1,13 @@
-"""
-Objects used with ProofreadPage Extension.
-
-This module includes objects:
-
-* ProofreadPage(Page)
-* FullHeader
-* IndexPage(Page)
-
+"""Objects used with ProofreadPage Extension.

 OCR support of page scans via:
-- https://phetools.toolforge.org/hocr_cgi.py
-- https://phetools.toolforge.org/ocr.php
-- inspired by https://en.wikisource.org/wiki/MediaWiki:Gadget-ocr.js

-- Wikimedia OCR
-- see: https://www.mediawiki.org/wiki/Help:Extension:Wikisource/Wikimedia_OCR
+- Wikimedia OCR, see:
+  https://www.mediawiki.org/wiki/Help:Extension:Wikisource/Wikimedia_OCR
+- https://ocr.wmcloud.org/, inspired by
+  https://wikisource.org/wiki/MediaWiki:GoogleOCR.js

-- https://ocr.wmcloud.org/
-- inspired by https://wikisource.org/wiki/MediaWiki:GoogleOCR.js
-- see also: https://wikisource.org/wiki/Wikisource:Google_OCR
+.. seealso:: https://wikisource.org/wiki/Wikisource:Google_OCR

 """
 #
@@ -421,13 +410,6 @@
 p_close = re.compile(r'(|\n\n\n)?')
 p_close_no_div = re.compile('')  # V2 page format.

-# phetools ocr utility
-_HOCR_CMD = ('https://phetools.toolforge.org/hocr_cgi.py?'
- 'cmd=hocr={book}={lang}={user}')
-
-_OCR_CMD = ('https://phetools.toolforge.org/ocr.php?'
-'cmd=ocr={url_image}={lang}={user}')
-
 # Wikimedia OCR utility
 _WMFOCR_CMD = ('https://ocr.wmcloud.org/api.php?engine=tesseract;'
'langs[]={lang}={url_image}={lang}')
@@ -438,14 +420,10 @@

 _MULTI_PAGE_EXT = ['djvu', 'pdf']

-_PHETOOLS = 'phetools'
 _WMFOCR = 'wmfOCR'
 _GOOGLE_OCR = 'googleOCR'
-_OCR_CMDS = {_PHETOOLS: _OCR_CMD,
- _WMFOCR: _WMFOCR_CMD,
- _GOOGLE_OCR: _GOCR_CMD,
- }
-_OCR_METHODS = list(_OCR_CMDS.keys())
+_OCR_CMDS = {_WMFOCR: _WMFOCR_CMD, _GOOGLE_OCR: _GOCR_CMD}
+_OCR_METHODS = list(_OCR_CMDS)

 def __init__(self, source: PageSourceType, title: str = '') -> None:
 """Instantiate a ProofreadPage object.
@@ -883,10 +861,12 @@

 return self._url_image_ge_140()

-def _ocr_callback(self, cmd_uri: str,
-  parser_func: Callable[[str], str] | None = None,
-  ocr_tool: str | None = None
-  ) -> tuple[bool, str | Exception]:
+def _ocr_callback(
+self,
+cmd_uri: str,
+parser_func: Callable[[str], str] | None = None,
+ocr_tool: str | None = None,
+) -> tuple[bool, str | Exception]:
 """OCR callback function.

 :return: tuple (error, text [error description in case of error]).
@@ -903,7 +883,7 @@
 if not callable(parser_func):
 raise TypeError('Keyword parser_func must be callable.')

-if ocr_tool not in self._OCR_METHODS:
+if ocr_tool not in self._OCR_CMDS:
 raise TypeError(
 f"ocr_tool must be in {self._OCR_METHODS}, not '{ocr_tool}'.")

@@ -931,54 +911,17 @@

 data = response.json()

-if ocr_tool == self._PHETOOLS:  # phetools
-assert 'error' in data, f'Error from phetools: {data}'
-assert data['error'] in [0, 1, 2, 3], \
-f'Error from phetools: {data}'
-error, _text = bool(data['error']), data['text']
-else:  # googleOCR
-if 'error' in data:
-error, _text = True, data['error']
-else:
-error, _text = False, data['text']
+if 'error' in data:
+error, _text = True, data['error']
+else:
+error, _text = False, data['text']

 if error:
 pywikibot.error(f'OCR query {cmd_uri}: {_text}')
 return error, _text
+
 return error, parser_func(_text)

-def _do_hocr(self) -> tuple[bool, str | Exception]:
-"""Do hocr 

[Pywikibot-commits] [Gerrit] ...core[master]: [cleanup] deactivate wait cycle for Page.main_authors()

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

Change subject: [cleanup] deactivate wait cycle for Page.main_authors()
..

[cleanup] deactivate wait cycle for Page.main_authors()

Bug: T366100
Change-Id: I3bf4e6e28ebd4b75f53469754be1d3329b026e4f
---
M pywikibot/page/_toolforge.py
1 file changed, 11 insertions(+), 9 deletions(-)

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




diff --git a/pywikibot/page/_toolforge.py b/pywikibot/page/_toolforge.py
index 37df61b..ebdf5b2 100644
--- a/pywikibot/page/_toolforge.py
+++ b/pywikibot/page/_toolforge.py
@@ -3,7 +3,7 @@
 .. versionadded:: 7.7
 """
 #
-# (C) Pywikibot team, 2022-2023
+# (C) Pywikibot team, 2022-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -62,19 +62,20 @@

 .. note:: Only implemented for main namespace pages.
 .. note:: Only wikipedias of :attr:`WIKIBLAME_CODES` are supported.
+.. attention:: This method does not return new results due to
+   :phab:`366100`.
 .. seealso::
- https://wikihistory.toolforge.org
- https://de.wikipedia.org/wiki/Wikipedia:Technik/Cloud/wikihistory

-:param onlynew: If False, use the cached values. If True,
-calculate the Counter data which can take some time; it may
-fail with TimeoutError after ``config.max_retries``. If None
-it calculates new data like for True but uses data from
-cache if new data cannot be calculated in meantime.
+.. versionchanged:: 9.2
+   do not use any wait cycles due to :phab:`366100`.
+
+:param onlynew: Currently meaningless
 :return: Number of edits for each username
 :raise NotImplementedError: unsupported site or unsupported namespace
 :raise pywikibot.exceptions.NoPageError: The page does not exist
-:raise pywikibot.exceptions.TimeoutError: Maximum retries exceeded
+:raise pywikibot.exceptions.TimeoutError: No cached results found
 """
 baseurl = 'https://wikihistory.toolforge.org'
 pattern = (r'>(?P.+?)\s'
@@ -97,10 +98,11 @@
 {user: int(cnt)
  for user, cnt in re.findall(pattern, r.text)})

+break  # T366100
+
 delay = pywikibot.config.retry_wait * 2 ** current_retries
 pywikibot.warning('WikiHistory timeout.\n'
-  'Waiting {:.1f} seconds before retrying.'
-  .format(delay))
+  f'Waiting {delay:.1f} seconds before retrying.')
 pywikibot.sleep(delay)
 if onlynew is None and current_retries >= config.max_retries - 2:
 url += '=1'

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1036734?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: I3bf4e6e28ebd4b75f53469754be1d3329b026e4f
Gerrit-Change-Number: 1036734
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.0d3] Follow-up for Pywikibot 9.1.3

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

Change subject: [9.2.0d3] Follow-up for Pywikibot 9.1.3
..

[9.2.0d3] Follow-up for Pywikibot 9.1.3

Change-Id: I58239fd83508fe852576a61b30f70106fefa17b5
---
M HISTORY.rst
M pywikibot/__metadata__.py
2 files changed, 8 insertions(+), 1 deletion(-)

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




diff --git a/HISTORY.rst b/HISTORY.rst
index f9cefb7..3135942 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,6 +1,13 @@
 Release history
 ===

+9.1.3
+-
+*28.05.2024*
+
+* Add support for dtpwiki (:phab:`T365232`)
+* i18n updates
+
 9.1.2
 -
 *03 May 2024*
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 362e90a..6e5a9d0 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
 from time import strftime


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

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1036669?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: I58239fd83508fe852576a61b30f70106fefa17b5
Gerrit-Change-Number: 1036669
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]: [9.1.3] Add support for dtpwiki and publish Pywikibot 9.1.3 stable

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

Change subject: [9.1.3] Add support for dtpwiki and publish Pywikibot 9.1.3 
stable
..

[9.1.3] Add support for dtpwiki and publish Pywikibot 9.1.3 stable

Signed-off-by: xqt 
Bug: T365232
Change-Id: I38f429f572debfab0d2871fdbfbcbbdefae19e3e
---
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
M pywikibot/families/wikipedia_family.py
M requirements.txt
M setup.py
M tests/paraminfo_tests.py
7 files changed, 44 insertions(+), 35 deletions(-)

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




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..c8fa63a 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,8 +1,7 @@
 Current release
 ---

-* Remove line endings in :func:`version.getversion_nightly` (:phab:`T363943`)
-* Provide ``-nouser`` option with :mod:`pywikibot.scripts.version`
+* Add support for dtpwiki (:phab:`T365232`)
 * i18n updates

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


-__version__ = '9.1.2'
+__version__ = '9.1.3'
 __url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
 __copyright__ = f'2003-{strftime("%Y")}, Pywikibot team'
diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index 9620473..531a61a 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -34,32 +34,32 @@
 'be', 'be-tarask', 'bew', 'bg', 'bh', 'bi', 'bjn', 'blk', 'bm', 'bn',
 'bo', 'bpy', 'br', 'bs', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ce',
 'ceb', 'ch', 'chr', 'chy', 'ckb', 'co', 'cr', 'crh', 'cs', 'csb', 'cu',
-'cv', 'cy', 'da', 'dag', 'de', 'dga', 'din', 'diq', 'dsb', 'dty', 'dv',
-'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 'et', 'eu', 'ext', 'fa',
-'fat', 'ff', 'fi', 'fiu-vro', 'fj', 'fo', 'fon', 'fr', 'frp', 'frr',
-'fur', 'fy', 'ga', 'gag', 'gan', 'gcr', 'gd', 'gl', 'glk', 'gn', 'gom',
-'gor', 'got', 'gpe', 'gu', 'guc', 'gur', 'guw', 'gv', 'ha', 'hak',
-'haw', 'he', 'hi', 'hif', 'hr', 'hsb', 'ht', 'hu', 'hy', 'hyw', 'ia',
-'id', 'ie', 'ig', 'igl', 'ik', 'ilo', 'inh', 'io', 'is', 'it', 'iu',
-'ja', 'jam', 'jbo', 'jv', 'ka', 'kaa', 'kab', 'kbd', 'kbp', 'kcg',
-'kg', 'ki', 'kk', 'kl', 'km', 'kn', 'ko', 'koi', 'krc', 'ks', 'ksh',
-'ku', 'kus', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe', 'lez', 'lfn',
-'lg', 'li', 'lij', 'lld', 'lmo', 'ln', 'lo', 'lt', 'ltg', 'lv', 'mad',
-'mai', 'map-bms', 'mdf', 'mg', 'mhr', 'mi', 'min', 'mk', 'ml', 'mn',
-'mni', 'mnw', 'mr', 'mrj', 'ms', 'mt', 'mwl', 'my', 'myv', 'mzn',
-'nah', 'nap', 'nds', 'nds-nl', 'ne', 'new', 'nia', 'nl', 'nn', 'no',
-'nov', 'nqo', 'nrm', 'nso', 'nv', 'ny', 'oc', 'olo', 'om', 'or', 'os',
-'pa', 'pag', 'pam', 'pap', 'pcd', 'pcm', 'pdc', 'pfl', 'pi', 'pih',
-'pl', 'pms', 'pnb', 'pnt', 'ps', 'pt', 'pwn', 'qu', 'rm', 'rmy', 'rn',
-'ro', 'roa-rup', 'roa-tara', 'ru', 'rue', 'rw', 'sa', 'sah', 'sat',
-'sc', 'scn', 'sco', 'sd', 'se', 'sg', 'sh', 'shi', 'shn', 'si',
-'simple', 'sk', 'skr', 'sl', 'sm', 'smn', 'sn', 'so', 'sq', 'sr',
-'srn', 'ss', 'st', 'stq', 'su', 'sv', 'sw', 'szl', 'szy', 'ta', 'tay',
-'tcy', 'te', 'tet', 'tg', 'th', 'ti', 'tk', 'tl', 'tly', 'tn', 'to',
-'tpi', 'tr', 'trv', 'ts', 'tt', 'tum', 'tw', 'ty', 'tyv', 'udm', 'ug',
-'uk', 'ur', 'uz', 've', 'vec', 'vep', 'vi', 'vls', 'vo', 'wa', 'war',
-'wo', 'wuu', 'xal', 'xh', 'xmf', 'yi', 'yo', 'za', 'zea', 'zgh', 'zh',
-'zh-classical', 'zh-min-nan', 'zh-yue', 'zu',
+'cv', 'cy', 'da', 'dag', 'de', 'dga', 'din', 'diq', 'dsb', 'dtp',
+'dty', 'dv', 'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 'et', 'eu',
+'ext', 'fa', 'fat', 'ff', 'fi', 'fiu-vro', 'fj', 'fo', 'fon', 'fr',
+'frp', 'frr', 'fur', 'fy', 'ga', 'gag', 'gan', 'gcr', 'gd', 'gl',
+'glk', 'gn', 'gom', 'gor', 'got', 'gpe', 'gu', 'guc', 'gur', 'guw',
+'gv', 'ha', 'hak', 'haw', 'he', 'hi', 'hif', 'hr', 'hsb', 'ht', 'hu',
+'hy', 'hyw', 'ia', 'id', 'ie', 'ig', 'igl', 'ik', 'ilo', 'inh', 'io',
+'is', 'it', 'iu', 'ja', 'jam', 'jbo', 'jv', 'ka', 'kaa', 'kab', 'kbd',
+'kbp', 'kcg', 'kg', 'ki', 'kk', 'kl', 'km', 

[Pywikibot-commits] [Gerrit] ...core[master]: Add support for dtpwiki

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

Change subject: Add support for dtpwiki
..

Add support for dtpwiki

Bug: T365232
Change-Id: I69af1cbab956be6ae9a95ec5ed91533214375c5d
---
M pywikibot/families/wikipedia_family.py
1 file changed, 26 insertions(+), 26 deletions(-)

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




diff --git a/pywikibot/families/wikipedia_family.py 
b/pywikibot/families/wikipedia_family.py
index 9620473..531a61a 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -34,32 +34,32 @@
 'be', 'be-tarask', 'bew', 'bg', 'bh', 'bi', 'bjn', 'blk', 'bm', 'bn',
 'bo', 'bpy', 'br', 'bs', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ce',
 'ceb', 'ch', 'chr', 'chy', 'ckb', 'co', 'cr', 'crh', 'cs', 'csb', 'cu',
-'cv', 'cy', 'da', 'dag', 'de', 'dga', 'din', 'diq', 'dsb', 'dty', 'dv',
-'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 'et', 'eu', 'ext', 'fa',
-'fat', 'ff', 'fi', 'fiu-vro', 'fj', 'fo', 'fon', 'fr', 'frp', 'frr',
-'fur', 'fy', 'ga', 'gag', 'gan', 'gcr', 'gd', 'gl', 'glk', 'gn', 'gom',
-'gor', 'got', 'gpe', 'gu', 'guc', 'gur', 'guw', 'gv', 'ha', 'hak',
-'haw', 'he', 'hi', 'hif', 'hr', 'hsb', 'ht', 'hu', 'hy', 'hyw', 'ia',
-'id', 'ie', 'ig', 'igl', 'ik', 'ilo', 'inh', 'io', 'is', 'it', 'iu',
-'ja', 'jam', 'jbo', 'jv', 'ka', 'kaa', 'kab', 'kbd', 'kbp', 'kcg',
-'kg', 'ki', 'kk', 'kl', 'km', 'kn', 'ko', 'koi', 'krc', 'ks', 'ksh',
-'ku', 'kus', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe', 'lez', 'lfn',
-'lg', 'li', 'lij', 'lld', 'lmo', 'ln', 'lo', 'lt', 'ltg', 'lv', 'mad',
-'mai', 'map-bms', 'mdf', 'mg', 'mhr', 'mi', 'min', 'mk', 'ml', 'mn',
-'mni', 'mnw', 'mr', 'mrj', 'ms', 'mt', 'mwl', 'my', 'myv', 'mzn',
-'nah', 'nap', 'nds', 'nds-nl', 'ne', 'new', 'nia', 'nl', 'nn', 'no',
-'nov', 'nqo', 'nrm', 'nso', 'nv', 'ny', 'oc', 'olo', 'om', 'or', 'os',
-'pa', 'pag', 'pam', 'pap', 'pcd', 'pcm', 'pdc', 'pfl', 'pi', 'pih',
-'pl', 'pms', 'pnb', 'pnt', 'ps', 'pt', 'pwn', 'qu', 'rm', 'rmy', 'rn',
-'ro', 'roa-rup', 'roa-tara', 'ru', 'rue', 'rw', 'sa', 'sah', 'sat',
-'sc', 'scn', 'sco', 'sd', 'se', 'sg', 'sh', 'shi', 'shn', 'si',
-'simple', 'sk', 'skr', 'sl', 'sm', 'smn', 'sn', 'so', 'sq', 'sr',
-'srn', 'ss', 'st', 'stq', 'su', 'sv', 'sw', 'szl', 'szy', 'ta', 'tay',
-'tcy', 'te', 'tet', 'tg', 'th', 'ti', 'tk', 'tl', 'tly', 'tn', 'to',
-'tpi', 'tr', 'trv', 'ts', 'tt', 'tum', 'tw', 'ty', 'tyv', 'udm', 'ug',
-'uk', 'ur', 'uz', 've', 'vec', 'vep', 'vi', 'vls', 'vo', 'wa', 'war',
-'wo', 'wuu', 'xal', 'xh', 'xmf', 'yi', 'yo', 'za', 'zea', 'zgh', 'zh',
-'zh-classical', 'zh-min-nan', 'zh-yue', 'zu',
+'cv', 'cy', 'da', 'dag', 'de', 'dga', 'din', 'diq', 'dsb', 'dtp',
+'dty', 'dv', 'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 'et', 'eu',
+'ext', 'fa', 'fat', 'ff', 'fi', 'fiu-vro', 'fj', 'fo', 'fon', 'fr',
+'frp', 'frr', 'fur', 'fy', 'ga', 'gag', 'gan', 'gcr', 'gd', 'gl',
+'glk', 'gn', 'gom', 'gor', 'got', 'gpe', 'gu', 'guc', 'gur', 'guw',
+'gv', 'ha', 'hak', 'haw', 'he', 'hi', 'hif', 'hr', 'hsb', 'ht', 'hu',
+'hy', 'hyw', 'ia', 'id', 'ie', 'ig', 'igl', 'ik', 'ilo', 'inh', 'io',
+'is', 'it', 'iu', 'ja', 'jam', 'jbo', 'jv', 'ka', 'kaa', 'kab', 'kbd',
+'kbp', 'kcg', 'kg', 'ki', 'kk', 'kl', 'km', 'kn', 'ko', 'koi', 'krc',
+'ks', 'ksh', 'ku', 'kus', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe',
+'lez', 'lfn', 'lg', 'li', 'lij', 'lld', 'lmo', 'ln', 'lo', 'lt',
+'ltg', 'lv', 'mad', 'mai', 'map-bms', 'mdf', 'mg', 'mhr', 'mi', 'min',
+'mk', 'ml', 'mn', 'mni', 'mnw', 'mr', 'mrj', 'ms', 'mt', 'mwl', 'my',
+'myv', 'mzn', 'nah', 'nap', 'nds', 'nds-nl', 'ne', 'new', 'nia', 'nl',
+'nn', 'no', 'nov', 'nqo', 'nrm', 'nso', 'nv', 'ny', 'oc', 'olo', 'om',
+'or', 'os', 'pa', 'pag', 'pam', 'pap', 'pcd', 'pcm', 'pdc', 'pfl',
+'pi', 'pih', 'pl', 'pms', 'pnb', 'pnt', 'ps', 'pt', 'pwn', 'qu', 'rm',
+'rmy', 'rn', 'ro', 'roa-rup', 'roa-tara', 'ru', 'rue', 'rw', 'sa',
+'sah', 'sat', 'sc', 'scn', 'sco', 'sd', 'se', 'sg', 'sh', 'shi',
+'shn', 'si', 'simple', 'sk', 'skr', 'sl', 'sm', 'smn', 'sn', 'so',
+'sq', 'sr', 'srn', 'ss', 'st', 'stq', 'su', 'sv', 'sw', 'szl', 'szy',
+'ta', 'tay', 'tcy', 'te', 'tet', 'tg', 'th', 'ti', 'tk', 'tl', 'tly',
+'tn', 'to', 'tpi', 'tr', 'trv', 'ts', 'tt', 'tum', 'tw', 'ty', 'tyv',
+'udm', 'ug', 'uk', 'ur', 'uz', 've', 'vec', 'vep', 'vi', 'vls', 'vo',
+'wa', 'war', 'wo', 'wuu', 'xal', 'xh', 'xmf', 'yi', 'yo', 'za', 'zea',
+'zgh', 'zh', 'zh-classical', 'zh-min-nan', 'zh-yue', 'zu',
 }

 # 

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

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

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

Localisation updates from https://translatewiki.net.

Change-Id: I37317b35c2dece3d48a0482ab484658f6ec33984
---
M category/zh.json
1 file changed, 2 insertions(+), 1 deletion(-)

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




diff --git a/category/zh.json b/category/zh.json
index 78ee627..dec1273 100644
--- a/category/zh.json
+++ b/category/zh.json
@@ -4,6 +4,7 @@
"A Chinese Wikipedian",
"Anakmalaysia",
"Hehua",
+   "LittlePaw365",
"Liuxinyu970226",
"Shizhao",
"StarrySky",
@@ -22,7 +23,7 @@
"category-section-title": "之前%(oldcat)s的页面历史",
"category-strip-cfd-templates": "机器人:完成操作时移除CFD模板",
"category-strip-sort-keys": "机器人:删除已完成动作的排序键",
-   "category-strip-both": "机器人:删除CFD模板并为完成的操作排序关键字",
+   "category-strip-both": "机器人:删除已完成操作的CFD模板和排序键",
"category-version-history": "机器人:保存之前%(oldcat)s的历史版本记录",
"category-was-disbanded": "机器人:分类已被解散",
"category-was-moved": "机器人:移动分类至[[:Category:%(newcat)s|%(title)s]]"

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1036253?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: I37317b35c2dece3d48a0482ab484658f6ec33984
Gerrit-Change-Number: 1036253
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]: Fix some spelling mistakes

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

Change subject: Fix some spelling mistakes
..

Fix some spelling mistakes

Change-Id: If6060f720f46ae71a426be01679e78f683174752
---
M pywikibot/date.py
M tests/file_tests.py
2 files changed, 4 insertions(+), 4 deletions(-)

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




diff --git a/pywikibot/date.py b/pywikibot/date.py
index 09d7caf..ef12fff 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -708,7 +708,7 @@


 def _en_period(period: str):
-"""Create century and millenium format function for ``en`` language."""
+"""Create century and millennium format function for ``en`` language."""
 return lambda m: multi(m, [
 (lambda v: dh_centuryAD(v, '%dst ' + period),
  lambda p: p == 1 or (p > 20 and p % 10 == 1)),
@@ -720,7 +720,7 @@


 def _period_with_pattern(period: str, pattern: str):
-"""Create century and millenium format function with pattern."""
+"""Create century and millennium format function with pattern."""
 return lambda m: multi(m, [
 (lambda v: dh_constVal(v, 1, period), lambda p: p == 1),
 (lambda v: dh(v, pattern, lambda i: i - 1, lambda ii: ii[0] + 1),
diff --git a/tests/file_tests.py b/tests/file_tests.py
index f411ca4..f55d73c 100755
--- a/tests/file_tests.py
+++ b/tests/file_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """FilePage tests."""
 #
-# (C) Pywikibot team, 2014-2023
+# (C) Pywikibot team, 2014-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -259,7 +259,7 @@
 self.assertEqual(self.image.latest_file_info.thumbwidth, 100)
 self.assertEqual(self.image.latest_file_info.thumbheight, 133)

-def test_get_file_url_thumburl_from_heigth(self):
+def test_get_file_url_thumburl_from_height(self):
 """Get File thumburl from height."""
 self.assertTrue(self.image.exists())
 # url_param has no precedence over height/width.

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1036094?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: If6060f720f46ae71a426be01679e78f683174752
Gerrit-Change-Number: 1036094
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]: fix spelling mistake

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

Change subject: fix spelling mistake
..

fix spelling mistake

Change-Id: Ia9ce6ad48236d0b7f4c39e832aafac104740e05d
Signed-off-by: Xqt 
---
M pywikibot/page/_basepage.py
1 file changed, 1 insertion(+), 1 deletion(-)

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




diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 61623b6..62083fd 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -673,7 +673,7 @@
 if sentences:
 raise NotImplementedError(
 "'wiki' variant of extract method does not support "
-"'sencence' parameter")
+"'sentences' parameter")

 extract = self.text[:]
 if intro:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035663?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: Ia9ce6ad48236d0b7f4c39e832aafac104740e05d
Gerrit-Change-Number: 1035663
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]: [tests] OAuthEditTest.test_edit may fail with EditConflictError

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

Change subject: [tests] OAuthEditTest.test_edit may fail with EditConflictError
..

[tests] OAuthEditTest.test_edit may fail with EditConflictError

Just test this case.

Change-Id: I09ace300dded8f94ee1c55ce1c08b8e99618c355
---
M tests/oauth_tests.py
1 file changed, 12 insertions(+), 8 deletions(-)

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




diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py
index 836b91a..6a7cc5e 100755
--- a/tests/oauth_tests.py
+++ b/tests/oauth_tests.py
@@ -13,6 +13,7 @@

 import pywikibot
 from pywikibot import config
+from pywikibot.exceptions import EditConflictError
 from pywikibot.login import OauthLoginManager
 from tests.aspects import (
 DefaultSiteTestCase,
@@ -74,15 +75,18 @@
 """Test editing to a page."""
 self.site.login()
 self.assertTrue(self.site.logged_in())
+title = f'User:{self.site.username()}/edit test'
 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))
+p = pywikibot.Page(self.site, title)
+try:
+p.site.editpage(p, appendtext=ts)
+except EditConflictError as e:
+self.assertEqual(e.page, p)
+else:
+revision_id = p.latest_revision_id
+p = pywikibot.Page(self.site, title)
+self.assertEqual(revision_id, p.latest_revision_id)
+self.assertTrue(p.text.endswith(ts))

 
 class TestOauthLoginManger(DefaultSiteTestCase, OAuthSiteTestCase):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035891?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: I09ace300dded8f94ee1c55ce1c08b8e99618c355
Gerrit-Change-Number: 1035891
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] rename environment variable PYWIKIBOT_LOGIN_LOGOUT

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

Change subject: [tests] rename environment variable PYWIKIBOT_LOGIN_LOGOUT
..

[tests] rename environment variable PYWIKIBOT_LOGIN_LOGOUT

rename environment variable PYWIKIBOT_LOGIN_LOGOUT to
PYWIKIBOT_TEST_LOGOUT to be consistent with other test environment
variables. Also add documentation to tests/README.rst.

Change-Id: I4ae5e7ed216aee0023f6270fa918dcbbd93db722
---
M .github/workflows/login_tests-ci.yml
M tests/README.rst
M tests/site_login_logout_tests.py
3 files changed, 14 insertions(+), 4 deletions(-)

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




diff --git a/.github/workflows/login_tests-ci.yml 
b/.github/workflows/login_tests-ci.yml
index bc718bc..dc1de99 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -10,8 +10,8 @@

 env:
   PYWIKIBOT_TEST_RUNNING: 1
+  PYWIKIBOT_TEST_LOGOUT: 1
   PYWIKIBOT_USERNAME: Pywikibot-test
-  PYWIKIBOT_LOGIN_LOGOUT: 1

 jobs:
   build:
diff --git a/tests/README.rst b/tests/README.rst
index e6880d0..a6f1265 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -105,6 +105,16 @@

 PYWIKIBOT_TEST_GUI=1

+**PYWIKIBOT_TEST_LOGOUT**
+  Used when a test is logging out the test user. This environment variable
+  enables :mod:`tests.site_login_logout_tests`. The environment setting is
+  needed to ensure that these tests run in their own test action and does not
+  interfere with other tests. Otherwise they could fail if the test user is
+  logged out by the test. Only one instance must run this test script. Set this
+  environment variable to run this test locally::
+
+PYWIKIBOT_TEST_LOGOUT=1
+
 **PYWIKIBOT_TEST_MODULES**
   Only run tests given with this environment variable. Multiple tests must be
   separated by a ``,`` without any white space. Available library tests are
diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py
index 18e0072..c4805c8 100755
--- a/tests/site_login_logout_tests.py
+++ b/tests/site_login_logout_tests.py
@@ -6,7 +6,7 @@
 to fail.
 """
 #
-# (C) Pywikibot team, 2022-2023
+# (C) Pywikibot team, 2022-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -82,8 +82,8 @@


 def setUpModule():
-"""Skip tests if PYWIKIBOT_LOGIN_LOGOUT variable is not set."""
-if os.environ.get('PYWIKIBOT_LOGIN_LOGOUT', '0') != '1':
+"""Skip tests if PYWIKIBOT_TEST_LOGOUT variable is not set."""
+if os.environ.get('PYWIKIBOT_TEST_LOGOUT', '0') != '1':
 raise unittest.SkipTest('login/logout tests are disabled')



--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035889?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: I4ae5e7ed216aee0023f6270fa918dcbbd93db722
Gerrit-Change-Number: 1035889
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]: Revert "[IMPR] use CachedRequest for userinfo requests"

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

Change subject: Revert "[IMPR] use CachedRequest for userinfo requests"
..

Revert "[IMPR] use CachedRequest for userinfo requests"

This reverts commit 07adfba14c901e46a4c794c3b4f5ad673a7f7885.

Bug: T348925
Bug: T365942
Change-Id: Ie8e34ff2678d5f548b05b796895dc3264689f45b
---
M ROADMAP.rst
M pywikibot/config.py
M pywikibot/site/_apisite.py
3 files changed, 5 insertions(+), 15 deletions(-)

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index e42e037..30a077d 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,6 @@
 Current release
 ---

-* Use :class:`data.api.CachedRequest` for userinfo requests (:phab:`T348925`)
 * Raise :exc:`exceptions.SectionError` if a section does not exists on a page 
(:phab:`T107141`)
 * Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)

diff --git a/pywikibot/config.py b/pywikibot/config.py
index b2f20fb..7f12bcc 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -175,8 +175,6 @@
 site_interface = 'APISite'
 # number of days to cache namespaces, api configuration, etc.
 API_config_expiry = 30
-# userinfo expiry
-API_uinfo_expiry = 1

 # The maximum number of bytes which uses a GET request, if not positive
 # it'll always use POST requests
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 0fe76de..729a7ec 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -648,10 +648,6 @@
 .. seealso:: :api:`Userinfo`
 .. versionchanged:: 8.0
Use API formatversion 2.
-.. versionchanged:: 9.2
-   API call is made through :class:`data.api.CachedRequest` with
-   expiry is set in ``API_uinfo_expiry`` within
-   :ref:`Account settings`.

 :return: A dict with the following keys and values:

@@ -665,14 +661,11 @@

 """
 if not hasattr(self, '_userinfo'):
-uirequest = self._request(
-expiry=pywikibot.config.API_uinfo_expiry,
-parameters={
-'action': 'query',
-'meta': 'userinfo',
-'uiprop': 'blockinfo|hasmsg|groups|rights|ratelimits',
-'formatversion': 2,
-}
+uirequest = self.simple_request(
+action='query',
+meta='userinfo',
+uiprop='blockinfo|hasmsg|groups|rights|ratelimits',
+formatversion=2,
 )
 uidata = uirequest.submit()
 assert 'query' in uidata, \

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035864?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: Ie8e34ff2678d5f548b05b796895dc3264689f45b
Gerrit-Change-Number: 1035864
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 'entity-schema' to unsupported entities

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

Change subject: [tests] Add 'entity-schema' to unsupported entities
..

[tests] Add 'entity-schema' to unsupported entities

paraminfo_tests.WikibaseKnownTypesTests.test_entities fails on
wpbeta and wsbeta

Change-Id: I72348c9a7f6afce27f506f3a958eda3e4e8d10e8
---
M tests/paraminfo_tests.py
1 file changed, 2 insertions(+), 2 deletions(-)

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




diff --git a/tests/paraminfo_tests.py b/tests/paraminfo_tests.py
index fd5f183..7c2c03b 100755
--- a/tests/paraminfo_tests.py
+++ b/tests/paraminfo_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Test confirming paraminfo contains expected values."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -216,7 +216,7 @@

 def test_entities(self):
 """Test known entities."""
-unsupported = {'form', 'lexeme', 'sense'}  # T195435
+unsupported = {'entity-schema', 'form', 'lexeme', 'sense'}  # T195435
 supported = {'item', 'property'}
 known = supported | unsupported
 self._check_param_superset(

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035857?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: I72348c9a7f6afce27f506f3a958eda3e4e8d10e8
Gerrit-Change-Number: 1035857
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-05-25 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035856?usp=email )

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

[doc] Update ROADMAP.rst

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

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index d1ef503..e42e037 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,13 +1,14 @@
 Current release
 ---

+* Use :class:`data.api.CachedRequest` for userinfo requests (:phab:`T348925`)
 * Raise :exc:`exceptions.SectionError` if a section does not exists on a page 
(:phab:`T107141`)
 * Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)

 Deprecations
 

-* 9.2.0: *total* argument in ``-logevents`` pagegenrators option is deprecated;
+* 9.2.0: *total* argument in ``-logevents`` pagegenerators option is 
deprecated;
   use ``-limit`` instead (:phab:`T128981`)
 * 9.0.0: The *content* parameter of :meth:`proofreadpage.IndexPage.page_gen` 
is deprecated and will be ignored
   (:phab:`T358635`)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035856?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: I15e336058996b0aeca8e7b978416592920afc702
Gerrit-Change-Number: 1035856
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] use CachedRequest for userinfo requests

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

Change subject: [IMPR] use CachedRequest for userinfo requests
..

[IMPR] use CachedRequest for userinfo requests

The expiry for userinfo is set to 1 day and can be changed within
user-config.py file. The second call for the same userinfo is upto
50 times faster.

Also create the site within its own worker thread. Now preload_sites.py
is up to 90 times faster than before and only half as fast than pwb 8.

Bug: T348925
Change-Id: I2bc6c375ee9b676e0a40a372362f37ee4a61ced8
---
M pywikibot/config.py
M pywikibot/scripts/preload_sites.py
M pywikibot/site/_apisite.py
3 files changed, 35 insertions(+), 12 deletions(-)

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




diff --git a/pywikibot/config.py b/pywikibot/config.py
index 7f12bcc..b2f20fb 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -175,6 +175,8 @@
 site_interface = 'APISite'
 # number of days to cache namespaces, api configuration, etc.
 API_config_expiry = 30
+# userinfo expiry
+API_uinfo_expiry = 1

 # The maximum number of bytes which uses a GET request, if not positive
 # it'll always use POST requests
diff --git a/pywikibot/scripts/preload_sites.py 
b/pywikibot/scripts/preload_sites.py
index 8ff7d57..27a31f7 100755
--- a/pywikibot/scripts/preload_sites.py
+++ b/pywikibot/scripts/preload_sites.py
@@ -6,13 +6,18 @@
 -worker: The number of parallel tasks to be run. Default is the
   number of processors on the machine

-Usage::
+**Usage:**

 python pwb.py preload_sites [{}] [-worker:{}]

-To force preloading, change the global expiry value to 0::
+To force preloading, change the global expiry values to 0:

-python pwb.py -API_config_expiry:0 preload_sites [{}]
+python pwb.py -API_config_expiry:0 -API_uinfo_expiry:0 \
+preload_sites [{}]
+
+or run the :mod:`cache` script previeously:
+
+python pwb.py cache -delete

 .. versionchanged:: 7.4
script was moved to the framework scripts folder.
@@ -57,7 +62,17 @@


 def preload_family(family: str, executor: ThreadPoolExecutor) -> None:
-"""Preload all sites of a single family file."""
+"""Preload all sites of a single family file.
+
+.. versionchanged:: 9.2
+   use a separate worker thread for each site.
+"""
+
+def create_page(code, family):
+"""Preload siteinfo and userinfo."""
+site = pywikibot.Site(code, family)
+pywikibot.Page(site, 'Main Page')
+
 msg = 'Preloading sites of {} family{}'
 pywikibot.info(msg.format(family, '...'))

@@ -65,14 +80,13 @@
 for code in exceptions.get(family, []):
 if code in codes:
 codes.remove(code)
+
 obsolete = Family.load(family).obsolete

 futures = set()
 for code in codes:
 if code not in obsolete:
-site = pywikibot.Site(code, family)
-# page title does not care
-futures.add(executor.submit(pywikibot.Page, site, 'Main page'))
+futures.add(executor.submit(create_page, code, family))
 wait(futures)
 pywikibot.info(msg.format(family, ' completed.'))

diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 729a7ec..0fe76de 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -648,6 +648,10 @@
 .. seealso:: :api:`Userinfo`
 .. versionchanged:: 8.0
Use API formatversion 2.
+.. versionchanged:: 9.2
+   API call is made through :class:`data.api.CachedRequest` with
+   expiry is set in ``API_uinfo_expiry`` within
+   :ref:`Account settings`.

 :return: A dict with the following keys and values:

@@ -661,11 +665,14 @@

 """
 if not hasattr(self, '_userinfo'):
-uirequest = self.simple_request(
-action='query',
-meta='userinfo',
-uiprop='blockinfo|hasmsg|groups|rights|ratelimits',
-formatversion=2,
+uirequest = self._request(
+expiry=pywikibot.config.API_uinfo_expiry,
+parameters={
+'action': 'query',
+'meta': 'userinfo',
+'uiprop': 'blockinfo|hasmsg|groups|rights|ratelimits',
+'formatversion': 2,
+}
 )
 uidata = uirequest.submit()
 assert 'query' in uidata, \

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

[Pywikibot-commits] [Gerrit] ...core[master]: [cleanup] remove arguments cleanup introduced with pwb 6.0.0

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

Change subject: [cleanup] remove arguments cleanup introduced with pwb 6.0.0
..

[cleanup] remove arguments cleanup introduced with pwb 6.0.0

Change-Id: I1ccc08b60e126397377707569cb31040bd9697cd
---
M scripts/solve_disambiguation.py
1 file changed, 4 insertions(+), 74 deletions(-)

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




diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index ac7f4ad..26c1dae 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -75,7 +75,7 @@

 """
 #
-# (C) Pywikibot team, 2003-2023
+# (C) Pywikibot team, 2003-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -107,7 +107,7 @@
 NoPageError,
 PageSaveRelatedError,
 )
-from pywikibot.tools import first_lower, first_upper, issue_deprecation_warning
+from pywikibot.tools import first_lower, first_upper
 from pywikibot.tools.formatter import SequenceOutputter


@@ -610,7 +610,7 @@
 }

 # refer -help message for complete options documentation
-disambig_options = {
+available_options = {
 'always': None,  # always perform the same action
 'pos': [],  # add possibilities as alternative disambig
 'just': True,  # just and only use the possibilities given with command
@@ -621,83 +621,13 @@
 'min': 0,  # minimum number of pages on a disambig
 }

-# needed for argument cleanup
-available_options = disambig_options
-
 def __init__(self, *args, **kwargs) -> None:
 """Initializer."""
-self._clean_args(args, kwargs)
-super().__init__(**kwargs)
+super().__init__(*args, **kwargs)
 self.ignores = set()
 self.summary = None
 self.dn_template_str = i18n.translate(self.site, dn_template)

-def _clean_args(self, args, kwargs) -> None:
-"""Cleanup positional and keyword arguments.
-
-Replace positional arguments with keyword arguments.
-Replace old keywords with new keywords which are given by
-argument handling.
-
-This also fixes arguments which aren't currently used by
-BaseDisambigBot abstract class but was introduced for the old
-DisambiguationRobot to prevent multiple deprecation warnings.
-"""
-# New keys of positional arguments
-keys = ('always', 'pos', 'just', 'dnskip', 'generator', 'primary',
-'main', 'first', 'min')
-
-# Keys mapping from old argument name to new keywords.
-# The ordering of dics is not safe for Python < 3.7. Therefore
-# we need a dict in addition to key above.
-keymap = {
-'alternatives': 'pos',
-'getAlternatives': 'just',
-'dnSkip': 'dnskip',
-'main_only': 'main',
-'first_only': 'first',
-'minimum': 'min',
-}
-
-# Replace positional arguments with keyword arguments
-for i, arg in enumerate(args):
-key = keys[i]
-issue_deprecation_warning(
-f'Positional argument {i + 1} ({arg})',
-f'keyword argument "{key}={arg}"',
-since='6.0.0')
-if key in kwargs:
-pywikibot.warning('{!r} is given as keyword argument {!r} '
-  'already; ignoring {!r}'
-  .format(key, arg, kwargs[key]))
-else:
-kwargs[key] = arg
-
-# replace old keywords to new
-for key in list(kwargs):
-if key in keymap:
-newkey = keymap[key]
-issue_deprecation_warning(
-f'{key!r} argument of {self.__class__.__name__}',
-repr(newkey), since='6.0.0')
-kwargs[newkey] = kwargs.pop(key)
-
-# Expand available_options
-# Currently scripts may have its own options set
-added_keys = []
-for key in keys:
-if key != 'generator' and key not in self.available_options:
-added_keys.append(key)
-self.available_options[key] = self.disambig_options[key]
-if added_keys:
-pywikibot.warning("""\
-The following keys were added to available_options:
-{options}.
-Either add them to available_options setting of {classname}
-bot class or use available_options.update() to use default settings from
-DisambiguationRobot""".format(options=added_keys,
-  classname=self.__class__.__name__))
-
 def checkContents(self, text: str) -> str | None:  # noqa: N802
 """
 Check if the text matches any of the ignore regexes.

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

[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] Add a new decorator to deprecate positional arguments

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

Change subject: [IMPR] Add a new decorator to deprecate positional arguments
..

[IMPR] Add a new decorator to deprecate positional arguments

The new deprecate_positionals decorator can be used to circumvent a
TypeError when using positional arguments if a keyword-only argument is
required but throws a FutureWarning. The advantage is to have a
deprecation period when introducing keyword-only syntax for methods
and functions.

Change-Id: I549a2e951e5b0c1ed10f2a1d656b27b226d03c63
---
M pywikibot/tools/__init__.py
M pywikibot/tools/_deprecate.py
M tests/tools_deprecate_tests.py
3 files changed, 173 insertions(+), 1 deletion(-)

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




diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 586684e..32c0bf2 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -52,6 +52,7 @@
 add_decorated_full_name,
 add_full_name,
 deprecate_arg,
+deprecate_positionals,
 deprecated,
 deprecated_args,
 get_wrapper_depth,
@@ -69,6 +70,7 @@
 'add_decorated_full_name',
 'add_full_name',
 'deprecate_arg',
+'deprecate_positionals',
 'deprecated',
 'deprecated_args',
 'get_wrapper_depth',
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index 9bbc133..05d5bc3 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -19,7 +19,7 @@
deprecation decorators moved to _deprecate submodule
 """
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -31,6 +31,7 @@
 import sys
 import types
 from contextlib import suppress
+from functools import wraps
 from importlib import import_module
 from inspect import getfullargspec
 from typing import Any
@@ -431,6 +432,84 @@
 return decorator


+def deprecate_positionals(since: str = ''):
+"""Decorator for methods that issues warnings for positional arguments.
+
+This decorator allowes positional arguments after keyword-only
+argument syntax (:pep:`3102`) but throws a FutureWarning. The
+decorator makes the needed argument updates before passing them to
+the called function or method. This decorator may be used for a
+deprecation period when require keyword-only arguments.
+
+Example:
+
+.. code-block:: python
+
+@deprecate_positionals(since='9.2.0')
+def f(posarg, *, kwarg):
+   ...
+
+f('foo', 'bar')
+
+This function call passes but throws a FutureWarning. Without
+decorator a TypeError would be raised.
+
+.. caution:: The decorated function may not use ``*args`` or
+   ``**kwargs``. The sequence of keyword-only arguments must match
+   the sequence of the old positional arguments, otherwise the
+   assignment of the arguments to the keyworded arguments will fail.
+.. versionadded:: 9.2
+
+:param since: a version string when some positional arguments were
+deprecated
+"""
+def decorator(func):
+"""Outer wrapper. Inspect the parameters of *func*.
+
+:param func: function or method beeing wrapped.
+"""
+
+@wraps(func)
+def wrapper(*args: Any, **kwargs: Any) -> Any:
+"""Throws the warning and makes the argument fixing.
+
+:param args: args passed to the decorated functoin or method
+:param kwargs: kwargs passed to the decorated function or
+method
+:return: the value returned by the decorated function or
+method
+"""
+if len(args) > positionals:
+replace_args = list(zip(arg_keys[positionals:],
+args[positionals:]))
+pos_args = "', '".join(name for name, arg in replace_args)
+keyw_args = ', '.join('{}={!r}'.format(name, arg)
+  for name, arg in replace_args)
+issue_deprecation_warning(
+f"Passing '{pos_args}' as positional "
+f'argument(s) to {func.__qualname__}()',
+f'keyword arguments like {keyw_args}',
+since=since)
+
+args = args[:positionals]
+kwargs.update(replace_args)
+
+return func(*args, **kwargs)
+
+sig = inspect.signature(func)
+arg_keys = list(sig.parameters)
+
+# find the first KEYWORD_ONLY index
+for positionals, key in enumerate(arg_keys):
+if sig.parameters[key].kind in (inspect.Parameter.KEYWORD_ONLY,
+inspect.Parameter.VAR_KEYWORD):
+break
+
+return wrapper
+
+  

[Pywikibot-commits] [Gerrit] ...core[master]: [tests] add TestScriptSimulate.test_commons_information to expected f...

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

Change subject: [tests] add TestScriptSimulate.test_commons_information to 
expected failures
..

[tests] add TestScriptSimulate.test_commons_information to expected failures

Change-Id: I607b5aae36d1523b0ca2ed1cf9e6fec1915f6a03
---
M tests/script_tests.py
1 file changed, 1 insertion(+), 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 7c11281..9f9df0a 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -364,6 +364,7 @@
 _expected_failures = {
 'catall',  # stdout user interaction
 'checkimages',
+'commons_information',  # no empty out_result
 'revertbot',
 'transwikiimport',
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1035854?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: I607b5aae36d1523b0ca2ed1cf9e6fec1915f6a03
Gerrit-Change-Number: 1035854
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]: [cleanup] drop bool values of deprecate_arg and deprecated_args

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

Change subject: [cleanup] drop bool values of deprecate_arg and deprecated_args
..

[cleanup] drop bool values of deprecate_arg and deprecated_args

bool values and None values were implemented to throw a
DeprecationWarning, PendingDeprecationWarning or FutureWarning but we
only used the later since years and never used the
PendingDeprecationWarning. Also update tests and backport types.NoneType.

Change-Id: I10ca6346525e71998d839e696b5e088242c76600
---
M pywikibot/backports.py
M pywikibot/tools/_deprecate.py
M tests/tools_deprecate_tests.py
3 files changed, 44 insertions(+), 32 deletions(-)

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




diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 8b9d989..815f7d3 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -116,10 +116,12 @@
 removesuffix = str.removesuffix  # type: ignore[assignment]


-# bpo-38200
 if PYTHON_VERSION < (3, 10) or SPHINX_RUNNING:
 from itertools import tee

+NoneType = type(None)
+
+# bpo-38200
 def pairwise(iterable):
 """Return successive overlapping pairs taken from the input iterable.

@@ -132,6 +134,7 @@
 next(b, None)
 return zip(a, b)
 else:
+from types import NoneType
 from itertools import pairwise  # type: ignore[no-redef]


diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index 9bbc133..571aad1 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -19,7 +19,7 @@
deprecation decorators moved to _deprecate submodule
 """
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -36,6 +36,7 @@
 from typing import Any
 from warnings import warn

+from pywikibot.backports import NoneType
 from pywikibot.tools import SPHINX_RUNNING


@@ -309,10 +310,12 @@
 deprecated = add_full_name(deprecated)


-def deprecate_arg(old_arg: str, new_arg: str | bool | None):
+def deprecate_arg(old_arg: str, new_arg: str | None = None):
 """Decorator to declare old_arg deprecated and replace it with new_arg.

-Usage:
+**Usage:**
+
+.. code-block:: python

 @deprecate_arg('foo', 'bar')
 def my_function(bar='baz'): pass
@@ -323,9 +326,12 @@
 # ignores 'foo' keyword no longer used by my_function

 :func:`deprecated_args` decorator should be used in favour of this
-``deprecate_arg`` decorator but it is held to deprecate args which
-become a reserved word in future Python releases and to prevent
-syntax errors.
+``deprecate_arg`` decorator but it is held to deprecate args of
+reserved words even for future Python releases and to prevent syntax
+errors.
+
+.. versionchanged:: 9.2
+   bool type of *new_arg* is no longer supported.

 :param old_arg: old keyword
 :param new_arg: new keyword
@@ -333,21 +339,29 @@
 return deprecated_args(**{old_arg: new_arg})


-def deprecated_args(**arg_pairs):
+def deprecated_args(**arg_pairs: str | None):
 """Decorator to declare multiple args deprecated.

-Usage:
+**Usage:**
+
+.. code-block:: python

 @deprecated_args(foo='bar', baz=None)
 def my_function(bar='baz'): pass
 # replaces 'foo' keyword by 'bar' and ignores 'baz' keyword

+.. versionchanged:: 3.0.20200703
+   show a FutureWarning if the *arg_pairs* value is True; don't show
+   a warning if the value is an empty string.
+.. versionchanged:: 6.4
+   show a FutureWarning for renamed arguments
+.. versionchanged:: 9.2
+   bool type argument is no longer supported.
+
 :param arg_pairs: Each entry points to the new argument name. If an
-argument is to be removed, the value may be one of the following:
-- None: shows a DeprecationWarning
-- False: shows a PendingDeprecationWarning
-- True: shows a FutureWarning (only once)
-- empty string: no warning is printed
+argument is to be removed, the value may be either an empty str
+or ``None``; the later also shows a `FutureWarning` once.
+:raises TypeError: *arg_pairs* value is neither str nor None or
 """
 def decorator(obj):
 """Outer wrapper.
@@ -376,15 +390,18 @@
 if old_arg not in __kw:
 continue

-if new_arg not in [True, False, None, '']:
+if not isinstance(new_arg, (str, NoneType)):
+raise TypeError(
+f'deprecated_arg value for {old_arg} of {name} must '
+f'be either str or None, not {type(new_arg).__name__}')
+
+if new_arg:
 if new_arg in __kw:
 warn('{new_arg} argument of 

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

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

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

Localisation updates from https://translatewiki.net.

Change-Id: I3bbfef7e268fff1c643978bd019a6998e22bae15
---
M protect/diq.json
1 file changed, 1 insertion(+), 1 deletion(-)

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




diff --git a/protect/diq.json b/protect/diq.json
index 565d342..f065fd4 100644
--- a/protect/diq.json
+++ b/protect/diq.json
@@ -8,6 +8,6 @@
"protect-category": "Bot: Pelanê kategoriya %(cat)s pêrıne bışevekne",
"protect-images": "Bot: Resımanê ke pela %(page)s derê pêrıne 
bışevekne",
"protect-links": "Bot: Pelanê ke %(page)s ra gıre biyê pêrıne 
bışevekne",
-   "protect-ref": "Bot: Pelanê ke %(page)s de çemê benê  pêrıne bışevekne",
+   "protect-ref": "Bot: Pelanê ke %(page)s de çıme benê, pêrıne bışevekne",
"protect-simple": "Bot: Yew lista dosyeyan bışevekne."
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1035379?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: I3bbfef7e268fff1c643978bd019a6998e22bae15
Gerrit-Change-Number: 1035379
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] Add 'commons_information' to auto_run_script_set

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

Change subject: [tests] Add 'commons_information' to auto_run_script_set
..

[tests] Add 'commons_information' to auto_run_script_set

otherwise script test will hang due to input requirement.

Change-Id: I9dbeb9c787d56d7502585ca8bdd8f5985490f74c
---
M tests/script_tests.py
1 file changed, 1 insertion(+), 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 665479a..7c11281 100755
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -85,6 +85,7 @@
 'category_redirect',
 'checkimages',
 'clean_sandbox',
+'commons_information',
 'create_isbn_edition',
 'delinker',
 'login',

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1034857?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: I9dbeb9c787d56d7502585ca8bdd8f5985490f74c
Gerrit-Change-Number: 1034857
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 a hint how to use empty string arguments with PowerShell

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

Change subject: [doc] Add a hint how to use empty string arguments with 
PowerShell
..

[doc] Add a hint how to use empty string arguments with PowerShell

Bug: T364689
Change-Id: I1647f58ce09572322d9d836b79e509b9a5bd1167
---
M scripts/replace.py
1 file changed, 35 insertions(+), 15 deletions(-)

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




diff --git a/scripts/replace.py b/scripts/replace.py
index e9f4db5..cb075d9 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -103,33 +103,51 @@

 -fullsummary  Use one large summary for all command line replacements.

-other:First argument is the old text, second argument is the new
-  text. If the -regex argument is given, the first argument
-  will be regarded as a regular expression, and the second
-  argument might contain expressions like \1 or \g.
-  It is possible to introduce more than one pair of old text
-  and replacement.
+
+*Replacement parameters*
+Replacement parameters are pairs of arguments given to the script.
+The First argument is the old text to be replaced, the second
+argument is the new text. If the ``-regex`` argument is given, the
+first argument will be regarded as a regular expression, and the
+second argument might contain expressions like ``\1`` or ``\g``.
+The second parameter can also be specified as empty string, usually
+``""``. It is possible to introduce more than one pair of
+replacement parameters.
+
+.. admonition:: **Empty string arguments with PowerShell**
+   :class: attention
+
+   Using PowerShell as command shell removes empty strings during
+   PowerShell's command line parsing. To enable empty strings with
+   PowerShell you have either to escape quotation marks with gravis
+   symbols in front of them like ```"`"`` or to disable command line
+   parsing with ``--%`` symbol for all following command parts like
+   :samp:`python pwb replace --% -start:! foo ""` which disables parsing
+   for all replace options and arguments following this delimiter and
+   enables empty strings.

 Examples
 

-If you want to change templates from the old syntax, e.g. {{msg:Stub}}, to the
-new syntax, e.g. {{Stub}}, download an XML dump file (pages-articles) from
-https://dumps.wikimedia.org, then use this command:
+If you want to change templates from the old syntax, e.g.
+``{{msg:Stub}}``, to the new syntax, e.g. ``{{Stub}}``, download an XML
+dump file (pages-articles) from https://dumps.wikimedia.org, then use
+this command:

 python pwb.py replace -xml -regex "{{msg:(.*?)}}" "{{\1}}"

-If you have a dump called foobar.xml and want to fix typos in articles, e.g.
-Errror -> Error, use this:
+If you have a dump called ``foobar.xml`` and want to fix typos in
+articles, e.g. Errror -> Error, use this:

 python pwb.py replace -xml:foobar.xml "Errror" "Error" -namespace:0

 If you want to do more than one replacement at a time, use this:

 python pwb.py replace -xml:foobar.xml "Errror" "Error" "Faail" "Fail" \
--namespace:0
+-namespace:0

-If you have a page called 'John Doe' and want to fix the format of ISBNs, use:
+If you have a page called 'John Doe' and want to fix the format of ISBNs,
+use:

 python pwb.py replace -page:John_Doe -fix:isbn

@@ -138,8 +156,10 @@

 python pwb.py replace referer referrer -file:typos.txt -excepttext:HTTP

-Please type "python pwb.py replace -help | more" if you can't read
-the top of the help.
+
+.. seealso:: :mod:`scripts.template` to modify or remove templates.
+.. Please type "python pwb.py replace -help | more" if you can't read
+   the top of the help.
 """
 #
 # (C) Pywikibot team, 2004-2024

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1034543?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: I1647f58ce09572322d9d836b79e509b9a5bd1167
Gerrit-Change-Number: 1034543
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-05-20 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1034066?usp=email )

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

Localisation updates from https://translatewiki.net.

Change-Id: I44e8b3b3e0a4644117544407eec151dc70a9f9f0
---
M archivebot/ne.json
M blockpageschecker/ne.json
M category/ne.json
M checkimages/ne.json
M delete/ne.json
M interwikidata/ne.json
A listpages/ne.json
M misspelling/ne.json
M pagefromfile/ne.json
M protect/ne.json
M pywikibot/ne.json
M replicate_wiki/diq.json
M template/ne.json
M unusedfiles/ne.json
M weblinkchecker/ne.json
15 files changed, 45 insertions(+), 25 deletions(-)

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




diff --git a/archivebot/ne.json b/archivebot/ne.json
index f542fca..f1e2696 100644
--- a/archivebot/ne.json
+++ b/archivebot/ne.json
@@ -9,8 +9,8 @@
]
},
"archivebot-archive-full": "(अभिलेख भरियो)",
-   "archivebot-archive-summary": "रोबोट : %(count)d 
{{PLURAL:%(count)d|थ्रेड|थ्रेडहरु}}को  [[%(from)s]]बाट अभिलेखिकरण गर्दै ।",
+   "archivebot-archive-summary": "रोबोट: [[%(from)s]] बाट Archiving 
%(count)d {{PLURAL:%(count)d|thread|threads}} अभिलेख गर्दै",
"archivebot-archiveheader": "{{Talkarchive}}",
-   "archivebot-older-than": "%(duration)s भन्दा पुरानो",
-   "archivebot-page-summary": "रोबोट: %(count)d, 
{{PLURAL:%(count)d|थ्रेड|थ्रेडहरू}} (%(why)s)लाई  %(archives)s मा अभिलेखिकरण 
गरिदै ।"
+   "archivebot-older-than": "{{PLURAL:%(count)d|older}}  %(duration)s 
भन्दा पुरानो",
+   "archivebot-page-summary": "रोबोट:  %(count)d 
{{PLURAL:%(count)d|thread|threads}} (%(why)s) लाई  %(archives)s मा अभिलेख गर्दै"
 }
diff --git a/blockpageschecker/ne.json b/blockpageschecker/ne.json
index 381673d..d8a6b7a 100644
--- a/blockpageschecker/ne.json
+++ b/blockpageschecker/ne.json
@@ -5,5 +5,7 @@
"सरोज कुमार ढकाल"
]
},
-   "blockpageschecker-deleting": "बोट : काम नलाग्ने ढाँचाहरू मेट्दै"
+   "blockpageschecker-adding": "रोबोट: पृष्ठ ताल्चा टेम्पल्लेट थप्दै",
+   "blockpageschecker-modifying": "रोबोट: पुराना टेम्प्लेटहरू परिमार्जन 
गर्दै",
+   "blockpageschecker-deleting": "रोबोट : काम नलाग्ने ढाँचाहरू मेट्दै"
 }
diff --git a/category/ne.json b/category/ne.json
index dbe5db2..6abf7b7 100644
--- a/category/ne.json
+++ b/category/ne.json
@@ -9,15 +9,17 @@
"हिमाल सुबेदी"
]
},
-   "category-adding": "यन्त्र: श्रेणी [[:Category:%(newcat)s|%(newcat)s]] 
थप्दै",
+   "category-adding": "रोबोट: श्रेणी [[:Category:%(newcat)s|%(newcat)s]] 
थप्दै",
"category-also-in": "(%(alsocat)s मा पनि)",
-   "category-listifying": "बोट: %(fromcat)sबाट (%(num)d entries)मा सूचीकृत 
गर्दै",
-   "category-removing": "यन्त्र: %(oldcat)sबाट हटाउँदै",
-   "category-renamed": "यन्त्र: %(oldcat)sबाट सारियो। लेखकहरू: 
%(authors)s",
-   "category-replacing": "यन्त्र: %(oldcat)s श्रेणलाई %(newcat)sसँग 
साट्दै",
+   "category-listifying": "रोबोट: %(fromcat)sबाट (%(num)d entries)मा 
सूचीकृत गर्दै",
+   "category-removing": "रोबोट: %(oldcat)sबाट हटाउँदै",
+   "category-renamed": "रोबोट:%(oldcat)s बाट सरेको  लेखकहरू:%(authors)s",
+   "category-replacing": "रोबोट: %(oldcat)s श्रेणलाई %(newcat)sसँग साट्दै",
"category-section-title": "%(oldcat)sको पृष्ठ इतिहास",
-   "category-strip-cfd-templates": "यन्त्र: सकिइसकेका कार्यहरूका सिडिइफ 
ढाँचाहरू हटाउँदै",
+   "category-strip-cfd-templates": "रोबोट: सकिइसकेका कार्यहरूका सिडिइफ 
ढाँचाहरू हटाउँदै",
+   "category-strip-sort-keys": "रोबोट: सकिइसकेका कार्यहरूका सर्ट किहरू 
हटाउँदै",
+   "category-strip-both": "रोबोट: सकिइसकेका कार्यहरूको लागि सिडिइफ 
ढाँचाहरू हटाउँदै",
"category-version-history": "रोबोट:  %(oldcat)sको संस्करण इतिहास संग्रह 
गर्दै",
-   "category-was-disbanded": "बोट: श्रेणीलाई अनिषेधित गरियो",
+   "category-was-disbanded": "रोबोट: श्रेणीलाई अनिषेधित गरियो",
"category-was-moved": "रोबोट: श्रेणीलाई  
[[:Category:%(newcat)s|%(title)s]]मा सारियो"
 }
diff --git a/checkimages/ne.json b/checkimages/ne.json
index 0525e94..70c59de 100644
--- a/checkimages/ne.json
+++ b/checkimages/ne.json
@@ -1,9 +1,13 @@
 {
"@metadata": {
"authors": [
-   "Nirajan pant"
+   "Nirajan pant",
+   "सरोज कुमार ढकाल"
]
},
-   "checkimages-source-tag-comment": "बोट: भर्खर अपलोड गरिएका अनङ्कित 
फाइलहरूलाई चिन्हित गरिँदै",
-   "checkimages-source-notice-comment": "बोट: स्रोत जानकारी माग गरिँदै।"
+   "checkimages-deletion-comment": "रोबोट: थप्दै %(adding)s",
+   "checkimages-source-tag-comment": "रोबोट: भर्खर अपलोड गरिएका अनङ्कित 
फाइलहरूलाई चिन्हित गरिँदै",
+   "checkimages-source-notice-comment": "रोबोट: स्रोत जानकारी माग गरिँदै।",
+   

[Pywikibot-commits] [Gerrit] ...i18n[master]: build: Updating grunt-banana-checker to 0.13.0

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

Change subject: build: Updating grunt-banana-checker to 0.13.0
..

build: Updating grunt-banana-checker to 0.13.0

Change-Id: I500b2eb9cc534a2d2e10e823d07894f0f131dd74
---
M package-lock.json
M package.json
2 files changed, 24 insertions(+), 15 deletions(-)

Approvals:
  Libraryupgrader: Checked
  DannyS712: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/package-lock.json b/package-lock.json
index 88f53f7..0140890 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
"": {
"devDependencies": {
"grunt": "1.6.1",
-   "grunt-banana-checker": "0.12.0"
+   "grunt-banana-checker": "0.13.0"
}
},
"node_modules/abbrev": {
@@ -95,9 +95,9 @@
}
},
"node_modules/chalk": {
-   "version": "4.1.1",
-   "resolved": 
"https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz;,
-   "integrity": 
"sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
+   "version": "4.1.2",
+   "resolved": 
"https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz;,
+   "integrity": 
"sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
@@ -105,6 +105,9 @@
},
"engines": {
"node": ">=10"
+   },
+   "funding": {
+   "url": 
"https://github.com/chalk/chalk?sponsor=1;
}
},
"node_modules/color-convert": {
@@ -376,10 +379,13 @@
}
},
"node_modules/grunt-banana-checker": {
-   "version": "0.12.0",
-   "resolved": 
"https://registry.npmjs.org/grunt-banana-checker/-/grunt-banana-checker-0.12.0.tgz;,
-   "integrity": 
"sha512-rdu8YqGxfyBUNMSLmqusSg8RUzGE61+kqrge4fRYb32Vqu5hzDGeomDQIkILEsSrZjtNTTcJ8iTwIswQ+POCGw==",
+   "version": "0.13.0",
+   "resolved": 
"https://registry.npmjs.org/grunt-banana-checker/-/grunt-banana-checker-0.13.0.tgz;,
+   "integrity": 
"sha512-uAUKILcP69Q4OJHHV2wzxqVaoXB8G3Uh/XuSJLn0Bk/9+WiUY/Q4+OX7dUhrPPeDZPtoGh37qqJLVvZlDTUecg==",
"dev": true,
+   "dependencies": {
+   "chalk": "4.1.2"
+   },
"bin": {
"banana-checker": "src/cli.js"
},
@@ -1180,9 +1186,9 @@
}
},
"chalk": {
-   "version": "4.1.1",
-   "resolved": 
"https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz;,
-   "integrity": 
"sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
+   "version": "4.1.2",
+   "resolved": 
"https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz;,
+   "integrity": 
"sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
@@ -1394,10 +1400,13 @@
}
},
"grunt-banana-checker": {
-   "version": "0.12.0",
-   "resolved": 
"https://registry.npmjs.org/grunt-banana-checker/-/grunt-banana-checker-0.12.0.tgz;,
-   "integrity": 
"sha512-rdu8YqGxfyBUNMSLmqusSg8RUzGE61+kqrge4fRYb32Vqu5hzDGeomDQIkILEsSrZjtNTTcJ8iTwIswQ+POCGw==",
-   "dev": true
+   "version": "0.13.0",
+   "resolved": 
"https://registry.npmjs.org/grunt-banana-checker/-/grunt-banana-checker-0.13.0.tgz;,
+   "integrity": 
"sha512-uAUKILcP69Q4OJHHV2wzxqVaoXB8G3Uh/XuSJLn0Bk/9+WiUY/Q4+OX7dUhrPPeDZPtoGh37qqJLVvZlDTUecg==",
+   "dev": true,
+   "requires": {
+   "chalk": "4.1.2"
+   }
},
"grunt-cli": {
"version": "1.4.3",
diff --git a/package.json b/package.json

[Pywikibot-commits] [Gerrit] ...core[master]: [doc] remove tests supbackages documenation

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

Change subject: [doc] remove tests supbackages documenation
..

[doc] remove tests supbackages documenation

Change-Id: I0d5e7768a0a0ea0b894446badd0b8045eb4bd91a
---
M docs/tests_ref/index.rst
D docs/tests_ref/pwb.print_env.rst
D docs/tests_ref/pwb.print_locals.rst
D docs/tests_ref/pwb.print_unicode.rst
D docs/tests_ref/pwb.rst
5 files changed, 0 insertions(+), 49 deletions(-)

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




diff --git a/docs/tests_ref/index.rst b/docs/tests_ref/index.rst
index d55c2c9..7f069a9 100644
--- a/docs/tests_ref/index.rst
+++ b/docs/tests_ref/index.rst
@@ -4,13 +4,6 @@

 .. include:: ../../tests/README.rst

-***
-Subpackages
-***
-
-.. toctree::
-
-pwb

 **
 Test utilities
diff --git a/docs/tests_ref/pwb.print_env.rst b/docs/tests_ref/pwb.print_env.rst
deleted file mode 100644
index 9117030..000
--- a/docs/tests_ref/pwb.print_env.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-***
-tests.pwb.print\_env module
-***
-
-.. automodule:: tests.pwb.print_env
-:members:
-:undoc-members:
-:show-inheritance:
diff --git a/docs/tests_ref/pwb.print_locals.rst 
b/docs/tests_ref/pwb.print_locals.rst
deleted file mode 100644
index 2df531e..000
--- a/docs/tests_ref/pwb.print_locals.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-**
-tests.pwb.print\_locals module
-**
-
-.. automodule:: tests.pwb.print_locals
-:members:
-:undoc-members:
-:show-inheritance:
diff --git a/docs/tests_ref/pwb.print_unicode.rst 
b/docs/tests_ref/pwb.print_unicode.rst
deleted file mode 100644
index a5a7f1f..000
--- a/docs/tests_ref/pwb.print_unicode.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-***
-tests.pwb.print\_unicode module
-***
-
-.. automodule:: tests.pwb.print_unicode
-:members:
-:undoc-members:
-:show-inheritance:
diff --git a/docs/tests_ref/pwb.rst b/docs/tests_ref/pwb.rst
deleted file mode 100644
index c2d77a4..000
--- a/docs/tests_ref/pwb.rst
+++ /dev/null
@@ -1,18 +0,0 @@
-*
-tests.pwb package
-*
-
-.. automodule:: tests.pwb
-:members:
-:undoc-members:
-:show-inheritance:
-
-pwb submodules
-==
-
-.. toctree::
-
-   pwb.print_env
-   pwb.print_locals
-   pwb.print_unicode
-

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033693?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: I0d5e7768a0a0ea0b894446badd0b8045eb4bd91a
Gerrit-Change-Number: 1033693
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] remove empty tests.i18n documenation

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

Change subject: [doc] remove empty tests.i18n documenation
..

[doc] remove empty tests.i18n documenation

Change-Id: Iaabe33bc84c3934b83b075b436634bcb4aa59108
---
D docs/tests_ref/i18n.rst
M docs/tests_ref/index.rst
2 files changed, 0 insertions(+), 10 deletions(-)

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




diff --git a/docs/tests_ref/i18n.rst b/docs/tests_ref/i18n.rst
deleted file mode 100644
index 8f891d7..000
--- a/docs/tests_ref/i18n.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-**
-tests.i18n package
-**
-
-.. automodule:: tests.i18n
-:members:
-:undoc-members:
-:show-inheritance:
-
diff --git a/docs/tests_ref/index.rst b/docs/tests_ref/index.rst
index 615f55a..d55c2c9 100644
--- a/docs/tests_ref/index.rst
+++ b/docs/tests_ref/index.rst
@@ -10,7 +10,6 @@

 .. toctree::

-i18n
 pwb

 **

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033692?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: Iaabe33bc84c3934b83b075b436634bcb4aa59108
Gerrit-Change-Number: 1033692
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]: [IMPR] remove unnecessary else after return/raise

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

Change subject: [IMPR] remove unnecessary else after return/raise
..

[IMPR] remove unnecessary else after return/raise

Change-Id: I89911e8d674602c856e47e8dc23877ed849500dc
---
M pywikibot/__init__.py
M pywikibot/cosmetic_changes.py
M pywikibot/page/_basepage.py
M pywikibot/page/_wikibase.py
M pywikibot/proofreadpage.py
M pywikibot/site/_siteinfo.py
M pywikibot/textlib.py
M scripts/checkimages.py
M scripts/coordinate_import.py
M scripts/interwikidata.py
10 files changed, 28 insertions(+), 29 deletions(-)

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




diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index f03fef5..569889b 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -231,8 +231,8 @@
 tmp = __import__('pywikibot.site', fromlist=[interface])
 except ImportError:
 raise ValueError(f'Invalid interface name: {interface}')
-else:
-interface = getattr(tmp, interface)
+
+interface = getattr(tmp, interface)

 if not issubclass(interface, _BaseSite):
 warning(f'Site called with interface={interface.__name__}')
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index e18a3ae..c966cdc 100644
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -309,10 +309,10 @@
 pywikibot.error(e)
 return False
 raise
-else:
-if self.show_diff:
-pywikibot.showDiff(text, new_text)
-return new_text
+
+if self.show_diff:
+pywikibot.showDiff(text, new_text)
+return new_text

 def fixSelfInterwiki(self, text: str) -> str:
 """
diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 1c51f20..61623b6 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -1764,8 +1764,8 @@
 lastmove = next(gen)
 except StopIteration:
 raise NoMoveTargetError(self)
-else:
-return lastmove.target_page
+
+return lastmove.target_page

 def revisions(self,
   reverse: bool = False,
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 1f9ed9a..8f3bd66 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -477,8 +477,8 @@
 error_message = str(exc)
 if 'is not a file' in error_message:
 raise NoWikibaseEntityError(self) from exc
-else:
-raise Error(self) from exc
+
+raise Error(self) from exc

 # Create _content. Format is same as with wbgetentities
 # 
https://commons.wikimedia.org/w/api.php?action=wbgetentities=M20985340
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index e75f397..84d4e60 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -848,10 +848,8 @@
 url_image = url_image['src']
 except (TypeError, AttributeError):
 raise ValueError(f'No prp-page-image src found for {self}.')
-else:
-url_image = 'https:' + url_image

-return url_image
+return 'https:' + url_image

 def _url_image_ge_140(self) -> str:
 """Get the file url of the scan of ProofreadPage.
@@ -865,8 +863,8 @@
 url = self._imageforpage.get('fullsize')
 if url is not None:
 return f'{self.site.family.protocol(self.site.code)}:{url}'
-else:
-raise ValueError(f'imagesforpage is empty for {self}.')
+
+raise ValueError(f'imagesforpage is empty for {self}.')

 @property
 @cached
diff --git a/pywikibot/site/_siteinfo.py b/pywikibot/site/_siteinfo.py
index 5f58640..d0e92e1 100644
--- a/pywikibot/site/_siteinfo.py
+++ b/pywikibot/site/_siteinfo.py
@@ -303,8 +303,8 @@
 self._get_cached(key)
 except KeyError:
 return False
-else:
-return True
+
+return True

 def __contains__(self, key: str) -> bool:
 """Return whether the value is in Siteinfo container.
@@ -316,8 +316,8 @@
 self[key]
 except KeyError:
 return False
-else:
-return True
+
+return True

 def is_recognised(self, key: str) -> bool | None:
 """Return if 'key' is a valid property name. 'None' if not cached."""
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 8cc33a7..29cd9df 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -2276,8 +2276,8 @@
 f"incorrect month name {dateDict['month']['value']!r} "
 f'in page in site {self.site}'
 )
-else:
-

[Pywikibot-commits] [Gerrit] ...core[master]: [doc] fix deprecation list

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

Change subject: [doc] fix deprecation list
..

[doc] fix deprecation list

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

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index 1bfeda5..d1ef503 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -66,7 +66,7 @@
 * 7.5.0: :mod:`textlib`.tzoneFixedOffset class will be removed in favour of 
:class:`time.TZoneFixedOffset`
 * 7.4.0: ``FilePage.usingPages()`` was renamed to 
:meth:`using_pages()`
 * 7.3.0: Old color escape sequences like ``\03{color}`` is deprecated in 
favour of new color format like <>
-* 7.3.0: ``linkitrail`` method of :class:`family.Family` is deprecated; use 
:meth:`APISite.linktrail()
+* 7.3.0: ``linktrail`` method of :class:`family.Family` is deprecated; use 
:meth:`APISite.linktrail()
   ` instead
 * 7.2.0: ``tb`` parameter of :func:`exception()` function 
was renamed to ``exc_info``
 * 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` 
parameter of

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1032812?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: I81459c13284b21687b82f3319c96ce5d4216aae7
Gerrit-Change-Number: 1032812
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] fix doc string with duplicate string entries

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

Change subject: [doc] fix doc string with duplicate string entries
..

[doc] fix doc string with duplicate string entries

Change-Id: I511426ed8120796f7c1da97bfad10fa423aeb302
---
M pywikibot/tools/_deprecate.py
1 file changed, 6 insertions(+), 5 deletions(-)

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




diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index d8c56d3..9bbc133 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -174,7 +174,7 @@
`since`parameter must be a release number, not a timestamp.

 :param instead: suggested replacement for the deprecated object
-:param since: a version string string when the method was deprecated
+:param since: a version string when the method or function was deprecated
 """
 if since and '.' not in since:
 raise ValueError(f'{since} is not a valid release number')
@@ -204,7 +204,7 @@
 :param depth: depth + 1 will be used as stacklevel for the warnings
 :param warning_class: a warning class (category) to be used,
 defaults to FutureWarning
-:param since: a version string string when the method was deprecated
+:param since: a version string when the method or function was deprecated
 """
 msg = _build_msg_string(instead, since)
 if warning_class is None:
@@ -221,7 +221,7 @@

 :keyword str instead: if provided, will be used to specify the
 replacement
-:keyword str since: a version string string when the method was
+:keyword str since: a version string when the method or function was
 deprecated
 :keyword bool future_warning: if True a FutureWarning will be thrown,
 otherwise it provides a DeprecationWarning
@@ -525,7 +525,7 @@
 new function.
 :param class_name: The name of the class. It's added to the target and
 source module (separated by a '.').
-:param since: a version string string when the method was deprecated
+:param since: a version string when the method or function was deprecated
 :param future_warning: if True a FutureWarning will be thrown,
 otherwise it provides a DeprecationWarning
 :return: A new function which adds a warning prior to each execution.
@@ -602,7 +602,8 @@
 object name, and evaluated when the deprecated object is needed.
 :param warning_message: The warning to display, with positional
 variables: {0} = module, {1} = attribute name, {2} = replacement.
-:param since: a version string string when the method was deprecated
+:param since: a version string when the method or function was
+deprecated
 :param future_warning: if True a FutureWarning will be thrown,
 otherwise it provides a DeprecationWarning
 """

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033606?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: I511426ed8120796f7c1da97bfad10fa423aeb302
Gerrit-Change-Number: 1033606
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]: [fix] show the right docstring with tools.deprecated

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

Change subject: [fix] show the right docstring with tools.deprecated
..

[fix] show the right docstring with tools.deprecated

Previously the docstring of the outer wrapper of add_full_name
decorator was shown as the docstring of deprecated function.
Now remove the add_full_name when Sphinx is running.

Use the same technique with allow_asynchronous decorator.

Bug: T365286
Change-Id: I292bb7a3dc7a2804a77ce84dcf228848fc3239a4
---
M pywikibot/page/_decorators.py
M pywikibot/tools/_deprecate.py
2 files changed, 24 insertions(+), 21 deletions(-)

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




diff --git a/pywikibot/page/_decorators.py b/pywikibot/page/_decorators.py
index 9108cc8..38c2d1f 100644
--- a/pywikibot/page/_decorators.py
+++ b/pywikibot/page/_decorators.py
@@ -1,6 +1,6 @@
 """Decorators for Page objects."""
 #
-# (C) Pywikibot team, 2017-2022
+# (C) Pywikibot team, 2017-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -12,20 +12,17 @@
 OtherPageSaveError,
 PageSaveRelatedError,
 )
-from pywikibot.tools import add_full_name, manage_wrapping
+from pywikibot.tools import SPHINX_RUNNING, add_full_name, manage_wrapping


-# decorating this function leads sphinx to hide it
-def _allow_asynchronous(func):
-"""
-Decorator to make it possible to run a BasePage method asynchronously.
+def allow_asynchronous(func):
+"""Decorator to make it possible to run a BasePage method asynchronously.

-This is done when the method is called with kwarg asynchronous=True.
-Optionally, you can also provide kwarg callback, which, if provided, is
-a callable that gets the page as the first and a possible exception that
-occurred during saving in the second thread or None as the second argument.
-
-:meta public:
+This is done when the method is called with kwarg
+:code:`asynchronous=True`. Optionally, you can also provide kwarg
+callback, which, if provided, is a callable that gets the page as
+the first and a possible exception that occurred during saving in
+the second thread or None as the second argument.
 """
 def handle(func, self, *args, **kwargs):
 do_async = kwargs.pop('asynchronous', False)
@@ -59,5 +56,6 @@
 return wrapper


-#: `_allow_asynchronous` decorated with :func:`tools.add_full_name`
-allow_asynchronous = add_full_name(_allow_asynchronous)
+if not SPHINX_RUNNING:
+# T365286: decorate allow_asynchronous function with add_full_name
+allow_asynchronous = add_full_name(allow_asynchronous)
diff --git a/pywikibot/tools/_deprecate.py b/pywikibot/tools/_deprecate.py
index 58409ac..d8c56d3 100644
--- a/pywikibot/tools/_deprecate.py
+++ b/pywikibot/tools/_deprecate.py
@@ -36,6 +36,8 @@
 from typing import Any
 from warnings import warn

+from pywikibot.tools import SPHINX_RUNNING
+

 class _NotImplementedWarning(RuntimeWarning):

@@ -211,20 +213,18 @@
 warn(msg.format(name, instead), warning_class, depth + 1)


-@add_full_name
 def deprecated(*args, **kwargs):
 """Decorator to output a deprecation warning.

 .. versionchanged:: 7.0
`since` keyword must be a release number, not a timestamp.

-:keyword instead: if provided, will be used to specify the replacement
-:type instead: str
-:keyword since: a version string string when the method was deprecated
-:type since: str
-:keyword future_warning: if True a FutureWarning will be thrown,
+:keyword str instead: if provided, will be used to specify the
+replacement
+:keyword str since: a version string string when the method was
+deprecated
+:keyword bool future_warning: if True a FutureWarning will be thrown,
 otherwise it provides a DeprecationWarning
-:type future_warning: bool
 """
 def decorator(obj):
 """Outer wrapper.
@@ -304,6 +304,11 @@
 return decorator


+if not SPHINX_RUNNING:
+# T365286: decorate deprecated function with add_full_name
+deprecated = add_full_name(deprecated)
+
+
 def deprecate_arg(old_arg: str, new_arg: str | bool | None):
 """Decorator to declare old_arg deprecated and replace it with new_arg.


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033192?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: I292bb7a3dc7a2804a77ce84dcf228848fc3239a4
Gerrit-Change-Number: 1033192
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 and CHANGELOG.rst

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

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

[doc] Update ROADMAP.rst and CHANGELOG.rst

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

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




diff --git a/ROADMAP.rst b/ROADMAP.rst
index 7313b90..1bfeda5 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,11 +1,14 @@
 Current release
 ---

+* Raise :exc:`exceptions.SectionError` if a section does not exists on a page 
(:phab:`T107141`)
 * Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)

 Deprecations
 

+* 9.2.0: *total* argument in ``-logevents`` pagegenrators option is deprecated;
+  use ``-limit`` instead (:phab:`T128981`)
 * 9.0.0: The *content* parameter of :meth:`proofreadpage.IndexPage.page_gen` 
is deprecated and will be ignored
   (:phab:`T358635`)
 * 9.0.0: ``userinterfaces.transliteration.transliterator`` was renamed to 
:class:`Transliterator
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 334fac1..a7b5e4c 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -7,6 +7,8 @@
 commons_information
 ^^^

+* Do not remove valid description parts of Information template 
(:phab:`T364640`)
+* Use transclusions of Information template as default generator
 * Preload pages to make the script upto 10 times faster

 noreferences

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033112?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: I0cf875da1aff1f62797302e827715e35a25da5ce
Gerrit-Change-Number: 1033112
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] Update tests documentation

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

Change subject: [doc] Update tests documentation
..

[doc] Update tests documentation

Change-Id: I4596f0f0702c43ad9efcdb0fcf73c75da1c9daca
---
M tests/aspects.py
M tests/setup_tests.py
M tests/thanks_tests.py
M tests/version_tests.py
4 files changed, 15 insertions(+), 20 deletions(-)

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




diff --git a/tests/aspects.py b/tests/aspects.py
index 157210c..039542a 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1288,17 +1288,19 @@

 """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
-initialises loggers and uses the network to determine if the code is stale.
+Test cases which use pwb typically also access a site, and use the
+network. Even during initialisation, scripts may call
+:func:`pywikibot.handle_args`, which initialises loggers and uses
+the network to determine if the code is stale.

-The flag 'pwb' is used by the TestCase metaclass to check that a test site
-is set declared in the class properties, or that 'site = False' is added
-to the class properties in the unlikely scenario that the test case
-uses pwb in a way that doesn't use a site.
+The flag 'pwb' is used by the TestCase metaclass to check that a
+test site is set declared in the class properties, or that
+:code:`site = False` is added to the class properties in the
+unlikely scenario that the test case uses pwb in a way that doesn't
+use a site.

-If a test class is marked as 'site = False', the metaclass will also check
-that the 'net' flag is explicitly set.
+If a test class is marked as :code:`site = False , the metaclass
+will also check that the ``net`` flag is explicitly set.
 """

 pwb = True
diff --git a/tests/setup_tests.py b/tests/setup_tests.py
index 174aed5..8263f3a 100755
--- a/tests/setup_tests.py
+++ b/tests/setup_tests.py
@@ -1,8 +1,5 @@
 #!/usr/bin/env python3
-"""Test setup.py.
-
-.. versionadded:: 9.0
-"""
+"""Test setup.py."""
 #
 # (C) Pywikibot team, 2024
 #
diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py
index 04b6fc9..19e5ca9 100755
--- a/tests/thanks_tests.py
+++ b/tests/thanks_tests.py
@@ -30,9 +30,8 @@
 def test_thank_revision(self):
 """Test thanks for normal revisions.

-.. note:: This test relies on activity in recentchanges, and
-   there must make edits made before reruns of this test.
-.. seealso:: :phab:`T137836`.
+This test relies on activity in recentchanges, and there must
+make edits made before reruns of this test; see :phab:`T137836`.
 """
 site = self.get_site()
 data = site.recentchanges(total=20)
diff --git a/tests/version_tests.py b/tests/version_tests.py
index 96a6de1..6da5b5d 100644
--- a/tests/version_tests.py
+++ b/tests/version_tests.py
@@ -1,8 +1,5 @@
 #!/usr/bin/env python3
-"""Test cases for the :mod:`version` module.
-
-.. versionadded:: 9.2
-"""
+"""Test cases for the :mod:`version` module."""
 #
 # (C) Pywikibot team, 2024
 #

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033102?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: I4596f0f0702c43ad9efcdb0fcf73c75da1c9daca
Gerrit-Change-Number: 1033102
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]: [cleanup] Only keep test utilities for test api reference

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

Change subject: [cleanup] Only keep test utilities for test api reference
..

[cleanup] Only keep test utilities for test api reference

remove all tests from documentation because they are unnecessary and
just enlage the documentation. But keep the aspects, utils and basepage
classes. See also T187009#4625587

Bug: T187009
Change-Id: I60e0ef5f7753ffa2b2fe47021fe08eae1964921e
---
D docs/tests_ref/add_text_tests.rst
D docs/tests_ref/api_tests.rst
D docs/tests_ref/archivebot_tests.rst
D docs/tests_ref/bot_tests.rst
D docs/tests_ref/cache_tests.rst
D docs/tests_ref/category_bot_tests.rst
D docs/tests_ref/category_tests.rst
D docs/tests_ref/checkimages_tests.rst
D docs/tests_ref/cosmetic_changes_tests.rst
D docs/tests_ref/data_ingestion_tests.rst
D docs/tests_ref/date_tests.rst
D docs/tests_ref/deletionbot_tests.rst
D docs/tests_ref/diff_tests.rst
D docs/tests_ref/djvu_tests.rst
D docs/tests_ref/dry_api_tests.rst
D docs/tests_ref/dry_site_tests.rst
D docs/tests_ref/edit_failure_tests.rst
D docs/tests_ref/edit_tests.rst
D docs/tests_ref/eventstreams_tests.rst
D docs/tests_ref/family_tests.rst
D docs/tests_ref/file_tests.rst
D docs/tests_ref/fixes_tests.rst
D docs/tests_ref/fixing_redirects_tests.rst
D docs/tests_ref/flow_edit_tests.rst
D docs/tests_ref/flow_tests.rst
D docs/tests_ref/flow_thanks_tests.rst
D docs/tests_ref/generate_family_file_tests.rst
D docs/tests_ref/generate_user_files_tests.rst
D docs/tests_ref/gui_tests.rst
D docs/tests_ref/harvest_template_tests.rst
D docs/tests_ref/http_tests.rst
D docs/tests_ref/i18n_tests.rst
M docs/tests_ref/index.rst
D docs/tests_ref/interwiki_graph_tests.rst
D docs/tests_ref/interwiki_link_tests.rst
D docs/tests_ref/interwikidata_tests.rst
D docs/tests_ref/l10n_tests.rst
D docs/tests_ref/link_tests.rst
D docs/tests_ref/logentries_tests.rst
D docs/tests_ref/login_tests.rst
D docs/tests_ref/make_dist_tests.rst
D docs/tests_ref/mediawikiversion_tests.rst
D docs/tests_ref/memento_tests.rst
D docs/tests_ref/namespace_tests.rst
D docs/tests_ref/noreferences_tests.rst
D docs/tests_ref/oauth_tests.rst
D docs/tests_ref/page_tests.rst
D docs/tests_ref/pagegenerators_tests.rst
D docs/tests_ref/paraminfo_tests.rst
D docs/tests_ref/patrolbot_tests.rst
D docs/tests_ref/plural_tests.rst
D docs/tests_ref/proofreadpage_tests.rst
D docs/tests_ref/protectbot_tests.rst
D docs/tests_ref/pwb_tests.rst
D docs/tests_ref/redirect_bot_tests.rst
D docs/tests_ref/reflinks_tests.rst
D docs/tests_ref/replacebot_tests.rst
D docs/tests_ref/script_tests.rst
D docs/tests_ref/setup_tests.rst
D docs/tests_ref/site_decorators_tests.rst
D docs/tests_ref/site_detect_tests.rst
D docs/tests_ref/site_generators_tests.rst
D docs/tests_ref/site_obsoletesites_tests.rst
D docs/tests_ref/site_tests.rst
D docs/tests_ref/sparql_tests.rst
D docs/tests_ref/template_bot_tests.rst
D docs/tests_ref/tests_tests.rst
D docs/tests_ref/textlib_tests.rst
D docs/tests_ref/thanks_tests.rst
D docs/tests_ref/time_tests.rst
D docs/tests_ref/timestripper_tests.rst
D docs/tests_ref/tools_chars_tests.rst
D docs/tests_ref/tools_deprecate_tests.rst
D docs/tests_ref/tools_formatter_tests.rst
D docs/tests_ref/tools_tests.rst
D docs/tests_ref/tools_threading_tests.rst
D docs/tests_ref/ui_options_tests.rst
D docs/tests_ref/ui_tests.rst
D docs/tests_ref/upload_tests.rst
D docs/tests_ref/uploadbot_tests.rst
D docs/tests_ref/user_tests.rst
D docs/tests_ref/version_tests.rst
D docs/tests_ref/wikibase_edit_tests.rst
D docs/tests_ref/wikibase_tests.rst
D docs/tests_ref/wikistats_tests.rst
D docs/tests_ref/xmlreader_tests.rst
86 files changed, 3 insertions(+), 778 deletions(-)

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




diff --git a/docs/tests_ref/add_text_tests.rst 
b/docs/tests_ref/add_text_tests.rst
deleted file mode 100644
index 31ee803..000
--- a/docs/tests_ref/add_text_tests.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-*
-tests.add\_text\_tests module
-*
-
-.. automodule:: tests.add_text_tests
-:members:
-:undoc-members:
-:show-inheritance:
diff --git a/docs/tests_ref/api_tests.rst b/docs/tests_ref/api_tests.rst
deleted file mode 100644
index a774c14..000
--- a/docs/tests_ref/api_tests.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-***
-tests.api\_tests module
-***
-
-.. automodule:: tests.api_tests
-:members:
-:undoc-members:
-:show-inheritance:
diff --git a/docs/tests_ref/archivebot_tests.rst 
b/docs/tests_ref/archivebot_tests.rst
deleted file mode 100644
index 29196ea..000
--- a/docs/tests_ref/archivebot_tests.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-**
-tests.archivebot\_tests module
-**
-
-.. automodule:: tests.archivebot_tests
-:members:
-:undoc-members:
-

[Pywikibot-commits] [Gerrit] ...core[master]: [cleanup] remove unused noop2 decorator in tools_deprecate_tests.py

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

Change subject: [cleanup] remove unused noop2 decorator in 
tools_deprecate_tests.py
..

[cleanup] remove unused noop2 decorator in tools_deprecate_tests.py

Change-Id: I246495a0e0070fb10b271de5f63433df5bf3f7d6
---
M tests/tools_deprecate_tests.py
1 file changed, 0 insertions(+), 10 deletions(-)

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




diff --git a/tests/tools_deprecate_tests.py b/tests/tools_deprecate_tests.py
index c4024b1..fd5cc21 100755
--- a/tests/tools_deprecate_tests.py
+++ b/tests/tools_deprecate_tests.py
@@ -31,16 +31,6 @@
 return decorator


-@add_full_name
-def noop2():
-"""Dummy decorator."""
-def decorator(obj):
-def wrapper(*args, **kwargs):
-raise Exception(obj.__full_name__)
-return wrapper
-return decorator
-
-
 @noop()
 def decorated_func():
 """Test dummy decorator."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1033046?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: I246495a0e0070fb10b271de5f63433df5bf3f7d6
Gerrit-Change-Number: 1033046
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] Do not remove valid description parts of Information template

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

Change subject: [bugfix] Do not remove valid description parts of Information 
template
..

[bugfix] Do not remove valid description parts of Information template

- use a set of lang codes instead ot the template pages; the comparison
  is easier with that strings
- rewrite choosing language code in process_desc_template;
  check whether the selected lang has a template page on wiki site
- add process_desc_other method to handle different nodes except
  templates and comments

Bug: T364640
Change-Id: I960496f4f64839e9740180a47a3e89e348ff4b7d
---
M scripts/commons_information.py
1 file changed, 132 insertions(+), 57 deletions(-)

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




diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index e71aecd..2d5b31c 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -28,7 +28,7 @@
 #
 from __future__ import annotations

-import copy
+from textwrap import fill

 import mwparserfromhell

@@ -62,7 +62,8 @@
 """Initialzer."""
 super().__init__(**kwargs)
 lang_tmp_cat = pywikibot.Category(self.site, self.lang_tmp_cat)
-self.lang_tmps = set(lang_tmp_cat.articles(namespaces=[10]))
+self.lang_tmps = {t.title(with_ns=False).lower()
+  for t in lang_tmp_cat.articles(namespaces=[10])}

 def get_description(self, template):
 """Get description parameter."""
@@ -75,50 +76,134 @@
 return None

 @staticmethod
-def detect_langs(text):
+def detect_langs(text: str):
 """Detect language from given text."""
 if langdetect is not None:
 return langdetect.detect_langs(text)
 return None

-def process_desc_template(self, template) -> bool:
-"""Process description template."""
-tmp_page = pywikibot.Page(self.site, template.name.strip(), ns=10)
-if tmp_page in self.lang_tmps and len(template.params) == 1 \
+def process_desc_template(
+self,
+template: mwparserfromhell.nodes.template.Template
+) -> bool:
+"""Process description template.
+
+:param template: a mwparserfromhell Template found in the
+description parameter of ``Information`` template.
+:return: whether the *template* node was changed.
+"""
+tmpl_lang = template.name.strip().lower()
+if tmpl_lang in self.lang_tmps and len(template.params) == 1 \
and template.has('1'):
 lang_tmp_val = template.get('1').value.strip()
 langs = self.detect_langs(lang_tmp_val)
-if langs and langs[0].prob > 0.9:
-tmp_page2 = pywikibot.Page(self.site, langs[0].lang, ns=10)
-if tmp_page2 != tmp_page:
-pywikibot.info(
-'<>The language template {before!r} '
-'was found, but langdetect thinks {after!r} is the '
-'most appropriate with a probability of {prob}:'
-'<>\n{text}'
-.format(before=tmp_page.title(with_ns=False),
-after=tmp_page2.title(with_ns=False),
-prob=langs[0].prob,
-text=lang_tmp_val))
+if not langs:
+return False
+
+lang, prob = langs[0].lang, langs[0].prob
+if lang != tmpl_lang and prob > 0.9 and lang in self.lang_tmps:
+pywikibot.info(
+f'<>The language template {tmpl_lang!r} '
+f'was found, but language detection thinks {lang!r}\n'
+f'is the most appropriate with a probability of {prob}:'
+)
+pywikibot.info(fill(lang_tmp_val, width=78))
+while True:
 choice = pywikibot.input_choice(
 'What to do?',
-[('Replace it', 'r'), ('Do not replace it', 'n'),
- ('Choose another', 'c')])
+[
+('Replace it', 'r'),
+('Do not replace it', 'n'),
+('Choose another', 'c'),
+],
+default='n',
+)
+if choice == 'n':
+break
+
 if choice == 'r':
-template.name = langs[0].lang
+template.name = lang
 return True

-if choice == 'c':
-newlang = pywikibot.input(
-'Enter the language of the displayed text:')
-  

[Pywikibot-commits] [Gerrit] ...core[master]: [IMPR] use transclusions of Information template as default generator

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

Change subject: [IMPR] use transclusions of Information template as default 
generator
..

[IMPR] use transclusions of Information template as default generator

- if no generator is given, use file transclusions of Information templates
- use commons:commons as default site
- update documentation

Change-Id: I3fa02ce47007635c8c8caa99119494553d685668
---
M scripts/commons_information.py
1 file changed, 62 insertions(+), 14 deletions(-)

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




diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index e71aecd..415cbfa 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -1,6 +1,38 @@
 #!/usr/bin/env python3
-"""
-This bot adds a language template to the file's description field.
+"""This bot adds a language template to the file's description field.
+
+The ``Information`` template is commonly used to provide formatting to
+the basic information for files (description, source, author, etc.). The
+``description`` field should provide brief but complete information
+about the image. The description format should use Language templates
+like ``{{En}}`` or ``{{De}}`` to specify the language of the description.
+This script adds these langage templates if missing. For example the
+description of
+
+.. code-block:: wikitext
+
+   {{Information
+| Description = A simplified icon for [[Pywikibot]]
+| Date = 2003-06-14
+| Other fields =
+   }}
+
+will be analyzed as ``en`` language by ~100 % accurancy and the bot
+replaces its content by
+
+.. code-block:: wikitext
+   :emphasize-lines: 2
+
+   {{Information
+| Description = {{en|A simplified icon for [[Pywikibot]]}}
+| Date = 2003-06-14
+| Other fields =
+   }}
+
+.. note:: ``langdetect`` package is needed for fully support of language
+   detection. Install it with::
+
+   pip install langdetect

 This script understands the following command-line arguments:

@@ -10,8 +42,12 @@

 python pwb.py commons_information [pagegenerators]

-You can use any typical pagegenerator (like categories) to provide with a
-list of pages.
+You can use any typical pagegenerator (like categories) to provide with
+a list of pages. If no pagegenerator is given, transcluded pages from
+``Information`` template are used.
+
+.. hint:: This script uses ``commons`` site as default. For other sites
+   use the global ``-site`` option.

 Example for going through all files:

@@ -19,7 +55,8 @@

 .. versionadded:: 6.0
 .. versionchanged:: 9.2
-   accelerated script with preloading pages.
+   accelerate script with preloading pages; use ``commons`` as default
+   site; use transcluded pages of ``Information`` template.
 """
 #
 # (C) Pywikibot team, 2015-2024
@@ -33,7 +70,7 @@
 import mwparserfromhell

 import pywikibot
-from pywikibot import i18n, pagegenerators
+from pywikibot import config, i18n, pagegenerators
 from pywikibot.bot import ExistingPageBot, SingleSiteBot

 # This is required for the text that is shown when you run this script
@@ -46,6 +83,9 @@
 langdetect = None


+INFORMATION_TMPL = 'Information'
+
+
 class InformationBot(SingleSiteBot, ExistingPageBot):

 """Bot for the Information template."""
@@ -54,8 +94,8 @@
 desc_params = ('Description', 'description')

 comment = {
-'en': ('Bot: wrap the description parameter of Information in the '
-   'appropriate language template')
+'en': (f'Bot: wrap the description parameter of {INFORMATION_TMPL} in'
+   ' the appropriate language template')
 }

 def __init__(self, **kwargs) -> None:
@@ -131,7 +171,8 @@
 edited = False  # to prevent unwanted changes

 for template in code.ifilter_templates():
-if not page.site.sametitle(template.name.strip(), 'Information'):
+if not page.site.sametitle(template.name.strip(),
+   INFORMATION_TMPL):
 continue

 desc = self.get_description(template)
@@ -186,18 +227,25 @@

 :param args: command line arguments
 """
+# set default family to commons
+config.mylang = config.family = 'commons'
+
 local_args = pywikibot.handle_args(args)
 gen_factory = pagegenerators.GeneratorFactory()

 for arg in local_args:
 gen_factory.handle_arg(arg)

+site = pywikibot.Site()
 gen = gen_factory.getCombinedGenerator(preload=True)
-if gen:
-bot = InformationBot(generator=gen)
-bot.run()
-else:
-pywikibot.bot.suggest_help(missing_generator=True)
+if not gen:
+tmpl = pywikibot.Page(site, INFORMATION_TMPL,
+  ns=site.namespaces.TEMPLATE)
+gen = tmpl.getReferences(only_template_inclusion=True,
+   

[Pywikibot-commits] [Gerrit] ...core[master]: [fix] raise SectionError if a section does not exists on a page

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

Change subject: [fix] raise SectionError if a section does not exists on a page
..

[fix] raise SectionError if a section does not exists on a page

Also add some tests and update documentation.

Bug: T107141
Change-Id: Ib515e94657e7100695b69d77934d448ce424e232
---
M pywikibot/page/_basepage.py
M tests/page_tests.py
2 files changed, 38 insertions(+), 6 deletions(-)

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




diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py
index 8eaeeb0..1c51f20 100644
--- a/pywikibot/page/_basepage.py
+++ b/pywikibot/page/_basepage.py
@@ -292,11 +292,10 @@
 return title

 def section(self) -> str | None:
-"""
-Return the name of the section this Page refers to.
+"""Return the name of the section this Page refers to.

-The section is the part of the title following a '#' character, if
-any. If no section is present, return None.
+The section is the part of the title following a ``#`` character,
+if any. If no section is present, return None.
 """
 try:
 section = self._link.section
@@ -373,12 +372,14 @@
  ...
 pywikibot.exceptions.IsRedirectPageError: ... is a redirect page.

+.. versionchanged:: 9.2
+   :exc:`exceptions.SectionError` is raised if the
+   :meth:`section` does not exists
 .. 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
@@ -394,7 +395,18 @@
 if not get_redirect:
 raise

-return self.latest_revision.text  # type: ignore[attr-defined]
+text = self.latest_revision.text
+
+# check for valid section in title
+page_section = self.section()
+if page_section:
+content = textlib.extract_sections(text, self.site)
+headings = {section.heading for section in content.sections}
+if page_section not in headings:
+raise SectionError(f'{page_section!r} is not a valid section '
+   f'of {self.title(with_section=False)}')
+
+return text

 def has_content(self) -> bool:
 """
diff --git a/tests/page_tests.py b/tests/page_tests.py
index b56cf4b..ea4dfd8 100755
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -22,6 +22,7 @@
 IsNotRedirectPageError,
 IsRedirectPageError,
 NoPageError,
+SectionError,
 TimeoutError,
 UnknownExtensionError,
 )
@@ -974,6 +975,7 @@

 def testPageGet(self):
 """Test ``Page.get()`` on different types of pages."""
+fail_msg = '{page!r}.get() raised {error!r} unexpectedly!'
 site = self.get_site('en')
 p1 = pywikibot.Page(site, 'User:Legoktm/R2')
 p2 = pywikibot.Page(site, 'User:Legoktm/R1')
@@ -986,9 +988,27 @@
 r'{} is a redirect page\.'
 .format(re.escape(str(p2:
 p2.get()
+
+try:
+p2.get(get_redirect=True)
+except (IsRedirectPageError, NoPageError, SectionError) as e:
+self.fail(fail_msg.format(page=p2, error=e))
+
 with self.assertRaisesRegex(NoPageError, NO_PAGE_RE):
 p3.get()
 
+page = pywikibot.Page(site, 'User:Legoktm/R2#Section')
+with self.assertRaisesRegex(SectionError,
+"'Section' is not a valid section"):
+page.get()
+
+site = pywikibot.Site('mediawiki')
+page = pywikibot.Page(site, 'Manual:Pywikibot/2.0 #See_also')
+try:
+page.get()
+except (IsRedirectPageError, NoPageError, SectionError) as e:
+self.fail(fail_msg.format(page=page, error=e))
+
 def test_set_redirect_target(self):
 """Test set_redirect_target method."""
 # R1 redirects to R2 and R3 doesn't exist.

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030049?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: Ib515e94657e7100695b69d77934d448ce424e232
Gerrit-Change-Number: 1030049
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- 

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

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

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

Localisation updates from https://translatewiki.net.

Change-Id: I2861ccde18bbfeb0e9c48e3128009b6ec34c37a9
---
M blockpageschecker/ja.json
1 file changed, 3 insertions(+), 0 deletions(-)

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




diff --git a/blockpageschecker/ja.json b/blockpageschecker/ja.json
index cc91816..fc7149e 100644
--- a/blockpageschecker/ja.json
+++ b/blockpageschecker/ja.json
@@ -1,11 +1,14 @@
 {
"@metadata": {
"authors": [
+   "Chqaz",
"Otokoume",
"Shirayuki",
"Weather Top Wizard",
"Whym"
]
},
+   "blockpageschecker-adding": "ボット: ページロックテンプレートの追加",
+   "blockpageschecker-modifying": "ボット: 古いテンプレートを修正",
"blockpageschecker-deleting": "ボットによる: 失効したテンプレートを削除"
 }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/1032461?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: I2861ccde18bbfeb0e9c48e3128009b6ec34c37a9
Gerrit-Change-Number: 1032461
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] [M] ...core[master]: [cleanup] Deprecate total argument in -logevents; use -limit instead

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

Change subject: [cleanup] Deprecate total argument in -logevents; use -limit 
instead
..

[cleanup] Deprecate total argument in -logevents; use -limit instead

Bug: T128981
Change-Id: Idc205c90f7ecdcc68ec0b81f0347509919d82d9d
---
M pywikibot/pagegenerators/__init__.py
M pywikibot/pagegenerators/_factory.py
2 files changed, 82 insertions(+), 59 deletions(-)

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




diff --git a/pywikibot/pagegenerators/__init__.py 
b/pywikibot/pagegenerators/__init__.py
index 477c3fa..b9f02d7 100644
--- a/pywikibot/pagegenerators/__init__.py
+++ b/pywikibot/pagegenerators/__init__.py
@@ -1,5 +1,4 @@
-"""
-This module offers a wide variety of page generators.
+"""This module offers a wide variety of page generators.

 A page generator is an object that is iterable (see :pep:`255`) and
 that yields page objects on which other scripts can then work.
@@ -8,12 +7,12 @@
 generator. For testing purposes listpages.py can be used, to print page
 titles to standard output.

-These parameters are supported to specify which pages titles to print:
+These parameters are supported to specify which pages titles to be used:

 
 """
 #
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -214,44 +213,47 @@

 logevent,username,start,end

-or for backward compatibility::
+.. deprecated:: 9.2
+   backward compatible *total* argument like
+   ``logevent,username,total``; use ``-limit`` filter
+   option instead (see below).

-logevent,username,total
+To use the default value, use an empty string.

 .. note:: 'start' is the most recent date and log
events are iterated from present to past. If
'start' is not provided, it means 'now'; if 'end'
is not provided, it means 'since the beginning'.

-To use the default value, use an empty string.
-You have options for every type of logs given by the
-log event parameter which could be one of the following::
+.. seealso::
+   *letype* of :api:`Logevents` for the supported
+   types of log events.
 
-spamblacklist, titleblacklist, gblblock, renameuser,
-globalauth, gblrights, gblrename, abusefilter,
-massmessage, thanks, usermerge, block, protect, rights,
-delete, upload, move, import, patrol, merge, suppress,
-tag, managetags, contentmodel, review, stable,
-timedmediahandler, newusers
+**Examples:**

-It uses the default number of pages 10.
-
-Examples:
-
--logevents:move gives pages from move log (usually
+``-logevents:move`` gives pages from move log (usually
 redirects)
--logevents:delete,,20 gives 20 pages from deletion log
--logevents:protect,Usr gives pages from protect log by user
-Usr
--logevents:patrol,Usr,20 gives 20 patrolled pages by Usr
--logevents:upload,,20121231,20100101 gives upload pages
-in the 2010s, 2011s, and 2012s
--logevents:review,,20121231 gives review pages since the
-beginning till the 31 Dec 2012
--logevents:review,Usr,20121231 gives review pages by user
-Usr since the beginning till the 31 Dec 2012

-In some cases it must be given as -logevents:"move,Usr,20"
+``-logevents:delete -limit20`` gives 20 pages from deletion
+log
+
+``-logevents:protect,Usr`` gives pages from protect log by
+user Usr
+
+``-logevents:patrol,Usr -limit:20`` gives 20 patrolled
+pages by Usr
+
+``-logevents:upload,,20121231,20100101`` gives upload pages
+in the 2010s, 2011s, and 2012s
+
+``-logevents:review,,20121231`` gives review pages since
+the beginning till the 31 Dec 2012
+
+``-logevents:review,Usr,20121231`` gives review pages by
+user Usr since the beginning till the 31 Dec 2012
+
+In some cases it must be given as
+``-logevents:"move,Usr,20"``

 -interwiki   

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

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

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

Localisation updates from https://translatewiki.net.

Change-Id: I3e4e084c6739b93a47373b19847c3153357b7cfa
---
M delete/diq.json
M delete/ne.json
M misspelling/ne.json
M protect/ne.json
A replicate_wiki/diq.json
A transferbot/diq.json
M undelete/ne.json
M unprotect/diq.json
M unprotect/ne.json
9 files changed, 34 insertions(+), 12 deletions(-)

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




diff --git a/delete/diq.json b/delete/diq.json
index 18312f5..846b5aa 100644
--- a/delete/diq.json
+++ b/delete/diq.json
@@ -11,5 +11,5 @@
"delete-from-file": "Bot: Yew list perran estereno.",
"delete-images": "Boti pela da %(page)s ra dosyay pêro besternay",
"delete-linked-pages": "Boti %(page)s rê gırey peran pêron besterneno.",
-   "delete-referring-pages": "Boti pela da %(page)s ra peley pêro 
besternay"
+   "delete-referring-pages": "Bot: Heme pelanê ke %(page)s de çıme benê, 
bestere"
 }
diff --git a/delete/ne.json b/delete/ne.json
index 0aaf226..ef01c4c 100644
--- a/delete/ne.json
+++ b/delete/ne.json
@@ -2,12 +2,13 @@
"@metadata": {
"authors": [
"राम प्रसाद जोशी",
-   "सरोज कुमार ढकाल"
+   "सरोज कुमार ढकाल",
+   "हिमाल सुबेदी"
]
},
"delete-from-category": "रोबोट:  %(page)s श्रेणीमा रहेका सबै पृष्ठहरू 
मेट्दै",
"delete-from-file": "रोबोट: सूचीमा रहेका पृष्ठहरू मेट्दै",
-   "delete-images": "रोबोट:  %(page)s पृष्ठमा रहेका सबै तस्वीरहरु मेट्दै",
+   "delete-images": "बोट:  %(page)s पृष्ठमा रहेका सबै तस्वीरहरू मेटाउँदै",
"delete-linked-pages": "रोबोट:  %(page)s पृष्ठमा जोडिएका सबै पृष्ठहरू 
मेट्दै",
"delete-referring-pages": "रोबोट:  %(page)s ले जनाउने सबै पृष्ठहरू 
मेट्दै"
 }
diff --git a/misspelling/ne.json b/misspelling/ne.json
index b458bae..de4fd71 100644
--- a/misspelling/ne.json
+++ b/misspelling/ne.json
@@ -1,8 +1,9 @@
 {
"@metadata": {
"authors": [
-   "Njsubedi"
+   "Njsubedi",
+   "हिमाल सुबेदी"
]
},
-   "misspelling-fixing": "रोबोट: %(page)s को लागि हिज्जे बिग्रिएका लिङ्क 
सुधार गर्दै"
+   "misspelling-fixing": "बोट: %(page)s को लागि हिज्जे बिग्रिएका कडी सुधार 
गर्दै"
 }
diff --git a/protect/ne.json b/protect/ne.json
index 5ede948..0e6d21d 100644
--- a/protect/ne.json
+++ b/protect/ne.json
@@ -2,11 +2,12 @@
"@metadata": {
"authors": [
"Njsubedi",
-   "राम प्रसाद जोशी"
+   "राम प्रसाद जोशी",
+   "हिमाल सुबेदी"
]
},
"protect-category": "रोबोट:  %(cat)s वर्गमा रहेका सबै पृष्ठहरूलाई 
सुरक्षित गर्दै",
-   "protect-images": "रोबोट: %(page)s पृष्ठमा रहेका सबै तस्वीरहरु सुरक्षित 
गर्दै",
+   "protect-images": "बोट: %(page)s पृष्ठमा रहेका सबै तस्वीरहरू सुरक्षित 
गर्दै",
"protect-links": "रोबोट:  %(page)s पृष्ठमा जोडिएका सबै पृष्ठहरूलाई 
सुरक्षा गर्दै",
"protect-ref": "रोबोट:  %(page)s ले जनाउने सबै पृष्ठहरू सुरक्षित गर्दै",
"protect-simple": "रोबोट: फाइलहरूको सूची सुरक्षित गर्दै"
diff --git a/replicate_wiki/diq.json b/replicate_wiki/diq.json
new file mode 100644
index 000..3c88a2b
--- /dev/null
+++ b/replicate_wiki/diq.json
@@ -0,0 +1,9 @@
+{
+   "@metadata": {
+   "authors": [
+   "GolyatGeri"
+   ]
+   },
+   "replicate_wiki-same-pages": "Zeri peran peron sey pê yo",
+   "replicate_wiki-summary": "Bot: %(source)s ra Wiki Senkronizasyon"
+}
diff --git a/transferbot/diq.json b/transferbot/diq.json
new file mode 100644
index 000..a34d225
--- /dev/null
+++ b/transferbot/diq.json
@@ -0,0 +1,8 @@
+{
+   "@metadata": {
+   "authors": [
+   "GolyatGeri"
+   ]
+   },
+   "transferbot-summary": "%(source)s ra perla wegêriye"
+}
diff --git a/undelete/ne.json b/undelete/ne.json
index 96b6499..e0a7b0e 100644
--- a/undelete/ne.json
+++ b/undelete/ne.json
@@ -1,10 +1,11 @@
 {
"@metadata": {
"authors": [
-   "सरोज कुमार ढकाल"
+   "सरोज कुमार ढकाल",
+   "हिमाल सुबेदी"
]
},
"undelete-from-file": "रोबोट: सूचीमा रहेका पृष्ठहरू मेट्दै",
-   "undelete-images": "रोबोट:  %(page)s पृष्ठमा रहेका सबै तस्वीरहरु 
अनडिलिट गर्दै",
+   "undelete-images": "बोट:  %(page)s पृष्ठमा रहेका सबै तस्वीरहरू अनडिलिट 
गर्दै",
"undelete-linked-pages": "बोट: %(page)s सँग जोडिएका र मेटिएका पानाहरू 
पुन:स्थापित गर्दै"
 }
diff --git 

[Pywikibot-commits] [Gerrit] [S] ...core[master]: [IMPR] Show the replacements pairs if they are incomplete as user hint

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

Change subject: [IMPR] Show the replacements pairs if they are incomplete as 
user hint
..

[IMPR] Show the replacements pairs if they are incomplete as user hint

Bug: T364689
Change-Id: I360e76aed1258c39facf5dac90a6fb81f7ac670b
---
M scripts/replace.py
M tests/replacebot_tests.py
2 files changed, 13 insertions(+), 8 deletions(-)

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




diff --git a/scripts/replace.py b/scripts/replace.py
index ea12617..e9f4db5 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -142,7 +142,7 @@
 the top of the help.
 """
 #
-# (C) Pywikibot team, 2004-2023
+# (C) Pywikibot team, 2004-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -820,6 +820,8 @@
 """Handle -pairsfile argument.

 .. versionadded:: 7.0
+.. versionchanged:: 9.2
+   replacement patterns are printed it they are incomplete.
 """
 if not filename:
 filename = pywikibot.input(
@@ -835,8 +837,8 @@
 return None

 if len(replacements) % 2:
-pywikibot.error(
-f'{filename} contains an incomplete pattern replacement pair.')
+pywikibot.error(f'{filename} contains an incomplete pattern '
+f'replacement pair:\n{replacements}')
 return None

 # Strip BOM from first line
@@ -893,11 +895,13 @@

 
 def main(*args: str) -> None:  # noqa: C901
-"""
-Process command line arguments and invoke bot.
+"""Process command line arguments and invoke bot.

 If args is an empty list, sys.argv is used.

+.. versionchanged:: 9.2
+   replacement patterns are printed it they are incomplete.
+
 :param args: command line arguments
 """
 options = {}
@@ -976,7 +980,8 @@
 return

 if len(commandline_replacements) % 2:
-pywikibot.error('Incomplete command line pattern replacement pair.')
+pywikibot.error('Incomplete command line pattern replacement pair:\n'
+f'{commandline_replacements}')
 return

 commandline_replacements += file_replacements
diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py
index 2237ba5..a1e7eaf 100755
--- a/tests/replacebot_tests.py
+++ b/tests/replacebot_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Tests for the replace script and ReplaceRobot class."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -109,7 +109,7 @@
 with empty_sites():
 self._run('foo')
 self.assertEqual([
-'Incomplete command line pattern replacement pair.',
+"Incomplete command line pattern replacement pair:\n['foo']",
 ], pywikibot.bot.ui.pop_output())

 # In the end no bots should've been created

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030595?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: I360e76aed1258c39facf5dac90a6fb81f7ac670b
Gerrit-Change-Number: 1030595
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] [S] ...core[master]: [doc] update ROADMAP.rst, HISTORY.rst and CHANGELOG.rst

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

Change subject: [doc] update ROADMAP.rst, HISTORY.rst and CHANGELOG.rst
..

[doc] update ROADMAP.rst, HISTORY.rst and CHANGELOG.rst

Change-Id: I84ff2e16a0a50da774f23dcdc182aabec1efaa62
---
M HISTORY.rst
M ROADMAP.rst
M scripts/CHANGELOG.rst
3 files changed, 14 insertions(+), 2 deletions(-)

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




diff --git a/HISTORY.rst b/HISTORY.rst
index fc240b8..f9cefb7 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -23,7 +23,6 @@
 -
 *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`)
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 19cb97f..7313b90 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,7 @@
 Current release
 ---

-* (no changes yet)
+* Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)

 Deprecations
 
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 825505a..334fac1 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -1,6 +1,19 @@
 Scripts Changelog
 =

+9.2.0
+-
+
+commons_information
+^^^
+
+* Preload pages to make the script upto 10 times faster
+
+noreferences
+
+
+* L10N updates
+
 9.1.0
 -


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030597?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: I84ff2e16a0a50da774f23dcdc182aabec1efaa62
Gerrit-Change-Number: 1030597
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] [S] ...core[master]: [doc] Fix sphinx roles

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

Change subject: [doc] Fix sphinx roles
..

[doc] Fix sphinx roles

Change-Id: Ia1c2b24afb8bb07c25fe0747aab424b2ab8c03b0
---
M pywikibot/families/lingualibre_family.py
M pywikibot/i18n.py
M pywikibot/site/_apisite.py
M pywikibot/site/_generators.py
M setup.py
5 files changed, 8 insertions(+), 8 deletions(-)

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




diff --git a/pywikibot/families/lingualibre_family.py 
b/pywikibot/families/lingualibre_family.py
index 99a36ad..6b81c93 100644
--- a/pywikibot/families/lingualibre_family.py
+++ b/pywikibot/families/lingualibre_family.py
@@ -1,9 +1,9 @@
 """Family module for Lingua Libre.

-.. versionaddded: 6.5
+.. versionadded:: 6.5
 """
 #
-# (C) Pywikibot team, 2021-2023
+# (C) Pywikibot team, 2021-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -16,7 +16,7 @@

 """Family class for Lingua Libre.

-.. versionaddded: 6.5
+.. versionadded:: 6.5
 """

 name = 'lingualibre'
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 51146cc..9a5ceb7 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -15,7 +15,7 @@
 See :py:obj:`twtranslate` for more information on the messages.
 """
 #
-# (C) Pywikibot team, 2004-2023
+# (C) Pywikibot team, 2004-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -657,7 +657,7 @@
 ) -> str:
 """Get the bot prefix string like 'Bot: ' including space delimiter.

-.. note: If *source* is a str and ``config.bot_prefix`` is set to
+.. note:: If *source* is a str and ``config.bot_prefix`` is set to
None, it cannot be determined whether the current user is a bot
account. In this cas the prefix will be returned.
 .. versionadded:: 8.1
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 4924b60..729a7ec 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -2516,7 +2516,7 @@

 Requires appropriate privileges.

-.. seealso: :api:`Delete`
+.. seealso:: :api:`Delete`

 Page to be deleted can be given either as Page object or as pageid.
 To delete a specific version of an image the oldimage identifier
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 6d954e3..1ee5a29 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -1856,7 +1856,7 @@
 Pages are listed in a fixed sequence, only the starting point is
 random.

-.. seealso: :api:`Random`
+.. seealso:: :api:`Random`
 .. versionchanged:: 9.0
Raises ``TypeError`` instead of ``AssertionError`` if
*redirects* is invalid.
diff --git a/setup.py b/setup.py
index 5428b45..cb14e17 100755
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,7 @@
   ``pywikibot.__metadata__.py`` and adding developmental identifier
 - upload this patchset to Gerrit and merge it.

-.. warning: do not upload a development release to pypi.
+.. warning:: do not upload a development release to pypi.
 """
 #
 # (C) Pywikibot team, 2009-2024

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030593?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: Ia1c2b24afb8bb07c25fe0747aab424b2ab8c03b0
Gerrit-Change-Number: 1030593
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] [S] ...core[master]: [doc] update maintenance documentation

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

Change subject: [doc] update maintenance documentation
..

[doc] update maintenance documentation

Change-Id: I66c4aa4cc4f7075ca0d764c254d18e0cb6ae4679
---
M scripts/maintenance/__init__.py
1 file changed, 11 insertions(+), 2 deletions(-)

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




diff --git a/scripts/maintenance/__init__.py b/scripts/maintenance/__init__.py
index e2ce651..bc5b99f 100644
--- a/scripts/maintenance/__init__.py
+++ b/scripts/maintenance/__init__.py
@@ -1,5 +1,14 @@
 """Maintenance scripts.

-.. versionchanged:: 8.0
-   sorting_order script was removed.
+.. versionremoved:: 3.0.20190430
+   ``diff_checker`` script was removed (:phab:`T221462`).
+.. versionremoved:: 6.1
+   ``compat2core`` script was removed.
+.. versionremoved:: 7.3
+   ``update_linktrails`` script (:phab:`T89451`) and ``update_script``
+   script were removed.
+.. versionremoved:: 8.0
+   ``sorting_order`` script was removed (:phab:`T325426`).
+.. versionremoved:: 9.0
+   ``wikimedia_sites`` script was removed (:phab:`T78396`).
 """

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030538?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: I66c4aa4cc4f7075ca0d764c254d18e0cb6ae4679
Gerrit-Change-Number: 1030538
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] [XS] ...core[master]: [doc] use `code-block` directive instead of `code`

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

Change subject: [doc] use `code-block` directive instead of `code`
..

[doc] use `code-block` directive instead of `code`

but keep it in README.rst which is used by Github.

Change-Id: Ibb1c7fae346daeac6e8174d4fee650c4b81d79ce
---
M pywikibot/site/_generators.py
M pywikibot/specialbots/_upload.py
M pywikibot/textlib.py
3 files changed, 4 insertions(+), 4 deletions(-)

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




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index bdb7b63..6d954e3 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 partially within your code like:

-   .. code:: python
+   .. code-block:: python

   from pywikibot import config
   save_timeout = config.socket_timeout  # save the timeout config
diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index 7e3a8d8..c10f519 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -36,7 +36,7 @@
 origin *file_url* passed to the :meth:`upload` method and the
 *filename* returned from that method. It can be used like this:

-.. code:: python
+.. code-block:: python

def summarize(old: str, new: str | None) -> None:
if new is None:
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index db243e7..8cc33a7 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -574,7 +574,7 @@

 The parser is used by :func:`removeHTMLParts` similar to this:

-.. code:: python
+.. code-block:: python

from contextlib import closing
from pywikibot.textlib import _GetDataHTML
@@ -586,7 +586,7 @@

 The result is:

-.. code:: text
+.. code-block:: html

Test me!


--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030534?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: Ibb1c7fae346daeac6e8174d4fee650c4b81d79ce
Gerrit-Change-Number: 1030534
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] [S] ...core[master]: [doc] Update documentation of scripts

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

Change subject: [doc] Update documentation of scripts
..

[doc] Update documentation of scripts

Change-Id: I2809512eda5fb6e40908359a41e7a733ccb2ff7b
---
M scripts/change_pagelang.py
M scripts/download_dump.py
2 files changed, 17 insertions(+), 15 deletions(-)

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




diff --git a/scripts/change_pagelang.py b/scripts/change_pagelang.py
index d977639..473b785 100755
--- a/scripts/change_pagelang.py
+++ b/scripts/change_pagelang.py
@@ -1,8 +1,8 @@
 #!/usr/bin/env python3
-"""
-This script changes the content language of pages.
+"""This script changes the content language of pages.

-These command line parameters can be used to specify which pages to work on:
+These command line parameters can be used to specify which pages to work
+on:

 

@@ -10,18 +10,20 @@

 -setlang  What language the pages should be set to

--always   If a language is already set for a page, always change it
-  to the one set in -setlang.
+-always   If a language is already set for a page, always change
+  it to the one set in -setlang.

--neverIf a language is already set for a page, never change it to
-  the one set in -setlang (keep the current language).
+-neverIf a language is already set for a page, never change
+  it to the one set in -setlang (keep the current
+  language).

 .. note:: This script is a
-   :py:obj:`ConfigParserBot `. All options
-   can be set within a settings file which is scripts.ini by default.
+   :class:`ConfigParserBot`. All options can be set
+   within a settings file which is scripts.ini by default.
+.. versionadded:: 5.1
 """
 #
-# (C) Pywikibot team, 2018-2023
+# (C) Pywikibot team, 2018-2024
 #
 # Distributed under the terms of the MIT license.
 #
diff --git a/scripts/download_dump.py b/scripts/download_dump.py
index 8fb42f7..f374923 100755
--- a/scripts/download_dump.py
+++ b/scripts/download_dump.py
@@ -1,6 +1,5 @@
 #!/usr/bin/env python3
-"""
-This bot downloads dump from dumps.wikimedia.org.
+"""This bot downloads dump from dumps.wikimedia.org.

 This script supports the following command line parameters:

@@ -12,11 +11,12 @@
 formatted as MMDD.

 .. note:: This script is a
-   :py:obj:`ConfigParserBot `. All options
-   can be set within a settings file which is scripts.ini by default.
+   :class:`ConfigParserBot`. All options can be set
+   within a settings file which is scripts.ini by default.
+.. versionadded:: 3.0.20180108
 """
 #
-# (C) Pywikibot team, 2017-2022
+# (C) Pywikibot team, 2017-2024
 #
 # Distributed under the terms of the MIT license.
 #

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030528?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: I2809512eda5fb6e40908359a41e7a733ccb2ff7b
Gerrit-Change-Number: 1030528
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] [S] ...core[master]: [IMPR] Use a set for lang_tmp_cat category content instead of a gener...

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

Change subject: [IMPR] Use a set for lang_tmp_cat category content instead of a 
generator
..

[IMPR] Use a set for lang_tmp_cat category content instead of a generator

lang_tmp_cat is a generator for a category that holds the languages templates.
instead using the generator for __contains__ operator create a set first.

Change-Id: I5d5a07bd7acee977d9ecd59bf7556d12ec2feffc
---
M scripts/commons_information.py
1 file changed, 9 insertions(+), 1 deletion(-)

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




diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index 2cf69eb..e71aecd 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -62,7 +62,7 @@
 """Initialzer."""
 super().__init__(**kwargs)
 lang_tmp_cat = pywikibot.Category(self.site, self.lang_tmp_cat)
-self.lang_tmps = lang_tmp_cat.articles(namespaces=[10])
+self.lang_tmps = set(lang_tmp_cat.articles(namespaces=[10]))

 def get_description(self, template):
 """Get description parameter."""
@@ -129,23 +129,29 @@
 page = self.current_page
 code = mwparserfromhell.parse(page.text)
 edited = False  # to prevent unwanted changes
+
 for template in code.ifilter_templates():
 if not page.site.sametitle(template.name.strip(), 'Information'):
 continue
+
 desc = self.get_description(template)
 if desc is None:
 continue
+
 for tmp in desc.value.filter_templates(recursive=False):
 if self.process_desc_template(tmp):
 edited = True
+
 desc_clean = copy.deepcopy(desc.value)
 for tmp in desc_clean.filter_templates(recursive=False):
 # TODO: emit a debug item?
 desc_clean.remove(tmp)
+
 value = desc_clean.strip()
 if value == '':
 pywikibot.info('Empty description')
 continue
+
 pywikibot.info(value)
 langs = self.detect_langs(value)
 if langs:
@@ -153,6 +159,7 @@
 for language in langs:
 pywikibot.info(
 f'<>{language.lang}: {language.prob}')
+
 lang = pywikibot.input(
 'Enter the language of the displayed text:').strip()
 if lang != '':
@@ -163,6 +170,7 @@
 new = mwparserfromhell.nodes.template.Template(lang, [value])
 self.replace_value(desc, new)
 edited = True
+
 if edited:
 text = str(code)
 summary = i18n.translate(page.site.lang, self.comment,

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030176?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: I5d5a07bd7acee977d9ecd59bf7556d12ec2feffc
Gerrit-Change-Number: 1030176
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] [XS] ...core[master]: [IMPR] preload pages in commons_information.py

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

Change subject: [IMPR] preload pages in commons_information.py
..

[IMPR] preload pages in commons_information.py

The script is up tp 10 times faster.

Change-Id: I7ab108188660889cb27900443c0b2dba3ce5c9cf
---
M scripts/commons_information.py
1 file changed, 4 insertions(+), 1 deletion(-)

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




diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index 138f842..2cf69eb 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -17,6 +17,9 @@

 python pwb.py commons_information -start:File:!

+.. versionadded:: 6.0
+.. versionchanged:: 9.2
+   accelerated script with preloading pages.
 """
 #
 # (C) Pywikibot team, 2015-2024
@@ -181,7 +184,7 @@
 for arg in local_args:
 gen_factory.handle_arg(arg)

-gen = gen_factory.getCombinedGenerator()
+gen = gen_factory.getCombinedGenerator(preload=True)
 if gen:
 bot = InformationBot(generator=gen)
 bot.run()

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030276?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: I7ab108188660889cb27900443c0b2dba3ce5c9cf
Gerrit-Change-Number: 1030276
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] [S] ...core[master]: [IMPR] adding documentation to commons_information.py

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

Change subject: [IMPR] adding documentation to commons_information.py
..

[IMPR] adding documentation to commons_information.py

Adding standard documentation to commons_information.py and fixing some typos 
inside

Bug: T349269
Change-Id: Ie1919407a48041c7d90856e8090078658cc9d6b4
---
M scripts/commons_information.py
1 file changed, 24 insertions(+), 3 deletions(-)

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




diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index 8c2fe59..138f842 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -1,7 +1,25 @@
 #!/usr/bin/env python3
-"""Insert a language template into the description field."""
+"""
+This bot adds a language template to the file's description field.
+
+This script understands the following command-line arguments:
+
+
+
+Usage:
+
+python pwb.py commons_information [pagegenerators]
+
+You can use any typical pagegenerator (like categories) to provide with a
+list of pages.
+
+Example for going through all files:
+
+python pwb.py commons_information -start:File:!
+
+"""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -15,6 +33,9 @@
 from pywikibot import i18n, pagegenerators
 from pywikibot.bot import ExistingPageBot, SingleSiteBot

+# This is required for the text that is shown when you run this script
+# with the parameter -help or without parameters.
+docuReplacements = {'': pagegenerators.parameterHelp}  # noqa: N816

 try:
 import langdetect
@@ -52,7 +73,7 @@

 @staticmethod
 def detect_langs(text):
-"""Detect language from griven text."""
+"""Detect language from given text."""
 if langdetect is not None:
 return langdetect.detect_langs(text)
 return None

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1030040?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: Ie1919407a48041c7d90856e8090078658cc9d6b4
Gerrit-Change-Number: 1030040
Gerrit-PatchSet: 3
Gerrit-Owner: Rubin 
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


  1   2   3   4   5   6   7   8   9   10   >