jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/965058 )
Change subject: Make exception about missing mediainfo more friendly
......................................................................
Make exception about missing mediainfo more friendly
Before throwing, re-use the pageid of the file to avoid
exception saying "Entity '-1' ..."
Also don't show the KeyError traceback.
Change-Id: I1a130419477960856b6f976762a128d100eb43a6
---
M pywikibot/page/_wikibase.py
1 file changed, 18 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index 5141e00..7f098f8 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -433,8 +433,10 @@
data = self.file.latest_revision.slots['mediainfo']['*']
except NoPageError as exc:
raise NoWikibaseEntityError(self) from exc
- except KeyError as exc:
- raise NoWikibaseEntityError(self) from exc
+ except KeyError:
+ # reuse the reserved ID for better message
+ self.id = 'M' + str(self.file.pageid)
+ raise NoWikibaseEntityError(self) from None
self._content = jsonlib.loads(data)
self.id = self._content['id']
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/965058
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: I1a130419477960856b6f976762a128d100eb43a6
Gerrit-Change-Number: 965058
Gerrit-PatchSet: 2
Gerrit-Owner: Matěj Suchánek <matejsuchanek97(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/965466 )
Change subject: [doc] Update deprecations for tools module
......................................................................
[doc] Update deprecations for tools module
Change-Id: I0ae99e3a363ee40536efd84c951b3655b09b3614
---
M pywikibot/tools/__init__.py
1 file changed, 29 insertions(+), 2 deletions(-)
Approvals:
Xqt: Verified; Looks good to me, approved
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 1661611..0f07fc3 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1,4 +1,20 @@
-"""Miscellaneous helper functions (not wiki-dependent)."""
+"""Miscellaneous helper functions (not wiki-dependent).
+
+.. deprecated:: 7.6
+ The *CombinedError*, *DequeGenerator*, *EmptyDefault*, *EMPTY_DEFAULT*
+ and *SizedKeyCollection* objects. Import them from
+ :mod:`tools.collections` instead.
+.. deprecated:: 7.6
+ The *itergroup* function. Use :func:`backports.batched` or
+ ``itertools.batched`` instead.
+.. deprecated:: 7.6
+ The *filter_unique*, *intersect_generators*, *islice_with_ellipsis*
+ and *roundrobin_generators* functions. Import them from
+ :mod:`tools.itertools` instead.
+.. deprecated:: 7.7
+ The *RLock*, *ThreadedGenerator* and *ThreadList* classes.
+ Import them from :mod:`tools.threading` instead.
+"""
#
# (C) Pywikibot team, 2008-2023
#
@@ -841,12 +857,14 @@
replacement_name='pywikibot.tools.collections.EMPTY_DEFAULT',
since='7.6.0')
-# Deprecate objects which has to be imported from tools.itertools instead
+# Deprecate objects which has to be imported from backports instead
wrapper.add_deprecated_attr(
'itergroup',
# new replacement in 8.2
replacement_name='pywikibot.backports.batched',
since='7.6.0')
+
+# Deprecate objects which has to be imported from tools.itertools instead
wrapper.add_deprecated_attr(
'islice_with_ellipsis',
replacement_name='pywikibot.tools.itertools.islice_with_ellipsis',
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/965466
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: I0ae99e3a363ee40536efd84c951b3655b09b3614
Gerrit-Change-Number: 965466
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/+/965275 )
Change subject: Change category output string to format string.
......................................................................
Change category output string to format string.
Change the category output string to a format string so that the
category is correctly logged out to the user when generating a category
graph.
Bug: T348709
Change-Id: I6d078ccabd5d69b143b4e4d0546aa7d96073d833
---
M scripts/category_graph.py
1 file changed, 15 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 0d875b2..58ae66d 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -71,7 +71,7 @@
cat_title = pywikibot.input(
'For which category do you want to create a graph?')
- pywikibot.info('Scanning {cat_title!r}')
+ pywikibot.info(f'Scanning {cat_title!r}')
self.cat = pywikibot.Category(self.site, cat_title)
self.to = args.to
if self.to == '?':
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/965275
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: I6d078ccabd5d69b143b4e4d0546aa7d96073d833
Gerrit-Change-Number: 965275
Gerrit-PatchSet: 3
Gerrit-Owner: Enag2000 <enag2000(a)gmail.com>
Gerrit-Reviewer: D3r1ck01 <dalangi-ctr(a)wikimedia.org>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged