From e81f5ef1ebf57e9df2cfefabb5c5fa67defa6d2f Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 27 May 2008 20:34:09 +0000 Subject: [PATCH] Remove __metaclass__ remains. --- Demo/newmetaclasses/Eiffel.py | 4 ++-- Demo/newmetaclasses/Enum.py | 8 ++++---- Lib/test/test_descr.py | 2 +- Parser/asdl.py | 2 -- Tools/framer/framer/bases.py | 8 ++++---- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Demo/newmetaclasses/Eiffel.py b/Demo/newmetaclasses/Eiffel.py index 337ad937c61..15fa58a7003 100644 --- a/Demo/newmetaclasses/Eiffel.py +++ b/Demo/newmetaclasses/Eiffel.py @@ -85,8 +85,8 @@ class EiffelMetaClass2(EiffelBaseMetaClass): make_eiffel_method = EiffelDescriptor def _test(metaclass): - class Eiffel: - __metaclass__ = metaclass + class Eiffel(metaclass=metaclass): + pass class Test(Eiffel): diff --git a/Demo/newmetaclasses/Enum.py b/Demo/newmetaclasses/Enum.py index 99b6fe80415..3ff8ddd720b 100644 --- a/Demo/newmetaclasses/Enum.py +++ b/Demo/newmetaclasses/Enum.py @@ -82,11 +82,11 @@ class EnumInstance(int): def __str__(self): return "%s.%s" % (self.__classname, self.__enumname) -class Enum: - __metaclass__ = EnumMetaclass +class Enum(metaclass=EnumMetaclass): + pass -class FullEnum: - __metaclass__ = FullEnumMetaclass +class FullEnum(metaclass=FullEnumMetaclass): + pass def _test(): diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index ad649cb176b..bfbb400f400 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -440,7 +440,7 @@ class ClassPropertiesAndMethods(unittest.TestCase): self.assertEqual(a[100:200], (100,200)) def test_metaclass(self): - # Testing __metaclass__... + # Testing metaclasses... class C(metaclass=type): def __init__(self): self.__state = 0 diff --git a/Parser/asdl.py b/Parser/asdl.py index 71d3be7f8a5..3583d846fa8 100644 --- a/Parser/asdl.py +++ b/Parser/asdl.py @@ -10,8 +10,6 @@ browser. Changes for Python: Add support for module versions """ -#__metaclass__ = type - import os import sys import traceback diff --git a/Tools/framer/framer/bases.py b/Tools/framer/framer/bases.py index d9c99dbab23..08aacb9eac4 100644 --- a/Tools/framer/framer/bases.py +++ b/Tools/framer/framer/bases.py @@ -96,8 +96,8 @@ class ModuleMetaclass(BaseMetaclass): p("}") -class Module: - __metaclass__ = ModuleMetaclass +class Module(metaclass=ModuleMetaclass): + pass class TypeMetaclass(BaseMetaclass): @@ -211,5 +211,5 @@ class TypeMetaclass(BaseMetaclass): p(template.type_init_type) p(template.module_add_type) -class Type: - __metaclass__ = TypeMetaclass +class Type(metaclass=TypeMetaclass): + pass