Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/668361 )
Change subject: [doc] Update ROADMAP.rst
......................................................................
[doc] Update ROADMAP.rst
Change-Id: Iee1e0577546a5e71e619b0d41f11c7f973247eef
---
M ROADMAP.rst
1 file changed, 8 insertions(+), 0 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/ROADMAP.rst b/ROADMAP.rst
index 10abecd..b7f6c4d 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -14,6 +14,14 @@
Other changes
^^^^^^^^^^^^^
+* Ensure that BaseBot.generator is a Generator
+* Add additional info into log if 'messagecode' is missing during login (T261061, T269503)
+* Use hardcoded messages if i18n system is not available (T275981)
+* Move wikibase data structures to page/_collections.py
+* Remove deprecated Wikibase.lastrevid attribute
+* L10N updates
+* Add support for altwiki (T271984)
+* Add support for mniwiki and mniwiktionary (T273467, T273462)
* config settings of archived scripts were removed (T223826)
* Drop startsort/endsort parameter for site.categorymembers method (T74101)
* Don't use mime parameter as boolean in api.Request (T274723)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/668361
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: Iee1e0577546a5e71e619b0d41f11c7f973247eef
Gerrit-Change-Number: 668361
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/+/641019 )
Change subject: [bugfix] Ensure that BaseBot.generator is a Generator
......................................................................
[bugfix] Ensure that BaseBot.generator is a Generator
Ensure that BaseBot.generator is a Generator that it can be closed
with close method
Change-Id: I9961c67f3d6a94bde2d3100d7745948900700e6f
---
M pywikibot/bot.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index b2be383..0feab32 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -95,6 +95,7 @@
import warnings
import webbrowser
+from collections.abc import Generator
from contextlib import closing
from importlib import import_module
from pathlib import Path
@@ -1468,6 +1469,9 @@
if not hasattr(self, 'generator'):
raise NotImplementedError('Variable {}.generator not set.'
.format(self.__class__.__name__))
+ if not isinstance(self.generator, Generator):
+ # to provide close() method
+ self.generator = (item for item in self.generator)
try:
for item in self.generator:
# preprocessing of the page
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/641019
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: I9961c67f3d6a94bde2d3100d7745948900700e6f
Gerrit-Change-Number: 641019
Gerrit-PatchSet: 2
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/+/667874 )
Change subject: [tests] throw an expected failure for beta cluster search tests at travis
......................................................................
[tests] throw an expected failure for beta cluster search tests at travis
Bug: T276038
Change-Id: I79445e4d40a6d279fcc1bdad926ac341309aa5e1
---
M tests/site_tests.py
1 file changed, 3 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 6535c63..de58446 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -4,6 +4,7 @@
#
# Distributed under the terms of the MIT license.
#
+import os
import pickle
import random
import threading
@@ -31,6 +32,7 @@
WikimediaDefaultSiteTestCase,
)
from tests.basepage import BasePageLoadRevisionsCachingTestBase
+from tests.utils import expected_failure_if
class TestSiteObjectDeprecatedFunctions(DefaultSiteTestCase,
@@ -1462,6 +1464,7 @@
self.skipTest('gsrsearch is diabled on site {}:\n{!r}'
.format(mysite, e))
+ @expected_failure_if(os.environ.get('FAMILY') in ['wpbeta', 'wsbeta'])
@suppress_warnings("where='title' is deprecated", DeprecationWarning)
def test_search_where_title(self):
"""Test site.search() method with 'where' parameter set to title."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/667874
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: I79445e4d40a6d279fcc1bdad926ac341309aa5e1
Gerrit-Change-Number: 667874
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/+/667626 )
Change subject: [IMPR] Prepare scripts to be derived from specialbot/_disambig
......................................................................
[IMPR] Prepare scripts to be derived from specialbot/_disambig
Change-Id: Ifb8153e6d745a573343718375b314ba13eaecf58
---
M scripts/misspelling.py
M scripts/solve_disambiguation.py
M tox.ini
3 files changed, 23 insertions(+), 30 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 91d7ef1..cefb7f8 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -12,15 +12,16 @@
some choices for XY don't make sense and will result in a loop,
e.g. "l" or "m".
+ -main only check pages in the main namespace, not in the talk,
+ wikipedia, user, etc. namespaces.
+
-start:XY goes through all misspellings in the category on your wiki
that is defined (to the bot) as the category containing
misspelling pages, starting at XY. If the -start argument is not
given, it starts at the beginning.
-
- -main only check pages in the main namespace, not in the talk,
- wikipedia, user, etc. namespaces.
"""
-# (C) Pywikibot team, 2007-2020
+#
+# (C) Pywikibot team, 2007-2021
#
# Distributed under the terms of the MIT license.
#
@@ -33,7 +34,7 @@
from pywikibot.bot import SingleSiteBot
from pywikibot.tools.formatter import color_format
-from scripts.solve_disambiguation import DisambiguationRobot as DisambigBotBase
+from scripts.solve_disambiguation import DisambiguationRobot as BaseDisambigBot
HELP_MSG = """\n
misspelling.py does not support site {site}.
@@ -45,7 +46,7 @@
these misspellings.\n"""
-class MisspellingRobot(DisambigBotBase):
+class MisspellingRobot(BaseDisambigBot):
"""Spelling bot."""
@@ -112,15 +113,13 @@
pywikibot.output(HELP_MSG.format(site=self.site))
return
- generator = chain(*generators)
- preloadingGen = pagegenerators.PreloadingGenerator(generator)
- yield from preloadingGen
+ yield from pagegenerators.PreloadingGenerator(chain(*generators))
def findAlternatives(self, page) -> bool:
"""
Append link target to a list of alternative links.
- Overrides the DisambigBotBase method.
+ Overrides the BaseDisambigBot method.
@return: True if alternate link was appended
"""
@@ -157,11 +156,11 @@
"""
Setup the summary message.
- Overrides the DisambiguationRobot method.
+ Overrides the BaseDisambigBot method.
"""
# TODO: setSummaryMessage() in solve_disambiguation now has parameters
# new_targets and unlink. Make use of these here.
- self.comment = i18n.twtranslate(self.site, 'misspelling-fixing',
+ self.summary = i18n.twtranslate(self.site, 'misspelling-fixing',
{'page': page.title()})
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 2c3c7b4..b8bc74d 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -98,7 +98,6 @@
from pywikibot.tools import first_lower, first_upper
from pywikibot.tools.formatter import SequenceOutputter
-
# Disambiguation Needed template
dn_template = {
'ar': '{{بحاجة لتوضيح}}',
@@ -471,7 +470,7 @@
if line:
self.ignorelist.add(line)
- def isIgnored(self, ref_page) -> bool:
+ def isIgnored(self, ref_page) -> bool: # noqa: N802
"""Return if ref_page is to be ignored.
@type ref_page: pywikibot.Page
@@ -576,7 +575,7 @@
class DisambiguationRobot(SingleSiteBot):
- """Disambiguation bot."""
+ """Disambiguation Bot."""
ignore_contents = {
'de': ('{{[Ii]nuse}}',
@@ -617,15 +616,13 @@
self.first_only = first_only
self.minimum = minimum
self.summary = None
-
self.dn_template_str = i18n.translate(self.site, dn_template)
- def checkContents(self, text) -> Optional[str]:
+ def checkContents(self, text: str) -> Optional[str]: # noqa: N802
"""
Check if the text matches any of the ignore regexes.
@param text: wikitext of a page
- @type text: str
@return: None if none of the regular expressions
given in the dictionary at the top of this class matches
a substring of the text, otherwise the matched substring
@@ -636,17 +633,14 @@
return match.group()
return None
- def makeAlternativesUnique(self) -> None:
+ def makeAlternativesUnique(self) -> None: # noqa: N802
"""Remove duplicate items from self.alternatives.
Preserve the order of alternatives.
- @rtype: None
-
"""
seen = set()
- self.alternatives = [
- i for i in self.alternatives if i not in seen and not seen.add(i)
- ]
+ self.alternatives = [i for i in self.alternatives
+ if i not in seen and not seen.add(i)]
def setup(self) -> None:
"""Compile regular expressions."""
@@ -1025,7 +1019,7 @@
return 'done'
- def findAlternatives(self, page) -> bool:
+ def findAlternatives(self, page) -> bool: # noqa: N802
"""Extend self.alternatives using correctcap of disambPage.linkedPages.
@param page: the disambiguation page
@@ -1266,9 +1260,9 @@
if page.exists():
alternatives.append(page.title())
elif pywikibot.input_yn(
- 'Possibility {0} does not actually exist. Use it anyway?'
- .format(page.title()),
- default=False, automatic_quit=False):
+ 'Possibility {} does not actually exist. Use it anyway?'
+ .format(page.title()), default=False,
+ automatic_quit=False):
alternatives.append(page.title())
elif arg == '-just':
getAlternatives = False
diff --git a/tox.ini b/tox.ini
index 8fbb637..fb963f5 100644
--- a/tox.ini
+++ b/tox.ini
@@ -170,14 +170,14 @@
scripts/imagetransfer.py : N803, N806, N816
scripts/maintenance/* : T001
scripts/maintenance/download_dump.py : N815
- scripts/misspelling.py : N802, N803, N806, N815
+ scripts/misspelling.py : N802, N806
scripts/movepages.py : N803, N806, N802
scripts/noreferences.py : N802, N803, N806, N816
scripts/pagefromfile.py : N815
scripts/redirect.py : N803, N806, N815
scripts/replace.py : N802, N803, N806, N816
scripts/revertbot.py: N815
- scripts/solve_disambiguation.py : N803, N806, N802
+ scripts/solve_disambiguation.py : N802, N803, N806
scripts/templatecount.py: N802
scripts/weblinkchecker.py : N803, N806, N802
scripts/welcome.py: N802, N815
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/667626
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: Ifb8153e6d745a573343718375b314ba13eaecf58
Gerrit-Change-Number: 667626
Gerrit-PatchSet: 3
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