jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/648571 )
Change subject: Modified 'super' to support python 3.5+ only ......................................................................
Modified 'super' to support python 3.5+ only
Change-Id: I5a750a19e97233e1f81a6259a07f6312d473007f --- M pywikibot/logentries.py M scripts/makecat.py M scripts/movepages.py M scripts/newitem.py M tests/api_tests.py M tests/deletionbot_tests.py M tests/edit_tests.py M tests/fixes_tests.py M tests/generate_family_file_tests.py M tests/interwiki_graph_tests.py M tests/namespace_tests.py 11 files changed, 25 insertions(+), 25 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py index 683ba39..ea52c5e 100644 --- a/pywikibot/logentries.py +++ b/pywikibot/logentries.py @@ -39,7 +39,7 @@
def __init__(self, apidata, site): """Initialize object from a logevent dict returned by MW API.""" - super(LogEntry, self).__init__(apidata) + super().__init__(apidata) self.site = site expected_type = self._expected_type if expected_type is not None and expected_type != self.type(): @@ -90,7 +90,7 @@ 'user'): # TODO use specific User class for 'user'? return lambda: self[item]
- return super(LogEntry, self).__getattribute__(item) + return super().__getattribute__(item)
@property def _params(self): @@ -171,7 +171,7 @@
def __init__(self, apidata, site): """Initializer.""" - super(BlockEntry, self).__init__(apidata, site) + super().__init__(apidata, site) # When an autoblock is removed, the "title" field is not a page title # See bug T19781 pos = self['title'].find('#') @@ -192,7 +192,7 @@ if self.isAutoblockRemoval: return self._blockid else: - return super(BlockEntry, self).page() + return super().page()
def flags(self) -> List[str]: """ diff --git a/scripts/makecat.py b/scripts/makecat.py index b447193..8f6f9ac 100755 --- a/scripts/makecat.py +++ b/scripts/makecat.py @@ -174,7 +174,7 @@ def init_page(self, page): """Add redirect targets to check list.""" global checked - super(MakeCatBot, self).init_page(page) + super().init_page(page) if page.isRedirectPage(): newpage = page.getRedirectTarget() if self.needcheck(newpage): @@ -187,7 +187,7 @@ pywikibot.warning('Page {page} does not exist on {page.site}. ' 'Skipping.'.format(page=page)) return True - return super(MakeCatBot, self).skip_page(page) + return super().skip_page(page)
def treat_page(self): """Work on current page and ask to add article to category.""" diff --git a/scripts/movepages.py b/scripts/movepages.py index 3d64832..98047cc 100755 --- a/scripts/movepages.py +++ b/scripts/movepages.py @@ -90,7 +90,7 @@ 'Page {page} on {page.site} is a redirect; skipping' .format(page=page)) return True - return super(MovePagesBot, self).skip_page(page) + return super().skip_page(page)
def treat_page(self): """Treat a single page.""" diff --git a/scripts/newitem.py b/scripts/newitem.py index 6db06a7..49418ec 100755 --- a/scripts/newitem.py +++ b/scripts/newitem.py @@ -174,7 +174,7 @@ % (page, template)) return True
- return super(NewItemRobot, self).skip_page(page) + return super().skip_page(page)
def treat_page_and_item(self, page, item) -> None: """Treat page/item.""" diff --git a/tests/api_tests.py b/tests/api_tests.py index 4dce5c7..eca078d 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -78,7 +78,7 @@
def setUp(self): """Mock warning and error.""" - super(TestAPIMWException, self).setUp() + super().setUp() self.warning_patcher = patch.object(pywikibot, 'warning') self.error_patcher = patch.object(pywikibot, 'error') self.warning_patcher.start() @@ -88,7 +88,7 @@ """Check warning and error calls.""" self.warning_patcher.stop() self.error_patcher.stop() - super(TestAPIMWException, self).tearDown() + super().tearDown()
def _test_assert_called_with(self, req): self.assertRaises(api.APIMWException, req.submit) @@ -584,7 +584,7 @@
def setUp(self): """Set up test case.""" - super(TestDryPageGenerator, self).setUp() + super().setUp() mysite = self.get_site() self.gen = api.PageGenerator(site=mysite, generator='links', @@ -796,7 +796,7 @@
def setUp(self): """Set up test case.""" - super(TestDryQueryGeneratorNamespaceParam, self).setUp() + super().setUp() self.site = self.get_site() self.site._paraminfo['query+querypage'] = { 'prefix': 'qp', @@ -869,7 +869,7 @@
def setUp(self): """Set up test case.""" - super(TestDryListGenerator, self).setUp() + super().setUp() mysite = self.get_site() mysite._paraminfo['query+allpages'] = { 'prefix': 'ap', @@ -988,14 +988,14 @@
def setUp(self): """Patch the LoginManager to avoid UI interaction.""" - super(TestLazyLoginNotExistUsername, self).setUp() + super().setUp() self.orig_login_manager = pywikibot.data.api.LoginManager pywikibot.data.api.LoginManager = FakeLoginManager
def tearDown(self): """Restore the original LoginManager.""" pywikibot.data.api.LoginManager = self.orig_login_manager - super(TestLazyLoginNotExistUsername, self).tearDown() + super().tearDown()
@patch.object(pywikibot, 'output') @patch.object(pywikibot, 'warning') diff --git a/tests/deletionbot_tests.py b/tests/deletionbot_tests.py index b035087..25b8a8c 100644 --- a/tests/deletionbot_tests.py +++ b/tests/deletionbot_tests.py @@ -93,13 +93,13 @@ self._original_undelete = pywikibot.Page.undelete pywikibot.Page.delete = delete_dummy pywikibot.Page.undelete = undelete_dummy - super(TestDeletionBot, self).setUp() + super().setUp()
def tearDown(self): """Tear down unit test.""" pywikibot.Page.delete = self._original_delete pywikibot.Page.undelete = self._original_undelete - super(TestDeletionBot, self).tearDown() + super().tearDown()
def test_dry(self): """Test dry run of bot.""" diff --git a/tests/edit_tests.py b/tests/edit_tests.py index 639b05b..f480ec6 100644 --- a/tests/edit_tests.py +++ b/tests/edit_tests.py @@ -190,14 +190,14 @@
def setUp(self): """Set up test by checking site and initialization.""" - super(OAuthEditTest, self).setUp() + super().setUp() self._authenticate = config.authenticate oauth_tokens = self.consumer_token + self.access_token config.authenticate[self.site.hostname()] = oauth_tokens
def tearDown(self): """Tear down test by resetting config.authenticate.""" - super(OAuthEditTest, self).tearDown() + super().tearDown() config.authenticate = self._authenticate
def test_edit(self): diff --git a/tests/fixes_tests.py b/tests/fixes_tests.py index a0d820a..11a66cd 100644 --- a/tests/fixes_tests.py +++ b/tests/fixes_tests.py @@ -21,13 +21,13 @@
def setUp(self): """Backup the current fixes.""" - super(TestFixes, self).setUp() + super().setUp() self._old_fixes = fixes.fixes
def tearDown(self): """Recover the current fixes.""" fixes.fixes = self._old_fixes - super(TestFixes, self).tearDown() + super().tearDown()
def test_overwrite_value(self): """Test loading a fix file overwriting the fixes.""" diff --git a/tests/generate_family_file_tests.py b/tests/generate_family_file_tests.py index 819c9e2..64bb7a2 100644 --- a/tests/generate_family_file_tests.py +++ b/tests/generate_family_file_tests.py @@ -25,7 +25,7 @@ save = self.langs self.langs = sample(save, min(len(save), 10)) self.prefixes = [item['prefix'] for item in self.langs] - super(FamilyTestGenerator, self).getapis() + super().getapis() self.langs = save
def writefile(self): @@ -41,7 +41,7 @@
def setUp(self): """Set up tests class.""" - super(TestGenerateFamilyFiles, self).setUp() + super().setUp() self.generator_instance = FamilyTestGenerator( url=self.site.base_url(''), name=self.familyname, dointerwiki='y')
diff --git a/tests/interwiki_graph_tests.py b/tests/interwiki_graph_tests.py index 1095599..8894e65 100644 --- a/tests/interwiki_graph_tests.py +++ b/tests/interwiki_graph_tests.py @@ -49,7 +49,7 @@
def setUp(self): """Setup interwiki_graph data.""" - super(TestWiktionaryGraph, self).setUp() + super().setUp() data = interwiki_graph.Subject(self.pages['en']) data.found_in[self.pages['en']] = [self.pages['fr'], self.pages['pl']] data.found_in[self.pages['fr']] = [self.pages['en'], self.pages['pl']] diff --git a/tests/namespace_tests.py b/tests/namespace_tests.py index ae968df..4a02daf 100644 --- a/tests/namespace_tests.py +++ b/tests/namespace_tests.py @@ -260,7 +260,7 @@
def setUp(self): """Setup namespaces dict.""" - super(TestNamespacesDictLookupName, self).setUp() + super().setUp() self.namespaces = builtin_NamespacesDict()
def test_lookup_name(self):