← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3only-super into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3only-super into launchpad:master.

Commit message:
Rely on Python 3 zero-argument super()

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/414405

pyupgrade missed these for various reasons (doctests, odd constructions due to long class names, and a few cases where `__new__` methods were passing the wrong class name to `super()`).
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3only-super into launchpad:master.
diff --git a/lib/lp/app/browser/tests/test_vocabulary.py b/lib/lp/app/browser/tests/test_vocabulary.py
index 2585a02..8f745ee 100644
--- a/lib/lp/app/browser/tests/test_vocabulary.py
+++ b/lib/lp/app/browser/tests/test_vocabulary.py
@@ -474,8 +474,7 @@ class TestVocabularyFilter(VocabularyFilter):
     # A filter returning all objects.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
-            cls, 'FILTER', 'Test Filter', 'Test')
+        return super().__new__(cls, 'FILTER', 'Test Filter', 'Test')
 
     @property
     def filter_terms(self):
diff --git a/lib/lp/app/stories/basics/xx-offsite-form-post.txt b/lib/lp/app/stories/basics/xx-offsite-form-post.txt
index b41aab4..132ea72 100644
--- a/lib/lp/app/stories/basics/xx-offsite-form-post.txt
+++ b/lib/lp/app/stories/basics/xx-offsite-form-post.txt
@@ -15,12 +15,11 @@ functionality:
     >>> class BrowserWithReferrer(Browser):
     ...     def __init__(self, referrer):
     ...         self._referrer = referrer
-    ...         super(BrowserWithReferrer, self).__init__()
+    ...         super().__init__()
     ...
     ...     @contextmanager
     ...     def _preparedRequest(self, url):
-    ...         with super(BrowserWithReferrer, self)._preparedRequest(
-    ...                 url) as reqargs:
+    ...         with super()._preparedRequest(url) as reqargs:
     ...             reqargs["headers"] = [
     ...                 (key, value) for key, value in reqargs["headers"]
     ...                 if key.lower() != "referer"]
diff --git a/lib/lp/bugs/doc/checkwatches-cli-switches.txt b/lib/lp/bugs/doc/checkwatches-cli-switches.txt
index d3613e9..79873ac 100644
--- a/lib/lp/bugs/doc/checkwatches-cli-switches.txt
+++ b/lib/lp/bugs/doc/checkwatches-cli-switches.txt
@@ -48,8 +48,7 @@ line.
     >>> class TestCheckWatchesCronScript(CheckWatchesCronScript):
     ...
     ...     def __init__(self, name, dbuser=None, test_args=None):
-    ...         super(TestCheckWatchesCronScript, self).__init__(
-    ...             name, dbuser, test_args)
+    ...         super().__init__(name, dbuser, test_args)
     ...         self.txn = transaction
     ...
     ...     def handle_options(self):
diff --git a/lib/lp/bugs/doc/externalbugtracker-linking-back.txt b/lib/lp/bugs/doc/externalbugtracker-linking-back.txt
index 28b8597..cdd3783 100644
--- a/lib/lp/bugs/doc/externalbugtracker-linking-back.txt
+++ b/lib/lp/bugs/doc/externalbugtracker-linking-back.txt
@@ -16,7 +16,7 @@ about the bug.
     ... class BackLinkingExternalBugTracker(TestExternalBugTracker):
     ...
     ...     def __init__(self, baseurl):
-    ...         super(BackLinkingExternalBugTracker, self).__init__(baseurl)
+    ...         super().__init__(baseurl)
     ...         self.last_launchpad_bug_id = None
     ...
     ...     def getLaunchpadBugId(self, remote_bug):
diff --git a/lib/lp/buildmaster/tests/builderproxy.py b/lib/lp/buildmaster/tests/builderproxy.py
index 5e9e4ac..82197ed 100644
--- a/lib/lp/buildmaster/tests/builderproxy.py
+++ b/lib/lp/buildmaster/tests/builderproxy.py
@@ -69,7 +69,7 @@ class InProcessProxyAuthAPIFixture(fixtures.Fixture):
 
             @defer.inlineCallbacks
             def setUp(self):
-                super(TestSomething, self).setUp()
+                super().setUp()
                 yield self.useFixture(InProcessProxyAuthAPIFixture()).start()
     """
 
diff --git a/lib/lp/codehosting/puller/tests/test_errors.py b/lib/lp/codehosting/puller/tests/test_errors.py
index 47676ed..f06ca00 100644
--- a/lib/lp/codehosting/puller/tests/test_errors.py
+++ b/lib/lp/codehosting/puller/tests/test_errors.py
@@ -55,7 +55,7 @@ class TestErrorCatching(TestCase):
 
     class CustomErrorOpener(BranchMirrorer):
         def __init__(self, exc):
-            super(TestErrorCatching.CustomErrorOpener, self).__init__(None)
+            super().__init__(None)
             self.exc = exc
 
         def open(self, url):
diff --git a/lib/lp/registry/doc/standing.txt b/lib/lp/registry/doc/standing.txt
index f337a4a..4ecb3b4 100644
--- a/lib/lp/registry/doc/standing.txt
+++ b/lib/lp/registry/doc/standing.txt
@@ -69,7 +69,7 @@ are not a member of, their message gets held for moderator approval.
     ...         switch_dbuser(config.standingupdater.dbuser)
     ...         self.txn = LaunchpadZopelessLayer.txn
     ...         self.logger = DevNullLogger()
-    ...         results = super(TestableScript, self).main()
+    ...         results = super().main()
     ...         switch_dbuser(launchpad_dbuser)
     ...         return results
     >>> script = TestableScript('update-standing', test_args=[])
diff --git a/lib/lp/registry/vocabularies.py b/lib/lp/registry/vocabularies.py
index 045cb4e..e0f9837 100644
--- a/lib/lp/registry/vocabularies.py
+++ b/lib/lp/registry/vocabularies.py
@@ -521,7 +521,7 @@ class VocabularyFilterPerson(VocabularyFilter):
     # A filter returning just persons.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
+        return super().__new__(
             cls, 'PERSON', 'Person',
             'Display search results for people only')
 
@@ -534,7 +534,7 @@ class VocabularyFilterTeam(VocabularyFilter):
     # A filter returning just teams.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
+        return super().__new__(
             cls, 'TEAM', 'Team',
             'Display search results for teams only')
 
@@ -1785,7 +1785,7 @@ class VocabularyFilterProject(VocabularyFilter):
     # A filter returning just projects.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
+        return super().__new__(
             cls, 'PROJECT', 'Project',
             'Display search results associated with projects')
 
@@ -1798,7 +1798,7 @@ class VocabularyFilterProjectGroup(VocabularyFilter):
     # A filter returning just project groups.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
+        return super().__new__(
             cls, 'PROJECTGROUP', 'Project Group',
             'Display search results associated with project groups')
 
@@ -1811,7 +1811,7 @@ class VocabularyFilterDistribution(VocabularyFilter):
     # A filter returning just distros.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
+        return super().__new__(
             cls, 'DISTRO', 'Distribution',
             'Display search results associated with distributions')
 
diff --git a/lib/lp/services/webapp/tests/test_authorization.py b/lib/lp/services/webapp/tests/test_authorization.py
index 3b27dcc..5e31460 100644
--- a/lib/lp/services/webapp/tests/test_authorization.py
+++ b/lib/lp/services/webapp/tests/test_authorization.py
@@ -426,8 +426,7 @@ class TestCheckPermissionCaching(TestCase):
 class TestLaunchpadSecurityPolicy_getPrincipalsAccessLevel(TestCase):
 
     def setUp(self):
-        cls = TestLaunchpadSecurityPolicy_getPrincipalsAccessLevel
-        super(cls, self).setUp()
+        super().setUp()
         self.principal = LaunchpadPrincipal(
             'foo.bar@xxxxxxxxxxxxx', 'foo', 'foo', object())
         self.security = LaunchpadSecurityPolicy()
diff --git a/lib/lp/services/webapp/vocabulary.py b/lib/lp/services/webapp/vocabulary.py
index 309d871..023deca 100644
--- a/lib/lp/services/webapp/vocabulary.py
+++ b/lib/lp/services/webapp/vocabulary.py
@@ -239,8 +239,7 @@ class VocabularyFilterAll(VocabularyFilter):
     # A filter returning all objects.
 
     def __new__(cls):
-        return super(VocabularyFilter, cls).__new__(
-            cls, 'ALL', 'All', 'Display all search results')
+        return super().__new__(cls, 'ALL', 'All', 'Display all search results')
 
 
 class FilteredVocabularyBase:
diff --git a/lib/lp/testing/keyserver/inprocess.py b/lib/lp/testing/keyserver/inprocess.py
index 932ff2e..b994bea 100644
--- a/lib/lp/testing/keyserver/inprocess.py
+++ b/lib/lp/testing/keyserver/inprocess.py
@@ -43,7 +43,7 @@ class InProcessKeyServerFixture(Fixture):
 
             @defer.inlineCallbacks
             def setUp(self):
-                super(TestSomething, self).setUp()
+                super().setUp()
                 yield self.useFixture(InProcessKeyServerFixture()).start()
 
     Unlike other fixtures, `InProcessKeyServerFixture` should not be used as
diff --git a/lib/lp/translations/doc/translations-export-to-branch.txt b/lib/lp/translations/doc/translations-export-to-branch.txt
index 76b63db..50e9dcc 100644
--- a/lib/lp/translations/doc/translations-export-to-branch.txt
+++ b/lib/lp/translations/doc/translations-export-to-branch.txt
@@ -63,8 +63,7 @@ files into the branches.  We mock it up here.
     ...     config_name = "translations_export_to_branch"
     ...
     ...     def __init__(self, *args, **kwargs):
-    ...         super(MockExportTranslationsToBranch, self).__init__(
-    ...             *args, **kwargs)
+    ...         super().__init__(*args, **kwargs)
     ...         self.logger = FakeLogger()
     ...
     ...     def _getLatestTranslationsCommit(self, branch):