jenkins-bot has submitted this change and it was merged.
Change subject: Use new-style classes inheriting from object
......................................................................
Use new-style classes inheriting from object
Enforce this using OpenStack hacking flake8 plugin
by disabling the rules the codebase currently breaks,
but leaving H238 enabled to ensure all classes are
new-style classes.
Change-Id: I4fd9a559918e2f8a0abc10200315f714dcef34e3
---
M pywikibot/cosmetic_changes.py
M pywikibot/data/wikidataquery.py
M pywikibot/interwiki_graph.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/userinterfaces/cgi_interface.py
M pywikibot/userinterfaces/gui.py
M pywikibot/xmlreader.py
M scripts/blockreview.py
M scripts/category.py
M scripts/cfd.py
M scripts/freebasemappingupload.py
M scripts/imagetransfer.py
M scripts/isbn.py
M scripts/noreferences.py
M scripts/pagefromfile.py
M scripts/redirect.py
M scripts/replicate_wiki.py
M scripts/solve_disambiguation.py
M scripts/templatecount.py
M tests/utils.py
M tox.ini
22 files changed, 29 insertions(+), 28 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
XZise: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py
index 8401a0e..0a35bcd 100755
--- a/pywikibot/cosmetic_changes.py
+++ b/pywikibot/cosmetic_changes.py
@@ -206,7 +206,7 @@
text, lambda match: _format_isbn_match(match, strict=strict))
-class CosmeticChangesToolkit:
+class CosmeticChangesToolkit(object):
"""Cosmetic changes toolkit."""
diff --git a/pywikibot/data/wikidataquery.py b/pywikibot/data/wikidataquery.py
index da54df2..a2e39db 100644
--- a/pywikibot/data/wikidataquery.py
+++ b/pywikibot/data/wikidataquery.py
@@ -34,7 +34,7 @@
return x if isinstance(x, list) else [x]
-class QuerySet():
+class QuerySet(object):
"""
A QuerySet represents a set of queries or other query sets.
@@ -116,7 +116,7 @@
return u"QuerySet(%s)" % self
-class Query():
+class Query(object):
"""
A query is a single query for the WikidataQuery API.
@@ -458,7 +458,7 @@
% claim.type)
-class WikidataQuery():
+class WikidataQuery(object):
"""
An interface to the WikidataQuery API.
diff --git a/pywikibot/interwiki_graph.py b/pywikibot/interwiki_graph.py
index 536e647..c0037b9 100644
--- a/pywikibot/interwiki_graph.py
+++ b/pywikibot/interwiki_graph.py
@@ -129,7 +129,7 @@
self.found_in = value
-class GraphDrawer:
+class GraphDrawer(object):
"""Graphviz (dot) code creator."""
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 68c8dff..97c881c 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3921,7 +3921,7 @@
return super(ItemPage, self).isRedirectPage()
-class Property():
+class Property(object):
"""
A Wikibase property.
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index d68b883..0397ba9 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -2147,7 +2147,7 @@
# following classes just ported from version 1 without revision; not tested
-class YahooSearchPageGenerator:
+class YahooSearchPageGenerator(object):
"""
Page generator using Yahoo! search results.
@@ -2206,7 +2206,7 @@
yield page
-class GoogleSearchPageGenerator:
+class GoogleSearchPageGenerator(object):
"""
Page generator using Google search results.
diff --git a/pywikibot/userinterfaces/cgi_interface.py
b/pywikibot/userinterfaces/cgi_interface.py
index 5575b73..6a137d5 100644
--- a/pywikibot/userinterfaces/cgi_interface.py
+++ b/pywikibot/userinterfaces/cgi_interface.py
@@ -5,7 +5,7 @@
import sys
-class UI:
+class UI(object):
"""CGI user interface."""
diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 03a49d6..bedccd3 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -399,7 +399,7 @@
# the following class isn't used anywhere in the framework: ####
-class ListBoxWindow:
+class ListBoxWindow(object):
"""List box window."""
@@ -446,7 +446,7 @@
return self.list
-class Tkdialog:
+class Tkdialog(object):
"""The dialog window for image info."""
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py
index 14e4647..216e3aa 100644
--- a/pywikibot/xmlreader.py
+++ b/pywikibot/xmlreader.py
@@ -49,7 +49,7 @@
return editRestriction, moveRestriction
-class XmlEntry:
+class XmlEntry(object):
"""Represent a page."""
diff --git a/scripts/blockreview.py b/scripts/blockreview.py
index 759fa9e..a656904 100755
--- a/scripts/blockreview.py
+++ b/scripts/blockreview.py
@@ -28,7 +28,7 @@
from pywikibot import i18n
-class BlockreviewBot:
+class BlockreviewBot(object):
"""Block review bot."""
diff --git a/scripts/category.py b/scripts/category.py
index 3e20019..9b44fc9 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -159,7 +159,7 @@
}
-class CategoryDatabase:
+class CategoryDatabase(object):
"""Temporary database saving pages and subcategories for each
category.
@@ -766,7 +766,7 @@
pagesonly=pagesonly)
-class CategoryListifyRobot:
+class CategoryListifyRobot(object):
"""Create a list containing all of the members in a
category."""
@@ -982,7 +982,7 @@
self.move_to_category(page, self.cat, self.cat)
-class CategoryTreeRobot:
+class CategoryTreeRobot(object):
"""Robot to create tree overviews of the category structure.
diff --git a/scripts/cfd.py b/scripts/cfd.py
index 2c3f7fb..849cfb6 100755
--- a/scripts/cfd.py
+++ b/scripts/cfd.py
@@ -58,7 +58,7 @@
re.IGNORECASE)
-class ReCheck:
+class ReCheck(object):
"""Helper class."""
diff --git a/scripts/freebasemappingupload.py b/scripts/freebasemappingupload.py
index 0fab739..1e57f37 100755
--- a/scripts/freebasemappingupload.py
+++ b/scripts/freebasemappingupload.py
@@ -31,7 +31,7 @@
import pywikibot
-class FreebaseMapperRobot:
+class FreebaseMapperRobot(object):
"""Freebase Mapping bot."""
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index 0df238f..b00e7b6 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -156,7 +156,7 @@
}
-class ImageTransferBot:
+class ImageTransferBot(object):
"""Image transfer bot."""
diff --git a/scripts/isbn.py b/scripts/isbn.py
index e2eaba5..483514a 100755
--- a/scripts/isbn.py
+++ b/scripts/isbn.py
@@ -1180,7 +1180,7 @@
"""Invalid ISBN."""
-class ISBN:
+class ISBN(object):
"""Abstract superclass."""
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index c26f131..42e6dd0 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -441,7 +441,7 @@
maintenance_category = 'cite_error_refs_without_references_category'
-class XmlDumpNoReferencesPageGenerator:
+class XmlDumpNoReferencesPageGenerator(object):
"""
Generator which will yield Pages that might lack a references tag.
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 4579372..38d4fe3 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -183,7 +183,7 @@
ignore_save_related_errors=True)
-class PageFromFileReader:
+class PageFromFileReader(object):
"""
Responsible for reading the file.
diff --git a/scripts/redirect.py b/scripts/redirect.py
index b7bdc09..2ffce7e 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -96,7 +96,7 @@
return link.canonical_title().replace(' ', '_')
-class RedirectGenerator:
+class RedirectGenerator(object):
"""Redirect generator."""
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index e0845e3..7ab9444 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -68,7 +68,7 @@
return text
-class SyncSites:
+class SyncSites(object):
"""Work is done in here."""
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 8f9d511..c7460b0 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -358,7 +358,7 @@
return linkupper
-class ReferringPageGeneratorWithIgnore:
+class ReferringPageGeneratorWithIgnore(object):
"""Referring Page generator, with an ignore
manager."""
diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index 07c0a81..a5cf3c8 100755
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -46,7 +46,7 @@
templates = ['ref', 'note', 'ref label', 'note label',
'reflist']
-class TemplateCountRobot:
+class TemplateCountRobot(object):
"""Template count bot."""
diff --git a/tests/utils.py b/tests/utils.py
index e5ba6be..ff38840 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -257,7 +257,7 @@
return self[module][param_name]
-class DummySiteinfo():
+class DummySiteinfo(object):
"""Dummy class to use instead of
L{pywikibot.site.Siteinfo}."""
diff --git a/tox.ini b/tox.ini
index 6884c5d..ba8f743 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,6 +22,7 @@
commands = flake8 --ignore={[params]flake8_ignore} {posargs}
basepython = python2.7
deps = flake8
+ hacking
flake8-docstrings
flake8-coding
flake8-future-import
@@ -236,7 +237,7 @@
-rdocs/requirements-py3.txt
[flake8]
-ignore = E241,E402,E731,FI10,FI12,FI13,FI15,FI5,P102,P103
+ignore =
E241,E402,E731,FI10,FI12,FI13,FI15,FI5,H101,H201,H202,H236,H237,H301,H306,H404,H405,H501,P102,P103
exclude = .tox,.git,./*.egg,ez_setup.py,build,externals,user-config.py,./scripts/i18n/*
max_line_length = 130
accept-encodings = utf-8
--
To view, visit
https://gerrit.wikimedia.org/r/237910
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4fd9a559918e2f8a0abc10200315f714dcef34e3
Gerrit-PatchSet: 6
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>