jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994684?usp=email )
Change subject: [doc] Notice deprecated old color format
......................................................................
[doc] Notice deprecated old color format
Change-Id: I87c61a08a696b7330ddc9f5464322f19469a15fe
---
M ROADMAP.rst
1 file changed, 10 insertions(+), 0 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 47f1e2d..9b450fd 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -119,6 +119,7 @@
* 7.6.0: :mod:`tools.collections` datatypes should no longer imported from :mod:`tools`
* 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()<pywikibot.FilePage.using_pages>`
+* 7.3.0: Old color escape sequences like ``\03{color}`` is deprecated in favour of new color format like <<color>>
* 7.3.0: ``linkitrail`` method of :class:`family.Family` is deprecated; use :meth:`APISite.linktrail()
<pywikibot.site._apisite.APISite.linktrail>` instead
* 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.exception>` function was renamed to ``exc_info``
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994684?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: I87c61a08a696b7330ddc9f5464322f19469a15fe
Gerrit-Change-Number: 994684
Gerrit-PatchSet: 1
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/+/994675?usp=email )
Change subject: [doc] Add Family attribute hints to sphinx doc.
......................................................................
[doc] Add Family attribute hints to sphinx doc.
Change-Id: I8bc1a19fc6c451cbb57c97124d8ef9f10cf3afe8
---
M ROADMAP.rst
M pywikibot/family.py
2 files changed, 111 insertions(+), 70 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 65f3950..47f1e2d 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -119,6 +119,8 @@
* 7.6.0: :mod:`tools.collections` datatypes should no longer imported from :mod:`tools`
* 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()<pywikibot.FilePage.using_pages>`
+* 7.3.0: ``linkitrail`` method of :class:`family.Family` is deprecated; use :meth:`APISite.linktrail()
+ <pywikibot.site._apisite.APISite.linktrail>` instead
* 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.exception>` function was renamed to ``exc_info``
* 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` parameter of
:func:`XMLDumpPageGenerator<pagegenerators.XMLDumpPageGenerator>` (:phab:`T306134`)
diff --git a/pywikibot/family.py b/pywikibot/family.py
index fa48156..5c8dd28 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1,6 +1,6 @@
"""Objects representing MediaWiki families."""
#
-# (C) Pywikibot team, 2004-2023
+# (C) Pywikibot team, 2004-2024
#
# Distributed under the terms of the MIT license.
#
@@ -97,98 +97,117 @@
#: Not open for edits; stewards can still edit.
closed_wikis: list[str] = []
- #: Completely removed sites
+ #: Completely removed sites.
removed_wikis: list[str] = []
code_aliases: dict[str, str] = {}
"""Code mappings which are only an alias, and there is no 'old' wiki.
-
For all except 'nl_nds', subdomains do exist as a redirect, but that
should not be relied upon.
"""
langs: dict[str, str] = {}
- # A list of category redirect template names in different languages
+ #: A list of category redirect template names in different languages.
category_redirect_templates: dict[str, Sequence[str]] = {
'_default': []
}
- # A list of disambiguation template names in different languages
+ #: A list of disambiguation template names in different languages.
disambiguationTemplates: dict[str, Sequence[str]] = {
'_default': []
}
- # A dict of tuples for different sites with names of templates
- # that indicate an edit should be avoided
edit_restricted_templates: dict[str, tuple[str, ...]] = {}
+ """A dict of tuples for different sites with names of templates that
+ indicate an edit should be avoided.
+ """
- # A dict of tuples for different sites with names of archive
- # templates that indicate an edit of non-archive bots
- # should be avoided
archived_page_templates: dict[str, tuple[str, ...]] = {}
+ """A dict of tuples for different sites with names of archive
+ templates that indicate an edit of non-archive bots should be
+ avoided.
+ """
- # A set of projects that share cross-project sessions.
+ #: A set of projects that share cross-project sessions.
cross_projects: set[str] = set()
- # A list with the name for cross-project cookies.
- # default for wikimedia centralAuth extensions.
+ #: A list with the name for cross-project cookies, default for
+ #: wikimedia centralAuth extensions.
cross_projects_cookies = ['centralauth_Session',
'centralauth_Token',
'centralauth_User']
cross_projects_cookie_username = 'centralauth_User'
- # A list with the name in the cross-language flag permissions
+ #: A list with the name in the cross-language flag permissions.
cross_allowed: list[str] = []
- # A dict with the name of the category containing disambiguation
- # pages for the various languages. Only one category per language,
- # and without the namespace, so add things like:
- # 'en': "Disambiguation"
disambcatname: dict[str, str] = {}
+ """A dict with the name of the category containing disambiguation
+ pages for the various languages. Only one category per language, and
+ without the namespace, so add things like:
- # attop is a list of languages that prefer to have the interwiki
- # links at the top of the page.
+ 'en': "Disambiguation"
+ """
+
interwiki_attop: list[str] = []
- # on_one_line is a list of languages that want the interwiki links
- # one-after-another on a single line
+ """attop is a list of languages that prefer to have the interwiki
+ links at the top of the page.
+ """
+
interwiki_on_one_line: list[str] = []
- # String used as separator between interwiki links and the text
+ """on_one_line is a list of languages that want the interwiki links
+ one-after-another on a single line
+ """
+
+ #: String used as separator between interwiki links and the text.
interwiki_text_separator = '\n\n'
# Similar for category
category_attop: list[str] = []
- # on_one_line is a list of languages that want the category links
- # one-after-another on a single line
+ """attop is a list of categories that prefer to have the category
+ links at the top of the page.
+ """
+
category_on_one_line: list[str] = []
- # String used as separator between category links and the text
+ """on_one_line is a list of languages that want the category links
+ one-after-another on a single line.
+ """
+
+ #: String used as separator between category links and the text
category_text_separator = '\n\n'
- # When both at the bottom should categories come after interwikilinks?
- # TODO: T86284 Needed on Wikia sites, as it uses the CategorySelect
- # extension which puts categories last on all sites. TO BE DEPRECATED!
+
categories_last: list[str] = []
+ """When both at the bottom should categories come after
+ interwikilinks?
- # Which languages have a special order for putting interlanguage
- # links, and what order is it? If a language is not in
- # interwiki_putfirst, alphabetical order on language code is used.
- # For languages that are in interwiki_putfirst, interwiki_putfirst
- # is checked first, and languages are put in the order given there.
- # All other languages are put after those, in code-alphabetical
- # order.
+ TODO: :phab:`T86284` Needed on Wikia sites, as it uses the
+ CategorySelect extension which puts categories last on all sites.
+ TO BE DEPRECATED!
+ """
+
interwiki_putfirst: dict[str, str] = {}
+ """Which languages have a special order for putting interlanguage
+ links, and what order is it? If a language is not in
+ interwiki_putfirst, alphabetical order on language code is used. For
+ languages that are in interwiki_putfirst, interwiki_putfirst is
+ checked first, and languages are put in the order given there. All
+ other languages are put after those, in code-alphabetical order.
+ """
- # Some families, e. g. commons and meta, are not multilingual and
- # forward interlanguage links to another family (wikipedia).
- # These families can set this variable to the name of the target
- # family.
interwiki_forward: str | None = None
+ """Some families, e. g. commons and meta, are not multilingual and
+ forward interlanguage links to another family (wikipedia). These
+ families can set this variable to the name of the target family.
+ """
- # Language codes of the largest wikis. They should be roughly sorted
- # by size.
languages_by_size: list[str] = []
+ """Language codes of the largest wikis. They should be roughly
+ sorted by size.
+ """
- # Some languages belong to a group where the possibility is high that
- # equivalent articles have identical titles among the group.
+ #: Some languages belong to a group where the possibility is high
+ #: that equivalent articles have identical titles among the group.
language_groups = {
# languages using the Arabic script
'arab': [
@@ -248,37 +267,48 @@
],
}
- # LDAP domain if your wiki uses LDAP authentication,
- # https://www.mediawiki.org/wiki/Extension:LDAPAuthentication2
ldapDomain = ()
+ """LDAP domain if your wiki uses LDAP authentication.
- # Allows crossnamespace interwiki linking.
- # Lists the possible crossnamespaces combinations
- # keys are originating NS
- # values are dicts where:
- # keys are the originating langcode, or _default
- # values are dicts where:
- # keys are the languages that can be linked to from the lang+ns, or
- # '_default'; values are a list of namespace numbers
+ .. seealso:: https://www.mediawiki.org/wiki/Extension:LDAPAuthentication2
+ """
+
crossnamespace: CrossnamespaceType = collections.defaultdict(dict)
- ##
- # Examples :
- #
- # Allowing linking to pt' 102 NS from any other lang' 0 NS is
- #
- # crossnamespace[0] = {
- # '_default': { 'pt': [102]}
- # }
- #
- # While allowing linking from pt' 102 NS to any other lang' = NS is
- #
- # crossnamespace[102] = {
- # 'pt': { '_default': [0]}
- # }
+ """Allows crossnamespace interwiki linking.
- # Some wiki farms have UrlShortener extension enabled only on the main
- # site. This value can specify this last one with (lang, family) tuple.
+ Lists the possible crossnamespaces combinations; keys are
+ originating namespace; values are dicts where keys are the
+ originating langcode, or ``_default`` and values are dicts where
+ keys are the languages that can be linked to from the lang+ns, or
+ ``_default``; values are a list of namespace numbers.
+
+ **Examples:**
+
+ Allowing linking *to* ``pt`` 102 namespace from any other lang 0
+ namepace is:
+
+ .. code-block:: Python
+
+ crossnamespace[0] = {
+ '_default': { 'pt': [102]}
+ }
+
+ While allowing linking *from* ``pt`` 102 namespace to any other
+ lang 0 namespace is
+
+ .. code-block:: Python
+
+ crossnamespace[102] = {
+ 'pt': { '_default': [0]}
+ }
+
+ """
+
shared_urlshortner_wiki: tuple[str, str] | None = None
+ """Some wiki farms have UrlShortener extension enabled only on
+ the main site. This value can specify this last one with
+ ``(lang, family)`` tuple.
+ """
title_delimiter_and_aliases = ' _'
"""Titles usually are delimited by a space and the alias is replaced
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994675?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: I8bc1a19fc6c451cbb57c97124d8ef9f10cf3afe8
Gerrit-Change-Number: 994675
Gerrit-PatchSet: 6
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/+/994673?usp=email )
Change subject: [PEP8] rename transliteration.transliterator to Transliterator
......................................................................
[PEP8] rename transliteration.transliterator to Transliterator
Change-Id: I5fb4b651360e32f4d65d07f2d5c35e494cb6c28f
---
M ROADMAP.rst
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/userinterfaces/transliteration.py
3 files changed, 21 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 5c244b1..65f3950 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -28,9 +28,11 @@
Breaking changes and code cleanups
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+* ``userinterfaces.transliteration.transliterator`` was renamed to :class:`Transliterator
+ <userinterfaces.transliteration.Transliterator>`
* ``pywikibot.BaseSite`` and ``pywikibotAPISite`` were dropped. :func:`pywikibot.Site` has to be used to create a
:mod:`site` object.
-* ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to ``succ``
+* ``next`` parameter of :meth:`userinterfaces.transliteration.Transliterator.transliterate` was renamed to ``succ``
* ``type`` parameter of :meth:`site.APISite.protectedpages()<pywikibot.site._generators.GeneratorsMixin.protectedpages>`
was renamed to ``protect_type``
* ``all`` parameter of :meth:`site.APISite.namespace()<pywikibot.site._apisite.APISite.namespace>` was renamed to
@@ -65,6 +67,8 @@
Deprecations
------------
+* 9.0.0: ``userinterfaces.transliteration.transliterator`` was renamed to :class:`Transliterator
+ <userinterfaces.transliteration.Transliterator>`
* 9.0.0: ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to
``succ``
* 9.0.0: ``type`` parameter of :meth:`site.APISite.protectedpages()
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index 83f7f4a..fb76bf3 100644
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -30,7 +30,7 @@
from pywikibot.userinterfaces._interface_base import ABUIC
-transliterator = transliteration.transliterator(config.console_encoding)
+transliterator = transliteration.Transliterator(config.console_encoding)
#: Colors supported by Pywikibot
colors = [
diff --git a/pywikibot/userinterfaces/transliteration.py b/pywikibot/userinterfaces/transliteration.py
index 0bbc083..4ad1d85 100644
--- a/pywikibot/userinterfaces/transliteration.py
+++ b/pywikibot/userinterfaces/transliteration.py
@@ -6,7 +6,7 @@
#
from __future__ import annotations
-from pywikibot.tools import deprecate_arg
+from pywikibot.tools import ModuleDeprecationWrapper, deprecate_arg
#: Non latin digits used by the framework
@@ -1100,7 +1100,7 @@
_trans.update({char: str(i) for i, char in enumerate(digits)})
-class transliterator: # noqa: N801
+class Transliterator:
"""Class to transliterating text."""
@@ -1150,3 +1150,7 @@
elif char == 'ŕş«':
result = '' if next in 'ງຍນຣລຼຼວ' else 'h'
return result
+
+
+wrapper = ModuleDeprecationWrapper(__name__)
+wrapper.add_deprecated_attr('transliterator', Transliterator, since='9.0.0')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994673?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: I5fb4b651360e32f4d65d07f2d5c35e494cb6c28f
Gerrit-Change-Number: 994673
Gerrit-PatchSet: 1
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/+/994671?usp=email )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: Ie6fdcc89d5d4f3e39768c1d89330b11d10645dc8
---
M ROADMAP.rst
1 file changed, 40 insertions(+), 4 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst
index b399e0f..5c244b1 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -4,6 +4,7 @@
Improvements
^^^^^^^^^^^^
+* Add :func:`config.base_dir<config.get_base_dir>` to scripts search path with :mod:`pwb` wrapper (:phab:`T324287`)
* :meth:`pywikibot.WbTime.equal_instant` was added (:phab:`T325248`)
* ``revisions`` parameter of :class:`xmlreader.XmlDump` was introduced to specify parsing method
(:phab:`T340804`)
@@ -16,6 +17,9 @@
Bugfixes
^^^^^^^^
+* Add ``hy`` to special languages in :class:`textlib.TimeStripper` (:phab:`T356175`)
+* Pass login token when using ``action=login`` (:phab:`T309898`)
+* Detect range blocks with :meth:`pywikibot.User.is_blocked` (:phab:`T301282`)
* Use only ``end`` tags in ElementTree.iterparse in :mod:`xmlreader` module (:phab:`T354095`)
* Suppress error in :meth:`cosmetic_changes.CosmeticChangesToolkit.cleanUpLinks` (:phab:`T337045`)
* :func:`pywikibot.input_choice` validates *default* parameter (:phab:`T353097`)
@@ -24,6 +28,17 @@
Breaking changes and code cleanups
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+* ``pywikibot.BaseSite`` and ``pywikibotAPISite`` were dropped. :func:`pywikibot.Site` has to be used to create a
+ :mod:`site` object.
+* ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to ``succ``
+* ``type`` parameter of :meth:`site.APISite.protectedpages()<pywikibot.site._generators.GeneratorsMixin.protectedpages>`
+ was renamed to ``protect_type``
+* ``all`` parameter of :meth:`site.APISite.namespace()<pywikibot.site._apisite.APISite.namespace>` was renamed to
+ ``all_ns``
+* ``filter`` parameter of :func:`date.dh` was renamed to ``filter_func``
+* ``dict`` parameter of :class:`data.api.OptionSet` was renamed to ``data``
+* ``setuptools`` package is no longer mandatory but required for tests
+ (:phab:`T340640`, :phab:`T347052`, :phab:`T354515`)
* ``root`` attribute of :class:`xmlreader.XmlDump` was removed
* ``tools.Version`` class was removed; use classes from ``packaging.version`` instead (:phab:`T340640`)
* ``packaging`` package is mandatory; ``importlib_metadata`` package is required for Python 3.7 (:phab:`T340640`)
@@ -34,7 +49,8 @@
* require ``PyMySQL >= 1.0.0`` if necessary
* ``keys()`` and ``items()`` methods of :class:`data.api.Request` gives a view instead a list (:phab:`T310953`)
* ``SequenceOutputter.format_list()`` was removed in favour of :attr:`tools.formatter.SequenceOutputter.out` property
-* *output* parameter of :class:`bot_choice.OutputProxyOption` (i.e. ``OutputOption`` instance) without *out* property is no longer supported
+* *output* parameter of :class:`bot_choice.OutputProxyOption` (i.e. ``OutputOption`` instance) without *out* property is
+ no longer supported
* ``OutputOption.output()`` method was removed
* ``ContextOption.output_range()`` and ``HighlightContextOption.output_range()`` methods were removed
* ``page.url2unicode()`` function was removed in favour of :func:`tools.chars.url2string`
@@ -49,10 +65,20 @@
Deprecations
------------
+* 9.0.0: ``next`` parameter of :meth:`userinterfaces.transliteration.transliterator.transliterate` was renamed to
+ ``succ``
+* 9.0.0: ``type`` parameter of :meth:`site.APISite.protectedpages()
+ <pywikibot.site._generators.GeneratorsMixin.protectedpages>` was renamed to ``protect_type``
+* 9.0.0: ``all`` parameter of :meth:`site.APISite.namespace()<pywikibot.site._apisite.APISite.namespace>` was renamed to
+ ``all_ns``
+* 9.0.0: ``filter`` parameter of :func:`date.dh` was renamed to ``filter_func``
+* 9.0.0: ``dict`` parameter of :class:`data.api.OptionSet` was renamed to ``data``
* 9.0.0: ``pywikibot.version.get_toolforge_hostname()`` is deprecated without replacement
-* 9.0.0: ``allrevisions`` parameter of :class:`xmlreader.XmpDump` is deprecated, use ``revisions`` instead (:phab:`T340804`)
+* 9.0.0: ``allrevisions`` parameter of :class:`xmlreader.XmpDump` is deprecated, use ``revisions`` instead
+ (:phab:`T340804`)
* 9.0.0: ``iteritems`` method of :class:`data.api.Request` will be removed in favour of ``items``
-* 9.0.0: ``SequenceOutputter.output()`` is deprecated in favour of :attr:`tools.formatter.SequenceOutputter.out` property
+* 9.0.0: ``SequenceOutputter.output()`` is deprecated in favour of :attr:`tools.formatter.SequenceOutputter.out`
+ property
* 9.0.0: *nullcontext* context manager and *SimpleQueue* queue of :mod:`backports` are derecated
* 8.4.0: *modules_only_mode* parameter of :class:`data.api.ParamInfo`, its *paraminfo_keys* class attribute
and its preloaded_modules property will be removed
@@ -98,6 +124,7 @@
* 7.1.0: Unused ``get_redirect`` parameter of :meth:`Page.getOldVersion()<page.BasePage.getOldVersion>` will be removed
* 7.0.0: User.isBlocked() method is renamed to is_blocked for consistency
* 7.0.0: A boolean watch parameter in Page.save() is deprecated and will be desupported
-* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers() DataSite methods will be removed
+* 7.0.0: baserevid parameter of editSource(), editQualifier(), removeClaims(), removeSources(), remove_qualifiers()
+ DataSite methods will be removed
* 7.0.0: Values of APISite.allpages() parameter filterredir other than True, False and None are deprecated
* 7.0.0: The i18n identifier 'cosmetic_changes-append' will be removed in favour of 'pywikibot-cosmetic-changes'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994671?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: Ie6fdcc89d5d4f3e39768c1d89330b11d10645dc8
Gerrit-Change-Number: 994671
Gerrit-PatchSet: 1
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/+/994332?usp=email )
Change subject: [bugfix] Add hy to special languages in TimeStripper
......................................................................
[bugfix] Add hy to special languages in TimeStripper
Also hy needs to check both upper and lower case for months.
Bug: T356175
Change-Id: Ibc7982084102735ffa87fd8d97f6a2813c7176ca
---
M pywikibot/textlib.py
1 file changed, 20 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 75c3d87..788df3a 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -1,6 +1,6 @@
"""Functions for manipulating wiki-text."""
#
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
@@ -1985,10 +1985,13 @@
self.site = pywikibot.Site() if site is None else site
self.origNames2monthNum = {}
- # use first_lower/first_upper for 'vi' language because monthsnames
- # were changed: T324310
- functions = [first_upper,
- first_lower] if self.site.lang == 'vi' else [str]
+ # use first_lower/first_upper for those language where month names
+ # were changed: T324310, T356175
+ if self.site.lang in ('hy', 'vi'):
+ functions = [first_upper, first_lower]
+ else:
+ functions = [str]
+
for n, (long, short) in enumerate(self.site.months_names, start=1):
for func in functions:
self.origNames2monthNum[func(long)] = n
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994332?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: Ibc7982084102735ffa87fd8d97f6a2813c7176ca
Gerrit-Change-Number: 994332
Gerrit-PatchSet: 1
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.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/+/994187?usp=email )
Change subject: [cleanup] Drop pywikibot.BaseSite and pywikibotAPISite
......................................................................
[cleanup] Drop pywikibot.BaseSite and pywikibotAPISite
BaseSite and APISite are used for typing and interface check in Site()
constructor function. They were introduced with b903d0aa for typing
and b17ca6e8 for interface check. Other BaseSite subclasses like
DataSite and ClosedSite were already removed in an earlier version.
They were never intended for direct usage and it should never be used
directly. Therefore is not part of pywikibot.__all__ list. See also the
warning at
https://doc.wikimedia.org/pywikibot/stable/api_ref/pywikibot.html#pywikibot…
To be safe, remove direct imports of BaseSite and APISite in
pywikibot.__init__.py
Bug: T355915
Change-Id: I3de35e9780a1184cbb9492f2c9ab5b91c523805a
---
M pywikibot/__init__.py
M pywikibot/page/_wikibase.py
M scripts/redirect.py
M scripts/speedy_delete.py
M tests/category_bot_tests.py
5 files changed, 44 insertions(+), 16 deletions(-)
Approvals:
jenkins-bot: Verified
JJMC89: Looks good to me, approved
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 22002d8..4fc3a17 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1,6 +1,6 @@
"""The initialization file for the Pywikibot framework."""
#
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
@@ -14,7 +14,7 @@
from contextlib import suppress
from queue import Queue
from time import sleep as time_sleep
-from typing import Any, cast
+from typing import Any, TYPE_CHECKING, cast
from urllib.parse import urlparse
from warnings import warn
@@ -67,11 +67,15 @@
stdout,
warning,
)
-from pywikibot.site import APISite, BaseSite
+from pywikibot.site import BaseSite as _BaseSite
from pywikibot.time import Timestamp
from pywikibot.tools import normalize_username
+if TYPE_CHECKING:
+ from pywikibot.site import APISite
+
+
__all__ = (
'__copyright__', '__description__', '__download_url__', '__license__',
'__maintainer__', '__maintainer_email__', '__name__', '__url__',
@@ -127,11 +131,11 @@
return matched_sites[0]
-def Site(code: str | None = None, # noqa: 134
+def Site(code: str | None = None, # noqa: N802
fam: str | Family | None = None,
user: str | None = None, *,
- interface: str | BaseSite | None = None,
- url: str | None = None) -> BaseSite:
+ interface: str | _BaseSite | None = None,
+ url: str | None = None) -> _BaseSite:
"""A factory method to obtain a Site object.
Site objects are cached and reused by this method.
@@ -242,7 +246,7 @@
else:
interface = getattr(tmp, interface)
- if not issubclass(interface, BaseSite):
+ if not issubclass(interface, _BaseSite):
warning(f'Site called with interface={interface.__name__}')
user = normalize_username(user)
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 34607ce..b5de1b3 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -9,7 +9,7 @@
* WikibaseEntity: base interface for Wikibase entities.
"""
#
-# (C) Pywikibot team, 2013-2023
+# (C) Pywikibot team, 2013-2024
#
# Distributed under the terms of the MIT license.
#
@@ -65,7 +65,7 @@
)
if TYPE_CHECKING:
- LANGUAGE_IDENTIFIER = str | pywikibot.APISite
+ LANGUAGE_IDENTIFIER = str | pywikibot.site.APISite
ALIASES_TYPE = dict[LANGUAGE_IDENTIFIER, list[str]]
LANGUAGE_TYPE = dict[LANGUAGE_IDENTIFIER, str]
SITELINK_TYPE = (
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 3a31af2..bffa83c 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -66,7 +66,7 @@
¶ms;
"""
#
-# (C) Pywikibot team, 2004-2023
+# (C) Pywikibot team, 2004-2024
#
# Distributed under the terms of the MIT license.
#
@@ -408,11 +408,12 @@
else:
raise NotImplementedError(f'No valid action "{action}" found.')
- def get_sd_template(self, site=None) -> str | None:
+ def get_sd_template(
+ self, site: pywikibot.site.BaseSite | None = None
+ ) -> str | None:
"""Look for speedy deletion template and return it.
:param site: site for which the template has to be given
- :type site: pywikibot.BaseSite
:return: A valid speedy deletion template.
"""
title = None
diff --git a/scripts/speedy_delete.py b/scripts/speedy_delete.py
index 76dab20..0f4d0c3 100755
--- a/scripts/speedy_delete.py
+++ b/scripts/speedy_delete.py
@@ -22,7 +22,7 @@
.. note:: This script currently only works for the Wikipedia project.
"""
#
-# (C) Pywikibot team, 2007-2023
+# (C) Pywikibot team, 2007-2024
#
# Distributed under the terms of the MIT license.
#
@@ -325,7 +325,7 @@
def __init__(self, **kwargs) -> None:
"""Initializer.
- :keyword pywikibot.APISite site: the site to work on
+ :keyword pywikibot.site.APISite site: the site to work on
"""
super().__init__(**kwargs)
csd_cat = i18n.translate(self.site, self.csd_cat_title)
diff --git a/tests/category_bot_tests.py b/tests/category_bot_tests.py
index 8122c32..e96cec3 100755
--- a/tests/category_bot_tests.py
+++ b/tests/category_bot_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for the category bot script."""
#
-# (C) Pywikibot team, 2015-2022
+# (C) Pywikibot team, 2015-2024
#
# Distributed under the terms of the MIT license.
#
@@ -12,7 +12,7 @@
from unittest.mock import Mock, patch
import pywikibot
-from pywikibot import BaseSite
+from pywikibot.site import BaseSite
from scripts.category import CategoryMoveRobot, CategoryPreprocess
from tests.aspects import DefaultSiteTestCase, TestCase
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/994187?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: I3de35e9780a1184cbb9492f2c9ab5b91c523805a
Gerrit-Change-Number: 994187
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/993750?usp=email )
Change subject: Fix casing of Mediawiki
......................................................................
Fix casing of Mediawiki
Change-Id: I1fda8383117524ad2252c2891f73f3c1208c23e0
---
M docs/api_ref/logentries.rst
M pywikibot/data/api/__init__.py
M pywikibot/logentries.py
M pywikibot/proofreadpage.py
M scripts/checkimages.py
M scripts/welcome.py
6 files changed, 16 insertions(+), 7 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/docs/api_ref/logentries.rst b/docs/api_ref/logentries.rst
index e45b3f9..c7805e1 100644
--- a/docs/api_ref/logentries.rst
+++ b/docs/api_ref/logentries.rst
@@ -3,4 +3,4 @@
************************
.. automodule:: logentries
- :synopsis: Objects representing Mediawiki log entries
+ :synopsis: Objects representing MediaWiki log entries
diff --git a/pywikibot/data/api/__init__.py b/pywikibot/data/api/__init__.py
index 9f289ab..609d3c5 100644
--- a/pywikibot/data/api/__init__.py
+++ b/pywikibot/data/api/__init__.py
@@ -1,4 +1,4 @@
-"""Interface to Mediawiki's api.php."""
+"""Interface to MediaWiki's api.php."""
#
# (C) Pywikibot team, 2014-2024
#
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 5bda04e..67e6296 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -1,4 +1,4 @@
-"""Objects representing Mediawiki log entries."""
+"""Objects representing MediaWiki log entries."""
#
# (C) Pywikibot team, 2007-2023
#
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 8f217e9..8050443 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -395,7 +395,7 @@
class ProofreadPage(pywikibot.Page):
- """ProofreadPage page used in Mediawiki ProofreadPage extension."""
+ """ProofreadPage page used in MediaWiki ProofreadPage extension."""
WITHOUT_TEXT = 0
NOT_PROOFREAD = 1
@@ -1068,7 +1068,7 @@
class IndexPage(pywikibot.Page):
- """Index Page page used in Mediawiki ProofreadPage extension."""
+ """Index Page page used in MediaWiki ProofreadPage extension."""
INDEX_TEMPLATE = ':MediaWiki:Proofreadpage_index_template'
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index f0991bb..351a814 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1168,7 +1168,7 @@
"""
Check if template is in list.
- The problem is the calls to the Mediawiki system because they can be
+ The problem is the calls to the MediaWiki system because they can be
pretty slow. While searching in a list of objects is really fast, so
first of all let's see if we can find something in the info that we
already have, then make a deeper check.
diff --git a/scripts/welcome.py b/scripts/welcome.py
index a557bdc..4a48426 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -926,7 +926,7 @@
except ValueError:
# upon request, we could check for software version here
raise ValueError(fill(
- 'Mediawiki has changed, -offset:# is not supported anymore, but '
+ 'MediaWiki has changed, -offset:# is not supported anymore, but '
'-offset:TIMESTAMP is, assuming TIMESTAMP is yyyymmddhhmmss or '
'yyyymmdd. -timeoffset is now also supported. Please read this '
'script source header for documentation.'))
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/993750?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: I1fda8383117524ad2252c2891f73f3c1208c23e0
Gerrit-Change-Number: 993750
Gerrit-PatchSet: 5
Gerrit-Owner: Reedy <reedy(a)wikimedia.org>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged