Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/959242 )
Change subject: [8.3.3] Publish Pywikibot 8.3.3 ......................................................................
[8.3.3] Publish Pywikibot 8.3.3
- Extract code and family from dbname in APISite.fromDBName (backport from master) - fix i18n
Bug: T345036 Change-Id: I2f7203263c321c0977e3963d0a916fa213bc4d18 --- M pywikibot/families/wikisource_family.py M pywikibot/families/wikibooks_family.py M ROADMAP.rst M pywikibot/__metadata__.py M pywikibot/i18n.py M HISTORY.rst M pywikibot/site/_apisite.py M pywikibot/families/wikiquote_family.py M pywikibot/families/wiktionary_family.py M tests/site_tests.py M pywikibot/families/wikipedia_family.py 11 files changed, 108 insertions(+), 69 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Verified; Looks good to me, approved
diff --git a/HISTORY.rst b/HISTORY.rst index 6826a0d..6f9aa08 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,14 @@ Release history ===============
+8.3.2 +----- +*29. August 2023* + +* Add support for tlywiki (:phab:`T345172`) +* L10N and i18n updates + + 8.3.1 ----- *17. August 2023* diff --git a/ROADMAP.rst b/ROADMAP.rst index 6937f8d..a812236 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -1,13 +1,15 @@ Current release ---------------
-* Add support for tlywiki (:phab:`T345172`) -* i18n updates +* Extract code and family from dbname in :meth:`site.APISite.fromDBName() + <pywikibot.site._apisite.APISite.fromDBName>` (:phab:`T345036`) +* L10N updates
Deprecations ------------
+* 8.2.0: :func:`tools.itertools.itergroup` will be removed in favour of :func:`backports.batched` * 8.2.0: *normalize* parameter of :meth:`WbTime.toTimestr` and :meth:`WbTime.toWikibase` will be removed * 8.1.0: Dependency of :exc:`exceptions.NoSiteLinkError` from :exc:`exceptions.NoPageError` will be removed * 8.1.0: ``exceptions.Server414Error`` is deprecated in favour of :exc:`exceptions.Client414Error` @@ -45,6 +47,10 @@ * 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' + +Will be removed in Pywikibot 9 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * 6.5.0: OutputOption.output() method will be removed in favour of OutputOption.out property * 6.5.0: Infinite rotating file handler with logfilecount of -1 is deprecated * 6.4.0: 'allow_duplicates' parameter of :func:`tools.itertools.intersect_generators` as positional argument is deprecated, use keyword argument instead diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py index 562d97f..49f82b1 100644 --- a/pywikibot/__metadata__.py +++ b/pywikibot/__metadata__.py @@ -11,7 +11,7 @@
__name__ = 'pywikibot' -__version__ = '8.3.2' +__version__ = '8.3.3' __description__ = 'Python MediaWiki Bot Framework' __maintainer__ = 'The Pywikibot team' __maintainer_email__ = 'pywikibot@lists.wikimedia.org' diff --git a/pywikibot/families/wikibooks_family.py b/pywikibot/families/wikibooks_family.py index 9eec871..a42f5ed 100644 --- a/pywikibot/families/wikibooks_family.py +++ b/pywikibot/families/wikibooks_family.py @@ -30,12 +30,12 @@
languages_by_size = [ 'en', 'vi', 'hu', 'de', 'fr', 'it', 'ja', 'pt', 'es', 'nl', 'pl', 'id', - 'he', 'fi', 'zh', 'fa', 'az', 'sq', 'ru', 'ca', 'eu', 'th', 'cs', 'da', - 'ko', 'hi', 'ba', 'sv', 'gl', 'sr', 'uk', 'hr', 'no', 'tr', 'sa', 'ar', - 'ta', 'bn', 'eo', 'is', 'sk', 'si', 'ro', 'bg', 'ms', 'mk', 'ka', 'tt', - 'lt', 'el', 'li', 'sl', 'tl', 'ur', 'km', 'la', 'mr', 'kk', 'te', - 'shn', 'et', 'be', 'ia', 'ml', 'oc', 'ne', 'hy', 'pa', 'cv', 'tg', - 'ku', 'fy', 'af', 'bs', 'cy', 'mg', 'ky', + 'he', 'fi', 'zh', 'fa', 'az', 'sq', 'ru', 'lt', 'ca', 'eu', 'th', 'cs', + 'da', 'ko', 'hi', 'ba', 'sv', 'gl', 'sr', 'uk', 'hr', 'no', 'tr', 'sa', + 'ar', 'ta', 'bn', 'eo', 'is', 'sk', 'si', 'ro', 'bg', 'ms', 'mk', 'ka', + 'tt', 'el', 'li', 'sl', 'tl', 'ur', 'km', 'la', 'mr', 'shn', 'kk', + 'te', 'et', 'be', 'ia', 'ml', 'oc', 'ne', 'hy', 'pa', 'cv', 'tg', 'ku', + 'fy', 'af', 'bs', 'cy', 'mg', 'ky', ]
category_redirect_templates = { diff --git a/pywikibot/families/wikipedia_family.py b/pywikibot/families/wikipedia_family.py index 02fd9e1..4a7036e 100644 --- a/pywikibot/families/wikipedia_family.py +++ b/pywikibot/families/wikipedia_family.py @@ -28,36 +28,36 @@ languages_by_size = [ 'en', 'ceb', 'de', 'sv', 'fr', 'nl', 'ru', 'es', 'it', 'arz', 'pl', 'ja', 'zh', 'vi', 'uk', 'war', 'ar', 'pt', 'fa', 'ca', 'sr', 'id', - 'ko', 'no', 'ce', 'fi', 'cs', 'tr', 'hu', 'tt', 'sh', 'ro', + 'ko', 'no', 'ce', 'fi', 'tr', 'cs', 'hu', 'tt', 'sh', 'ro', 'zh-min-nan', 'eu', 'ms', 'eo', 'he', 'hy', 'da', 'bg', 'cy', 'sk', - 'azb', 'uz', 'et', 'simple', 'be', 'kk', 'min', 'el', 'hr', 'lt', 'gl', - 'az', 'ur', 'sl', 'lld', 'ka', 'nn', 'hi', 'th', 'ta', 'bn', 'la', - 'mk', 'zh-yue', 'ast', 'lv', 'af', 'tg', 'my', 'mg', 'mr', 'sq', 'bs', + 'uz', 'azb', 'et', 'simple', 'be', 'kk', 'min', 'el', 'hr', 'lt', 'gl', + 'az', 'ur', 'sl', 'lld', 'ka', 'nn', 'hi', 'th', 'ta', 'bn', 'mk', + 'la', 'zh-yue', 'ast', 'lv', 'af', 'tg', 'my', 'mg', 'sq', 'mr', 'bs', 'oc', 'te', 'ml', 'nds', 'be-tarask', 'br', 'ky', 'sw', 'lmo', 'jv', 'new', 'pnb', 'vec', 'ht', 'pms', 'ba', 'lb', 'su', 'ku', 'ga', 'szl', 'is', 'fy', 'ckb', 'cv', 'pa', 'tl', 'an', 'wuu', 'diq', 'io', 'sco', - 'vo', 'yo', 'ne', 'ia', 'kn', 'gu', 'als', 'ha', 'avk', 'bar', 'crh', - 'scn', 'bpy', 'qu', 'mn', 'nv', 'xmf', 'ban', 'si', 'tum', 'ps', 'ig', - 'frr', 'os', 'mzn', 'bat-smg', 'or', 'sah', 'cdo', 'gd', 'bug', 'yi', - 'sd', 'ilo', 'am', 'nap', 'li', 'bcl', 'fo', 'gor', 'hsb', 'map-bms', - 'mai', 'shn', 'eml', 'ace', 'zh-classical', 'sa', 'as', 'wa', 'ie', + 'vo', 'yo', 'ne', 'ha', 'kn', 'ia', 'gu', 'als', 'avk', 'crh', 'bar', + 'scn', 'bpy', 'qu', 'mn', 'nv', 'ban', 'xmf', 'si', 'tum', 'ps', 'mzn', + 'ig', 'frr', 'os', 'or', 'bat-smg', 'sah', 'cdo', 'gd', 'bug', 'yi', + 'sd', 'ilo', 'am', 'bcl', 'nap', 'li', 'fo', 'gor', 'hsb', 'map-bms', + 'mai', 'shn', 'eml', 'ace', 'zh-classical', 'as', 'sa', 'wa', 'ie', 'hyw', 'lij', 'mhr', 'zu', 'sn', 'hif', 'mrj', 'bjn', 'km', 'mni', - 'hak', 'roa-tara', 'sat', 'pam', 'rue', 'nso', 'bh', 'so', 'mi', 'se', - 'myv', 'vls', 'nds-nl', 'dag', 'sc', 'co', 'ary', 'kw', 'bo', 'vep', - 'glk', 'tk', 'kab', 'gan', 'rw', 'fiu-vro', 'ab', 'gv', 'ug', 'nah', - 'zea', 'skr', 'frp', 'udm', 'pcd', 'mt', 'kv', 'csb', 'gn', 'smn', - 'ay', 'nrm', 'ks', 'lez', 'olo', 'lfn', 'mwl', 'lo', 'stq', 'ang', - 'mdf', 'fur', 'rm', 'lad', 'kaa', 'gom', 'ext', 'koi', 'tyv', 'pap', - 'av', 'dsb', 'ln', 'dty', 'tw', 'cbk-zam', 'dv', 'ksh', 'za', 'gag', - 'bxr', 'pfl', 'lg', 'szy', 'blk', 'pag', 'pi', 'tay', 'haw', 'awa', - 'inh', 'krc', 'xal', 'pdc', 'to', 'atj', 'tcy', 'arc', 'mnw', 'shi', - 'jam', 'kbp', 'wo', 'anp', 'kbd', 'nia', 'om', 'nov', 'ki', 'nqo', - 'bi', 'ff', 'xh', 'tpi', 'tet', 'roa-rup', 'jbo', 'fj', 'kg', 'lbe', - 'ty', 'cu', 'guw', 'trv', 'ami', 'srn', 'sm', 'mad', 'alt', 'ltg', - 'gcr', 'chr', 'tn', 'ny', 'st', 'pih', 'got', 'rmy', 'ee', 'ss', 'pcm', - 'bm', 'gpe', 'ts', 've', 'kcg', 'chy', 'rn', 'gur', 'ch', 'ik', 'ady', - 'fat', 'pnt', 'guc', 'iu', 'pwn', 'sg', 'din', 'ti', 'kl', 'dz', 'cr', - 'tly', + 'hak', 'sat', 'roa-tara', 'pam', 'rue', 'nso', 'bh', 'so', 'mi', 'myv', + 'se', 'vls', 'nds-nl', 'dag', 'co', 'sc', 'ary', 'kw', 'bo', 'vep', + 'glk', 'tk', 'kab', 'gan', 'rw', 'fiu-vro', 'gv', 'ab', 'ug', 'zea', + 'nah', 'skr', 'frp', 'tly', 'udm', 'mt', 'pcd', 'kv', 'gn', 'csb', + 'smn', 'ay', 'nrm', 'ks', 'lez', 'olo', 'lfn', 'mwl', 'lo', 'mdf', + 'stq', 'ang', 'fur', 'rm', 'kaa', 'lad', 'ext', 'gom', 'koi', 'tyv', + 'pap', 'av', 'dsb', 'ln', 'dty', 'tw', 'cbk-zam', 'dv', 'ksh', 'za', + 'gag', 'bxr', 'pfl', 'lg', 'szy', 'blk', 'pag', 'tay', 'pi', 'haw', + 'awa', 'inh', 'krc', 'xal', 'pdc', 'to', 'atj', 'tcy', 'arc', 'mnw', + 'shi', 'jam', 'kbp', 'wo', 'anp', 'kbd', 'nia', 'om', 'nov', 'ki', + 'nqo', 'xh', 'bi', 'ff', 'tpi', 'tet', 'roa-rup', 'jbo', 'fj', 'lbe', + 'kg', 'ty', 'cu', 'guw', 'trv', 'ami', 'srn', 'mad', 'sm', 'alt', + 'ltg', 'gcr', 'chr', 'tn', 'ny', 'st', 'pih', 'got', 'rmy', 'gpe', + 'ss', 'ee', 'pcm', 'bm', 'kcg', 'ts', 've', 'chy', 'rn', 'gur', 'ch', + 'ady', 'ik', 'guc', 'fat', 'pnt', 'iu', 'pwn', 'sg', 'din', 'ti', 'kl', + 'dz', 'cr', ]
# Sites we want to edit but not count as real languages diff --git a/pywikibot/families/wikiquote_family.py b/pywikibot/families/wikiquote_family.py index 2858fa8..00fb57f 100644 --- a/pywikibot/families/wikiquote_family.py +++ b/pywikibot/families/wikiquote_family.py @@ -27,10 +27,10 @@ ]
languages_by_size = [ - 'it', 'en', 'pl', 'ru', 'cs', 'et', 'pt', 'fa', 'uk', 'he', 'fr', 'de', + 'it', 'en', 'pl', 'ru', 'cs', 'et', 'pt', 'fa', 'he', 'uk', 'fr', 'de', 'es', 'tr', 'eo', 'sk', 'bs', 'az', 'ca', 'fi', 'sr', 'zh', 'lt', 'sl', - 'ar', 'su', 'id', 'bg', 'hy', 'hr', 'el', 'nn', 'sv', 'li', 'hu', 'ko', - 'nl', 'sah', 'ja', 'la', 'ta', 'hi', 'ig', 'gl', 'gu', 'ur', 'as', + 'ar', 'id', 'su', 'bg', 'hy', 'hr', 'el', 'nn', 'sv', 'li', 'hu', 'ko', + 'nl', 'sah', 'ja', 'la', 'ta', 'hi', 'ig', 'gl', 'gu', 'as', 'ur', 'guw', 'be', 'te', 'vi', 'tl', 'bn', 'cy', 'no', 'sq', 'ml', 'kn', 'eu', 'ro', 'ku', 'uz', 'ka', 'da', 'sa', 'is', 'bcl', 'th', 'br', 'mr', 'af', 'ky', diff --git a/pywikibot/families/wikisource_family.py b/pywikibot/families/wikisource_family.py index a246e23..0242579 100644 --- a/pywikibot/families/wikisource_family.py +++ b/pywikibot/families/wikisource_family.py @@ -27,11 +27,11 @@ languages_by_size = [ 'pl', 'en', 'ru', 'de', 'fr', 'zh', 'he', 'it', 'uk', 'ar', 'es', 'mul', 'gu', 'cs', 'sr', 'pt', 'bn', 'fa', 'sv', 'ko', 'hu', 'ta', - 'ml', 'sa', 'te', 'tr', 'sl', 'vi', 'la', 'hy', 'be', 'el', 'ja', 'nl', + 'ml', 'sa', 'te', 'tr', 'sl', 'be', 'vi', 'la', 'hy', 'el', 'nl', 'ja', 'ro', 'fi', 'nap', 'az', 'ca', 'hr', 'br', 'kn', 'no', 'id', 'th', - 'hi', 'eo', 'is', 'cy', 'vec', 'mr', 'pms', 'ban', 'lij', 'da', 'et', + 'hi', 'eo', 'cy', 'vec', 'is', 'mr', 'pms', 'ban', 'lij', 'da', 'et', 'as', 'mk', 'yi', 'bg', 'jv', 'wa', 'li', 'lt', 'pa', 'or', 'eu', 'gl', - 'bs', 'sah', 'sk', 'zh-min-nan', 'fo', 'su', + 'bs', 'sah', 'sk', 'su', 'zh-min-nan', 'fo', ]
# Sites we want to edit but not count as real languages diff --git a/pywikibot/families/wiktionary_family.py b/pywikibot/families/wiktionary_family.py index 1fced79..d98e269 100644 --- a/pywikibot/families/wiktionary_family.py +++ b/pywikibot/families/wiktionary_family.py @@ -32,22 +32,22 @@ ]
languages_by_size = [ - 'en', 'fr', 'mg', 'zh', 'ru', 'de', 'es', 'sh', 'sv', 'nl', 'el', 'pl', - 'ku', 'lt', 'ca', 'it', 'hu', 'fi', 'ta', 'pt', 'tr', 'ja', 'io', 'hy', + 'en', 'fr', 'mg', 'zh', 'ru', 'el', 'de', 'es', 'sh', 'ku', 'sv', 'nl', + 'pl', 'lt', 'ca', 'it', 'hu', 'fi', 'ta', 'pt', 'tr', 'ja', 'io', 'hy', 'ko', 'kn', 'vi', 'sr', 'th', 'hi', 'ro', 'id', 'no', 'et', 'skr', 'cs', 'ml', 'my', 'uz', 'li', 'eo', 'or', 'te', 'fa', 'gl', 'sg', 'ar', - 'oc', 'jv', 'is', 'az', 'uk', 'eu', 'ast', 'br', 'mnw', 'da', 'simple', - 'bn', 'lo', 'la', 'shn', 'hr', 'sk', 'fj', 'ky', 'wa', 'bg', 'lmo', - 'ur', 'cy', 'ps', 'tg', 'he', 'kbd', 'vo', 'om', 'sl', 'af', + 'oc', 'jv', 'is', 'az', 'uk', 'eu', 'ast', 'br', 'mnw', 'da', 'bn', + 'simple', 'lo', 'la', 'shn', 'hr', 'sk', 'fj', 'wa', 'ky', 'bg', 'lmo', + 'ur', 'cy', 'ps', 'tg', 'kbd', 'he', 'vo', 'om', 'sl', 'af', 'zh-min-nan', 'ms', 'scn', 'tl', 'pa', 'fy', 'sw', 'kk', 'ka', 'nn', - 'min', 'lv', 'gor', 'nds', 'sq', 'lb', 'bs', 'co', 'mn', 'pnb', 'nah', - 'yue', 'ckb', 'sa', 'km', 'be', 'vec', 'tk', 'diq', 'nia', 'mk', 'sm', - 'hsb', 'ks', 'shy', 'su', 'bcl', 'ga', 'btm', 'gd', 'an', 'gom', 'mr', - 'wo', 'mni', 'ia', 'bjn', 'ang', 'mt', 'sd', 'fo', 'tt', 'ha', 'so', - 'gn', 'si', 'ie', 'mi', 'csb', 'ug', 'guw', 'st', 'hif', 'jbo', + 'min', 'lv', 'nds', 'gor', 'sq', 'lb', 'bs', 'co', 'mn', 'pnb', 'nah', + 'yue', 'ckb', 'sa', 'km', 'diq', 'be', 'vec', 'tk', 'nia', 'mk', 'sm', + 'hsb', 'ks', 'shy', 'bcl', 'su', 'ga', 'btm', 'gd', 'an', 'gom', 'mr', + 'wo', 'mni', 'ha', 'ia', 'bjn', 'ang', 'mt', 'sd', 'tt', 'fo', 'blk', + 'so', 'si', 'gn', 'ie', 'mi', 'csb', 'ug', 'guw', 'st', 'hif', 'jbo', 'roa-rup', 'kl', 'zu', 'ay', 'ln', 'yi', 'gu', 'na', 'gv', 'kw', 'tpi', 'kcg', 'am', 'ne', 'rw', 'ts', 'ig', 'qu', 'ss', 'iu', 'chr', 'dv', - 'ti', 'tn', 'blk', + 'ti', 'tn', ]
category_redirect_templates = { diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py index 0c12c3b..3f8205c 100644 --- a/pywikibot/i18n.py +++ b/pywikibot/i18n.py @@ -911,7 +911,7 @@ >>> i18n.known_languages()[-10:] ['vo', 'vro', 'wa', 'war', 'xal', 'xmf', 'yi', 'yo', 'yue', 'zh'] >>> len(i18n.known_languages()) - 253 + 254
The implementation is roughly equivalent to:
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py index f8097cc..996dcb0 100644 --- a/pywikibot/site/_apisite.py +++ b/pywikibot/site/_apisite.py @@ -184,14 +184,15 @@ """ return self._interwikimap[prefix].local
- @classmethod + @staticmethod def fromDBName( # noqa: N802 - cls, dbname: str, site: Optional[BaseSite] = None ) -> BaseSite: - """ - Create a site from a database name using the sitematrix. + """Create a site from a database name using the sitematrix. + + .. versionchanged:: 8.3.3 + changed from classmethod to staticmethod.
:param dbname: database name :param site: Site to load sitematrix from. (Default meta.wikimedia.org) @@ -200,19 +201,27 @@ # TODO this only works for some WMF sites if not site: site = pywikibot.Site('meta') + param = { + 'action': 'sitematrix', + 'smlangprop': 'site', + 'smsiteprop': ('code', 'dbname'), + 'formatversion': 2, + } req = site._request(expiry=datetime.timedelta(days=10), - parameters={'action': 'sitematrix'}) + parameters=param) data = req.submit() for key, val in data['sitematrix'].items(): if key == 'count': continue - if 'code' in val: - lang = val['code'] + if 'site' in val: for m_site in val['site']: if m_site['dbname'] == dbname: - if m_site['code'] == 'wiki': - m_site['code'] = 'wikipedia' - return pywikibot.Site(lang, m_site['code']) + # extract site from dbname + family = m_site['code'] + code = removesuffix(dbname, family).replace('_', '-') + if family == 'wiki': + family = 'wikipedia' + return pywikibot.Site(code, family) else: # key == 'specials' for m_site in val: if m_site['dbname'] == dbname: diff --git a/tests/site_tests.py b/tests/site_tests.py index add933a..5908217 100755 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -89,17 +89,19 @@ def test_constructors(self): """Test cases for site constructors.""" test_list = [ + ['alswiki', 'wikipedia:als'], # see T345036 + ['commonswiki', 'commons:commons'], + ['dewikinews', 'wikinews:de'], ['enwiki', 'wikipedia:en'], ['eswikisource', 'wikisource:es'], - ['dewikinews', 'wikinews:de'], - ['ukwikivoyage', 'wikivoyage:uk'], ['metawiki', 'meta:meta'], - ['commonswiki', 'commons:commons'], - ['wikidatawiki', 'wikidata:wikidata'], - ['testwikidatawiki', 'wikidata:test'], - ['testwiki', 'wikipedia:test'], # see T225729, T228300 - ['test2wiki', 'wikipedia:test2'], # see T225729 + ['roa_rupwiki', 'wikipedia:roa-rup'], # see T345036 ['sourceswiki', 'wikisource:mul'], # see T226960 + ['test2wiki', 'wikipedia:test2'], # see T225729 + ['testwiki', 'wikipedia:test'], # see T225729, T228300 + ['testwikidatawiki', 'wikidata:test'], + ['ukwikivoyage', 'wikivoyage:uk'], + ['wikidatawiki', 'wikidata:wikidata'], ] if isinstance(self.site.family, pywikibot.family.WikimediaFamily): site = self.site
pywikibot-commits@lists.wikimedia.org