jenkins-bot submitted this change.

View Change


Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[flake8] remove trailing commas within tuples and lists

Change-Id: Ib94afbdf984a39e59c588d0e795d9b5a8817dade
---
M pywikibot/families/meta_family.py
M pywikibot/families/wikimediachapter_family.py
M pywikibot/families/wikinews_family.py
M pywikibot/families/wikipedia_family.py
M pywikibot/page/_user.py
M scripts/dataextend.py
M tests/interwikimap_tests.py
M tests/thanks_tests.py
M tests/wikibase_tests.py
9 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/pywikibot/families/meta_family.py b/pywikibot/families/meta_family.py
index 0aa07ae..cb308ce 100644
--- a/pywikibot/families/meta_family.py
+++ b/pywikibot/families/meta_family.py
@@ -1,6 +1,6 @@
"""Family module for Meta Wiki."""
#
-# (C) Pywikibot team, 2005-2023
+# (C) Pywikibot team, 2005-2024
#
# Distributed under the terms of the MIT license.
#
@@ -17,7 +17,7 @@
name = 'meta'

interwiki_forward = 'wikipedia'
- cross_allowed = ['meta', ]
+ cross_allowed = ['meta']

category_redirect_templates = {
'meta': (
diff --git a/pywikibot/families/wikimediachapter_family.py b/pywikibot/families/wikimediachapter_family.py
index 3590ec9..b3aba7a 100644
--- a/pywikibot/families/wikimediachapter_family.py
+++ b/pywikibot/families/wikimediachapter_family.py
@@ -1,6 +1,6 @@
"""Family module for Wikimedia chapter, thematic organisation and WUG wikis."""
#
-# (C) Pywikibot team, 2012-2023
+# (C) Pywikibot team, 2012-2024
#
# Distributed under the terms of the MIT license.
#
@@ -18,7 +18,7 @@
'et': 'ee'
}

- closed_wikis = ['cn', 'nz', 'pa-us', ]
+ closed_wikis = ['cn', 'nz', 'pa-us']

codes = [
'am', 'ar', 'az', 'bd', 'be', 'br', 'ca', 'co', 'dk', 'ec', 'ee', 'fi',
diff --git a/pywikibot/families/wikinews_family.py b/pywikibot/families/wikinews_family.py
index afd9caf..d9be92b 100644
--- a/pywikibot/families/wikinews_family.py
+++ b/pywikibot/families/wikinews_family.py
@@ -1,6 +1,6 @@
"""Family module for Wikinews."""
#
-# (C) Pywikibot team, 2005-2023
+# (C) Pywikibot team, 2005-2024
#
# Distributed under the terms of the MIT license.
#
@@ -52,7 +52,7 @@
# TODO: List is incomplete, to be completed for missing languages.
doc_subpages = {
'_default': (('/doc', ),
- ['en', ]
+ ['en']
),
'ar': ('/شرح', '/doc'),
'it': ('/man', ),
diff --git a/pywikibot/families/wikipedia_family.py b/pywikibot/families/wikipedia_family.py
index 20f36dd..ba4697c 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -162,8 +162,8 @@
'ilo', 'ja', 'ms', 'pt', 'ro', 'ru', 'simple', 'sh',
'vi', 'zh']
),
- 'ar': ('/شرح', '/doc', ),
- 'ary': ('/توثيق', '/شرح', '/doc', ),
+ 'ar': ('/شرح', '/doc'),
+ 'ary': ('/توثيق', '/شرح', '/doc'),
'bs': ('/dok', ),
'ca': ('/ús', ),
'de': ('Doku', '/Meta'),
@@ -194,7 +194,7 @@
'arz': ('بتتطور',),
'bs': ('Izmjena u toku',),
'cs': ('Pracuje se',),
- 'de': ('Inuse', 'In use', 'In bearbeitung', 'Inbearbeitung',),
+ 'de': ('Inuse', 'In use', 'In bearbeitung', 'Inbearbeitung'),
'en': ('Inuse', 'In use'),
'fa': ('ویرایش',),
'fr': ('En cours',),
@@ -202,7 +202,7 @@
'hr': ('Radovi',),
'hy': ('Խմբագրում եմ',),
'ru': ('Редактирую',),
- 'sr': ('Радови у току', 'Рут',),
+ 'sr': ('Радови у току', 'Рут'),
'test': ('In use',),
'ur': ('زیر ترمیم',),
'zh': ('Inuse',),
@@ -215,7 +215,7 @@
'arz': ('صفحة ارشيف',),
'cs': ('Archiv', 'Archiv Wikipedie', 'Archiv diskuse',
'Archivace start', 'Posloupnost archivů', 'Rfa-archiv-start',
- 'Rfc-archiv-start',),
+ 'Rfc-archiv-start'),
'de': ('Archiv',),
}

diff --git a/pywikibot/page/_user.py b/pywikibot/page/_user.py
index 3cfb12e..28ebd9c 100644
--- a/pywikibot/page/_user.py
+++ b/pywikibot/page/_user.py
@@ -98,7 +98,7 @@
if force and hasattr(self, '_userprops'):
del self._userprops
if not hasattr(self, '_userprops'):
- self._userprops = list(self.site.users([self.username, ]))[0]
+ self._userprops = list(self.site.users([self.username]))[0]
if self.isAnonymous() or self.is_CIDR():
r = list(self.site.blocks(iprange=self.username, total=1))
if r:
diff --git a/scripts/dataextend.py b/scripts/dataextend.py
index 0c97fe9..79fbef7 100755
--- a/scripts/dataextend.py
+++ b/scripts/dataextend.py
@@ -15739,8 +15739,9 @@

def findtitles(self, html: str):
return self.getinfos(
- [r'titre\d*', r'титул_?\d*', r'tước vị[\w\s]*', '爵位', 'titels', 'titles', 'títuloas', r'titul(?:y|as|ai)?\d*',
- '(?:altri)?titol[oi]', ], html, 'title') + \
+ [r'titre\d*', r'титул_?\d*', r'tước vị[\w\s]*', '爵位',
+ 'titels', 'titles', 'títuloas', r'titul(?:y|as|ai)?\d*',
+ '(?:altri)?titol[oi]'], html, 'title') + \
self.findallbyre(r'Categorie:\s*((?:Heer|Vorst|Graaf) van.*?)\]', html, 'title') + self.findallbyre(
r'Kategorie:\s*((?:Herzog|Herr|Graf|Vizegraf) \([^\[\]]*\))\s*\]', html, 'title') + \
self.findallbyre(r'Catégorie:\s*((?:Duc|Prince|Comte) de.*?)\]', html, 'title') + \
@@ -15783,8 +15784,10 @@
self.findbyre(r'\|otec\|([^|{}]*)}', html, 'person')

def findmother(self, html: str):
- return self.getinfo(['mother', 'madre', 'moeder', 'mère', 'mor', 'matka', 'мать', 'майка', '母親', 'матір', 'mẹ',
- 'الأم', 'mer', 'маці', 'mãe', 'motina', 'мати', 'nome_mãe', ], html, 'person') or \
+ return self.getinfo(['mother', 'madre', 'moeder', 'mère', 'mor',
+ 'matka', 'мать', 'майка', '母親', 'матір', 'mẹ',
+ 'الأم', 'mer', 'маці', 'mãe', 'motina', 'мати',
+ 'nome_mãe'], html, 'person') or \
self.getinfo(['rodzice', 'parents', 'roditelji', 'γονείς', 'والدین', 'parella', '부모', 'wazazi', 'ouers',
], html, 'female-person') or \
self.findbyre(r'\|matka\|([^|{}]*)}', html, 'person')
diff --git a/tests/interwikimap_tests.py b/tests/interwikimap_tests.py
index 54e075a..0797eb0 100755
--- a/tests/interwikimap_tests.py
+++ b/tests/interwikimap_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for the site module."""
#
-# (C) Pywikibot team, 2018-2023
+# (C) Pywikibot team, 2018-2024
#
# Distributed under the terms of the MIT license.
#
@@ -149,7 +149,7 @@

def test_invalid_prefix(self):
"""Test wrong interwiki prefix."""
- for prefix in ('foo', 'mediawiki', 'test', ):
+ for prefix in ('foo', 'mediawiki', 'test'):
with self.subTest(prefix=prefix), self.assertRaises(KeyError):
self.iw_map[prefix]

diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py
index 5f137b6..4f2c05c 100755
--- a/tests/thanks_tests.py
+++ b/tests/thanks_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for thanks-related code."""
#
-# (C) Pywikibot team, 2016-2022
+# (C) Pywikibot team, 2016-2024
#
# Distributed under the terms of the MIT license.
#
@@ -99,7 +99,7 @@
def test_invalid_revision(self):
"""Test that passing an invalid revision ID causes an error."""
site = self.get_site()
- invalid_revids = (0.99, (0, -1), (0, -1, 0.99,), [0, -1, 0.99], 'zero',
+ invalid_revids = (0.99, (0, -1), (0, -1, 0.99), [0, -1, 0.99], 'zero',
'minus one, and point nine nine')
code = 'invalidrevision' if site.mw_version < '1.35' else 'badinteger'
for invalid_revid in invalid_revids:
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 5d689cc..8390755 100755
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for the Wikidata parts of the page module."""
#
-# (C) Pywikibot team, 2008-2023
+# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
@@ -42,7 +42,7 @@
def _get_test_unconnected_page(site):
"""Get unconnected page from site for tests."""
gen = pagegenerators.NewpagesPageGenerator(site=site, total=10,
- namespaces=[1, ])
+ namespaces=[1])
for page in gen:
if not page.properties().get('wikibase_item'):
return page
@@ -667,26 +667,26 @@
q = pywikibot.WbQuantity(amount=1234, error=1, site=repo)
self.assertEqual(q.toWikibase(),
{'amount': '+1234', 'lowerBound': '+1233',
- 'upperBound': '+1235', 'unit': '1', })
+ 'upperBound': '+1235', 'unit': '1'})
q = pywikibot.WbQuantity(amount=5, error=(2, 3), site=repo)
self.assertEqual(q.toWikibase(),
{'amount': '+5', 'lowerBound': '+2',
- 'upperBound': '+7', 'unit': '1', })
+ 'upperBound': '+7', 'unit': '1'})
q = pywikibot.WbQuantity(amount=0, error=(0, 0), site=repo)
self.assertEqual(q.toWikibase(),
{'amount': '+0', 'lowerBound': '+0',
- 'upperBound': '+0', 'unit': '1', })
+ 'upperBound': '+0', 'unit': '1'})
q = pywikibot.WbQuantity(amount=-5, error=(2, 3), site=repo)
self.assertEqual(q.toWikibase(),
{'amount': '-5', 'lowerBound': '-8',
- 'upperBound': '-3', 'unit': '1', })
+ 'upperBound': '-3', 'unit': '1'})

def test_WbQuantity_float_27(self):
"""Test WbQuantity for float value."""
repo = self.get_repo()
q = pywikibot.WbQuantity(amount=0.044405586, error=0.0, site=repo)
q_dict = {'amount': '+0.044405586', 'lowerBound': '+0.044405586',
- 'upperBound': '+0.044405586', 'unit': '1', }
+ 'upperBound': '+0.044405586', 'unit': '1'}
self.assertEqual(q.toWikibase(), q_dict)

def test_WbQuantity_scientific(self):
@@ -694,7 +694,7 @@
repo = self.get_repo()
q = pywikibot.WbQuantity(amount='1.3e-13', error='1e-14', site=repo)
q_dict = {'amount': '+1.3e-13', 'lowerBound': '+1.2e-13',
- 'upperBound': '+1.4e-13', 'unit': '1', }
+ 'upperBound': '+1.4e-13', 'unit': '1'}
self.assertEqual(q.toWikibase(), q_dict)

def test_WbQuantity_decimal(self):
@@ -703,7 +703,7 @@
q = pywikibot.WbQuantity(amount=Decimal('0.044405586'),
error=Decimal('0.0'), site=repo)
q_dict = {'amount': '+0.044405586', 'lowerBound': '+0.044405586',
- 'upperBound': '+0.044405586', 'unit': '1', }
+ 'upperBound': '+0.044405586', 'unit': '1'}
self.assertEqual(q.toWikibase(), q_dict)

def test_WbQuantity_string(self):
@@ -711,7 +711,7 @@
repo = self.get_repo()
q = pywikibot.WbQuantity(amount='0.044405586', error='0', site=repo)
q_dict = {'amount': '+0.044405586', 'lowerBound': '+0.044405586',
- 'upperBound': '+0.044405586', 'unit': '1', }
+ 'upperBound': '+0.044405586', 'unit': '1'}
self.assertEqual(q.toWikibase(), q_dict)

def test_WbQuantity_formatting_bound(self):
@@ -747,7 +747,7 @@
# note that the bounds are inputted as INT but are returned as FLOAT
self.assertEqual(q.toWikibase(),
{'amount': '+0.0229', 'lowerBound': '+0.0000',
- 'upperBound': '+1.0000', 'unit': '1', })
+ 'upperBound': '+1.0000', 'unit': '1'})

def test_WbQuantity_errors(self):
"""Test WbQuantity error handling."""
@@ -763,19 +763,19 @@
self.assertEqual(q.toWikibase(),
{'amount': '+1234', 'lowerBound': '+1233',
'upperBound': '+1235',
- 'unit': 'http://www.wikidata.org/entity/Q712226', })
+ 'unit': 'http://www.wikidata.org/entity/Q712226'})

def test_WbQuantity_unit_fromWikibase(self):
"""Test WbQuantity recognising unit from Wikibase output."""
repo = self.get_repo()
q = pywikibot.WbQuantity.fromWikibase({
'amount': '+1234', 'lowerBound': '+1233', 'upperBound': '+1235',
- 'unit': 'http://www.wikidata.org/entity/Q712226', },
+ 'unit': 'http://www.wikidata.org/entity/Q712226'},
site=repo)
self.assertEqual(q.toWikibase(),
{'amount': '+1234', 'lowerBound': '+1233',
'upperBound': '+1235',
- 'unit': 'http://www.wikidata.org/entity/Q712226', })
+ 'unit': 'http://www.wikidata.org/entity/Q712226'})


class TestWbQuantityNonDry(WbRepresentationTestCase):
@@ -831,7 +831,7 @@
site=self.repo)
self.assertEqual(q.toWikibase(),
{'amount': '+0.0229', 'lowerBound': None,
- 'upperBound': None, 'unit': '1', })
+ 'upperBound': None, 'unit': '1'})

def test_WbQuantity_ItemPage_unit(self):
"""Test WbQuantity with ItemPage unit."""
@@ -844,7 +844,7 @@
self.assertEqual(q.toWikibase(),
{'amount': '+1234', 'lowerBound': '+1233',
'upperBound': '+1235',
- 'unit': 'http://www.wikidata.org/entity/Q712226', })
+ 'unit': 'http://www.wikidata.org/entity/Q712226'})

def test_WbQuantity_equality(self):
"""Test WbQuantity equality with different unit representations."""

To view, visit change 991955. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib94afbdf984a39e59c588d0e795d9b5a8817dade
Gerrit-Change-Number: 991955
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged