jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/839493 )
Change subject: Localisation updates from https://translatewiki.net.
......................................................................
Localisation updates from https://translatewiki.net.
Change-Id: Iac665b42962d3dfb7a443e6b5748bfc6a3a83961
---
M add_text/tl.json
M archivebot/tl.json
A blockpageschecker/tl.json
M category/tl.json
M category_redirect/tl.json
5 files changed, 42 insertions(+), 22 deletions(-)
Approvals:
L10n-bot: Looks good to me, approved
jenkins-bot: Verified
diff --git a/add_text/tl.json b/add_text/tl.json
index 7d34a19..0b86ea9 100644
--- a/add_text/tl.json
+++ b/add_text/tl.json
@@ -1,6 +1,8 @@
{
"@metadata": {
- "authors": []
+ "authors": [
+ "GinawaSaHapon"
+ ]
},
- "add_text-adding": "robot dinagdag %(adding)s"
+ "add_text-adding": "Bot: Nagdadagdag ng %(adding)s"
}
diff --git a/archivebot/tl.json b/archivebot/tl.json
index db6f814..bbb47bc 100644
--- a/archivebot/tl.json
+++ b/archivebot/tl.json
@@ -1,12 +1,13 @@
{
"@metadata": {
"authors": [
- "AnakngAraw"
+ "AnakngAraw",
+ "GinawaSaHapon"
]
},
- "archivebot-archive-full": "(PUNO NA ANG SINUPAN)",
- "archivebot-archive-summary": "Robot: Nagsisinop ng %(count)d {{PLURAL:%(count)d|sinulid|mga sinulid}} mula sa [[%(from)s]]",
+ "archivebot-archive-full": "(PUNO NA TAGUAN)",
+ "archivebot-archive-summary": "Bot: Tinatago ang %(count)d {{PLURAL:%(count)d|usapan|(na) usapan}} mula sa [[%(from)s]]",
"archivebot-archiveheader": "{{talkarchive}}",
- "archivebot-older-than": "mas luma kaysa",
- "archivebot-page-summary": "Robot: Nagsisinop ng %(count)d {{PLURAL:%(count)d|sinulid|mga sinulid}} (%(why)s) sa %(archives)s"
+ "archivebot-older-than": "{{PLURAL:%(count)d|mas luma}} pa sa %(duration)s",
+ "archivebot-page-summary": "Bot: Tinatago ang %(count)d {{PLURAL:%(count)d|usapan|(na) usapan}} (%(why)s) sa %(archives)s"
}
diff --git a/blockpageschecker/tl.json b/blockpageschecker/tl.json
new file mode 100644
index 0000000..ce05de9
--- /dev/null
+++ b/blockpageschecker/tl.json
@@ -0,0 +1,10 @@
+{
+ "@metadata": {
+ "authors": [
+ "GinawaSaHapon"
+ ]
+ },
+ "blockpageschecker-adding": "Bot: Nagdadagdag ng padron sa pag-lock sa pahina",
+ "blockpageschecker-modifying": "Bot: Binabago ang lumang padron",
+ "blockpageschecker-deleting": "Bot: Binubura ang lumang padron"
+}
diff --git a/category/tl.json b/category/tl.json
index f31d34b..5d5e94c 100644
--- a/category/tl.json
+++ b/category/tl.json
@@ -1,16 +1,22 @@
{
"@metadata": {
"authors": [
- "AnakngAraw"
+ "AnakngAraw",
+ "GinawaSaHapon"
]
},
- "category-adding": "Robot: Nagdaragdag ng kategoryang [[:Category:%(newcat)s|%(newcat)s]]",
- "category-also-in": "(nasa loob din ng %(alsocat)s)",
- "category-listifying": "Bot: Isinalilista mula sa %(fromcat)s (%(num)d entries)",
- "category-removing": "Bot: Tinatanggal mula sa %(oldcat)s",
- "category-replacing": "Robot: Pinapalitan ng kategoryang %(oldcat)s ng %(newcat)s",
- "category-section-title": "Kasaysayan ng pahina ng dating %(oldcat)s",
- "category-version-history": "Robot: Sinasagip ang kasaysayan ng bersiyon ng dating %(oldcat)s",
- "category-was-disbanded": "Bot: Pinagwatak-watak ang kategorya",
- "category-was-moved": "Robot: Inilipat ang kategorya sa [[:Category:%(newcat)s|%(title)s]]"
+ "category-adding": "Bot: Nagdadagdag ng kategorya [[:Category:%(newcat)s|%(newcat)s]]",
+ "category-also-in": "(nasa %(alsocat)s din)",
+ "category-clean": "Bot: Tinatanggal ang kategorya %(category)s na nasa loob na ng %(child)s",
+ "category-listifying": "Bot: Ginagawang listahan mula sa %(fromcat)s ({{PLURAL:%(num)d|1 entry|%(num)d (na) entry}})",
+ "category-removing": "Bot: Tinatanggal mula %(oldcat)s",
+ "category-renamed": "Bot: Nilipat mula %(oldcat)s. May-akda: %(authors)s",
+ "category-replacing": "Bot; Pinapalitan ang kategorya %(oldcat)s ng %(newcat)s",
+ "category-section-title": "Nakaraan ng dating %(oldcat)s",
+ "category-strip-cfd-templates": "Bot: Tinatanggal ang mga padron na CFD para sa mga natapos na'ng gawain",
+ "category-strip-sort-keys": "Bot: Tinatanggal ang mga sort key para sa mga natapos na'ng gawain",
+ "category-strip-both": "Bot: Tinatanggal ang mga padron na CFD at sort key para sa mga natapos na'ng gawain",
+ "category-version-history": "Bot: Sine-save ang nakaraang bersyon ng dating %(oldcat)s",
+ "category-was-disbanded": "Bot: Hinati-hati na ang kategorya",
+ "category-was-moved": "Bot: Nilipat ang kategorya sa [[:Category:%(newcat)s|%(title)s]]"
}
diff --git a/category_redirect/tl.json b/category_redirect/tl.json
index 223def7..8243e3a 100644
--- a/category_redirect/tl.json
+++ b/category_redirect/tl.json
@@ -1,13 +1,14 @@
{
"@metadata": {
"authors": [
- "AnakngAraw"
+ "AnakngAraw",
+ "GinawaSaHapon"
]
},
- "category_redirect-add-template": "Robot: nagdaragdag ng suleras na papunta sa ibang kategorya para sa pagpapanatili",
- "category_redirect-change-category": "Robot: baguhin ang kategoryang pinapunta sa iba [[:%(oldCatLink)s| %(oldCatTitle)s|%(newCatLink)s|%(newCatTitle)s]]",
- "category_redirect-comment": "Bot na tagapagpanatili ng pagpapapunta sa ibang kategorya",
- "category_redirect-edit-request": "Ang sumusunod na nakaprutektang mga pahina ay napansing kailangan ng mga pagsasapanahon sa mga kawing na pangkategorya: %(itemlist)s",
+ "category_redirect-add-template": "Bot: Nagdadagdag ng padron sa pagturo sa kategorya para sa maintenance",
+ "category_redirect-change-category": "Bot: Binabago ang kategoryang tinuturo mula [[:%(oldCatLink)s|%(oldCatTitle)s]] papuntang [[:%(newCatLink)s|%(newCatTitle)s]]",
+ "category_redirect-comment": "Maintenance bot para sa mga pagturo sa kategorya",
+ "category_redirect-edit-request": "Na-detect ang mga sumusunod na protektadong pahina bilang mga nangangailangan ng update sa mga link sa kategorya: %(itemlist)s",
"category_redirect-edit-request-item": "* %(title)s ay nasa loob ng %(oldcat)s, na isang pagpapapunta sa %(newcat)s",
"category_redirect-fix-double": "Bot: kinukumpuni ang nagkadalawang pagpapapunta sa iba"
}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/i18n/+/839493
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/i18n
Gerrit-Branch: master
Gerrit-Change-Id: Iac665b42962d3dfb7a443e6b5748bfc6a3a83961
Gerrit-Change-Number: 839493
Gerrit-PatchSet: 1
Gerrit-Owner: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: L10n-bot <l10n-bot(a)translatewiki.net>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/838229 )
Change subject: [sphinx] Do not use sphinx 5.2
......................................................................
[sphinx] Do not use sphinx 5.2
Change-Id: Ia678822740d194dcd4cb9a6193f9a367bb63f17e
---
M docs/requirements-py3.txt
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Verified; Looks good to me, approved
diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index 3d73e4b..f079137 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -1,5 +1,5 @@
# This is a PIP requirements file for building Sphinx documentation of pywikibot
# requirements.txt is also needed
-sphinx != 5.2
+sphinx == 5.1.1
rstcheck >=3.5.0
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/838229
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: Ia678822740d194dcd4cb9a6193f9a367bb63f17e
Gerrit-Change-Number: 838229
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
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/+/838201 )
Change subject: [sphinx] Do not use sphinx 5.2
......................................................................
[sphinx] Do not use sphinx 5.2
Change-Id: I4f74633dfc8fea246cf79a63d72d112d0aacd812
---
M docs/requirements-py3.txt
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Verified; Looks good to me, approved
diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index ca73c35..3d73e4b 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -1,5 +1,5 @@
# This is a PIP requirements file for building Sphinx documentation of pywikibot
# requirements.txt is also needed
-sphinx >= 5.1.1, != 5.2.0, != 5.2.1, != 5.2.2, != 5.2.3
+sphinx != 5.2
rstcheck >=3.5.0
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/838201
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: I4f74633dfc8fea246cf79a63d72d112d0aacd812
Gerrit-Change-Number: 838201
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
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/+/838183 )
Change subject: [doc] Update ROADMAP.rst and CHANGELOG.rst
......................................................................
[doc] Update ROADMAP.rst and CHANGELOG.rst
Change-Id: Icca999d0c0f1d24b11b04bab718a8be3d06cf6af
---
M ROADMAP.rst
M scripts/CHANGELOG.rst
2 files changed, 15 insertions(+), 0 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Verified; Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index fd63a3e..899a79e 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,6 +1,12 @@
Current release 8.0.0
^^^^^^^^^^^^^^^^^^^^^
+* Enable pagegenerators options with ``move`` and ``remove`` actions (:phab:`T318239`)
+* ListBoxWindows class of :mod:`userinterfaces.gui` was removed
+* L10N and i18n updates
+* Adjust subprocess args in :mod:`tools.djvu`
+* Short site value can be given if site code is equal to family like ``-site:meta`` or ``-site:commons``
+* Require Python 3.6.1+ with Pywikibot and drop support for Python 3.6.0 (:phab:`T318912`)
* pymysql >= 0.9.3 is required (:phab:`T216741`)
* Python 3.5 support was dropped (:phab:`T301908`)
diff --git a/scripts/CHANGELOG.rst b/scripts/CHANGELOG.rst
index 9a1008c..23d7f5e 100644
--- a/scripts/CHANGELOG.rst
+++ b/scripts/CHANGELOG.rst
@@ -1,6 +1,14 @@
Scripts Changelog
=================
+8.0.0
+-----
+
+create_isbn_edition
+~~~~~~~~~~~~~~~~~~~
+
+* Fix argument parsing
+
7.7.0
-----
@@ -13,6 +21,7 @@
category_redirect
~~~~~~~~~~~~~~~~~
+
* Use localized template prefix (:phab:`T318049`)
create_isbn_edition
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/838183
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: Icca999d0c0f1d24b11b04bab718a8be3d06cf6af
Gerrit-Change-Number: 838183
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.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/+/838198 )
Change subject: [sphinx] Do not use sphinx 5.2
......................................................................
[sphinx] Do not use sphinx 5.2
sphinx 5.2 shows any module classes, methods and functions
in the side bar which shouldn't. 5.1.1 only displays the
headers.
Change-Id: Id5d429e8d2244e4b170d9c394d22b1f0c0dac85e
---
M docs/requirements-py3.txt
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Verified; Looks good to me, approved
diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index 53d9a1f..ca73c35 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -1,5 +1,5 @@
# This is a PIP requirements file for building Sphinx documentation of pywikibot
# requirements.txt is also needed
-sphinx >= 5.1.1
+sphinx >= 5.1.1, != 5.2.0, != 5.2.1, != 5.2.2, != 5.2.3
rstcheck >=3.5.0
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/838198
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: Id5d429e8d2244e4b170d9c394d22b1f0c0dac85e
Gerrit-Change-Number: 838198
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/+/834501 )
Change subject: [IMPR] Enable pagegenerators options with 'move' and 'remove' actions
......................................................................
[IMPR] Enable pagegenerators options with 'move' and 'remove' actions
- enable GeneratorFactory usage with 'move' and 'remove' actions
- add generator option to CategoryMoveRobot which may hold page generators
- chain the category page generators
- intersect the category page generators with page generators before
processing
- call __init__ and exit() methods to enable BaseBot counters
- add counters to the methods
- update documentation
Bug: T318239
Change-Id: I65a06133c8afbc328d8c2b73e3a40839424db161
---
M scripts/category.py
1 file changed, 75 insertions(+), 17 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/category.py b/scripts/category.py
index 7c22710..4402d2d 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -10,9 +10,11 @@
*add*
mass-add a category to a list of pages.
*remove*
- remove category tag from all pages in a category.
+ remove category tag from all pages in a category. If a pagegenerators
+ option is given, the intersection with category pages is processed.
*move*
- move all pages in a category to another category.
+ move all pages in a category to another category. If a pagegenerators
+ option is given, the intersection with category pages is processed.
*tidy*
tidy up a category by moving its pages into subcategories.
*tree*
@@ -87,10 +89,7 @@
Also, the category to make a list of in the listify option.
-to: - The category to move to (for the move option).
- Also, the name of the list to make in the listify option.
- NOTE: If the category names have spaces in them you may need to use
- a special syntax in your shell so that the names aren't treated as
- separate parameters. For instance, in BASH, use single quotes,
- e.g. -from:'Polar bears'.
+
-batch - Don't prompt to delete emptied categories (do it
automatically).
-summary: - Pick a custom edit summary for the bot.
@@ -106,7 +105,13 @@
-depth: - The max depth limit beyond which no subcategories will be
listed.
-If action is "add", the following additional options are supported:
+.. note:: If the category names have spaces in them you may need to use
+ a special syntax in your shell so that the names aren't treated as
+ separate parameters. For instance, in BASH, use single quotes, e.g.
+ ``-from:'Polar bears'``.
+
+If action is "add", "move" or "remove, the following additional options are
+supported:
¶ms;
@@ -126,6 +131,16 @@
python pwb.py category move -from:US -to:"United States"
This will move all pages in the category US to the category United States.
+
+A pagegenerators option can be given with ``move`` and ``remove`` action:
+
+ pwb category -site:wikipedia:en remove -from:Hydraulics -cat:Pneumatics
+
+The sample above would remove 'Hydraulics' category from all pages which
+are also in 'Pneumatics' category.
+
+.. versionchanged:: 8.0
+ :mod:`pagegenerators` are supported with "move" and "remove" action.
"""
#
# (C) Pywikibot team, 2004-2022
@@ -138,6 +153,7 @@
import pickle
import re
from contextlib import suppress
+from itertools import chain
from operator import methodcaller
from textwrap import fill
from typing import Optional, Union
@@ -161,6 +177,7 @@
PageSaveRelatedError,
)
from pywikibot.tools import open_archive
+from pywikibot.tools.itertools import intersect_generators
# This is required for the text that is shown when you run this script
@@ -549,6 +566,9 @@
empty.
Per default the operation applies to pages and subcategories.
+
+ .. versionadded:: 8.0
+ The ``generator`` parameter.
"""
DELETION_COMMENT_AUTOMATIC = 0
@@ -564,13 +584,14 @@
title_regex=None,
history: bool = False,
pagesonly: bool = False,
- deletion_comment: Union[int,
- str] = DELETION_COMMENT_AUTOMATIC,
+ deletion_comment: Union[
+ int, str] = DELETION_COMMENT_AUTOMATIC,
move_comment=None,
wikibase: bool = True,
allow_split: bool = False,
move_together: bool = False,
- keep_sortkey=None) -> None:
+ keep_sortkey=None,
+ generator=None) -> None:
"""Store all given parameters in the objects attributes.
:param oldcat: The move source.
@@ -603,7 +624,10 @@
:param move_together: If True moves the pages/subcategories only if
page and talk page could be moved or both source page and target
page don't exist.
+ :param generator: a generator from pagegenerators.GeneratorFactory.
+ If given an intersection to the oldcat category members is used.
"""
+ super().__init__()
self.site = pywikibot.Site()
self.can_move_cats = self.site.has_right('move-categorypages')
self.noredirect = delete_oldcat \
@@ -632,6 +656,7 @@
self.allow_split = allow_split
self.move_together = move_together
self.keep_sortkey = keep_sortkey
+ self.generator = generator
if not self.can_move_cats:
repo = self.site.data_repository()
@@ -691,7 +716,13 @@
- _hist()
- _change()
- _delete()
+
+ .. versionchanged:: 8.0
+ if a page generator is given to the bot, the intersection
+ with :func:`pagegenerators.CategorizedPageGenerator` or
+ :func:`pagegenerators.SubCategoriesPageGenerator` is used.
"""
+ self._start_ts = pywikibot.Timestamp.now()
# can_move_* determines if the page can be moved safely (target
# doesn't exist but source does), move_items determines if the
# items (pages/subcategories) of the category could be moved into
@@ -700,6 +731,7 @@
'category page', self.oldcat, self.newcat)
can_move_talk = CategoryMoveRobot.check_move(
'category talk page', self.oldtalk, self.newtalk)
+
if not self.newcat: # delete
move_items = True
else:
@@ -707,6 +739,7 @@
if not self.allow_split:
can_move_page = can_move_page and move_items
can_move_talk = can_move_talk and move_items
+
if self.newcat and self.move_oldcat:
if self.can_move_cats:
if can_move_page:
@@ -730,21 +763,36 @@
self._movetalk()
if self.wikibase:
self._update_wikibase_item()
+
if self.history and can_move_page:
self._hist()
if move_items:
- self._change(pagegenerators.CategorizedPageGenerator(self.oldcat))
+ gens = [pagegenerators.CategorizedPageGenerator(self.oldcat)]
if not self.pagesonly:
- self._change(
+ gens.append(
pagegenerators.SubCategoriesPageGenerator(self.oldcat))
+ gen = chain(*gens)
+
+ if self.generator:
+ pywikibot.info('Retrieving intersection of generators.')
+ # Allow duplicates if no subcategories are loaded to reduce
+ # memory usage. We can assume that there are no duplicates
+ # retrieved from CategorizedPageGenerator.
+ gen = intersect_generators(gen, self.generator,
+ allow_duplicates=self.pagesonly)
+ self._change(gen)
+
else:
pywikibot.log("Didn't move pages/subcategories, because the "
"category page hasn't been moved.")
+
if self.oldcat.isEmptyCategory() and self.delete_oldcat \
and (self.newcat and self.move_oldcat or not self.newcat):
self._delete(can_move_page, can_move_talk)
+ self.exit()
+
def _delete(self, moved_page, moved_talk) -> None:
"""Private function to delete the category page and its talk page.
@@ -760,9 +808,11 @@
if moved_page and self.oldcat.exists():
self.oldcat.delete(self.deletion_comment, not self.batch,
mark=True)
+ self.counter['delete'] += 1
if moved_talk and self.oldtalk.exists():
self.oldtalk.delete(self.deletion_comment, not self.batch,
mark=True)
+ self.counter['delete talk'] += 1
def _change(self, gen) -> None:
"""
@@ -773,6 +823,9 @@
:param gen: Generator containing pages or categories.
"""
for page in pagegenerators.PreloadingGenerator(gen):
+ self.counter['read'] += 1
+ count_key = 'move' if self.newcat else 'remove'
+
if not self.title_regex or re.search(self.title_regex,
page.title()):
@@ -780,6 +833,7 @@
summary=self.comment,
in_place=self.inplace,
sort_key=self.keep_sortkey)
+ self.counter[count_key] += 1
doc_page = self.determine_template_target(page)
if doc_page != page and (not self.title_regex
@@ -790,13 +844,13 @@
in_place=self.inplace,
include=self.includeonly,
sort_key=self.keep_sortkey)
+ self.counter[count_key + ' talk'] += 1
@staticmethod
- def check_move(name, old_page, new_page) -> bool:
+ def check_move(name: str, old_page, new_page) -> bool:
"""Return if the old page can be safely moved to the new page.
:param name: Title of the new page
- :type name: str
:param old_page: Page to be moved
:type old_page: pywikibot.page.BasePage
:param new_page: Page to be moved to
@@ -1538,7 +1592,7 @@
pg_options.append(arg)
enabled = ['namespace'] if action in ('tidy', 'listify') else None
- if action in ('add', 'listify', 'tidy'):
+ if action in ('add', 'listify', 'move', 'remove', 'tidy'):
gen_factory = pagegenerators.GeneratorFactory(enabled_options=enabled)
unknown += gen_factory.handle_args(pg_options)
else:
@@ -1564,6 +1618,7 @@
options['from'] = \
pywikibot.input('Please enter the name of the '
'category that should be removed:')
+ gen = gen_factory.getCombinedGenerator()
bot = CategoryMoveRobot(oldcat=options.get('from'),
batch=batch,
comment=summary,
@@ -1572,7 +1627,8 @@
title_regex=title_regex,
history=history,
pagesonly=pagesonly,
- deletion_comment=use_deletion_summary)
+ deletion_comment=use_deletion_summary,
+ generator=gen)
elif action == 'move':
if 'from' not in options:
options['from'] = pywikibot.input(
@@ -1585,6 +1641,7 @@
CategoryMoveRobot.DELETION_COMMENT_SAME_AS_EDIT_COMMENT
else:
deletion_comment = CategoryMoveRobot.DELETION_COMMENT_AUTOMATIC
+ gen = gen_factory.getCombinedGenerator()
bot = CategoryMoveRobot(oldcat=options.get('from'),
newcat=options.get('to'),
batch=batch,
@@ -1598,7 +1655,8 @@
wikibase=wikibase,
allow_split=allow_split,
move_together=move_together,
- keep_sortkey=keep_sortkey)
+ keep_sortkey=keep_sortkey,
+ generator=gen)
elif action == 'tidy':
bot = CategoryTidyRobot(options.get('from'), cat_db,
gen_factory.namespaces, summary)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/834501
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: I65a06133c8afbc328d8c2b73e3a40839424db161
Gerrit-Change-Number: 834501
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: Vladis13 <wikimail2013(a)gmail.com>
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/+/837680 )
Change subject: [cleanup] remove outdated code of open_archive
......................................................................
[cleanup] remove outdated code of open_archive
- Remove import check for b2z. This module is a Python module since 2.3.
The check was introduced for the case that someone builds his own
Python (T123092). But this is obviousliy not a Pywikibot issue to
solve such cases.
- Remove import check for lzma. This module is a Python module since 3.3.
The check was necessary for Python 2 backward compatibility but no
longer necessary.
- remove test without lzma/bz2
- decline T123092
This also reverts commit d02a9bd6dad1f3b2965fcd9e257e4f80c1f1d4da.
Bug: T123092
Change-Id: Ib99d7834f0cd57591c30c913d481b9d3885cd9a6
---
M pywikibot/tools/__init__.py
M tests/tools_tests.py
2 files changed, 3 insertions(+), 78 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 536d34f..72ce89b 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -4,9 +4,11 @@
#
# Distributed under the terms of the MIT license.
#
+import bz2
import gzip
import hashlib
import ipaddress
+import lzma
import os
import re
import stat
@@ -41,21 +43,6 @@
pkg_Version = pkg_resources.packaging.version.Version # noqa: N816
-try:
- import bz2
-except ImportError as bz2_import_error:
- try:
- import bz2file as bz2
- warn('package bz2 was not found; using bz2file', ImportWarning)
- except ImportError:
- warn('package bz2 and bz2file were not found', ImportWarning)
- bz2 = bz2_import_error
-
-try:
- import lzma
-except ImportError as lzma_import_error:
- lzma = lzma_import_error
-
__all__ = (
# deprecating functions
@@ -537,9 +524,6 @@
immediately raise that error but only on reading it.
:raises lzma.LZMAError: When error occurs during compression or
decompression or when initializing the state with lzma or xz.
- :raises ImportError: When file is compressed with bz2 but neither bz2 nor
- bz2file is importable, or when file is compressed with lzma or xz but
- lzma is not importable.
:return: A file-like object returning the uncompressed data in binary mode.
:rtype: file-like object
"""
@@ -575,8 +559,6 @@
extension = ''
if extension == 'bz2':
- if isinstance(bz2, ImportError):
- raise bz2
binary = bz2.BZ2File(filename, mode)
elif extension == 'gz':
@@ -604,8 +586,6 @@
binary = process.stdout
elif extension in ('lzma', 'xz'):
- if isinstance(lzma, ImportError):
- raise lzma
lzma_fmts = {'lzma': lzma.FORMAT_ALONE, 'xz': lzma.FORMAT_XZ}
binary = lzma.open(filename, mode, format=lzma_fmts[extension])
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 11ac059..3a4f362 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -12,7 +12,6 @@
from collections import Counter, OrderedDict
from collections.abc import Mapping
from contextlib import suppress
-from importlib import import_module
from unittest import mock
from pywikibot import tools
@@ -31,7 +30,7 @@
)
from tests import join_xml_data_path
-from tests.aspects import TestCase, require_modules
+from tests.aspects import TestCase
from tests.utils import skipping
@@ -75,34 +74,6 @@
self._get_content(self.base_file + '.bz2', use_extension=False),
self.original_content)
- @require_modules('bz2file')
- def test_open_archive_with_bz2file(self):
- """Test open_archive when bz2file library."""
- old_bz2 = tools.bz2
- try:
- tools.bz2 = import_module('bz2file')
- self.assertEqual(self._get_content(self.base_file + '.bz2'),
- self.original_content)
- self.assertEqual(self._get_content(self.base_file + '.bz2',
- use_extension=False),
- self.original_content)
- finally:
- tools.bz2 = old_bz2
-
- def test_open_archive_without_bz2(self):
- """Test open_archive when bz2 and bz2file are not available."""
- old_bz2 = tools.bz2
- bz2_import_error = ('This is a fake exception message that is '
- 'used when bz2 and bz2file are not importable')
- try:
- tools.bz2 = ImportError(bz2_import_error)
- with self.assertRaisesRegex(
- ImportError,
- bz2_import_error):
- self._get_content(self.base_file + '.bz2')
- finally:
- tools.bz2 = old_bz2
-
def test_open_archive_gz(self):
"""Test open_archive with gz compressor in the standard library."""
self.assertEqual(
@@ -123,8 +94,6 @@
def test_open_archive_lzma(self):
"""Test open_archive with lzma compressor in the standard library."""
- if isinstance(tools.lzma, ImportError):
- self.skipTest('lzma not importable')
self.assertEqual(
self._get_content(self.base_file + '.lzma'), self.original_content)
# Legacy LZMA container formet has no magic, skipping
@@ -135,24 +104,6 @@
self._get_content(self.base_file + '.xz', use_extension=False),
self.original_content)
- def test_open_archive_without_lzma(self):
- """Test open_archive when lzma is not available."""
- old_lzma = tools.lzma
- lzma_import_error = ('This is a fake exception message that is '
- 'used when lzma is not importable')
- try:
- tools.lzma = ImportError(lzma_import_error)
- with self.assertRaisesRegex(
- ImportError,
- lzma_import_error):
- self._get_content(self.base_file + '.lzma')
- with self.assertRaisesRegex(
- ImportError,
- lzma_import_error):
- self._get_content(self.base_file + '.xz')
- finally:
- tools.lzma = old_lzma
-
class OpenArchiveWriteTestCase(TestCase):
@@ -227,18 +178,12 @@
def test_write_archive_lzma(self):
"""Test writing a lzma archive."""
- if isinstance(tools.lzma, ImportError):
- self.skipTest('lzma not importable')
-
content = self._write_content('.lzma')
with open(self.base_file + '.lzma', 'rb') as f:
self.assertEqual(content, f.read())
def test_write_archive_xz(self):
"""Test writing a xz archive."""
- if isinstance(tools.lzma, ImportError):
- self.skipTest('lzma not importable')
-
content = self._write_content('.xz')
self.assertEqual(content[:6], b'\xFD7zXZ\x00')
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/837680
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: Ib99d7834f0cd57591c30c913d481b9d3885cd9a6
Gerrit-Change-Number: 837680
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: AbdealiJK <abdealikothari(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged