jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678694 )
Change subject: [doc] Fix typos in doc
......................................................................
[doc] Fix typos in doc
* wikibase --> Wikibase
** See
https://en.wikipedia.org/wiki/Wikibase
* pywikibot --> Pywikibot
Change-Id: I2c4d74de5bd80d1b0ca9729d8d9fa492c60d6dd6
---
M pywikibot/CONTENT.rst
M pywikibot/bot.py
M pywikibot/family.py
M scripts/commonscat.py
4 files changed, 10 insertions(+), 10 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/CONTENT.rst b/pywikibot/CONTENT.rst
index 6ef9ee8..978079f 100644
--- a/pywikibot/CONTENT.rst
+++ b/pywikibot/CONTENT.rst
@@ -4,10 +4,10 @@
+-----------------------------------------------------------------------------------+
| Library routines |
+============================+======================================================+
- | __init__.py | Initialization of the pywikibot framework, |
+ | __init__.py | Initialization of the Pywikibot framework, |
| | basic classes and methods |
+----------------------------+------------------------------------------------------+
- | __metadata__.py | pywikibot framework metadata file |
+ | __metadata__.py | Pywikibot framework metadata file |
+----------------------------+------------------------------------------------------+
| _wbtypes.py | Wikibase data type classes |
+----------------------------+------------------------------------------------------+
@@ -17,7 +17,7 @@
+----------------------------+------------------------------------------------------+
| bot_choice.py | Classes for input_choice |
+----------------------------+------------------------------------------------------+
- | config2.py | Module to define and load pywikibot configuration |
+ | config2.py | Module to define and load Pywikibot configuration |
+----------------------------+------------------------------------------------------+
| cosmetic_changes.py | Slight modifications to a wiki page's source code |
+----------------------------+------------------------------------------------------+
@@ -70,7 +70,7 @@
| titletranslate.py | Rules and tricks to auto-translate wikipage titles |
| | articles |
+----------------------------+------------------------------------------------------+
- | version.py | Module to determine the pywikibot version (tag, |
+ | version.py | Module to determine the Pywikibot version (tag, |
| | revision and date) |
+----------------------------+------------------------------------------------------+
| xmlreader.py | Reading and parsing XML dump files |
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index c59e23b..2192118 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -25,7 +25,7 @@
identified must be predefined in available_options dictionary.
* L{Bot}: The previous base class which should be avoided. This class is mainly
- used for bots which work with wikibase or together with an image repository.
+ used for bots which work with Wikibase or together with an image repository.
Additionally there is the L{CurrentPageBot} class which automatically sets the
current page to the page treated. It is recommended to use this class and to
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 3f3ff72..01ec119 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1161,9 +1161,9 @@
# Completely removed
removed_wikis = [] # type: List[str]
- # WikimediaFamily uses wikibase for the category name containing
+ # WikimediaFamily uses Wikibase for the category name containing
# disambiguation pages for the various languages. We need the
- # wikibase code and item number:
+ # Wikibase code and item number:
disambcatname = {'wikidata': 'Q1982926'}
# UrlShortener extension is only usable on metawiki, and this wiki can
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 85ca270..e965ed1 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -51,7 +51,7 @@
'¶ms;': pagegenerators.parameterHelp
}
-# wikibase property containing the wikibase category
+# Wikibase property containing the Wikibase category
wikibase_property = {
'wikidata:wikidata': 'P373',
}
@@ -393,9 +393,9 @@
return ''
def find_commons_category(self, page) -> str:
- """Find CommonsCat template on wikibase repository.
+ """Find CommonsCat template on Wikibase repository.
- Use wikibase property to get the category if possible.
+ Use Wikibase property to get the category if possible.
Otherwise check all langlinks to find it.
@return: name of a valid commons category
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678694
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: I2c4d74de5bd80d1b0ca9729d8d9fa492c60d6dd6
Gerrit-Change-Number: 678694
Gerrit-PatchSet: 6
Gerrit-Owner: Meno25 <meno25mail(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/+/678691 )
Change subject: [doc] Update documentation
......................................................................
[doc] Update documentation
* Current wording is a TODO note.
* Convert it to a real doc
* Text was added more than 5 years ago
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/202016
* Use capital letters consistently through out the file
Change-Id: Ibef05b05c7883fe38cd842aaf183b53324c8f60e
---
M scripts/README.rst
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/README.rst b/scripts/README.rst
index 8e6cfa4..b636f65 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -57,9 +57,9 @@
+------------------------+---------------------------------------------------------+
| fixing_redirects.py | Correct all redirect links of processed pages. |
+------------------------+---------------------------------------------------------+
- | harvest_template.py | [IMPROV] Reduce maximum line length to 130 |
+ | harvest_template.py | Template harvesting script. |
+------------------------+---------------------------------------------------------+
- | illustrate_wikidata.py | Don't use 'gen' to refer to the generator factory. |
+ | illustrate_wikidata.py | Bot to add images to Wikidata items. |
+------------------------+---------------------------------------------------------+
| imagetransfer.py | Given a wiki page, check the interwiki links for |
| | images, and let the user choose among them for |
@@ -118,7 +118,7 @@
| speedy_delete.py | Help sysops to quickly check and/or delete pages listed |
| | for speedy deletion. |
+------------------------+---------------------------------------------------------+
- | template.py | change one template (that is {{...}}) into another. |
+ | template.py | Change one template (that is {{...}}) into another. |
+------------------------+---------------------------------------------------------+
| templatecount.py | Display the list of pages transcluding a given list |
| | of templates. |
@@ -175,10 +175,10 @@
+------------------------+---------------------------------------------------------+
| flickrripper.py | Upload images from Flickr easily. |
+------------------------+---------------------------------------------------------+
- | followlive.py | follow new articles on a Wikipedia and flag them |
+ | followlive.py | Follow new articles on a Wikipedia and flag them |
| | with a template. |
+------------------------++--------------------------------------------------------+
- | freebasemappingupload.py| Docstring fixes in scripts |
+ | freebasemappingupload.py| Script to upload the mappings of Freebase to Wikidata. |
+------------------------++--------------------------------------------------------+
| image.py | This script can be used to change one image to another |
| | or remove an image entirely. |
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678691
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: Ibef05b05c7883fe38cd842aaf183b53324c8f60e
Gerrit-Change-Number: 678691
Gerrit-PatchSet: 5
Gerrit-Owner: Meno25 <meno25mail(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/+/676969 )
Change subject: [IMPR] Improvements for patrol.py
......................................................................
[IMPR] Improvements for patrol.py
- Type checking of BaseBot can be changed by passing treat_page_type to
the bot. Therefore remove the run() method and inherit the method
from BaseBot
- Derive PatrolBot from BaseBot to prevent site checking of skip_page()
- remove unused attribute repeat_start_ts
- remove counter and use default BaseBot behavior
- rename load_whitelist() to setup(). It will be called from run()
method before generator is processed
- remove try statement in treat(). These exceptions cannot be rised
because there is not Page object. This also solves the error that
title is not a callable, introduced 6 years ago.
- remove LinkedPagesRule.title() which is never used
- update docs
- DummyPatrolBot is no longer necessary for testes because whitelist
is loaded with run() method and not with constructor
Change-Id: I370b9c0108c7860e053242af97ac6779a1547a7c
---
M scripts/patrol.py
M tests/patrolbot_tests.py
2 files changed, 77 insertions(+), 110 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/patrol.py b/scripts/patrol.py
index 4843f8d..f33f956 100755
--- a/scripts/patrol.py
+++ b/scripts/patrol.py
@@ -5,7 +5,8 @@
This bot obtains a list of recent changes and newpages and marks the
edits as patrolled based on a whitelist.
-WHITELIST FORMAT
+Whitelist Format
+~~~~~~~~~~~~~~~~
The whitelist is formatted as a number of list entries. Any links outside of
lists are ignored and can be used for documentation. In a list the first link
@@ -41,7 +42,7 @@
"""
#
-# (C) Pywikibot team, 2011-2020
+# (C) Pywikibot team, 2011-2021
#
# Distributed under the terms of the MIT license.
#
@@ -50,16 +51,17 @@
from collections import defaultdict
from contextlib import suppress
-try:
- import mwparserfromhell
-except ImportError as e:
- mwparserfromhell = e
-
import pywikibot
from pywikibot import pagegenerators
-from pywikibot.bot import SingleSiteBot, QuitKeyboardInterrupt, suggest_help
+from pywikibot.backports import removeprefix
+from pywikibot.bot import BaseBot, suggest_help
+
+try:
+ import mwparserfromhell
+except ImportError as e:
+ mwparserfromhell = e
_logger = 'patrol'
@@ -70,7 +72,7 @@
pywikibot.output(string)
-class PatrolBot(SingleSiteBot):
+class PatrolBot(BaseBot):
"""Bot marks the edits as patrolled based on info obtained by whitelist."""
@@ -79,7 +81,7 @@
'en': 'patrol_whitelist',
}
- def __init__(self, site=True, **kwargs):
+ def __init__(self, site=None, **kwargs):
"""
Initializer.
@@ -94,7 +96,8 @@
'versionchecktime': 300,
'autopatroluserns': False
})
- super().__init__(site, **kwargs)
+ super().__init__(**kwargs)
+ self.site = site or pywikibot.Site()
self.recent_gen = True
self.user = None
if self.opt.whitelist:
@@ -111,10 +114,11 @@
self.highest_rcid = 0 # used to track loops
self.last_rcid = 0
- self.repeat_start_ts = 0
- self.rc_item_counter = 0 # counts how many items have been reviewed
- self.patrol_counter = 0 # and how many times an action was taken
+ self._load_prefix_index_aliases()
+
+ def _load_prefix_index_aliases(self):
+ """Load _prefixindex_aliases."""
for entry in self.site.siteinfo['specialpagealiases']:
if entry['realname'] == 'Prefixindex':
self._prefixindex_aliases = {alias.lower()
@@ -123,10 +127,8 @@
else:
raise RuntimeError('No alias for "prefixindex"')
- def load_whitelist(self):
+ def setup(self):
"""Load most recent watchlist_page for further processing."""
- if isinstance(mwparserfromhell, ImportError):
- raise mwparserfromhell
# Check for a more recent version after versionchecktime in sec.
if (self.whitelist_load_ts and (time.time() - self.whitelist_load_ts
< self.opt.versionchecktime)):
@@ -260,7 +262,7 @@
return dict(whitelist)
def is_wikisource_author_page(self, title):
- """Initialise author_ns if site family is 'wikisource' else pass."""
+ """Patrol a single item."""
if self.site.family.name != 'wikisource':
return False
@@ -269,107 +271,81 @@
author_ns = self.site.family.authornamespaces[self.site.lang][0]
author_ns_prefix = self.site.namespace(author_ns) + ':'
- if title.startswith(author_ns_prefix):
- author_page_name = title[len(author_ns_prefix):]
+ author_page_name = removeprefix(title, author_ns_prefix)
+ if title != author_ns_prefix:
verbose_output('Found author ' + author_page_name)
return True
return False
- def run(self, feed):
- """Process 'whitelist' page absent in generator."""
- if self.whitelist is None:
- self.load_whitelist()
- try:
- for page in feed:
- self.treat(page)
- except QuitKeyboardInterrupt:
- pywikibot.output('\nUser quit {} bot run.'
- .format(self.__class__.__name__))
-
def treat(self, page):
"""It loads the given page, does some changes, and saves it."""
choice = False
- try:
- # page: title, date, username, comment, loginfo, rcid, token
- username = page['user']
- # when the feed isn't from the API, it used to contain
- # '(not yet written)' or '(page does not exist)' when it was
- # a redlink
- rcid = page['rcid']
- title = page['title']
- if not rcid:
- raise Exception('rcid not present')
- # check whether we have wrapped around to higher rcids
- # which indicates a new RC feed is being processed
- if rcid > self.last_rcid:
- # refresh the whitelist
- self.load_whitelist()
- self.repeat_start_ts = time.time()
+ # page: title, date, username, comment, loginfo, rcid, token
+ username = page['user']
+ # when the feed isn't from the API, it used to contain
+ # '(not yet written)' or '(page does not exist)' when it was
+ # a redlink
+ rcid = page['rcid']
+ title = page['title']
+ if not rcid:
+ raise Exception('rcid not present')
- if pywikibot.config.verbose_output or self.opt.ask:
- pywikibot.output('User {0} has created or modified page {1}'
- .format(username, title))
+ # check whether we have wrapped around to higher rcids
+ # which indicates a new RC feed is being processed
+ if rcid > self.last_rcid:
+ # refresh the whitelist
+ self.setup()
- if (self.opt.autopatroluserns
- and page['ns'] in (2, 3)):
- # simple rule to whitelist any user editing their own userspace
- if title.partition(':')[2].split('/')[0].startswith(username):
- verbose_output('{0} is whitelisted to modify {1}'
- .format(username, title))
- choice = True
+ if pywikibot.config.verbose_output or self.opt.ask:
+ pywikibot.output('User {0} has created or modified page {1}'
+ .format(username, title))
- if not choice and username in self.whitelist:
- if self.in_list(self.whitelist[username], title):
- verbose_output('{0} is whitelisted to modify {1}'
- .format(username, title))
- choice = True
+ if (self.opt.autopatroluserns
+ and page['ns'] in (2, 3)):
+ # simple rule to whitelist any user editing their own userspace
+ if title.partition(':')[2].split('/')[0].startswith(username):
+ verbose_output('{0} is whitelisted to modify {1}'
+ .format(username, title))
+ choice = True
- if self.opt.ask:
- choice = pywikibot.input_yn(
- 'Do you want to mark page as patrolled?')
+ if not choice and username in self.whitelist:
+ if self.in_list(self.whitelist[username], title):
+ verbose_output('{0} is whitelisted to modify {1}'
+ .format(username, title))
+ choice = True
- # Patrol the page
- if choice:
- # list() iterates over patrol() which returns a generator
- list(self.site.patrol(rcid))
- self.patrol_counter = self.patrol_counter + 1
- pywikibot.output('Patrolled {0} (rcid {1}) by user {2}'
- .format(title, rcid, username))
- else:
- verbose_output('Skipped')
+ if self.opt.ask:
+ choice = pywikibot.input_yn(
+ 'Do you want to mark page as patrolled?')
- if rcid > self.highest_rcid:
- self.highest_rcid = rcid
- self.last_rcid = rcid
- self.rc_item_counter = self.rc_item_counter + 1
+ # Patrol the page
+ if choice:
+ # list() iterates over patrol() which returns a generator
+ list(self.site.patrol(rcid))
+ pywikibot.output('Patrolled {0} (rcid {1}) by user {2}'
+ .format(title, rcid, username))
+ else:
+ verbose_output('Skipped')
- except pywikibot.NoPage:
- pywikibot.output('Page {0} does not exist; skipping.'
- .format(title(as_link=True)))
- except pywikibot.IsRedirectPage:
- pywikibot.output('Page {0} is a redirect; skipping.'
- .format(title(as_link=True)))
+ if rcid > self.highest_rcid:
+ self.highest_rcid = rcid
+ self.last_rcid = rcid
class LinkedPagesRule:
"""Matches of page site title and linked pages title."""
- def __init__(self, page_title):
+ def __init__(self, page_title: str):
"""Initializer.
@param page_title: The page title for this rule
- @type page_title: pywikibot.Page
"""
self.site = pywikibot.Site()
self.page_title = page_title
self.linkedpages = None
- def title(self):
- """Obtain page title."""
- return self.page_title
-
def match(self, page_title):
"""Match page_title to linkedpages elements."""
if page_title == self.page_title:
@@ -392,7 +368,8 @@
verbose_output("Checking against '{0}'".format(p))
if page_title.startswith(p):
verbose_output('Matched.')
- return p
+ return True
+ return False
def api_feed_repeater(gen, delay=0, repeat=False, namespaces=None,
@@ -471,8 +448,6 @@
else:
recentchanges = True
- bot = PatrolBot(**options)
-
if isinstance(mwparserfromhell, ImportError):
suggest_help(missing_dependencies=('mwparserfromhell',))
return
@@ -484,7 +459,9 @@
user=usercontribs,
namespaces=gen_factory.namespaces,
recent_new_gen=False)
- bot.run(feed)
+ bot = PatrolBot(site=site, generator=feed, **options)
+ bot.treat_page_type = dict
+ bot.run()
if recentchanges or usercontribs:
pywikibot.output('Recentchanges:')
@@ -492,10 +469,9 @@
feed = api_feed_repeater(gen, delay=60, repeat=repeat,
namespaces=gen_factory.namespaces,
user=usercontribs)
- bot.run(feed)
-
- pywikibot.output('{0}/{1} patrolled'
- .format(bot.patrol_counter, bot.rc_item_counter))
+ bot = PatrolBot(site=site, generator=feed, **options)
+ bot.treat_page_type = dict
+ bot.run()
if __name__ == '__main__':
diff --git a/tests/patrolbot_tests.py b/tests/patrolbot_tests.py
index 081af28..864a3fb 100644
--- a/tests/patrolbot_tests.py
+++ b/tests/patrolbot_tests.py
@@ -1,12 +1,12 @@
"""Tests for the patrol script."""
#
-# (C) Pywikibot team, 2015-2020
+# (C) Pywikibot team, 2015-2021
#
# Distributed under the terms of the MIT license.
#
from contextlib import suppress
-from scripts import patrol
+from scripts.patrol import PatrolBot
from tests.aspects import require_modules, unittest, DefaultDrySiteTestCase
@@ -27,15 +27,6 @@
"""
-class DummyPatrolBot(patrol.PatrolBot):
-
- """Dummy Patrol Bot for Tests."""
-
- def load_whitelist(self):
- """Do not try to load the whitelist."""
- pass
-
-
@require_modules('mwparserfromhell')
class TestPatrolBot(DefaultDrySiteTestCase):
@@ -44,7 +35,7 @@
def setUp(self):
"""Create a bot dummy instance."""
super().setUp()
- self.bot = DummyPatrolBot(self.site)
+ self.bot = PatrolBot(self.site)
def test_parse_page_tuples(self):
"""Test parsing the page tuples from a dummy text."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676969
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: I370b9c0108c7860e053242af97ac6779a1547a7c
Gerrit-Change-Number: 676969
Gerrit-PatchSet: 6
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-CC: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676940 )
Change subject: [tests] enable different types with BaseBot.treat()
......................................................................
[tests] enable different types with BaseBot.treat()
Usually BaseBot.treat() works on BasePages and init_page has to be used
to upcast generators items to that type.
In some cases it can be usefull to allow generators item directly
Change-Id: Ide27f8cdce58558847c75fbe31e0589e2461e845
---
M pywikibot/bot.py
1 file changed, 11 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 5c68925..ebabc53 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1156,6 +1156,11 @@
Bot will process each page in the generator, invoking the method treat()
which must then be implemented by subclasses.
+ Each item processed by treat() must be a L{pywikibot.page.BasePage}
+ type. Use init_page() to upcast the type. To enable other types, set
+ BaseBot.treat_page_type to an appropriate type; your bot should
+ derive from BaseBot in that case and handle site properties.
+
If the subclass does not set a generator, or does not override
treat() or run(), NotImplementedError is raised.
@@ -1191,6 +1196,7 @@
self._save_counter = 0
self._skip_counter = 0
self._generator_completed = False
+ self.treat_page_type = pywikibot.page.BasePage # default type
@property
def current_page(self):
@@ -1475,9 +1481,11 @@
else:
page = initialized_page
- assert isinstance(page, pywikibot.page.BasePage), (
- '"page" is not a pywikibot.page.BasePage object but {}.'
- .format(page.__class__))
+ # validate page type
+ if not isinstance(page, self.treat_page_type):
+ raise TypeError('"page" is not a {!r} object but {}.'
+ .format(self.treat_page_type,
+ page.__class__.__name__))
if self.skip_page(page):
self._skip_counter += 1
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/676940
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: Ide27f8cdce58558847c75fbe31e0589e2461e845
Gerrit-Change-Number: 676940
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: DannyS712 <dannys712.wiki(a)gmail.com>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678419 )
Change subject: [doc] Fix typos in documentation
......................................................................
[doc] Fix typos in documentation
* Use correct English
** mediawiki --> MediaWiki
** wikispecies --> Wikispecies
* The official names of the sites are:
** Wikimedia Commons
** Wikimedia Incubator, etc
Change-Id: I038bca59290d3906ab51ba559b51ff0e84a94d71
---
M pywikibot/date.py
M pywikibot/families/species_family.py
M scripts/interwiki.py
3 files changed, 7 insertions(+), 7 deletions(-)
Approvals:
DannyS712: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 1b98c0d..30363a5 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -507,7 +507,7 @@
# See dh() for additional information.
class MonthNames(Mapping):
- """A Mapping with reads month names from mediawiki messages."""
+ """A Mapping which reads month names from MediaWiki messages."""
# Predefined month names which are needed at import time
months = {
diff --git a/pywikibot/families/species_family.py b/pywikibot/families/species_family.py
index ff2b499..8a76f7b 100644
--- a/pywikibot/families/species_family.py
+++ b/pywikibot/families/species_family.py
@@ -1,13 +1,13 @@
"""Family module for Wikimedia species wiki."""
#
-# (C) Pywikibot team, 2007-2020
+# (C) Pywikibot team, 2007-2021
#
# Distributed under the terms of the MIT license.
#
from pywikibot import family
-# The wikispecies family
+# The Wikispecies family
class Family(family.WikimediaOrgFamily):
"""Family class for Wikimedia species wiki."""
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 526c733..b21063b 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -139,11 +139,11 @@
Names of families that forward their interlanguage links
to the wiki family being worked upon can be used, they are:
- * commons: Interlanguage links of Mediawiki Commons
- * incubator: Links in pages on the Mediawiki Incubator
+ * commons: Interlanguage links of Wikimedia Commons
+ * incubator: Links in pages on the Wikimedia Incubator
* meta: Interlanguage links of named pages on Meta
- * species: Interlanguage links of the wikispecies wiki
- * strategy: Links in pages on Wikimedias strategy wiki
+ * species: Interlanguage links of the Wikispecies wiki
+ * strategy: Links in pages on Wikimedia Strategy wiki
* test: Take interwiki links from Test Wikipedia
* wikimania: Interwiki links of Wikimania
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678419
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: I038bca59290d3906ab51ba559b51ff0e84a94d71
Gerrit-Change-Number: 678419
Gerrit-PatchSet: 7
Gerrit-Owner: Meno25 <meno25mail(a)gmail.com>
Gerrit-Reviewer: DannyS712 <dannys712.wiki(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/+/678580 )
Change subject: [tests] Revert: "Do not skip tests due to MaxlagTimeoutError"
......................................................................
[tests] Revert: "Do not skip tests due to MaxlagTimeoutError"
This reverts commit 1e2525b35feff25418f01fe7766275d73a5e16c6.
Bug T242081 is not solved finally I guess. The problem still
exists and a maxlag timeout still occures from time to time.
Unfortunately a job at travis cannot be restarted anymore.
Therefore:
- increase max_retries to 3 for Travis tests
- skip MaxlagTimeoutError during tests
- concurrent jobs are also deactivated at
https://travis-ci.org/github/wikimedia/pywikibot/settings
Bug: T242081
Bug: T279817
Change-Id: Icb6b410cdf6b46c975e91bc49458e5a5a80c8b0e
---
M .travis.yml
M pywikibot/data/api.py
2 files changed, 7 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index 37e5f18..f63277d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -95,7 +95,7 @@
fi
- echo "authenticate['wiki.musicbrainz.org'] = ('NOTSPAM', 'NOTSPAM')" >> ~/.pywikibot/user-config.py ;
- - echo "max_retries = 2" >> ~/.pywikibot/user-config.py
+ - echo "max_retries = 3" >> ~/.pywikibot/user-config.py
- echo "maximum_GET_length = 5000" >> ~/.pywikibot/user-config.py
- echo "console_encoding = 'utf8'" >> ~/.pywikibot/user-config.py
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 32bd3be..9a21a50 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -1923,8 +1923,12 @@
except TypeError:
raise RuntimeError(result)
- raise MaxlagTimeoutError(
- 'Maximum retries attempted due to maxlag without success.')
+ msg = 'Maximum retries attempted due to maxlag without success.'
+ if os.environ.get('PYWIKIBOT_TESTS_RUNNING', '0') == '1':
+ import unittest
+ raise unittest.SkipTest(msg)
+
+ raise MaxlagTimeoutError(msg)
def wait(self, delay=None):
"""Determine how long to wait after a failed request."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678580
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: Icb6b410cdf6b46c975e91bc49458e5a5a80c8b0e
Gerrit-Change-Number: 678580
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/+/678572 )
Change subject: [doc] fix spelling mistake
......................................................................
[doc] fix spelling mistake
Change-Id: I6d6894101d53743fee026e457ddf2d0afb2ebe42
---
M scripts/archive/__init__.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archive/__init__.py b/scripts/archive/__init__.py
index f073cac..b87f80c 100644
--- a/scripts/archive/__init__.py
+++ b/scripts/archive/__init__.py
@@ -1,6 +1,6 @@
"""THIS DIRECTORY IS TO HOLD BOT SCRIPTS THAT NO LONGER ARE MAINTAINED.
-These scripts may be removed at any time withour further warning.
+These scripts may be removed at any time without further warning.
Feel free to reactivate any script at any time by creating a Phabricator
task:
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678572
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: I6d6894101d53743fee026e457ddf2d0afb2ebe42
Gerrit-Change-Number: 678572
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/+/678418 )
Change subject: [doc] Update documentation
......................................................................
[doc] Update documentation
* http --> https
* wikipedia --> Wikipedia
* full stop is not part of the URL
Change-Id: I498c904c28bba9ef2810f8c0779544feb13210a7
---
M pywikibot/diff.py
M pywikibot/logging.py
M pywikibot/pagegenerators.py
M pywikibot/userinterfaces/win32_unicode.py
M scripts/archive/capitalize_redirects.py
M scripts/archive/followlive.py
M scripts/misspelling.py
M scripts/parser_function_count.py
M scripts/reflinks.py
M scripts/solve_disambiguation.py
M scripts/upload.py
M scripts/welcome.py
12 files changed, 21 insertions(+), 21 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/diff.py b/pywikibot/diff.py
index 8eb6023..f57da33 100644
--- a/pywikibot/diff.py
+++ b/pywikibot/diff.py
@@ -78,7 +78,7 @@
def create_diff(self):
"""Generator of diff text for this hunk, without formatting."""
# make sure each line ends with '\n' to prevent
- # behaviour like http://bugs.python.org/issue2142
+ # behaviour like https://bugs.python.org/issue2142
def check_line(line):
return line if line.endswith('\n') else line + '\n'
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index ccb92af..785ce4d 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -137,7 +137,7 @@
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
"""
logoutput(text, decoder, newline, STDOUT, **kwargs)
@@ -151,7 +151,7 @@
should be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
"""
logoutput(text, decoder, newline, WARNING, **kwargs)
@@ -164,7 +164,7 @@
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
"""
logoutput(text, decoder, newline, ERROR, **kwargs)
@@ -177,7 +177,7 @@
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
"""
logoutput(text, decoder, newline, VERBOSE, **kwargs)
@@ -190,7 +190,7 @@
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
"""
logoutput(text, decoder, newline, CRITICAL, **kwargs)
@@ -203,7 +203,7 @@
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
@param layer: The name of the logger that text will be sent to.
"""
logoutput(text, decoder, newline, DEBUG, layer, **kwargs)
@@ -233,7 +233,7 @@
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@param kwargs: The keyword arguments can be found in the python doc:
- https://docs.python.org/3/howto/logging-cookbook.html.
+ https://docs.python.org/3/howto/logging-cookbook.html
@param tb: Set to True in order to output traceback also.
"""
if isinstance(msg, BaseException):
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index fbc585f..7dedfa6 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2,7 +2,7 @@
This module offers a wide variety of page generators.
A page generator is an
-object that is iterable (see http://legacy.python.org/dev/peps/pep-0255/ ) and
+object that is iterable (see https://legacy.python.org/dev/peps/pep-0255/ ) and
that yields page objects on which other scripts can then work.
Pagegenerators.py cannot be run as script. For testing purposes listpages.py
diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py
index 218be16..79bdb99 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -164,7 +164,7 @@
def register_cp65001():
"""Register codecs cp65001 as utf-8."""
- # Work around <http://bugs.python.org/issue6058>.
+ # Work around <https://bugs.python.org/issue6058>
codecs.register(lambda name: name == 'cp65001'
and codecs.lookup('utf-8') or None)
@@ -229,7 +229,7 @@
@rtype: tuple
"""
# Make Unicode console output work independently of the current code page.
- # This also fixes http://bugs.python.org/issue1602.
+ # This also fixes https://bugs.python.org/issue1602
# Credit to Michael Kaplan
# http://blogs.msdn.com/b/michkap/archive/2010/04/07/9989346.aspx
# and TZOmegaTZIOY
diff --git a/scripts/archive/capitalize_redirects.py b/scripts/archive/capitalize_redirects.py
index 8c42c62..0b73071 100755
--- a/scripts/archive/capitalize_redirects.py
+++ b/scripts/archive/capitalize_redirects.py
@@ -25,7 +25,7 @@
# Distributed under the terms of the MIT license.
#
# Originally derived from:
-# http://en.wikipedia.org/wiki/User:Drinibot/CapitalizationRedirects
+# https://en.wikipedia.org/wiki/User:Drinibot/CapitalizationRedirects
#
# Automatically converted from compat branch by compat2core.py script
#
diff --git a/scripts/archive/followlive.py b/scripts/archive/followlive.py
index a5dac68..b623fa1 100644
--- a/scripts/archive/followlive.py
+++ b/scripts/archive/followlive.py
@@ -2,7 +2,7 @@
"""
Periodically grab list of new articles and analyze to blank or flag them.
-Script to follow new articles on a wikipedia and flag them
+Script to follow new articles on the wiki and flag them
with a template or eventually blank them.
There must be A LOT of bugs! Use with caution and verify what
diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 30d88bf..8b5412d 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -12,8 +12,8 @@
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.
+ -main only check pages in the main namespace, not in the Talk,
+ Project, 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
diff --git a/scripts/parser_function_count.py b/scripts/parser_function_count.py
index 71ae836..9348187 100755
--- a/scripts/parser_function_count.py
+++ b/scripts/parser_function_count.py
@@ -163,7 +163,7 @@
if self.opt.save:
# This opens in strict error mode, that means bot will stop
# on encoding errors with ValueError.
- # See http://docs.python.org/library/codecs.html#codecs.open
+ # See https://docs.python.org/3/library/codecs.html#codecs.open
try:
with codecs.open(
self.opt.save, encoding='utf-8', mode='a') as f:
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index 559da2e..79578ea 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -75,7 +75,7 @@
localized_msg = ('fr', 'it', 'pl') # localized message at MediaWiki
-# localized message at specific wikipedia site
+# localized message at specific Wikipedia site
# should be moved to MediaWiki Pywikibot manual
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 4606913..dfdad27 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -49,8 +49,8 @@
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.
+ -main only check pages in the main namespace, not in the Talk,
+ Project, User, etc. namespaces.
-first Uses only the first link of every line on the disambiguation
page that begins with an asterisk. Useful if the page is full
diff --git a/scripts/upload.py b/scripts/upload.py
index 1a52578..6fba731 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
"""
-Script to upload images to wikipedia.
+Script to upload images to Wikipedia.
The following parameters are supported:
diff --git a/scripts/welcome.py b/scripts/welcome.py
index b2e93a4..269f91a 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -191,7 +191,7 @@
# Add the following strings to customise for a language:
# logbook, netext, report_page, bad_pag, report_text, random_sign,
# whitelist_pg, final_new_text_additions, logpage_header if
-# different from wikipedia entry
+# different from Wikipedia entry
############################################################################
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/678418
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: I498c904c28bba9ef2810f8c0779544feb13210a7
Gerrit-Change-Number: 678418
Gerrit-PatchSet: 7
Gerrit-Owner: Meno25 <meno25mail(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged