← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Use Python 3 metaclass syntax

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/409565
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3only-metaclass-syntax into launchpad:master.
diff --git a/lib/lp/app/widgets/tests/test_popup.py b/lib/lp/app/widgets/tests/test_popup.py
index d57d3b3..5627eaa 100644
--- a/lib/lp/app/widgets/tests/test_popup.py
+++ b/lib/lp/app/widgets/tests/test_popup.py
@@ -2,7 +2,6 @@
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 import simplejson
-import six
 from zope.interface import Interface
 from zope.interface.interface import InterfaceClass
 from zope.schema import Choice
@@ -33,7 +32,7 @@ class TestMetaClass(InterfaceClass):
             __module__=__module__)
 
 
-class ITest(six.with_metaclass(TestMetaClass, Interface)):
+class ITest(Interface, metaclass=TestMetaClass):
     # The schema class for the widget we will test.
     pass
 
diff --git a/lib/lp/bugs/model/apportjob.py b/lib/lp/bugs/model/apportjob.py
index 1343a4a..29448ab 100644
--- a/lib/lp/bugs/model/apportjob.py
+++ b/lib/lp/bugs/model/apportjob.py
@@ -113,8 +113,7 @@ class ApportJob(StormBase):
 
 @delegate_to(IApportJob)
 @provider(IApportJobSource)
-class ApportJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class ApportJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Intermediate class for deriving from ApportJob."""
 
     def __init__(self, job):
diff --git a/lib/lp/charms/model/charmrecipejob.py b/lib/lp/charms/model/charmrecipejob.py
index a610e58..649c965 100644
--- a/lib/lp/charms/model/charmrecipejob.py
+++ b/lib/lp/charms/model/charmrecipejob.py
@@ -14,7 +14,6 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
-import six
 from storm.databases.postgres import JSON
 from storm.locals import (
     Desc,
@@ -110,8 +109,7 @@ class CharmRecipeJob(StormBase):
 
 
 @delegate_to(ICharmRecipeJob)
-class CharmRecipeJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class CharmRecipeJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, recipe_job):
         self.context = recipe_job
diff --git a/lib/lp/code/model/branchjob.py b/lib/lp/code/model/branchjob.py
index 0010868..172f83c 100644
--- a/lib/lp/code/model/branchjob.py
+++ b/lib/lp/code/model/branchjob.py
@@ -243,8 +243,7 @@ class BranchJob(StormBase):
 
 
 @delegate_to(IBranchJob)
-class BranchJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class BranchJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, branch_job):
         self.context = branch_job
diff --git a/lib/lp/code/model/branchmergeproposaljob.py b/lib/lp/code/model/branchmergeproposaljob.py
index c7b0467..0430cb8 100644
--- a/lib/lp/code/model/branchmergeproposaljob.py
+++ b/lib/lp/code/model/branchmergeproposaljob.py
@@ -221,7 +221,7 @@ class BranchMergeProposalJob(StormBase):
 
 @delegate_to(IBranchMergeProposalJob)
 class BranchMergeProposalJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+        BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Intermediate class for deriving from BranchMergeProposalJob."""
 
     def __init__(self, job):
diff --git a/lib/lp/code/model/gitjob.py b/lib/lp/code/model/gitjob.py
index 69667f1..347d2f1 100644
--- a/lib/lp/code/model/gitjob.py
+++ b/lib/lp/code/model/gitjob.py
@@ -16,7 +16,6 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
-import six
 from storm.exceptions import LostObjectError
 from storm.locals import (
     Int,
@@ -139,7 +138,7 @@ class GitJob(StormBase):
 
 
 @delegate_to(IGitJob)
-class GitJobDerived(six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class GitJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, git_job):
         self.context = git_job
diff --git a/lib/lp/oci/model/ocirecipebuildjob.py b/lib/lp/oci/model/ocirecipebuildjob.py
index 51842ef..1d3143b 100644
--- a/lib/lp/oci/model/ocirecipebuildjob.py
+++ b/lib/lp/oci/model/ocirecipebuildjob.py
@@ -16,7 +16,6 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
-import six
 from storm.databases.postgres import JSON
 from storm.locals import (
     Int,
@@ -107,8 +106,7 @@ class OCIRecipeBuildJob(StormBase):
 
 
 @delegate_to(IOCIRecipeBuildJob)
-class OCIRecipeBuildJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class OCIRecipeBuildJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, oci_build_job):
         self.context = oci_build_job
diff --git a/lib/lp/oci/model/ocirecipejob.py b/lib/lp/oci/model/ocirecipejob.py
index 1a82a14..1f604a9 100644
--- a/lib/lp/oci/model/ocirecipejob.py
+++ b/lib/lp/oci/model/ocirecipejob.py
@@ -3,9 +3,6 @@
 
 """A build job for OCI Recipe."""
 
-from lp.buildmaster.model.processor import Processor
-from lp.oci.interfaces.ocirecipe import IOCIRecipeSet
-
 __all__ = [
     'OCIRecipeJob',
     ]
@@ -15,7 +12,6 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
-import six
 from storm.databases.postgres import JSON
 from storm.expr import Desc
 from storm.properties import Int
@@ -30,6 +26,8 @@ from zope.interface import (
 from zope.security.proxy import removeSecurityProxy
 
 from lp.app.errors import NotFoundError
+from lp.buildmaster.model.processor import Processor
+from lp.oci.interfaces.ocirecipe import IOCIRecipeSet
 from lp.oci.interfaces.ocirecipebuild import (
     OCIRecipeBuildRegistryUploadStatus,
     OCIRecipeBuildSetRegistryUploadStatus,
@@ -109,8 +107,7 @@ class OCIRecipeJob(StormBase):
 
 
 @delegate_to(IOCIRecipeJob)
-class OCIRecipeJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class OCIRecipeJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, recipe_job):
         self.context = recipe_job
diff --git a/lib/lp/registry/model/persontransferjob.py b/lib/lp/registry/model/persontransferjob.py
index aed104a..75d7b56 100644
--- a/lib/lp/registry/model/persontransferjob.py
+++ b/lib/lp/registry/model/persontransferjob.py
@@ -135,8 +135,7 @@ class PersonTransferJob(StormBase):
 
 @delegate_to(IPersonTransferJob)
 @provider(IPersonTransferJobSource)
-class PersonTransferJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class PersonTransferJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Intermediate class for deriving from PersonTransferJob.
 
     Storm classes can't simply be subclassed or you can end up with
diff --git a/lib/lp/registry/model/sharingjob.py b/lib/lp/registry/model/sharingjob.py
index 3f3f398..a8bc41a 100644
--- a/lib/lp/registry/model/sharingjob.py
+++ b/lib/lp/registry/model/sharingjob.py
@@ -182,8 +182,7 @@ class SharingJob(StormBase):
 
 @delegate_to(ISharingJob)
 @provider(ISharingJobSource)
-class SharingJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class SharingJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Intermediate class for deriving from SharingJob."""
 
     def __init__(self, job):
diff --git a/lib/lp/services/tests/test_utils.py b/lib/lp/services/tests/test_utils.py
index 32781d0..cabedb7 100644
--- a/lib/lp/services/tests/test_utils.py
+++ b/lib/lp/services/tests/test_utils.py
@@ -11,7 +11,6 @@ import os
 
 from fixtures import TempDir
 from pytz import UTC
-import six
 from testtools.matchers import (
     Equals,
     GreaterThan,
@@ -64,8 +63,7 @@ class TestAutoDecorate(TestCase):
         # All of the decorators passed to AutoDecorate are applied as
         # decorators in reverse order.
         class AutoDecoratedClass(
-            six.with_metaclass(
-                AutoDecorate(self.decorator_1, self.decorator_2), object)):
+                metaclass=AutoDecorate(self.decorator_1, self.decorator_2)):
 
             def method_a(s):
                 self.log.append('a')
diff --git a/lib/lp/services/webhooks/model.py b/lib/lp/services/webhooks/model.py
index 50966bc..82005ab 100644
--- a/lib/lp/services/webhooks/model.py
+++ b/lib/lp/services/webhooks/model.py
@@ -382,8 +382,7 @@ class WebhookJob(StormBase):
 
 
 @delegate_to(IWebhookJob)
-class WebhookJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class WebhookJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, webhook_job):
         self.context = webhook_job
diff --git a/lib/lp/snappy/model/snapbuildjob.py b/lib/lp/snappy/model/snapbuildjob.py
index 79e3537..4c522e1 100644
--- a/lib/lp/snappy/model/snapbuildjob.py
+++ b/lib/lp/snappy/model/snapbuildjob.py
@@ -17,7 +17,6 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
-import six
 from storm.locals import (
     Int,
     JSON,
@@ -113,8 +112,7 @@ class SnapBuildJob(StormBase):
 
 
 @delegate_to(ISnapBuildJob)
-class SnapBuildJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class SnapBuildJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, snap_build_job):
         self.context = snap_build_job
diff --git a/lib/lp/snappy/model/snapjob.py b/lib/lp/snappy/model/snapjob.py
index f6494c6..3c6b33b 100644
--- a/lib/lp/snappy/model/snapjob.py
+++ b/lib/lp/snappy/model/snapjob.py
@@ -16,7 +16,6 @@ from lazr.enum import (
     DBEnumeratedType,
     DBItem,
     )
-import six
 from storm.locals import (
     Desc,
     Int,
@@ -118,7 +117,7 @@ class SnapJob(StormBase):
 
 
 @delegate_to(ISnapJob)
-class SnapJobDerived(six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class SnapJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     def __init__(self, snap_job):
         self.context = snap_job
diff --git a/lib/lp/soyuz/model/archivejob.py b/lib/lp/soyuz/model/archivejob.py
index 51c8533..6aac1e6 100644
--- a/lib/lp/soyuz/model/archivejob.py
+++ b/lib/lp/soyuz/model/archivejob.py
@@ -5,7 +5,6 @@ import io
 import logging
 
 from lazr.delegates import delegate_to
-import six
 from storm.expr import And
 from storm.locals import (
     Int,
@@ -76,8 +75,7 @@ class ArchiveJob(StormBase):
 
 @delegate_to(IArchiveJob)
 @provider(IArchiveJobSource)
-class ArchiveJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class ArchiveJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Intermediate class for deriving from ArchiveJob."""
 
     def __init__(self, job):
diff --git a/lib/lp/soyuz/model/distributionjob.py b/lib/lp/soyuz/model/distributionjob.py
index 902ffa9..91c4571 100644
--- a/lib/lp/soyuz/model/distributionjob.py
+++ b/lib/lp/soyuz/model/distributionjob.py
@@ -7,7 +7,6 @@ __all__ = [
 ]
 
 from lazr.delegates import delegate_to
-import six
 from storm.locals import (
     And,
     Int,
@@ -67,8 +66,7 @@ class DistributionJob(StormBase):
 
 
 @delegate_to(IDistributionJob)
-class DistributionJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class DistributionJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Abstract class for deriving from DistributionJob."""
 
     def __init__(self, job):
diff --git a/lib/lp/soyuz/model/packagecopyjob.py b/lib/lp/soyuz/model/packagecopyjob.py
index bdbfbc1..f9bea8b 100644
--- a/lib/lp/soyuz/model/packagecopyjob.py
+++ b/lib/lp/soyuz/model/packagecopyjob.py
@@ -181,8 +181,7 @@ class PackageCopyJob(StormBase):
 
 
 @delegate_to(IPackageCopyJob)
-class PackageCopyJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class PackageCopyJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
     """Abstract class for deriving from PackageCopyJob."""
 
     def __init__(self, job):
diff --git a/lib/lp/soyuz/model/packagediffjob.py b/lib/lp/soyuz/model/packagediffjob.py
index bbc939d..9260ede 100644
--- a/lib/lp/soyuz/model/packagediffjob.py
+++ b/lib/lp/soyuz/model/packagediffjob.py
@@ -7,7 +7,6 @@ __all__ = [
 
 from lazr.delegates import delegate_to
 import simplejson
-import six
 from zope.component import getUtility
 from zope.interface import (
     implementer,
@@ -31,8 +30,7 @@ from lp.soyuz.interfaces.packagediffjob import (
 
 @delegate_to(IPackageDiffJob)
 @provider(IPackageDiffJobSource)
-class PackageDiffJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+class PackageDiffJobDerived(BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     config = config.IPackageDiffJobSource
 
diff --git a/lib/lp/soyuz/model/packagetranslationsuploadjob.py b/lib/lp/soyuz/model/packagetranslationsuploadjob.py
index f6b1433..e124c41 100644
--- a/lib/lp/soyuz/model/packagetranslationsuploadjob.py
+++ b/lib/lp/soyuz/model/packagetranslationsuploadjob.py
@@ -11,7 +11,6 @@ import os
 import tempfile
 
 from lazr.delegates import delegate_to
-import six
 from zope.component import getUtility
 from zope.interface import (
     implementer,
@@ -75,7 +74,7 @@ def _filter_ubuntu_translation_file(filename):
 @delegate_to(IPackageTranslationsUploadJob)
 @provider(IPackageTranslationsUploadJobSource)
 class PackageTranslationsUploadJobDerived(
-        six.with_metaclass(EnumeratedSubclass, BaseRunnableJob)):
+        BaseRunnableJob, metaclass=EnumeratedSubclass):
 
     config = config.IPackageTranslationsUploadJobSource
 
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index d78c35a..acc1bee 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -429,8 +429,7 @@ class GPGSigningContext:
         self.mode = mode
 
 
-class ObjectFactory(
-        six.with_metaclass(AutoDecorate(default_master_store)), object):
+class ObjectFactory(metaclass=AutoDecorate(default_master_store)):
     """Factory methods for creating basic Python objects."""
 
     # This allocates process-wide unique integers.  We count on Python doing
diff --git a/lib/lp/translations/model/translationsharingjob.py b/lib/lp/translations/model/translationsharingjob.py
index e1e2099..24c9762 100644
--- a/lib/lp/translations/model/translationsharingjob.py
+++ b/lib/lp/translations/model/translationsharingjob.py
@@ -113,8 +113,7 @@ class TranslationSharingJob(StormBase):
 
 
 @delegate_to(ITranslationSharingJob)
-class TranslationSharingJobDerived(
-        six.with_metaclass(EnumeratedSubclass, object)):
+class TranslationSharingJobDerived(metaclass=EnumeratedSubclass):
     """Base class for specialized TranslationTemplate Job types."""
 
     def getDBClass(self):