jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731223 )
Change subject: [doc] Update ConfigParserBot documentation
......................................................................
[doc] Update ConfigParserBot documentation
- update documentation for basic.py
- add documention for blockpageschecker.py
clean_sandbox.py:
- update documentation
- remove internal option 'no_repeat' and use hours value -1 to not
repeat script run
- remove internal 'delay_td' option and use delay_td attribute instead
Change-Id: I97a1a1d91efc377737a8d130d3cd4872a3aefaec
---
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/clean_sandbox.py
3 files changed, 18 insertions(+), 12 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/basic.py b/scripts/basic.py
index 0691d00..e8695da 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -22,10 +22,12 @@
-summary: Set the action summary message for the edit.
-All settings can be made either by giving option with the command line
-or with a settings file which is scripts.ini by default. If you don't
-want the default values you can add any option you want to change to
-that settings file below the [basic] section like:
+This sample script is a
+:py:obj:`ConfigParserBot <pywikibot.bot.ConfigParserBot>`. All settings can be
+made either by giving option with the command line or with a settings file
+which is scripts.ini by default. If you don't want the default values you can
+add any option you want to change to that settings file below the [basic]
+section like:
[basic] ; inline comments starts with colon
# This is a commend line. Assignments may be done with '=' or ':'
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index dc8715f..b5186c3 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -19,6 +19,10 @@
-moveprotected Same as -protectedpages, for moveprotected pages
+This script is a :py:obj:`ConfigParserBot <pywikibot.bot.ConfigParserBot>`.
+The following options can be set within a settings file which is scripts.ini
+by default::
+
-always Doesn't ask every time whether the bot should make the change.
Do it always.
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 6848c1d..e27b729 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -23,6 +23,7 @@
-summary Summary of the edit made by bot. Overrides the default
from i18n.
+This script is a :py:obj:`ConfigParserBot <pywikibot.bot.ConfigParserBot>`.
All local parameters can be given inside a scripts.ini file. Options
passed to the script are priorized over options read from ini file. See:
https://docs.python.org/3/library/configparser.html#supported-ini-file-stru…
@@ -152,12 +153,10 @@
"""Sandbox reset bot."""
available_options = {
- 'hours': 1.0,
- 'no_repeat': True,
+ 'hours': -1.0, # do not repeat if hours < 0
'delay': -1,
'text': '',
'summary': '',
- 'delay_td': None, # not a real option but __init__ sets it
}
def __init__(self, **kwargs) -> None:
@@ -165,10 +164,10 @@
super().__init__(**kwargs)
if self.opt.delay < 0:
d = min(15, max(5, int(self.opt.hours * 60)))
- self.opt.delay_td = datetime.timedelta(minutes=d)
+ self.delay_td = datetime.timedelta(minutes=d)
else:
d = max(5, self.opt.delay)
- self.opt.delay_td = datetime.timedelta(minutes=d)
+ self.delay_td = datetime.timedelta(minutes=d)
self.site = pywikibot.Site()
self.translated_content = self.opt.text or i18n.translate(
@@ -224,7 +223,7 @@
else:
edit_delta = (datetime.datetime.utcnow()
- sandbox_page.editTime())
- delta = self.opt.delay_td - edit_delta
+ delta = self.delay_td - edit_delta
# Is the last edit more than 'delay' minutes ago?
if delta <= datetime.timedelta(0):
sandbox_page.put(
@@ -247,9 +246,11 @@
pywikibot.output(
'*** The sandbox is not existent, skipping.')
continue
- if self.opt.no_repeat:
+
+ if self.opt.hours < 0:
pywikibot.output('\nDone.')
return
+
if not wait:
if self.opt.hours < 1.0:
pywikibot.output('\nSleeping {} minutes, now {}'.format(
@@ -279,7 +280,6 @@
continue
if opt == 'hours':
opts[opt] = float(value)
- opts['no_repeat'] = False
elif opt == 'delay':
opts[opt] = int(value)
elif opt == 'text':
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731223
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: I97a1a1d91efc377737a8d130d3cd4872a3aefaec
Gerrit-Change-Number: 731223
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731263 )
Change subject: [types] Fix type hints
......................................................................
[types] Fix type hints
- fix type hints for CategorizedPageGenerator and SubCategoriesPageGenerator
- update documentation
Change-Id: I01954ca52593d27ccf560e6bc83cca2d03316bfe
---
M pywikibot/pagegenerators.py
1 file changed, 28 insertions(+), 23 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 4579107..54653cc 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -716,6 +716,12 @@
Return generator based on Category defined by category and gen_func.
:param category: category name with start parameter
+ :param recurse: if not False or 0, also iterate articles in
+ subcategories. If an int, limit recursion to this number of
+ levels. (Example: recurse=1 will iterate articles in first-level
+ subcats, but no deeper.)
+ :param content: if True, retrieve the content of the current version
+ of each page (default False)
"""
if gen_func is None:
raise ValueError('getCategoryGen requires a gen_func argument')
@@ -1538,24 +1544,23 @@
def CategorizedPageGenerator(category: pywikibot.page.Category,
recurse: Union[int, bool] = False,
- start: Optional[int] = None,
+ start: Optional[str] = None,
total: Optional[int] = None,
content: bool = False,
namespaces: Optional[Sequence[int]] = None
) -> Iterable['pywikibot.page.Page']:
"""Yield all pages in a specific category.
- If recurse is True, pages in subcategories are included as well; if
- recurse is an int, only subcategories to that depth will be included
- (e.g., recurse=2 will get pages in subcats and sub-subcats, but will
- not go any further).
-
- If start is a string value, only pages whose sortkey comes after start
- alphabetically are included.
-
- If content is True (default is False), the current page text of each
- retrieved page will be downloaded.
-
+ :param recurse: if not False or 0, also iterate articles in
+ subcategories. If an int, limit recursion to this number of
+ levels. (Example: recurse=1 will iterate articles in first-level
+ subcats, but no deeper.)
+ :param start: if provided, only generate pages >= this title
+ lexically
+ :param total: iterate no more than this number of pages in
+ total (at all levels)
+ :param content: if True, retrieve the content of the current version
+ of each page (default False)
"""
kwargs = {
'content': content,
@@ -1569,22 +1574,22 @@
def SubCategoriesPageGenerator(category: 'pywikibot.page.Category',
recurse: Union[int, bool] = False,
- start: Optional[int] = None,
+ start: Optional[str] = None,
total: Optional[int] = None,
content: bool = False
) -> Iterable['pywikibot.page.Page']:
"""Yield all subcategories in a specific category.
- If recurse is True, pages in subcategories are included as well; if
- recurse is an int, only subcategories to that depth will be included
- (e.g., recurse=2 will get pages in subcats and sub-subcats, but will
- not go any further).
-
- If start is a string value, only categories whose sortkey comes after
- start alphabetically are included.
-
- If content is True (default is False), the current page text of each
- category description page will be downloaded.
+ :param recurse: if not False or 0, also iterate articles in
+ subcategories. If an int, limit recursion to this number of
+ levels. (Example: recurse=1 will iterate articles in first-level
+ subcats, but no deeper.)
+ :param start: if provided, only generate pages >= this title
+ lexically
+ :param total: iterate no more than this number of pages in
+ total (at all levels)
+ :param content: if True, retrieve the content of the current version
+ of each page (default False)
"""
# TODO: page generator could be modified to use cmstartsortkey ...
for s in category.subcategories(recurse=recurse,
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731263
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: I01954ca52593d27ccf560e6bc83cca2d03316bfe
Gerrit-Change-Number: 731263
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/729231 )
Change subject: [IMPR] provide a initialize_handlers wrapper for ui functions
......................................................................
[IMPR] provide a initialize_handlers wrapper for ui functions
provide a initialize_handlers wrapper for ui functions
and decorate ui functions with initialize_handlers wrapper
Patch detached from Ia1c7f31
Change-Id: Iad9cae7e08f2a7da0be8434adfa9ebf65370367c
---
M pywikibot/bot.py
1 file changed, 21 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index d477031..d439154 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -98,8 +98,10 @@
import time
import warnings
import webbrowser
+
from collections.abc import Generator
from contextlib import closing
+from functools import wraps
from importlib import import_module
from pathlib import Path
from textwrap import fill
@@ -320,11 +322,11 @@
def init_handlers() -> None:
"""Initialize logging system for terminal-based bots.
- This function must be called before using pywikibot.output(); and must
- be called again if the destination stream is changed.
+ This function must be called before using any input/output methods;
+ and must be called again if ui handler is changed..
- Note: this function is called by handle_args(), so it should normally
- not need to be called explicitly
+ Note: this function is called by any user input and output function,
+ so it should normally not need to be called explicitly.
All user output is routed through the logging module.
Each type of output is handled by an appropriate handler object.
@@ -532,7 +534,19 @@
# User input functions
+def initialize_handlers(function):
+ """Make sure logging system has been initialized.
+ .. versionadded:: 7.0
+ """
+ @wraps(function)
+ def wrapper(*args, **kwargs):
+ init_handlers()
+ return function(*args, **kwargs)
+ return wrapper
+
+
+@initialize_handlers
def input(question: str,
password: bool = False,
default: Optional[str] = '',
@@ -546,15 +560,11 @@
an answer.
:param force: Automatically use the default
"""
- # make sure logging system has been initialized
- if not _handlers_initialized:
- init_handlers()
-
assert ui is not None
- data = ui.input(question, password=password, default=default, force=force)
- return data
+ return ui.input(question, password=password, default=default, force=force)
+@initialize_handlers
def input_choice(question: str,
answers: ANSWER_TYPE,
default: Optional[str] = None,
@@ -579,10 +589,6 @@
selected, it does not return the shortcut and the default is not a
valid shortcut.
"""
- # make sure logging system has been initialized
- if not _handlers_initialized:
- init_handlers()
-
assert ui is not None
return ui.input_choice(question, answers, default, return_shortcut,
automatic_quit=automatic_quit, force=force)
@@ -619,6 +625,7 @@
automatic_quit=automatic_quit, force=force) == 'y'
+@initialize_handlers
def input_list_choice(question: str,
answers: ANSWER_TYPE,
default: Union[int, str, None] = None,
@@ -633,9 +640,6 @@
:param force: Automatically use the default
:return: The selected answer.
"""
- if not _handlers_initialized:
- init_handlers()
-
assert ui is not None
return ui.input_list_choice(question, answers, default=default,
force=force)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/729231
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: Iad9cae7e08f2a7da0be8434adfa9ebf65370367c
Gerrit-Change-Number: 729231
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731124 )
Change subject: [doc] use sphinx directives for versioning
......................................................................
[doc] use sphinx directives for versioning
Change-Id: I9d4d9484308f40664d5b01f88cc07e11ce1e2f38
---
M pywikibot/__init__.py
M pywikibot/__metadata__.py
M pywikibot/bot_choice.py
M pywikibot/comms/eventstreams.py
M pywikibot/config.py
M pywikibot/exceptions.py
M pywikibot/families/commons_family.py
M pywikibot/families/foundation_family.py
M pywikibot/families/lingualibre_family.py
M pywikibot/families/wikihow_family.py
M pywikibot/families/wikimania_family.py
M pywikibot/families/wikispore_family.py
M pywikibot/family.py
M pywikibot/page/__init__.py
M pywikibot/pagegenerators.py
M pywikibot/plural.py
M pywikibot/site/_apisite.py
M pywikibot/site/_generators.py
M pywikibot/site_detect.py
M pywikibot/specialbots/_upload.py
M pywikibot/textlib.py
M pywikibot/userinterfaces/_interface_base.py
M pywikibot/userinterfaces/gui.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/version.py
25 files changed, 98 insertions(+), 68 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index e0e55e4..698185b 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1052,7 +1052,7 @@
This data type is just a json container
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
_items = ('json',)
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 98f2899..155bdd7 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -1,6 +1,6 @@
"""Pywikibot metadata file.
-*New in version 4.0.*
+.. versionadded:: 4.0
"""
#
# (C) Pywikibot team, 2020-2021
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 90fc602..822fe9d 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -95,8 +95,9 @@
def result(self, value: str) -> Any:
"""Return the actual value which is associated by the given one.
- *New in version 6.2:* *result()* is an abstract method and must
- be defined in subclasses
+ .. versionadded:: 6.2
+ *result()* is an abstract method and must be defined in
+ subclasses
"""
raise NotImplementedError()
@@ -498,7 +499,7 @@
"""An option to show a list and select an item.
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
before_question = True
@@ -538,7 +539,7 @@
"""An option to select multiple items from a list.
- *New in version 3.0.*
+ .. versionadded 3.0
"""
def test(self, value: str) -> bool:
@@ -569,7 +570,7 @@
"""An option to show a list and select multiple items.
- *New in version 3.0.*
+ .. versionadded 3.0
"""
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py
index c92bc7b..3776e96 100644
--- a/pywikibot/comms/eventstreams.py
+++ b/pywikibot/comms/eventstreams.py
@@ -7,7 +7,7 @@
pip install sseclient
-*New in version 3.0.*
+.. versionadded:: 3.0
"""
#
# (C) Pywikibot team, 2017-2021
diff --git a/pywikibot/config.py b/pywikibot/config.py
index c6bbe26..cd38f22 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -25,7 +25,8 @@
- datafilepath
- shortpath
-*Renamed in version 6.2*
+.. versionchanged 6.2::
+ config2 was renamed to config
"""
#
# (C) Pywikibot team, 2003-2021
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 0850418..ef76f0f 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -470,7 +470,7 @@
"""Missing page history.
- *New in version 6.2.*
+ .. versionadded:: 6.2
"""
message = 'Page %s is invalid.'
diff --git a/pywikibot/families/commons_family.py b/pywikibot/families/commons_family.py
index 4670ab2..7ac1656 100644
--- a/pywikibot/families/commons_family.py
+++ b/pywikibot/families/commons_family.py
@@ -42,6 +42,6 @@
def interface(self, code):
"""Return 'DataSite' to enable structured data.
- *New in version 6.5.*
+ .. versionadded 6.5
"""
return 'DataSite'
diff --git a/pywikibot/families/foundation_family.py b/pywikibot/families/foundation_family.py
index cc9d7b2..d0b7556 100644
--- a/pywikibot/families/foundation_family.py
+++ b/pywikibot/families/foundation_family.py
@@ -1,19 +1,21 @@
"""Family module for Foundation wiki.
-*New in version 3.0.*
+.. versionadded 3.0
"""
#
-# (C) Pywikibot team, 2019-2020
+# (C) Pywikibot team, 2019-2021
#
# Distributed under the terms of the MIT license.
#
from pywikibot import family
-# The Foundation family
class Family(family.WikimediaFamily, family.SingleSiteFamily):
- """Family class for Foundation wiki."""
+ """Family class for Foundation wiki.
+
+ .. versionadded 3.0
+ """
name = 'foundation'
domain = 'foundation.wikimedia.org'
diff --git a/pywikibot/families/lingualibre_family.py b/pywikibot/families/lingualibre_family.py
index 3e47258..73523ea 100644
--- a/pywikibot/families/lingualibre_family.py
+++ b/pywikibot/families/lingualibre_family.py
@@ -1,4 +1,7 @@
-"""Family module for Lingua Libre."""
+"""Family module for Lingua Libre.
+
+.. versionaddded: 6.5
+"""
#
# (C) Pywikibot team, 2021
#
@@ -7,12 +10,11 @@
from pywikibot import family
-# The Lingua Libre family
class Family(family.WikimediaFamily):
"""Family class for Lingua Libre.
- *New in version 6.5.*
+ .. versionaddded: 6.5
"""
name = 'lingualibre'
diff --git a/pywikibot/families/wikihow_family.py b/pywikibot/families/wikihow_family.py
index afe6f85..4aa93f7 100644
--- a/pywikibot/families/wikihow_family.py
+++ b/pywikibot/families/wikihow_family.py
@@ -1,9 +1,9 @@
"""Family module for Wikihow Wiki.
-*New in version 3.0.*
+.. versionadded:: 3.0
"""
#
-# (C) Pywikibot team, 2020
+# (C) Pywikibot team, 2020-2021
#
# Distributed under the terms of the MIT license.
#
@@ -11,7 +11,12 @@
from pywikibot.tools import classproperty
-class Family(family.SubdomainFamily): # noqa: D101
+class Family(family.SubdomainFamily):
+
+ """Family class for Wikihow Wiki.
+
+ .. versionaddded: 3.0
+ """
name = 'wikihow'
domain = 'wikihow.com'
diff --git a/pywikibot/families/wikimania_family.py b/pywikibot/families/wikimania_family.py
index 3ba5ba1..aa8c468 100644
--- a/pywikibot/families/wikimania_family.py
+++ b/pywikibot/families/wikimania_family.py
@@ -1,9 +1,9 @@
"""Family module for Wikimania wikis.
-*New in version 3.0.*
+.. versionadded:: 3.0
"""
#
-# (C) Pywikibot team, 2017-2020
+# (C) Pywikibot team, 2017-2021
#
# Distributed under the terms of the MIT license.
#
@@ -14,7 +14,10 @@
# The Wikimania family
class Family(family.SubdomainFamily, family.WikimediaFamily):
- """Family class for Wikimania wikis."""
+ """Family class for Wikimania wikis.
+
+ .. versionadded:: 3.0
+ """
name = 'wikimania'
diff --git a/pywikibot/families/wikispore_family.py b/pywikibot/families/wikispore_family.py
index 1dd3037..7178ea9 100644
--- a/pywikibot/families/wikispore_family.py
+++ b/pywikibot/families/wikispore_family.py
@@ -1,18 +1,21 @@
"""Family module for Wikispore.
-*New in version 4.1.*
+.. versionadded:: 4.1
"""
#
-# (C) Pywikibot team, 2020
+# (C) Pywikibot team, 2020-2021
#
# Distributed under the terms of the MIT license.
#
from pywikibot import family
-class Family(family.Family): # noqa: D101
+class Family(family.Family):
- """Family class for Wikispore."""
+ """Family class for Wikispore.
+
+ .. versionadded:: 4.1
+ """
name = 'wikispore'
langs = {
diff --git a/pywikibot/family.py b/pywikibot/family.py
index abdf7a6..a14d60e 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -656,14 +656,14 @@
def get_edit_restricted_templates(self, code):
"""Return tuple of edit restricted templates.
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
return self.edit_restricted_templates.get(code, ())
def get_archived_page_templates(self, code):
"""Return tuple of archived page templates.
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
return self.archived_page_templates.get(code, ())
@@ -695,7 +695,8 @@
"""
Return whether a HTTPS certificate should be verified.
- *Renamed in version 5.3.*
+ .. versionadded:: 5.3
+ renamed from ignore_certificate_error
:param code: language code
:return: flag to verify the SSL certificate;
@@ -773,14 +774,14 @@
def eventstreams_host(self, code):
"""Hostname for EventStreams.
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
raise NotImplementedError('This family does not support EventStreams')
def eventstreams_path(self, code):
"""Return path for EventStreams.
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
raise NotImplementedError('This family does not support EventStreams')
@@ -1059,7 +1060,8 @@
"""Common features of Fandom families.
- *Renamed in version 3.0.*
+ .. versionadded:: 3.0
+ renamed from WikiaFamily
"""
@classproperty
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index b8bf88b..f696a0a 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1763,7 +1763,7 @@
def has_deleted_revisions(self) -> bool:
"""Return True if the page has deleted revisions.
- *New in version 4.2.*
+ .. versionadded:: 4.2
"""
if not hasattr(self, '_has_deleted_revisions'):
gen = self.site.deletedrevs(self, total=1, prop=['ids'])
@@ -2174,7 +2174,7 @@
Return the first 'preferred' ranked Claim specified by Wikibase
property or the first 'normal' one otherwise.
- *New in version 3.0.*
+ .. versionadded:: 3.0
:param prop: property id, "P###"
:return: Claim object given by Wikibase property number
@@ -2490,7 +2490,7 @@
the method returns the associated mediainfo entity. Otherwise,
it falls back to behavior of BasePage.data_item.
- *New in version 6.5.*
+ .. versionadded:: 6.5
:rtype: pywikibot.page.WikibaseEntity
"""
@@ -3133,7 +3133,7 @@
) -> Iterable[Tuple[Page, Revision]]:
"""Yield tuples describing this user's deleted edits.
- *New in version 5.5.*
+ .. versionadded:: 5.5
:param total: Limit results to this number of pages
:keyword start: Iterate contributions starting at this Timestamp
@@ -3435,7 +3435,7 @@
"""Interface for MediaInfo entities on Commons.
- *New in version 6.5.*
+ .. versionadded:: 6.5
"""
title_pattern = r'M[1-9]\d*'
@@ -5618,7 +5618,7 @@
- badges: Any badges associated with the sitelink
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
# Components used for __repr__
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 7f0afcf..f85c0f4 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1279,7 +1279,7 @@
def handle_args(self, args: Iterable[str]) -> List[str]:
"""Handle command line arguments and return the rest as a list.
- *New in version 6.0.*
+ .. versionadded:: 6.0
"""
return [arg for arg in args if not self.handle_arg(arg)]
@@ -1292,7 +1292,8 @@
can try parsing the argument. Call getCombinedGenerator() after all
arguments have been parsed to get the final output generator.
- *Renamed in version 6.0.*
+ .. versionadded:: 6.0
+ renamed from ``handleArg``
:param arg: Pywikibot argument consisting of -name:value
:return: True if the argument supplied was recognised by the factory
diff --git a/pywikibot/plural.py b/pywikibot/plural.py
index bb4c9d0..45b015d 100644
--- a/pywikibot/plural.py
+++ b/pywikibot/plural.py
@@ -110,6 +110,6 @@
def plural_rule(lang: str) -> PluralRule:
"""Return the plural rule for a given lang.
- *New in version 4.3.*
+ .. versionadded:: 4.3
"""
return plural_rules.get(lang, plural_rules['_default'])
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index eb2623e..67ea3ed 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -1417,7 +1417,7 @@
If more than one target id is provided, the same action is taken for
all of them.
- *New in version 6.0.*
+ .. versionadded:: 6.0
:param targettype: Type of target. One of "archive", "filearchive",
"logging", "oldimage", "revision".
@@ -2048,9 +2048,11 @@
To delete a specific version of an image the oldimage identifier
must be provided.
- *Renamed in version 6.1.*
+ .. versionadded:: 6.1
+ renamed from *deletepage*
- *New in version 6.1:* keyword only parameter *oldimage* was added.
+ .. versionchanged:: 6.1
+ keyword only parameter *oldimage* was added.
:param page: Page to be deleted or its pageid.
:type page: :py:obj:`pywikibot.page.BasePage` or, for pageid,
@@ -2111,11 +2113,12 @@
:see: https://www.mediawiki.org/wiki/API:Undelete
- *Renamed in version 6.1.*
+ .. versionadded:: 6.1
+ renamed from *undelete_page*
- *New in version 6.1:* *fileids* parameter was added.
-
- *Changed in verson 6.1:* keyword argument required for *revisions*.
+ .. versionchanged:: 6.1
+ *fileids* parameter was added,
+ keyword argument required for *revisions*.
:param page: Page to be deleted.
:type page: pywikibot.BasePage
@@ -2461,11 +2464,11 @@
Either source_filename or source_url, but not both, must be provided.
- *Changed in version 6.0:* keyword arguments required for all
- parameters except *filepage*.
+ .. versionchanged:: 6.0
+ keyword arguments required for all parameters except *filepage*
- *Changed in version 6.2:* asynchronous upload is used if
- *asynchronous* parameter is set.
+ .. versionchanged:: 6.2:
+ asynchronous upload is used if *asynchronous* parameter is set.
:param filepage: a FilePage object from which the wiki-name of the
file will be obtained.
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index 2314a13..ca50567 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -706,7 +706,8 @@
include_empty_titles: bool = False):
"""Iterate all interlanguage links on page, yielding Link objects.
- *New in version 6.2:* *include_empty_titles* parameter was added.
+ .. versionchanged:: 6.2:
+ *include_empty_titles* parameter was added.
:see: https://www.mediawiki.org/wiki/API:Langlinks
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index 1b81fc2..6868b52 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -275,7 +275,7 @@
def check_response(response):
"""Raise ServerError if the response indicates a server error.
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
if response.status_code >= HTTPStatus.INTERNAL_SERVER_ERROR:
raise ServerError(HTTPStatus(response.status_code).phrase)
diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index f3babaf..e3cf7e9 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -49,10 +49,11 @@
**kwargs):
"""Initializer.
- *Changed in version 6.2:* asynchronous upload is used if
- *asynchronous* parameter is set.
+ .. versionchanged:: 6.2
+ asynchronous upload is used if *asynchronous* parameter is set
- *New in version 6.4:* force_if_shared parameter.
+ .. versionchanged:: 6.4
+ *force_if_shared* parameter was added
:param url: path to url or local file, or list of urls or paths
to local files.
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index ec06c67..0b9668e 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -826,7 +826,7 @@
def add_text(text: str, add: str, *, site=None) -> str:
"""Add text to a page content above categories and interwiki.
- *New in version 6.4.*
+ .. versionadded:: 6.4
:param text: The page content to add text to.
:param add: Text to add.
@@ -925,7 +925,7 @@
('== Usage of A ==', 'Some usage...')]
result.footer = '[[Category:Things starting with A]]'
- *New in version 3.0.*
+ .. versionadded:: 3.0
"""
headings = _extract_headings(text, site)
sections = _extract_sections(text, headings)
@@ -1636,8 +1636,9 @@
:param strip: If enabled, strip arguments and values of templates.
:return: list of template name and params
- *New in version 6.1:* *wikitextparser* package is supported; either
- *wikitextparser* or *mwparserfromhell* is strictly recommended.
+ .. versionchanged:: 6.1
+ *wikitextparser* package is supported; either *wikitextparser* or
+ *mwparserfromhell* is strictly recommended.
"""
def explicit(param):
try:
diff --git a/pywikibot/userinterfaces/_interface_base.py b/pywikibot/userinterfaces/_interface_base.py
index b25b160..422496e 100644
--- a/pywikibot/userinterfaces/_interface_base.py
+++ b/pywikibot/userinterfaces/_interface_base.py
@@ -1,6 +1,6 @@
"""Abstract base user interface module.
-*New in version 6.2.*
+.. versionadded:: 6.2
"""
#
# (C) Pywikibot team, 2021
@@ -21,6 +21,8 @@
Every user interface should derive from it to ensure that all
required methods are implemented.
+
+ .. versionadded:: 6.2
"""
def argvu(self) -> List[str]:
diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index b9a7713..9324f4b 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -3,7 +3,8 @@
Useful for editing the contents of an article.
-*New in version 6.1:* Python 3.6 or highter is required.
+.. versionchanged:: 6.1
+ Python 3.6 or highter is required.
"""
#
# (C) Pywikibot team, 2003-2021
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index 5a94d6e..c288bdc 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -57,8 +57,9 @@
"""Base for terminal user interfaces.
- *New in version 6.2:* subclassed from
- :py:obj:`pywikibot.userinterfaces._interface_base.ABUIC`.
+ .. versionchanged:: 6.2:
+ subclassed from
+ :py:obj:`pywikibot.userinterfaces._interface_base.ABUIC`
"""
split_col_pat = re.compile(r'(\w+);?(\w+)?')
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 3bc2e86..26597cc 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -40,7 +40,7 @@
def get_toolforge_hostname() -> Optional[str]:
"""Get hostname of the current Toolforge host.
- *New in version 3.0.*
+ .. versionadded:: 3.0
:return: The hostname of the currently running host,
if it is in Wikimedia Toolforge; otherwise return None.
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731124
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: I9d4d9484308f40664d5b01f88cc07e11ce1e2f38
Gerrit-Change-Number: 731124
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731112 )
Change subject: [doc] Update ROADMAP.rst and CHANGELOG.md
......................................................................
[doc] Update ROADMAP.rst and CHANGELOG.md
Change-Id: I260cfdfcdf248de53871d3154fe7a0dbe1f7962f
---
M ROADMAP.rst
M scripts/CHANGELOG.md
2 files changed, 9 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index c3549f7..3aaab24 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,7 +4,9 @@
Improvements and Bugfixes
-------------------------
+* Rewrite tools.intersect_generators which makes it running up to 10'000 times faster. (T85623, T293276)
* The cached output functionality from compat release was re-implemented (T151727, T73646, T74942, T132135, T144698, T196039, T280466)
+* L10N updates
* Adjust groupsize within pagegenerators.PreloadingGenerator (T291770)
* New "maxlimit" property was added to APISite (T291770)
@@ -18,6 +20,10 @@
Code cleanups
-------------
+* TextfilePageGenerator was replaced by TextIOPageGenerator
+* PreloadingItemGenerator was replaced by PreloadingEntityGenerator
+* DuplicateFilterPageGenerator was replaced by tools.filter_unique
+* ItemPage.concept_url method was replaced by ItemPage.concept_uri
* Outdated parameter names has been dropped
* Deprecated pywikibot.Error exception were removed in favour of pywikibot.exceptions.Error classes (T280227)
* Deprecated exception identifiers were removed (T280227)
diff --git a/scripts/CHANGELOG.md b/scripts/CHANGELOG.md
index 0db9f4c..6677768 100644
--- a/scripts/CHANGELOG.md
+++ b/scripts/CHANGELOG.md
@@ -17,6 +17,9 @@
### category
* Deprecated code parts were removed
+### commonscat
+* Ignore InvalidTitleError in CommonscatBot.findCommonscatLink (T291783)
+
### djvutext
* pass site arg only once (T292367)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/731112
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: I260cfdfcdf248de53871d3154fe7a0dbe1f7962f
Gerrit-Change-Number: 731112
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged