jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/868778 )
Change subject: [cleanup] Remove interwiki_putfirst from wiktionary family
......................................................................
[cleanup] Remove interwiki_putfirst from wiktionary family
- remove interwiki_putfirst from wikitionary family
- remove alphabetic and alphabetic_revised from Family class because
this list is no longer used
- remove fyinterwiki from from Family class because this list is not used
- add a "known_codes" list to be reused with wikisource_family
- remove sorting_order.py script
- update documentation
Bug: T325426
Change-Id: I2ac6f0133e9a5e6ac6d2d99827bc50d3d06a96ce
---
M pywikibot/families/wikisource_family.py
M pywikibot/family.py
M scripts/README.rst
M docs/scripts_ref/scripts.maintenance.rst
M docs/scripts/maintenance.rst
D scripts/maintenance/sorting_order.py
M .codecov.yml
M scripts/maintenance/__init__.py
M pywikibot/families/wiktionary_family.py
M tests/site_tests.py
10 files changed, 73 insertions(+), 225 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.codecov.yml b/.codecov.yml
index 8823dfc..3995096 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -26,7 +26,6 @@
- scripts/dataextend.py
- scripts/maintenance/colors.py
- scripts/maintenance/make_i18n_dict.py
- - scripts/maintenance/sorting_order.py
- scripts/maintenance/wikimedia_sites.py
- scripts/userscripts/
- tests/pwb/
diff --git a/docs/scripts/maintenance.rst b/docs/scripts/maintenance.rst
index b42c812..bc26c71 100644
--- a/docs/scripts/maintenance.rst
+++ b/docs/scripts/maintenance.rst
@@ -16,13 +16,6 @@
:no-members:
:noindex:
-sorting\_order script
-=====================
-
-.. automodule:: scripts.maintenance.sorting_order
- :no-members:
- :noindex:
-
wikimedia\_sites script
=======================
diff --git a/docs/scripts_ref/scripts.maintenance.rst
b/docs/scripts_ref/scripts.maintenance.rst
index 4f2d4b6..ab32f10 100644
--- a/docs/scripts_ref/scripts.maintenance.rst
+++ b/docs/scripts_ref/scripts.maintenance.rst
@@ -25,11 +25,6 @@
.. automodule:: scripts.maintenance.make_i18n_dict
-scripts.maintenance.sorting\_order
-----------------------------------
-
-.. automodule:: scripts.maintenance.sorting_order
-
scripts.maintenance.wikimedia\_sites
------------------------------------
diff --git a/pywikibot/families/wikisource_family.py
b/pywikibot/families/wikisource_family.py
index 388e2a3..2e2fd04 100644
--- a/pywikibot/families/wikisource_family.py
+++ b/pywikibot/families/wikisource_family.py
@@ -68,7 +68,7 @@
@classproperty
def code_aliases(cls):
cls.code_aliases = super().code_aliases.copy()
- aliases = cls.alphabetic + ['-', 'www']
+ aliases = cls.known_codes + ['-', 'www']
for code in aliases:
if (code not in cls.languages_by_size
and code not in cls.closed_wikis
diff --git a/pywikibot/families/wiktionary_family.py
b/pywikibot/families/wiktionary_family.py
index 3ed5602..ea222e7 100644
--- a/pywikibot/families/wiktionary_family.py
+++ b/pywikibot/families/wiktionary_family.py
@@ -5,7 +5,6 @@
# Distributed under the terms of the MIT license.
#
from pywikibot import family
-from pywikibot.tools import classproperty
# The Wikimedia family that is known as Wiktionary
@@ -68,49 +67,6 @@
'vi', 'vo', 'wa', 'wo', 'yi',
'zh', 'zh-min-nan', 'zu',
]
- # 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.
-
- alphabetic_sv = [
- 'aa', 'af', 'ak', 'als', 'an',
'roa-rup', 'ast', 'gn', 'ay', 'az',
- 'id', 'ms', 'bm', 'zh-min-nan', 'jv',
'su', 'mt', 'bi', 'bo', 'bs',
- 'br', 'ca', 'cs', 'ch', 'sn',
'co', 'za', 'cy', 'da', 'de', 'na',
'mh',
- 'et', 'ang', 'en', 'es', 'eo',
'eu', 'to', 'fr', 'fy', 'fo', 'ga',
- 'gv', 'sm', 'gd', 'gl', 'hr',
'io', 'ia', 'ie', 'ik', 'xh', 'is',
'zu',
- 'it', 'kl', 'csb', 'kw', 'rw',
'rn', 'sw', 'ky', 'ku', 'la', 'lv',
- 'lb', 'lt', 'li', 'ln', 'jbo',
'hu', 'mg', 'mi', 'mo', 'my', 'fj',
- 'nah', 'nl', 'cr', 'no', 'nn',
'hsb', 'oc', 'om', 'ug', 'uz', 'nds',
- 'pl', 'pt', 'ro', 'rm', 'qu',
'sg', 'sc', 'st', 'tn', 'sq', 'scn',
- 'simple', 'ss', 'sk', 'sl', 'so',
'sh', 'fi', 'sv', 'tl', 'tt', 'vi',
- 'tpi', 'tr', 'tw', 'vo', 'wa',
'wo', 'ts', 'yo', 'el', 'av', 'ab',
- 'ba', 'be', 'bg', 'mk', 'mn',
'ru', 'sr', 'tg', 'uk', 'kk', 'hy',
'yi',
- 'he', 'ur', 'ar', 'tk', 'sd',
'fa', 'ha', 'ps', 'dv', 'ks', 'ne',
'pi',
- 'bh', 'mr', 'sa', 'hi', 'as',
'bn', 'pa', 'pnb', 'gu', 'or', 'ta',
- 'te', 'kn', 'ml', 'si', 'th',
'lo', 'dz', 'ka', 'ti', 'am', 'chr',
- 'iu', 'km', 'zh', 'ja', 'ko',
'shn',
- ]
-
- @classproperty
- def interwiki_putfirst(cls):
- cls.interwiki_putfirst = {
- 'da': cls.alphabetic,
- 'en': cls.alphabetic,
- 'et': cls.alphabetic,
- 'fi': cls.alphabetic,
- 'fy': cls.fyinterwiki,
- 'he': ['en'],
- 'hu': ['en'],
- 'ms': cls.alphabetic_revised,
- 'pl': cls.alphabetic_revised,
- 'sv': cls.alphabetic_sv,
- 'simple': cls.alphabetic,
- }
- return cls.interwiki_putfirst
-
interwiki_on_one_line = ['pl']
interwiki_attop = ['pl']
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 87519ca..7f57190 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -41,7 +41,12 @@
class Family:
- """Parent singleton class for all wiki families."""
+ """Parent singleton class for all wiki families.
+
+ .. versionchanged:: 8.0
+ ``alphabetic``, ``alphabetic_revised`` and ``fyinterwiki``
+ attributes where removed.
+ """
def __new__(cls):
"""Allocator."""
@@ -80,90 +85,6 @@
langs: Dict[str, str] = {}
- # For interwiki sorting order see
- #
https://meta.wikimedia.org/wiki/Interwiki_sorting_order
-
- # The sorting order by language name from meta
- # MediaWiki:Interwiki_config-sorting_order-native-languagename
- alphabetic = [
- 'ace', 'kbd', 'ady', 'af', 'ak',
'als', 'alt', 'am', 'smn', 'ang',
- 'ab', 'ar', 'an', 'arc', 'roa-rup',
'frp', 'as', 'ast', 'atj', 'awa',
- 'gn', 'av', 'ay', 'az', 'ban',
'bm', 'bn', 'bjn', 'zh-min-nan', 'nan',
- 'map-bms', 'ba', 'be', 'be-tarask',
'mnw', 'bh', 'bcl', 'bi', 'bg',
- 'bar', 'blk', 'bo', 'bs', 'br',
'bxr', 'ca', 'cv', 'ceb', 'cs', 'ch',
- 'cbk-zam', 'ny', 'sn', 'tum', 'cho',
'co', 'cy', 'dag', 'da', 'dk',
- 'ary', 'pdc', 'de', 'dv', 'nv',
'dsb', 'dty', 'dz', 'mh', 'et', 'el',
- 'eml', 'en', 'myv', 'es', 'eo',
'ext', 'eu', 'ee', 'fa', 'hif', 'fo',
- 'fr', 'fy', 'ff', 'fur', 'ga',
'gv', 'gag', 'gd', 'gl', 'gan', 'ki',
- 'glk', 'guw', 'gu', 'gor', 'got',
'hak', 'xal', 'ko', 'ha', 'haw',
- 'hy', 'hi', 'ho', 'hsb', 'hr',
'hyw', 'io', 'ig', 'ilo', 'inh', 'bpy',
- 'id', 'ia', 'ie', 'iu', 'ik',
'os', 'xh', 'zu', 'is', 'it', 'he',
'jv',
- 'kbp', 'kl', 'kn', 'kr', 'pam',
'krc', 'ka', 'ks', 'csb', 'kk', 'kw',
- 'rw', 'rn', 'sw', 'kv', 'kg',
'gom', 'avk', 'ht', 'gcr', 'ku', 'kj',
- 'ky', 'mrj', 'lld', 'lad', 'lbe',
'lo', 'ltg', 'la', 'lv', 'lb', 'lez',
- 'lfn', 'lt', 'lij', 'li', 'ln',
'olo', 'jbo', 'lg', 'lmo', 'lrc',
- 'mad', 'hu', 'mai', 'mk', 'mg',
'ml', 'mt', 'mi', 'mr', 'xmf', 'arz',
- 'mzn', 'mni', 'ms', 'min', 'cdo',
'mwl', 'mdf', 'mo', 'mn', 'mus',
- 'my', 'nah', 'na', 'fj', 'nl',
'nds-nl', 'cr', 'ne', 'new', 'nia',
- 'ja', 'nqo', 'nap', 'ce', 'frr',
'pih', 'no', 'nb', 'nn', 'nrm', 'nov',
- 'ii', 'oc', 'mhr', 'or', 'om',
'ng', 'hz', 'uz', 'pa', 'pi', 'pfl',
- 'pag', 'ami', 'pnb', 'pap', 'ps',
'jam', 'koi', 'km', 'pcd', 'pcm',
- 'pms', 'pwn', 'tpi', 'nds', 'pl',
'pnt', 'pt', 'aa', 'kaa', 'crh',
- 'ty', 'ksh', 'ro', 'rmy', 'rm',
'qu', 'rue', 'ru', 'sah', 'szy', 'se',
- 'sm', 'sa', 'sg', 'sat', 'skr',
'sc', 'sco', 'trv', 'stq', 'st', 'nso',
- 'tn', 'sq', 'scn', 'si', 'simple',
'sd', 'ss', 'sk', 'sl', 'cu', 'szl',
- 'so', 'ckb', 'srn', 'sr', 'sh',
'su', 'fi', 'sv', 'shi', 'tl', 'shn',
- 'ta', 'kab', 'roa-tara', 'tt', 'tay',
'te', 'tet', 'th', 'ti', 'tg',
- 'to', 'chr', 'chy', 've', 'tcy',
'tr', 'azb', 'tk', 'tw', 'kcg', 'tyv',
- 'din', 'udm', 'bug', 'uk', 'ur',
'ug', 'za', 'vec', 'vep', 'vi', 'vo',
- 'fiu-vro', 'wa', 'zh-classical', 'vls',
'war', 'wo', 'wuu', 'ts', 'yi',
- 'yo', 'zh-yue', 'diq', 'zea', 'bat-smg',
'zh', 'zh-tw', 'zh-cn',
- ]
-
- # The revised sorting order by first word from meta
- # MediaWiki:Interwiki_config-sorting_order-native-languagename-firstword
- alphabetic_revised = [
- 'ace', 'ady', 'kbd', 'af', 'ak',
'als', 'alt', 'kcg', 'am', 'smn',
- 'ang', 'ab', 'ar', 'an', 'arc',
'roa-rup', 'frp', 'as', 'ast', 'atj',
- 'awa', 'gn', 'av', 'ay', 'az',
'bjn', 'id', 'ms', 'ban', 'bm', 'bn',
- 'zh-min-nan', 'nan', 'map-bms', 'jv',
'su', 'ba', 'min', 'be',
- 'be-tarask', 'mnw', 'mad', 'bh', 'bcl',
'bi', 'bar', 'blk', 'bo', 'bs',
- 'br', 'bug', 'bg', 'bxr', 'ca',
'ceb', 'cv', 'cs', 'ch', 'cbk-zam',
- 'ny', 'sn', 'tum', 'cho', 'co',
'cy', 'dag', 'da', 'dk', 'ary', 'pdc',
- 'de', 'dv', 'nv', 'dsb', 'na',
'dty', 'dz', 'mh', 'et', 'el', 'eml',
- 'en', 'myv', 'es', 'eo', 'ext',
'eu', 'ee', 'fa', 'hif', 'fo', 'fr',
- 'fy', 'ff', 'fur', 'ga', 'gv',
'sm', 'gag', 'gd', 'gl', 'gan', 'ki',
- 'glk', 'guw', 'gu', 'got', 'hak',
'xal', 'ko', 'ha', 'haw', 'hy', 'hi',
- 'ho', 'hsb', 'hr', 'hyw', 'io',
'ig', 'ilo', 'inh', 'bpy', 'ia', 'ie',
- 'iu', 'ik', 'os', 'xh', 'zu',
'is', 'it', 'he', 'kl', 'kn', 'kr',
- 'pam', 'ka', 'ks', 'csb', 'kk',
'kw', 'rw', 'ky', 'rn', 'mrj', 'sw',
- 'kv', 'kg', 'gom', 'avk', 'gor',
'ht', 'gcr', 'ku', 'shn', 'kj', 'lld',
- 'lad', 'lbe', 'lez', 'lfn', 'lo',
'la', 'ltg', 'lv', 'to', 'lb', 'lt',
- 'lij', 'li', 'ln', 'nia', 'olo',
'jbo', 'lg', 'lmo', 'lrc', 'hu',
- 'mai', 'mk', 'mg', 'ml', 'krc',
'mt', 'mi', 'mr', 'xmf', 'arz', 'mzn',
- 'mni', 'cdo', 'mwl', 'koi', 'mdf',
'mo', 'mn', 'mus', 'my', 'nah',
- 'fj', 'nl', 'nds-nl', 'cr', 'ne',
'new', 'ja', 'nqo', 'nap', 'ce',
- 'frr', 'pih', 'no', 'nb', 'nn',
'nrm', 'nov', 'ii', 'oc', 'mhr', 'or',
- 'om', 'ng', 'hz', 'uz', 'pa',
'pi', 'pfl', 'pag', 'ami', 'pnb', 'pap',
- 'ps', 'jam', 'km', 'pcd', 'pcm',
'pms', 'pwn', 'nds', 'pl', 'pnt',
- 'pt', 'aa', 'kaa', 'crh', 'ty',
'ksh', 'ro', 'rmy', 'rm', 'qu', 'ru',
- 'rue', 'sah', 'szy', 'se', 'sa',
'sg', 'sat', 'skr', 'sc', 'sco',
- 'trv', 'stq', 'st', 'nso', 'tn',
'sq', 'scn', 'si', 'simple', 'sd',
- 'ss', 'sk', 'sl', 'cu', 'szl',
'so', 'ckb', 'srn', 'sr', 'sh', 'fi',
- 'sv', 'shi', 'tl', 'ta', 'kab',
'kbp', 'roa-tara', 'tt', 'tay', 'te',
- 'tet', 'th', 'vi', 'ti', 'tg',
'tpi', 'chr', 'chy', 've', 'tcy', 'tr',
- 'azb', 'tk', 'tw', 'tyv', 'din',
'udm', 'uk', 'ur', 'ug', 'za', 'vec',
- 'vep', 'vo', 'fiu-vro', 'wa',
'zh-classical', 'vls', 'war', 'wo',
- 'wuu', 'ts', 'yi', 'yo', 'zh-yue',
'diq', 'zea', 'bat-smg', 'zh',
- 'zh-tw', 'zh-cn',
- ]
-
- # Order for fy: alphabetical by code, but y counts as i
- fyinterwiki = alphabetic[:]
- fyinterwiki.remove('nb')
- fyinterwiki.sort(key=lambda x:
- x.replace('y', 'i') + x.count('y') *
'!')
-
# A list of category redirect template names in different languages
category_redirect_templates = {
'_default': []
@@ -884,7 +805,11 @@
class WikimediaFamily(Family):
- """Class for all wikimedia families."""
+ """Class for all wikimedia families.
+
+ .. versionchanged:: 8.0
+ :attr:`knows_codes` attribute was added.
+ """
multi_language_content_families = [
'wikipedia', 'wiktionary',
@@ -932,6 +857,42 @@
+ other_content_families
)
+ # Known Wikimedia site codes
+ known_codes = [
+ 'aa', 'ab', 'ace', 'ady', 'af',
'ak', 'als', 'alt', 'am', 'ami', 'an',
+ 'ang', 'ar', 'arc', 'ary', 'arz',
'as', 'ast', 'atj', 'av', 'avk',
+ 'awa', 'ay', 'az', 'azb', 'ba',
'ban', 'bar', 'bat-smg', 'bcl', 'be',
+ 'be-tarask', 'bg', 'bh', 'bi', 'bjn',
'blk', 'bm', 'bn', 'bo', 'bpy',
+ 'br', 'bs', 'bug', 'bxr', 'ca',
'cbk-zam', 'cdo', 'ce', 'ceb', 'ch',
+ 'cho', 'chr', 'chy', 'ckb', 'co',
'cr', 'crh', 'cs', 'csb', 'cu', 'cv',
+ 'cy', 'da', 'dag', 'de', 'din',
'diq', 'dk', 'dsb', 'dty', 'dv', 'dz',
+ 'ee', 'el', 'eml', 'en', 'eo',
'es', 'et', 'eu', 'ext', 'fa', 'ff',
+ 'fi', 'fiu-vro', 'fj', 'fo', 'fr',
'frp', 'frr', 'fur', 'fy', 'ga',
+ 'gag', 'gan', 'gcr', 'gd', 'gl',
'glk', 'gn', 'gom', 'gor', 'got',
+ 'gu', 'guw', 'gv', 'ha', 'hak',
'haw', 'he', 'hi', 'hif', 'ho', 'hr',
+ 'hsb', 'ht', 'hu', 'hy', 'hyw',
'hz', 'ia', 'id', 'ie', 'ig', 'ii',
+ 'ik', 'ilo', 'inh', 'io', 'is',
'it', 'iu', 'ja', 'jam', 'jbo', 'jv',
+ 'ka', 'kaa', 'kab', 'kbd', 'kbp',
'kcg', 'kg', 'ki', 'kj', 'kk', 'kl',
+ 'km', 'kn', 'ko', 'koi', 'kr',
'krc', 'ks', 'ksh', 'ku', 'kv', 'kw',
+ 'ky', 'la', 'lad', 'lb', 'lbe',
'lez', 'lfn', 'lg', 'li', 'lij', 'lld',
+ 'lmo', 'ln', 'lo', 'lrc', 'lt',
'ltg', 'lv', 'mad', 'mai', 'map-bms',
+ 'mdf', 'mg', 'mh', 'mhr', 'mi',
'min', 'mk', 'ml', 'mn', 'mni', 'mnw',
+ 'mo', 'mr', 'mrj', 'ms', 'mt',
'mus', 'mwl', 'my', 'myv', 'mzn', 'na',
+ 'nah', 'nan', 'nap', 'nb', 'nds',
'nds-nl', 'ne', 'new', 'ng', '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', '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', 'zh',
+ 'zh-classical', 'zh-cn', 'zh-min-nan', 'zh-tw',
'zh-yue', 'zu',
+ ]
+
# 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.
diff --git a/scripts/README.rst b/scripts/README.rst
index 62b413e..0d27749 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -165,8 +165,6 @@
+------------------------+---------------------------------------------------------+
| make_i18n_dict.py | Generate an i18n file from a given script. |
+------------------------+---------------------------------------------------------+
-| sorting_order.py | Updates interwiki sorting order in family.py file. |
-+------------------------+---------------------------------------------------------+
| wikimedia_sites.py | Updates the language lists in Wikimedia family files. |
+------------------------+---------------------------------------------------------+
diff --git a/scripts/maintenance/__init__.py b/scripts/maintenance/__init__.py
index 3fe2e25..e2ce651 100644
--- a/scripts/maintenance/__init__.py
+++ b/scripts/maintenance/__init__.py
@@ -1 +1,5 @@
-"""Maintenance scripts."""
+"""Maintenance scripts.
+
+.. versionchanged:: 8.0
+ sorting_order script was removed.
+"""
diff --git a/scripts/maintenance/sorting_order.py b/scripts/maintenance/sorting_order.py
deleted file mode 100755
index 5bfad98..0000000
--- a/scripts/maintenance/sorting_order.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python3
-"""Script that updates interwiki sorting order in family.py
file."""
-#
-# (C) Pywikibot team, 2020-2022
-#
-# Distributed under the terms of the MIT license.
-#
-import re
-from pathlib import Path
-
-import pywikibot
-from pywikibot.family import Family
-
-
-# MediaWiki page names for interwiki sorting order
-pages = {
- 'alphabetic':
- 'Interwiki config-sorting order-native-languagename',
- 'alphabetic_revised':
- 'Interwiki_config-sorting_order-native-languagename-firstword',
-}
-
-
-def update_family(list_name, page):
- """Update family.py file."""
- pywikibot.info(f'\nReading {list_name} sorting order from\n'
- f'{page.title(with_ns=False)!r}...')
-
- original = getattr(Family, list_name)
- new = page.text.split()
-
- # put the missing languages to the right place
- missing = original != new and set(original) - set(new)
- if missing:
- pywikibot.warning("['{}'] not listed at meta."
- .format("', '".join(missing)))
- index = {}
- for code in missing:
- index[original.index(code)] = code
- i = len(index) - 1
- for key in index:
- new.insert(key - i, index[key])
- i -= 1
-
- if original == new:
- pywikibot.info('The lists match!')
- return
-
- pywikibot.info("The lists don't match, the new list is:")
- text = f' {list_name} = [\n'
- line = ' ' * 7
- for code in new:
- if len(line) + len(code) >= 76:
- text += line + '\n'
- line = ' ' * 7
- line += f" '{code}',"
- text += line + '\n'
- text += ' ]'
- pywikibot.info(text)
- filepath = Path('pywikibot/family.py')
- family_text = filepath.read_text(encoding='utf8')
- family_text = re.sub(r'(?ms)^ {4}%s.+?\]' % list_name,
- text, family_text, 1)
- filepath.write_text(family_text, encoding='utf8')
-
-
-def main():
- """Main entry function."""
- site = pywikibot.Site('meta')
- for list_name, page_name in pages.items():
- page = pywikibot.Page(site, page_name, ns=site.namespaces.MEDIAWIKI)
- update_family(list_name, page)
-
-
-if __name__ == '__main__':
- main()
diff --git a/tests/site_tests.py b/tests/site_tests.py
index aa503af..2dfd288 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -123,8 +123,8 @@
self.assertIn(mysite.code, langs)
self.assertIsInstance(mysite.obsolete, bool)
ipf = mysite.interwiki_putfirst()
- if ipf: # Not all languages use this
- self.assertIsInstance(ipf, list)
+ if ipf: # no languages use this anymore, keep it for foreign families
+ self.assertIsInstance(ipf, list) # pragma: no cover
else:
self.assertIsNone(ipf)
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/868778
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: I2ac6f0133e9a5e6ac6d2d99827bc50d3d06a96ce
Gerrit-Change-Number: 868778
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged