Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1054011?usp=email )
Change subject: [9.2.1] Add support for aewikimedia wiki and publish Pywikibot 9.2.1
......................................................................
[9.2.1] Add support for aewikimedia wiki and publish Pywikibot 9.2.1
Bug: T362529
Change-Id: I487954d81cf38e3b53b2de6ac5d5b01417681566
---
M HISTORY.rst
M ROADMAP.rst
M pywikibot/__metadata__.py
M pywikibot/families/wikimediachapter_family.py
4 files changed, 38 insertions(+), 29 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/HISTORY.rst b/HISTORY.rst
index 1a23884..a6167ed 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -1,13 +1,44 @@
Release History
===============
+9.2.0
+-----
+*22 June 2024*
+
+* Add support for ``btmwiki`` to Pywikibot (:phab:`T368069`)
+* Include image repository extensions in :attr:`site.APISite.file_extensions
+ <pywikibot.site._apisite.APISite.file_extensions>`
+* Ignore :exc:`ValueError` durig upcast of :class:`FilePage<pywikibot.page.FilePage>` due to invalid file extension
+ (:phab:`T367777`)
+* Add :func:`pagegenerators.SupersetPageGenerator` pagegenerator (:phab:`T367684`)
+* No longer wait in :meth:`data.api.Request._http_request` for ``ImportError`` and ``NameError``
+* Replace ``requests.utils.urlparse`` with ``urllib.parse.urlparse`` in
+ :func:`comms.http.get_authentication` (:phab:`T367649`)
+* Show an appropiate message if ``requests_oauthlib`` package is required but missing (:phab:`T353387`)
+* Retry ``DBUnexpectedError`` in :meth:`data.api.Request._internal_api_error` (:phab:`T367383`)
+* Duplicated entries found in :mod:`pywikibot` were removed
+* Pass ``None`` instead of an empty string as *expiry* argument in
+ :meth:`site.APISite.protect()<pywikibot.site._apisite.APISite.protect>` (:phab:`T367176`)
+* Fix keyword argument in :meth:`Page.undelete()<page.BasePage.undelete>` when
+ calling :meth:`site.APISite.undelete()<pywikibot.site._apisite.APISite.undelete>` (:phab:`T367037`)
+* Check whether :attr:`BaseBot.generator<bot.BaseBot.generator>` is None in :meth:`run()<bot.BaseBot.run>` method
+* Add *namespaces* parameter to :meth:`Page.templates()<page.BasePage.templates>` and
+ :meth:`Page.itertemplates()<page.BasePage.itertemplates>` and require keyword arguments;
+ only use TEMPLATE namespace for meth:`Page.isDisambig()<page.BasePage.isDisambig>` (:phab:`T365199`)
+* Drop pheetools support for :mod:`proofreadpage` which is no longer available upstreams (:phab:`T366036`)
+* Raise :exc:`exceptions.SectionError` if a section does not exists on a page (:phab:`T107141`)
+* Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)
+* i18n updates
+
+
9.1.3
-----
-*28.05.2024*
+*28 May 2024*
* Add support for dtpwiki (:phab:`T365232`)
* i18n updates
+
9.1.2
-----
*03 May 2024*
diff --git a/ROADMAP.rst b/ROADMAP.rst
index b956e38..1ae85ee 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,29 +1,7 @@
Current Release Changes
=======================
-* Add support for ``btmwiki`` to Pywikibot (:phab:`T368069`)
-* Include image repository extensions in :attr:`site.APISite.file_extensions
- <pywikibot.site._apisite.APISite.file_extensions>`
-* Ignore :exc:`ValueError` durig upcast of :class:`FilePage<pywikibot.page.FilePage>` due to invalid file extension
- (:phab:`T367777`)
-* Add :func:`pagegenerators.SupersetPageGenerator` pagegenerator (:phab:`T367684`)
-* No longer wait in :meth:`data.api.Request._http_request` for ``ImportError`` and ``NameError``
-* Replace ``requests.utils.urlparse`` with ``urllib.parse.urlparse`` in
- :func:`comms.http.get_authentication` (:phab:`T367649`)
-* Show an appropiate message if ``requests_oauthlib`` package is required but missing (:phab:`T353387`)
-* Retry ``DBUnexpectedError`` in :meth:`data.api.Request._internal_api_error` (:phab:`T367383`)
-* Duplicated entries found in :mod:`pywikibot` were removed
-* Pass ``None`` instead of an empty string as *expiry* argument in
- :meth:`site.APISite.protect()<pywikibot.site._apisite.APISite.protect>` (:phab:`T367176`)
-* Fix keyword argument in :meth:`Page.undelete()<page.BasePage.undelete>` when
- calling :meth:`site.APISite.undelete()<pywikibot.site._apisite.APISite.undelete>` (:phab:`T367037`)
-* Check whether :attr:`BaseBot.generator<bot.BaseBot.generator>` is None in :meth:`run()<bot.BaseBot.run>` method
-* Add *namespaces* parameter to :meth:`Page.templates()<page.BasePage.templates>` and
- :meth:`Page.itertemplates()<page.BasePage.itertemplates>` and require keyword arguments;
- only use TEMPLATE namespace for meth:`Page.isDisambig()<page.BasePage.isDisambig>` (:phab:`T365199`)
-* Drop pheetools support for :mod:`proofreadpage` which is no longer available upstreams (:phab:`T366036`)
-* Raise :exc:`exceptions.SectionError` if a section does not exists on a page (:phab:`T107141`)
-* Retry api request on ServerError (:phab:`T364275`, :phab:`T364393`)
+* Add support for ``aewikimedia`` to Pywikibot (:phab:`T362529`)
* i18n updates
Current Deprecations
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index be801c8..577d0fa 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -12,6 +12,6 @@
from time import strftime
-__version__ = '9.2.0'
+__version__ = '9.2.1'
__url__ = 'https://www.mediawiki.org/wiki/Manual:Pywikibot'
__copyright__ = f'2003-{strftime("%Y")}, Pywikibot team'
diff --git a/pywikibot/families/wikimediachapter_family.py b/pywikibot/families/wikimediachapter_family.py
index e217010..e595a95 100644
--- a/pywikibot/families/wikimediachapter_family.py
+++ b/pywikibot/families/wikimediachapter_family.py
@@ -21,8 +21,8 @@
closed_wikis = ['cn', 'nz', 'pa-us']
codes = {
- 'am', 'ar', 'az', 'bd', 'be', 'br', 'ca', 'co', 'dk', 'ec', 'ee', 'fi',
- 'ge', 'gr', 'hi', 'id', 'id-internal', 'il', 'mai', 'mk', 'mx', 'ng',
- 'nl', 'no', 'nyc', 'pl', 'pt', 'punjabi', 'romd', 'rs', 'ru', 'se',
- 'tr', 'ua', 'uk', 've', 'wb',
+ 'ae', 'am', 'ar', 'az', 'bd', 'be', 'br', 'ca', 'co', 'dk', 'ec', 'ee',
+ 'fi', 'ge', 'gr', 'hi', 'id', 'id-internal', 'il', 'mai', 'mk', 'mx',
+ 'ng', 'nl', 'no', 'nyc', 'pl', 'pt', 'punjabi', 'romd', 'rs', 'ru',
+ 'se', 'tr', 'ua', 'uk', 've', 'wb',
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1054011?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: stable
Gerrit-Change-Id: I487954d81cf38e3b53b2de6ac5d5b01417681566
Gerrit-Change-Number: 1054011
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Meno25 <meno25mail(a)gmail.com>
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1052713?usp=email )
Change subject: [doc] update ROADMAP.rst
......................................................................
[doc] update ROADMAP.rst
Change-Id: I75bd053280fc6d31621d87f9d32fa337d41bfced
---
M ROADMAP.rst
M pywikibot/page/_page.py
2 files changed, 15 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 4c59145..ce8bc73 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,9 +1,12 @@
Current Release Changes
=======================
+* *botflag* parameter of :meth:`page.BasePage.save`, :meth:`page.BasePage.put`, :meth:`page.BasePage.touch`,
+ :meth:`pywikibot.Page.set_redirect_target` and :meth:`pywikibot.ItemPage.set_redirect_target` was renamed to *bot* to
+ be in sync with :meth:`APISite.editpage<pywikibot.site._apisite.APISite.editpage>` and :api:`edit`.
* use :meth:`page.BasePage.templates` in :meth:`Page.templatesWithParams<page.Page.templatesWithParams>` to cache
templates
-* Re-implement :meth:`Page.main_authors()<page._toolforge.WikiBlameMixin.main_authors>` as
+* Re-implement :meth:`Page.main_authors()<page._toolforge.WikiBlameMixin.main_authors>` as
:meth:`Page.authorship()<page._toolforge.WikiBlameMixin.authorship>` using ``xtools`` (:phab:`T366100`);
``wikitextparser`` packages is required for it.
@@ -73,7 +76,7 @@
* 7.3.0: Old color escape sequences like ``\03{color}`` is deprecated in favour of new color format like <<color>>
* 7.3.0: ``linktrail`` method of :class:`family.Family` is deprecated; use :meth:`APISite.linktrail()
<pywikibot.site._apisite.APISite.linktrail>` instead
-* 7.2.0: Positional arguments *decoder*, *layer* and *newline* for :mod:`logging` functions where dropped; keyword
+* 7.2.0: Positional arguments *decoder*, *layer* and *newline* for :mod:`logging` functions where dropped; keyword
arguments must be used instead.
* 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.logging.exception>` function was renamed to ``exc_info``
* 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a ``content`` parameter of
diff --git a/pywikibot/page/_page.py b/pywikibot/page/_page.py
index b89bc2c..2154ea9 100644
--- a/pywikibot/page/_page.py
+++ b/pywikibot/page/_page.py
@@ -28,7 +28,7 @@
from pywikibot.page._basepage import BasePage
from pywikibot.page._toolforge import WikiBlameMixin
from pywikibot.site import Namespace
-from pywikibot.tools import cached
+from pywikibot.tools import cached, deprecated_args
__all__ = ['Page']
@@ -122,6 +122,7 @@
result.append((pywikibot.Page(link, self.site), positional))
return result
+ @deprecated_args(botflag='bot') # since 9.3.0
def set_redirect_target(
self,
target_page,
@@ -134,6 +135,9 @@
"""
Change the page's text to point to the redirect page.
+ .. versionchanged:: 9.3
+ *botflag* keyword parameter was renamed to *bot*.
+
:param target_page: target of the redirect, this argument is required.
:type target_page: pywikibot.Page or string
:param create: if true, it creates the redirect even if the page
@@ -150,15 +154,19 @@
target_page = pywikibot.Page(self.site, target_page)
elif self.site != target_page.site:
raise InterwikiRedirectPageError(self, target_page)
+
if not self.exists() and not (create or force):
raise NoPageError(self)
+
if self.exists() and not self.isRedirectPage() and not force:
raise IsNotRedirectPageError(self)
+
redirect_regex = self.site.redirect_regex
if self.exists():
old_text = self.get(get_redirect=True)
else:
old_text = ''
+
result = redirect_regex.search(old_text)
if result:
oldlink = result[1]
@@ -172,8 +180,7 @@
prefix = self.text[:result.start()]
suffix = self.text[result.end():]
else:
- prefix = ''
- suffix = ''
+ prefix = suffix = ''
target_link = target_page.title(as_link=True, textlink=True,
allow_interwiki=False)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1052713?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I75bd053280fc6d31621d87f9d32fa337d41bfced
Gerrit-Change-Number: 1052713
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1051096?usp=email )
Change subject: [wikibase] give a more informative exception
......................................................................
[wikibase] give a more informative exception
Give a more informative exception if a property does not exists instead
of just KeyError: <prop>
Bug: T368908
Change-Id: I53d95f413d535947dc0d3fd4b753c095dd653c9b
---
M pywikibot/site/_datasite.py
1 file changed, 12 insertions(+), 8 deletions(-)
Approvals:
Matěj Suchánek: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py
index a61773d..f5be91e 100644
--- a/pywikibot/site/_datasite.py
+++ b/pywikibot/site/_datasite.py
@@ -1,6 +1,6 @@
"""Objects representing API interface to Wikibase site."""
#
-# (C) Pywikibot team, 2012-2023
+# (C) Pywikibot team, 2012-2024
#
# Distributed under the terms of the MIT license.
#
@@ -253,11 +253,12 @@
yield page
def getPropertyType(self, prop):
- """
- Obtain the type of a property.
+ """Obtain the type of a property.
- This is used specifically because we can cache
- the value for a much longer time (near infinite).
+ This is used specifically because we can cache the value for a
+ much longer time (near infinite).
+
+ :raises KeyError: *prop* does not exist
"""
params = {'action': 'wbgetentities', 'ids': prop.getID(),
'props': 'datatype'}
@@ -269,11 +270,14 @@
# the IDs returned from the API can be upper or lowercase, depending
# on the version. See bug T55894 for more information.
try:
- dtype = data['entities'][prop.getID()]['datatype']
+ entity = data['entities'][prop.getID()]
except KeyError:
- dtype = data['entities'][prop.getID().lower()]['datatype']
+ entity = data['entities'][prop.getID().lower()]
- return dtype
+ if 'missing' in entity:
+ raise KeyError(f'{prop} does not exist')
+
+ return entity['datatype']
@need_right('edit')
def editEntity(self, entity, data, bot: bool = True, **kwargs):
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1051096?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I53d95f413d535947dc0d3fd4b753c095dd653c9b
Gerrit-Change-Number: 1051096
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1052427?usp=email )
Change subject: [IMPR] use list comprehensions in several modules
......................................................................
[IMPR] use list comprehensions in several modules
also use dict.values() if key is not used
Change-Id: I7113e50ee624fc346799fa04fcb2f50e395d6603
---
M pywikibot/bot_choice.py
M pywikibot/page/_collections.py
M pywikibot/site/_apisite.py
M scripts/dataextend.py
M scripts/patrol.py
M tests/site_tests.py
M tests/utils.py
M tests/wikibase_edit_tests.py
8 files changed, 46 insertions(+), 56 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 035acd8..2548a8b 100644
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -71,10 +71,9 @@
@staticmethod
def formatted(text: str, options: Iterable[Option],
default: str | None = None) -> str:
- """
- Create a text with the options formatted into it.
+ """Create a text with the options formatted into it.
- This static method is used by :py:meth:`pywikibot.input_choice`.
+ This static method is used by :meth:`pywikibot.input_choice`.
It calls :py:obj:`format` for all *options* to combine the
question for :py:meth:`pywikibot.input`.
@@ -84,9 +83,8 @@
:return: Text with the options formatted into it
"""
- formatted_options = []
- for option in options:
- formatted_options.append(option.format(default=default))
+ formatted_options = [option.format(default=default)
+ for option in options]
# remove color highlights before fill function
text = f"{text} ({', '.join(formatted_options)})"
pattern = '<<[a-z]+>>'
diff --git a/pywikibot/page/_collections.py b/pywikibot/page/_collections.py
index 8f4ac1a..1abf430 100644
--- a/pywikibot/page/_collections.py
+++ b/pywikibot/page/_collections.py
@@ -1,6 +1,6 @@
"""Structures holding data for Wikibase entities."""
#
-# (C) Pywikibot team, 2019-2022
+# (C) Pywikibot team, 2019-2024
#
# Distributed under the terms of the MIT license.
#
@@ -471,14 +471,13 @@
for dbname, sitelink in data.items():
if dbname not in diffto:
continue
+
diffto_link = diffto[dbname]
if diffto_link.get('title') == sitelink.get('title'):
# compare badges
- tmp_badges = []
diffto_badges = diffto_link.get('badges', [])
badges = sitelink.get('badges', [])
- for badge in set(diffto_badges) - set(badges):
- tmp_badges.append('')
+ tmp_badges = [''] * len(set(diffto_badges) - set(badges))
for badge in set(badges) - set(diffto_badges):
tmp_badges.append(badge)
if tmp_badges:
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 916d894..abca600 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -1651,7 +1651,7 @@
if 'pages' not in result['query']:
# No "pages" element might indicate a circular redirect
# Check that a "to" link is also a "from" link in redirmap
- for _from, _to in redirmap.items():
+ for _to in redirmap.values():
if _to['title'] in redirmap:
raise CircularRedirectError(page)
diff --git a/scripts/dataextend.py b/scripts/dataextend.py
index 4ce1227..4ae3dcc 100755
--- a/scripts/dataextend.py
+++ b/scripts/dataextend.py
@@ -3190,12 +3190,11 @@
section = self.findbyre(
r'(?s)"description">\s*<span[^<>]*>(.*?)</span>', html)
if section:
- result = []
texts = []
for subsection in section.split(' et '):
texts += self.findallbyre(r'(\w[\-\s\w&\']+)', subsection)
- for text in texts[:8]:
- result.append(self.findbyre(r'(.+)', text, 'occupation'))
+ result = [self.findbyre(r'(.+)', text, 'occupation')
+ for text in texts[:8]]
return result
return None
@@ -5261,24 +5260,20 @@
if section:
parts = self.findallbyre(r'(?s)(<tr><th.*?</tr>\s*<tr>.*?</tr>)',
section)
- result = []
- for part in parts:
- if '[nominee]' not in part:
- result.append(
- self.findbyre(r'<th[^<>]*>(.*?)<', section, 'award'))
+ result = [self.findbyre(r'<th[^<>]*>(.*?)<', section, 'award')
+ for part in parts if '[nominee]' not in part]
return result
+ return None
def findnominations(self, html: str):
section = self.findbyre(r'(?s)<div id="awards".*?>(.*?)</table>', html)
if section:
parts = self.findallbyre(r'(?s)(<tr><th.*?</tr>\s*<tr>.*?</tr>)',
section)
- result = []
- for part in parts:
- if '[nominee]' in part:
- result.append(
- self.findbyre(r'<th[^<>]*>(.*?)<', section, 'award'))
+ result = [self.findbyre(r'<th[^<>]*>(.*?)<', section, 'award')
+ for part in parts if '[nominee]' in part]
return result
+ return None
def findspouses(self, html: str):
return self.findallbyre(
@@ -6305,14 +6300,15 @@
if section:
preresults = self.findallbyre(r'(?s)<tr>(.*?)</tr>',
section.replace(' ', ' '))[:5]
- results = []
- for preresult in preresults:
- if int(self.findbyre(r'">(\d+)</a>', preresult) or 0) > 5:
- results.append(
- self.findbyre(
- r'(?s)"Mathematics Subject Classification">(.*?)<',
- preresult, 'subject'))
- return results
+ result = [
+ self.findbyre(
+ r'(?s)"Mathematics Subject Classification">(.*?)<',
+ preresult, 'subject')
+ for preresult in preresults
+ if int(self.findbyre(r'">(\d+)</a>', preresult) or 0) > 5
+ ]
+ return result
+ return None
def findwebsite(self, html: str):
return self.findbyre(r'(?s)<td>Homepage:</td>\s*<td><a[^<>]*>(.*?)<',
@@ -8340,15 +8336,16 @@
r'(?s)<b>Woon- en verblijfplaatsen</b>\s*</td>\s*</tr>\s*<tr>(.*?)</tbody>',
html)
if section:
- result = []
subsections = self.findallbyre(r'(?s)(<tr.*?</tr>)', section)
- for subsection in subsections:
- result.append(
- self.findbyre(
- r'<td width="auto">([^<>]*)</td>', subsection, 'city')
- or self.findbyre(
- r'<span[^<>]*>(.*?)<', subsection, 'city'))
+ result = [
+ self.findbyre(
+ r'<td width="auto">([^<>]*)</td>', subsection, 'city')
+ or self.findbyre(
+ r'<span[^<>]*>(.*?)<', subsection, 'city')
+ for subsection in subsections
+ ]
return result
+ return None
def findoccupations(self, html: str):
section = self.findbyre(
@@ -14882,10 +14879,9 @@
def findsources(self, html: str):
sources = self.getvalues('670', 'a', html)
- result = []
- for source in sources:
- if source and ' by ' not in source and ' / ' not in source:
- result.append(self.findbyre('(.*)', source, 'source'))
+ result = [self.findbyre('(.*)', source, 'source')
+ for source in sources
+ if source and ' by ' not in source and ' / ' not in source]
return result
diff --git a/scripts/patrol.py b/scripts/patrol.py
index 5712ba4..ec0259b 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -354,9 +354,8 @@
if not self.linkedpages:
verbose_output('loading page links on ' + self.page_title)
p = pywikibot.Page(self.site, self.page_title)
- linkedpages = []
- for linkedpage in p.linkedPages():
- linkedpages.append(linkedpage.title())
+ linkedpages = [linkedpage.title()
+ for linkedpage in p.linkedPages()]
self.linkedpages = linkedpages
verbose_output(f'Loaded {len(linkedpages)} page links')
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3a087db..0016b2c 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -741,7 +741,7 @@
fp2 = pywikibot.FilePage(site, 'File:T276726.png')
site.loadimageinfo(fp2, history=True)
- for idx, v in fp2._file_revisions.items():
+ for v in fp2._file_revisions.values():
if v['timestamp'] in (ts1, ts2):
self.assertTrue(hasattr(v, 'commenthidden'))
@@ -753,7 +753,7 @@
fp3 = pywikibot.FilePage(site, 'File:T276726.png')
site.loadimageinfo(fp3, history=True)
- for idx, v in fp3._file_revisions.items():
+ for v in fp3._file_revisions.values():
if v['timestamp'] in (ts1, ts2):
self.assertFalse(hasattr(v, 'commenthidden'))
self.assertFalse(hasattr(v, 'userhidden'))
diff --git a/tests/utils.py b/tests/utils.py
index 31aea38..053743f 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -357,11 +357,10 @@
if self.family.name == 'wikisource':
extensions.append({'name': 'ProofreadPage'})
self._siteinfo._cache['extensions'] = (extensions, True)
- aliases = []
- for alias in ('PrefixIndex', ):
- # TODO: Not all follow that scheme (e.g. "BrokenRedirects")
- aliases.append(
- {'realname': alias.capitalize(), 'aliases': [alias]})
+
+ # TODO: Not all follow that scheme (e.g. "BrokenRedirects")
+ aliases = [{'realname': alias.capitalize(), 'aliases': [alias]}
+ for alias in ('PrefixIndex', )]
self._siteinfo._cache['specialpagealiases'] = (aliases, True)
self._msgcache = {'*': 'dummy entry', 'hello': 'world'}
diff --git a/tests/wikibase_edit_tests.py b/tests/wikibase_edit_tests.py
index 1ee33de..d9069d6 100755
--- a/tests/wikibase_edit_tests.py
+++ b/tests/wikibase_edit_tests.py
@@ -91,9 +91,8 @@
item = pywikibot.PropertyPage(testsite, 'P115')
item.get()
if 'P115' in item.claims:
- to_remove = []
- for claim in item.claims['P115']:
- to_remove.append({'id': claim.toJSON()['id'], 'remove': ''})
+ to_remove = [{'id': claim.toJSON()['id'], 'remove': ''}
+ for claim in item.claims['P115']]
item.editEntity({'claims': to_remove})
claim = pywikibot.page.Claim(
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1052427?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I7113e50ee624fc346799fa04fcb2f50e395d6603
Gerrit-Change-Number: 1052427
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot