summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/classutils.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/classutils.py')
-rw-r--r--meta/lib/oe/classutils.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/meta/lib/oe/classutils.py b/meta/lib/oe/classutils.py
index 98bb059a71..e7856c86f2 100644
--- a/meta/lib/oe/classutils.py
+++ b/meta/lib/oe/classutils.py
@@ -1,4 +1,11 @@
1class ClassRegistry(type): 1
2class ClassRegistryMeta(type):
3 """Give each ClassRegistry their own registry"""
4 def __init__(cls, name, bases, attrs):
5 cls.registry = {}
6 type.__init__(cls, name, bases, attrs)
7
8class ClassRegistry(type, metaclass=ClassRegistryMeta):
2 """Maintain a registry of classes, indexed by name. 9 """Maintain a registry of classes, indexed by name.
3 10
4Note that this implementation requires that the names be unique, as it uses 11Note that this implementation requires that the names be unique, as it uses
@@ -12,12 +19,6 @@ Subclasses of ClassRegistry may define an 'implemented' property to exert
12control over whether the class will be added to the registry (e.g. to keep 19control over whether the class will be added to the registry (e.g. to keep
13abstract base classes out of the registry).""" 20abstract base classes out of the registry)."""
14 priority = 0 21 priority = 0
15 class __metaclass__(type):
16 """Give each ClassRegistry their own registry"""
17 def __init__(cls, name, bases, attrs):
18 cls.registry = {}
19 type.__init__(cls, name, bases, attrs)
20
21 def __init__(cls, name, bases, attrs): 22 def __init__(cls, name, bases, attrs):
22 super(ClassRegistry, cls).__init__(name, bases, attrs) 23 super(ClassRegistry, cls).__init__(name, bases, attrs)
23 try: 24 try: