jenkins-bot submitted this change.

View Change

Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
[fix] Fix spelling mistakes

Change-Id: Ic9b43ffea454d5e6d1cea1a0fc1eb64f4cc97092
---
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/bot_choice.py
M pywikibot/comms/eventstreams.py
M pywikibot/config2.py
M pywikibot/data/api.py
M pywikibot/i18n.py
M pywikibot/logging.py
M pywikibot/page/__init__.py
M pywikibot/proofreadpage.py
M pywikibot/site/__init__.py
M pywikibot/site/_interwikimap.py
M pywikibot/tools/__init__.py
M pywikibot/tools/djvu.py
M pywikibot/version.py
M scripts/README.rst
M scripts/category.py
M scripts/data_ingestion.py
M scripts/flickrripper.py
M scripts/imageuncat.py
M scripts/maintenance/make_i18n_dict.py
M scripts/noreferences.py
M scripts/replicate_wiki.py
M tests/disambredir_tests.py
M tests/eventstreams_tests.py
M tests/tools_tests.py
M tests/utils.py
M tests/wikibase_tests.py
28 files changed, 56 insertions(+), 48 deletions(-)

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 163d437..f7ceda1 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -603,7 +603,7 @@
"""
Convert the data to a pywikibot.Timestamp.

- @raises ValueError: instance value can not be represented using
+ @raises ValueError: instance value cannot be represented using
Timestamp
"""
if self.year <= 0:
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 82fc233..a0d41f0 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -923,8 +923,8 @@
@param missing_action: Add an entry that no action was defined.
@type missing_action: bool
@param additional_text: Additional text added to the end.
- @param missing_dependencies: A list of dependencies which can not
- be imported.
+ @param missing_dependencies: A list of dependencies which cannot be
+ imported.
@type missing_dependencies: list of str
@return: True if an error message was printed, False otherwise
"""
@@ -1038,7 +1038,7 @@
"""Class to get and set options.

How to use options of OptionHandler and its BaseBot subclasses:
- First define a available_options class attribute to define all
+ First define an available_options class attribute to define all
available options:

available_options = {'foo': 'bar', 'bar': 42, 'baz': False}
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 7a00159..efef2d4 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -223,7 +223,7 @@

class Choice(StandardOption):

- """A simple choice consisting of a option, shortcut and handler."""
+ """A simple choice consisting of an option, shortcut and handler."""

def __init__(self, option, shortcut, replacer):
"""Initializer."""
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py
index 456b35e..c7e6c67 100644
--- a/pywikibot/comms/eventstreams.py
+++ b/pywikibot/comms/eventstreams.py
@@ -227,7 +227,7 @@
@param args: You may pass your own filter functions here.
Every function should be able to handle the data dict from events.
@type args: callable
- @param kwargs: Any key returned by event data with a event data value
+ @param kwargs: Any key returned by event data with an event data value
for this given key.
@type kwargs: str, list, tuple or other sequence
@raise TypeError: A given args parameter is not a callable.
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 120b404..3ca7aad 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -7,7 +7,7 @@
PYWIKIBOT_DIR, or the same directory as pwb.py, or in a directory within
the users home. See get_base_dir for more information.

-If user-config.py can not be found in any of those locations, this module
+If user-config.py cannot be found in any of those locations, this module
will fail to load unless the environment variable PYWIKIBOT_NO_USER_CONFIG
is set to a value other than '0'. i.e. PYWIKIBOT_NO_USER_CONFIG=1 will
allow config to load without a user-config.py. However, warnings will be
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c9f69a7..680550f 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -848,7 +848,7 @@
silently removed from the options (disabled by default).
"""
if self._site_set:
- raise TypeError('The site can not be set multiple times.')
+ raise TypeError('The site cannot be set multiple times.')
# If the entries written to this are valid, it will never be
# overwritten
self._valid_enable = set()
@@ -1169,7 +1169,7 @@
#
# When we can't easily check whether the extension is loaded,
# to avoid cyclic recursion in the Pywikibot codebase, assume
- # that it is present, which will cause a API warning emitted
+ # that it is present, which will cause an API warning emitted
# to the logging (console) if it is not present, but will not
# otherwise be a problem.
# This situation is only tripped when one of the first actions
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 359fc96..33b6037 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -468,7 +468,7 @@

plural_entries = []
specific_entries = {}
- # A plural entry can not start at the end of the variants list,
+ # A plural entry cannot start at the end of the variants list,
# and must end with | or the end of the variants list.
for number, plural in re.findall(
r'(?!$)(?: *(\d+) *= *)?(.*?)(?:\||$)', variants
@@ -823,7 +823,7 @@

@param twtitle: The TranslateWiki string title, in <package>-<key> format

- @raises OSError: the package i18n can not be loaded
+ @raises OSError: the package i18n cannot be loaded
"""
# obtain the directory containing all the json files for this package
package = twtitle.split('-')[0]
diff --git a/pywikibot/logging.py b/pywikibot/logging.py
index 457e276..0ac811e 100644
--- a/pywikibot/logging.py
+++ b/pywikibot/logging.py
@@ -166,7 +166,7 @@
def error(text, decoder=None, newline=True, **kwargs):
"""Output an error message to the user via the userinterface.

- @param text: the message containing the error which occured.
+ @param text: the message containing the error which occurred.
@param decoder: If None, text should be a unicode string else it should
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
@@ -235,7 +235,7 @@

This function should only be called from an Exception handler.

- @param msg: If not None,contains the description of the exception occured.
+ @param msg: If not None,contains the description of the exception occurred.
@param decoder: If None, text should be a unicode string else it should
be encoded in the given encoding.
@param newline: If True, a line feed will be added after printing the text.
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index 8a2ed50..26e5000 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -884,7 +884,7 @@
return self.namespace() == 14

def is_filepage(self):
- """Return True if this is an file description page, False otherwise."""
+ """Return True if this is a file description page, False otherwise."""
return self.namespace() == 6

@remove_last_args(['get_Index'])
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 0703d88..3cb72bd 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -287,7 +287,7 @@
@index.setter
def index(self, value):
if not isinstance(value, IndexPage):
- raise TypeError('value {} must be a IndexPage object.'
+ raise TypeError('value {} must be an IndexPage object.'
.format(value))
self._index = (value, None)

@@ -766,7 +766,7 @@
INDEX_TEMPLATE = ':MediaWiki:Proofreadpage_index_template'

def __init__(self, source, title=''):
- """Instantiate a IndexPage object.
+ """Instantiate an IndexPage object.

In this class:
page number is the number in the page title in the Page namespace, if
diff --git a/pywikibot/site/__init__.py b/pywikibot/site/__init__.py
index 28e6d8e..9c84f38 100644
--- a/pywikibot/site/__init__.py
+++ b/pywikibot/site/__init__.py
@@ -3907,11 +3907,11 @@

if text_overrides:
if 'text' in kwargs:
- raise ValueError('text can not be used with any of %s'
- % ', '.join(text_overrides))
+ raise ValueError('text cannot be used with any of {}'
+ .format(', '.join(text_overrides)))
if len(text_overrides) > 1:
- raise ValueError('Multiple text overrides used: %s'
- % ', '.join(text_overrides))
+ raise ValueError('Multiple text overrides used: {}'
+ .format(', '.join(text_overrides)))
text = None
basetimestamp = False
elif 'text' in kwargs:
diff --git a/pywikibot/site/_interwikimap.py b/pywikibot/site/_interwikimap.py
index 6352d26..2f18e54 100644
--- a/pywikibot/site/_interwikimap.py
+++ b/pywikibot/site/_interwikimap.py
@@ -49,7 +49,7 @@
@property
def _iw_sites(self):
"""Fill the interwikimap cache with the basic entries."""
- # _iw_sites is a local cache to return a APISite instance depending
+ # _iw_sites is a local cache to return an APISite instance depending
# on the interwiki prefix of that site
if self._map is None:
self._map = {iw['prefix']: _IWEntry('local' in iw, iw['url'])
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 49e4451..9346cf7 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -839,7 +839,7 @@
already present in the local set.

For large collections, this is not memory efficient, as a strong reference
- to every item is kept in a local set which can not be cleared.
+ to every item is kept in a local set which cannot be cleared.

Also, the local set can't be re-used when chaining unique operations on
multiple generators.
@@ -905,7 +905,7 @@
empty collections, so it can be iterated through it safely if treated as a
list, tuple, set or dictionary. It is also basically an empty string.

- Accessing a value via __getitem__ will result in an combined KeyError and
+ Accessing a value via __getitem__ will result in a combined KeyError and
IndexError.
"""

diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index 73992b0..f0f425b 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -261,7 +261,7 @@

# Convert white_page to djvu.
res, data = _call_cmd(['c44', white_ppm, '-dpi', dpi])
- os.unlink(white_ppm) # rm white_page.ppm before retuning.
+ os.unlink(white_ppm) # rm white_page.ppm before returning.
if not res:
return False

diff --git a/pywikibot/version.py b/pywikibot/version.py
index ce66b6f..878b4fb 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -141,7 +141,7 @@


def svn_rev_info(path):
- """Fetch information about the current revision of an Subversion checkout.
+ """Fetch information about the current revision of a Subversion checkout.

@param path: directory of the Subversion checkout
@return:
diff --git a/scripts/README.rst b/scripts/README.rst
index 24e48af..e2feed6 100644
--- a/scripts/README.rst
+++ b/scripts/README.rst
@@ -283,7 +283,7 @@
+------------------------+---------------------------------------------------------+
| interwikidumps.py | Convert interwiki dumps from pickle to txt format. |
+------------------------+---------------------------------------------------------+
- | make_i18n_dict.py | Generate a i18n file from a given script. |
+ | make_i18n_dict.py | Generate an i18n file from a given script. |
+------------------------+---------------------------------------------------------+
| sorting_order.py | Updates interwiki sorting order in family.py file. |
+------------------------+---------------------------------------------------------+
diff --git a/scripts/category.py b/scripts/category.py
index 62ec36c..83a459e 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -201,30 +201,38 @@
if self.follow_redirects:
if redir_target.exists():
return redir_target
+
if self.create:
redir_target.text = ''
pywikibot.output('Redirect target {} does not exist '
'yet; creating.'.format(
redir_target.title(as_link=True)))
return redir_target
+
if self.edit_redirects:
return page
- pywikibot.warning('Redirect target {} can not '
- 'be modified; skipping.'.format(
- redir_target.title(as_link=True)))
+
+ pywikibot.warning(
+ 'Redirect target {} cannot be modified; skipping.'
+ .format(redir_target))
return None
+
if self.edit_redirects:
return page
+
pywikibot.warning('Page {} is a redirect to {}; skipping.'
.format(page.title(as_link=True),
redir_target.title(as_link=True)))
return None
+
return page
+
if self.create:
page.text = ''
pywikibot.output('Page {} does not exist yet; creating.'
.format(page.title(as_link=True)))
return page
+
pywikibot.warning('Page {} does not exist; skipping.'
.format(page.title(as_link=True)))
return None
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index 608aa2a..6fb37fd 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -155,7 +155,7 @@

def downloadPhoto(self):
"""
- Download the photo and store it in a io.BytesIO object.
+ Download the photo and store it in an io.BytesIO object.

TODO: Add exception handling
"""
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 757cd48..0be7601 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -103,7 +103,7 @@

def downloadPhoto(photoUrl):
"""
- Download the photo and store it in a io.BytesIO object.
+ Download the photo and store it in an io.BytesIO object.

TODO: Add exception handling

diff --git a/scripts/imageuncat.py b/scripts/imageuncat.py
index 0881784..66ccbd8 100755
--- a/scripts/imageuncat.py
+++ b/scripts/imageuncat.py
@@ -36,7 +36,7 @@
'[[Category:Media lacking a description]]',
'[[Category:Self-published work]]']

-# Don't bother to put the template on a image with one of these templates
+# Don't bother to put the template on an image with one of these templates
skipTemplates = ['Delete',
'Nocat',
'No license',
diff --git a/scripts/maintenance/make_i18n_dict.py b/scripts/maintenance/make_i18n_dict.py
index 8d8cf42..284e82c 100755
--- a/scripts/maintenance/make_i18n_dict.py
+++ b/scripts/maintenance/make_i18n_dict.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
-Generate a i18n file from a given script.
+Generate an i18n file from a given script.

run IDLE at topmost level:
>>> import pwb
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index f3c3bd8..dd65741 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -582,7 +582,7 @@
# Set the edit summary for this case
self.comment = i18n.twtranslate(self.site, 'noreferences-fix-tag')

- # Repair two opening tags or a opening and an empty tag
+ # Repair two opening tags or an opening and an empty tag
pattern = re.compile(r'< *references *>(.*?)'
r'< */?\s*references */? *>', re.DOTALL)
if pattern.search(oldText):
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index 1d42b26..683363d 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -11,7 +11,7 @@

python pwb.py replicate_wiki [-r] -ns 10 -family:wikipedia -lang:nl li fy

-to copy all templates from an nlwiki to liwiki and fywiki. It will show which
+to copy all templates from nlwiki to liwiki and fywiki. It will show which
pages have to be changed if -r is not present, and will only actually write
pages if -r /is/ present.

diff --git a/tests/disambredir_tests.py b/tests/disambredir_tests.py
index 1cf1e2e..1726b28 100644
--- a/tests/disambredir_tests.py
+++ b/tests/disambredir_tests.py
@@ -20,10 +20,10 @@
from tests.utils import fixed_generator


-class TestDisambigurationRedirectBot(FakeSaveBotTestCase, TWNBotTestCase):
+class TestDisambiguationRedirectBot(FakeSaveBotTestCase, TWNBotTestCase):

"""
- Test cases for DisambigurationRedirectBot.
+ Test cases for DisambiguationRedirectBot.

