diff options
Diffstat (limited to 'meta/lib/oe/classutils.py')
-rw-r--r-- | meta/lib/oe/classutils.py | 15 |
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 @@ | |||
1 | class ClassRegistry(type): | 1 | |
2 | class 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 | |||
8 | class ClassRegistry(type, metaclass=ClassRegistryMeta): | ||
2 | """Maintain a registry of classes, indexed by name. | 9 | """Maintain a registry of classes, indexed by name. |
3 | 10 | ||
4 | Note that this implementation requires that the names be unique, as it uses | 11 | Note 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 | |||
12 | control over whether the class will be added to the registry (e.g. to keep | 19 | control over whether the class will be added to the registry (e.g. to keep |
13 | abstract base classes out of the registry).""" | 20 | abstract 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: |