File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ def get_registry(cls):
20
20
return dict (cls .REGISTRY )
21
21
22
22
23
- class BaseRegisteredClass (metaclass = RegistryHolder ):
23
+ class BaseRegisteredClass :
24
+ __metaclass__ = RegistryHolder
24
25
"""
25
26
Any class that will inherits from BaseRegisteredClass will be included
26
27
inside the dict RegistryHolder.REGISTRY, the key being the name of the
@@ -30,18 +31,20 @@ class and the associated value, the class itself.
30
31
31
32
if __name__ == "__main__" :
32
33
print ("Before subclassing: " )
33
- for k in RegistryHolder .REGISTRY :
34
+ for k in RegistryHolder .REGISTRY . keys () :
34
35
print (k )
35
36
36
37
class ClassRegistree (BaseRegisteredClass ):
37
38
38
39
def __init__ (self , * args , ** kwargs ):
39
40
pass
41
+
42
+
40
43
print ("After subclassing: " )
41
44
for k in RegistryHolder .REGISTRY :
42
45
print (k )
43
46
44
- ### OUTPUT ###
47
+ ### OUTPUT ###
45
48
# Before subclassing:
46
49
# BaseRegisteredClass
47
50
# After subclassing:
You can’t perform that action at this time.
0 commit comments