jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Remove some D102 and D103 errors
......................................................................
[FIX] Remove some D102 and D103 errors
This removes D102 and D103 errors for most files which only had one or
two errors and thus could easily be added to the tox.ini.
Change-Id: Ia92dc31e788e7801836842d9b4596a2fb3f740d4
---
M pywikibot/login.py
M scripts/cosmetic_changes.py
M scripts/create_categories.py
M scripts/disambredir.py
M scripts/fixing_redirects.py
M scripts/piper.py
M scripts/unlink.py
M tests/cache_tests.py
M tests/link_tests.py
M tests/timestripper_tests.py
M tox.ini
11 files changed, 22 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py
index c0cc049..70f3f31 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -265,4 +265,5 @@
return True
def showCaptchaWindow(self, url):
+ """Open a window to show the captcha for the given
URL."""
pass
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index 1ae4bf6..cf4553f 100644
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -56,6 +56,7 @@
"""Cosmetic changes bot."""
def __init__(self, generator, **kwargs):
+ """Constructor."""
self.availableOptions.update({
'async': False,
'summary': u'Robot: Cosmetic changes',
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index 0981776..a133c80 100755
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -48,6 +48,7 @@
"""Category creator bot."""
def __init__(self, generator, parent, basename, **kwargs):
+ """Constructor."""
super(CreateCategoriesBot, self).__init__(**kwargs)
self.generator = generator
self.parent = parent
diff --git a/scripts/disambredir.py b/scripts/disambredir.py
index fe5bd49..a7246a2 100755
--- a/scripts/disambredir.py
+++ b/scripts/disambredir.py
@@ -127,6 +127,7 @@
def workon(page, links):
+ """Execute treat for the given page which is linking to the given
links."""
text = page.get()
# Show the title of the page we're working on.
# Highlight the title in purple.
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index ebfb555..9e13e28 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -143,6 +143,7 @@
def workon(page):
+ """Change all redirects from the given page to actual
links."""
mysite = pywikibot.Site()
try:
text = page.get()
diff --git a/scripts/piper.py b/scripts/piper.py
index eb0c431..ecb4c4f 100755
--- a/scripts/piper.py
+++ b/scripts/piper.py
@@ -109,6 +109,7 @@
def main(*args):
+ """Create and run a PiperBot instance from the given command
arguments."""
# This factory is responsible for processing command line arguments
# that are also used by other scripts and that determine on which pages
# to work on.
diff --git a/scripts/unlink.py b/scripts/unlink.py
index 103a9a0..32256e4 100755
--- a/scripts/unlink.py
+++ b/scripts/unlink.py
@@ -41,6 +41,7 @@
"""Page unlinking bot."""
def __init__(self, pageToUnlink, **kwargs):
+ """Initialize a UnlinkBot instance with the given page to
unlink."""
self.availableOptions.update({
'namespaces': [],
# Which namespaces should be processed?
@@ -132,6 +133,7 @@
return text[:match.start()] + new + text[match.end():], False
def treat(self, page):
+ """Remove links pointing to the configured page from the given
page."""
self.current_page = page
try:
oldText = page.get()
diff --git a/tests/cache_tests.py b/tests/cache_tests.py
index b5e6fed..790cd19 100644
--- a/tests/cache_tests.py
+++ b/tests/cache_tests.py
@@ -24,6 +24,7 @@
net = False
def _check_cache_entry(self, entry):
+ """Assert validity of the cache entry."""
self.assertIsInstance(entry.site, BaseSite)
self.assertIsInstance(entry.site._loginstatus, int)
self.assertIsInstance(entry.site._username, list)
@@ -35,6 +36,7 @@
# to make it closely replicate the original object.
def test_cache(self):
+ """Test the apicache by doing _check_cache_entry over each
entry."""
cache.process_entries(_cache_dir, self._check_cache_entry)
diff --git a/tests/link_tests.py b/tests/link_tests.py
index 461dc88..83020ff 100644
--- a/tests/link_tests.py
+++ b/tests/link_tests.py
@@ -36,6 +36,7 @@
"""
def test_valid(self):
+ """Test that valid titles are correctly
normalized."""
self.assertEqual(Link('Sandbox', self.get_site()).title,
'Sandbox')
self.assertEqual(Link('A "B"', self.get_site()).title, 'A
"B"')
self.assertEqual(Link('A \'B\'', self.get_site()).title, 'A
\'B\'')
@@ -68,6 +69,7 @@
self.assertEqual(l.section, 'B')
def test_invalid(self):
+ """Test that invalid titles raise InvalidTitle
exception."""
self.assertRaises(InvalidTitle, Link('', self.get_site()).parse)
self.assertRaises(InvalidTitle, Link(':', self.get_site()).parse)
self.assertRaises(InvalidTitle, Link('__ __', self.get_site()).parse)
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py
index 3573bb9..80d70e0 100644
--- a/tests/timestripper_tests.py
+++ b/tests/timestripper_tests.py
@@ -97,6 +97,7 @@
cached = True
def setUp(self):
+ """Setup a timestripper for the configured
site."""
super(TestTimeStripperWithDigitsAsMonths, self).setUp()
self.ts = TimeStripper(self.get_site())
diff --git a/tox.ini b/tox.ini
index 412f9a0..f7bb997 100644
--- a/tox.ini
+++ b/tox.ini
@@ -52,6 +52,7 @@
pywikibot/families/ \
pywikibot/fixes.py \
pywikibot/i18n.py \
+ pywikibot/login.py \
pywikibot/pagegenerators.py \
pywikibot/plural.py \
pywikibot/throttle.py \
@@ -71,8 +72,11 @@
scripts/clean_sandbox.py \
scripts/commonscat.py \
scripts/coordinate_import.py \
+ scripts/cosmetic_changes.py \
scripts/data_ingestion.py \
scripts/delete.py \
+ scripts/disambredir.py \
+ scripts/fixing_redirects.py \
scripts/flickrripper.py \
scripts/harvest_template.py \
scripts/illustrate_wikidata.py \
@@ -84,12 +88,14 @@
scripts/maintenance/__init__.py \
scripts/newitem.py \
scripts/pagefromfile.py \
+ scripts/piper.py \
scripts/protect.py \
scripts/shell.py \
scripts/spamremove.py \
scripts/states_redirect.py \
scripts/template.py \
scripts/transferbot.py \
+ scripts/unlink.py \
scripts/unusedfiles.py \
scripts/upload.py \
scripts/version.py \
@@ -99,6 +105,7 @@
tests/utils.py \
tests/archivebot_tests.py \
tests/category_tests.py \
+ tests/cache_tests.py \
tests/date_tests.py \
tests/edit_failure_tests.py \
tests/exceptions_tests.py \
@@ -106,10 +113,12 @@
tests/file_tests.py \
tests/i18n/ \
tests/l10n_tests.py \
+ tests/link_tests.py \
tests/ipregex_tests.py \
tests/pwb/ \
tests/pwb_tests.py \
tests/script_tests.py \
+ tests/timestripper_tests.py \
tests/tools_tests.py \
tests/upload_tests.py \
tests/wikidataquery_tests.py
--
To view, visit
https://gerrit.wikimedia.org/r/210011
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia92dc31e788e7801836842d9b4596a2fb3f740d4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>