It patches the bot instances in such a way that there is no user
interaction required and it can be run autonomously. It also does not
@@ -37,7 +37,7 @@
"""
Patch _create_callback in the Bot instance.

- It still creates a InteractiveReplace instance but returns another
+ It still creates an InteractiveReplace instance but returns another
function which only calls 'handle_answer' from that InteractiveReplace
instance if the link matches.
"""
@@ -62,7 +62,7 @@
@classmethod
def setUpClass(cls):
"""Initialize page variable."""
- super(TestDisambigurationRedirectBot, cls).setUpClass()
+ super().setUpClass()
# Patch the page to be independent of the actual site
cls.page = pywikibot.Page(cls.site, 'User:BobBot/Test disambig')
cls.page.linkedPages = fixed_generator(
@@ -73,12 +73,12 @@
def bot_save(self, page, *args, **kwargs):
"""Check if the page matches."""
self.assertIs(page, self.page)
- return super(TestDisambigurationRedirectBot, self).bot_save(
+ return super().bot_save(
page, *args, **kwargs)

def setUp(self):
"""Set up the test page."""
- super(TestDisambigurationRedirectBot, self).setUp()
+ super().setUp()
self.page.text = ('[[User:BobBot/Redir#Foo|Bar]]\n'
'[[User:BobBot/Redir|Baz]]\n'
'[[User:BobBot/Redir2]]\n'
diff --git a/tests/eventstreams_tests.py b/tests/eventstreams_tests.py
index cce5f0d..d69225d 100644
--- a/tests/eventstreams_tests.py
+++ b/tests/eventstreams_tests.py
@@ -65,7 +65,7 @@

def setUp(self):
"""Setup tests."""
- super(TestEventStreamsStreamsTests, self).setUp()
+ super().setUp()
site = self.get_site()
fam = site.family
if not isinstance(fam, WikimediaFamily):
@@ -110,7 +110,7 @@

def setUp(self):
"""Set up unit test."""
- super(TestEventStreamsSettingTests, self).setUp()
+ super().setUp()
with mock.patch('pywikibot.comms.eventstreams.EventSource'):
self.es = EventStreams(url='dummy url')

@@ -169,7 +169,7 @@

def setUp(self):
"""Set up unit test."""
- super(TestEventStreamsFilterTests, self).setUp()
+ super().setUp()
with mock.patch('pywikibot.comms.eventstreams.EventSource'):
self.es = EventStreams(url='dummy url')

@@ -205,7 +205,7 @@
self.assertTrue(self.es.streamfilter(self.data))

def test_filter_value(self):
- """Test EventStreams filter with assignment of a int value."""
+ """Test EventStreams filter with assignment of an int value."""
self.es.register_filter(foo=10)
self.assertFalse(self.es.streamfilter(self.data))

diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 2fb4f0b..192b337 100644
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -494,7 +494,7 @@
self._test_dedup_int(deduped, deduper)

def test_OrderedDict(self):
- """Test filter_unique with a OrderedDict."""
+ """Test filter_unique with an OrderedDict."""
deduped = OrderedDict()
deduper = tools.filter_unique(self.ints, container=deduped)
self._test_dedup_int(deduped, deduper)
diff --git a/tests/utils.py b/tests/utils.py
index 67fa874..2bbd3aa 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -191,7 +191,7 @@
Context manager to assert certain APIError exceptions.

This is build similar to the L{unittest.TestCase.assertError}
- implementation which creates an context manager. It then calls L{handle}
+ implementation which creates a context manager. It then calls L{handle}
which either returns this manager if no executing object given or calls
the callable object.
"""
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 13a028c..181ad56 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1167,7 +1167,7 @@
"""Helper function to test a page without an associated item.

It tests two of the ways to fetch an item:
- 1. the Page already has props, which should contain a item id if
+ 1. the Page already has props, which should contain an item id if
present, and that item id is used to instantiate the item, and
2. the page doesn't have props, in which case the site&titles is
used to lookup the item id, but that lookup occurs after

To view, visit change 645838. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ic9b43ffea454d5e6d1cea1a0fc1eb64f4cc97092
Gerrit-Change-Number: 645838
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Mpaa <mpaa.wiki@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged