Total Complexity | 5 |
Total Lines | 14 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | class WeRoBotMetaClass(type): |
||
2 | TYPES = {} |
||
3 | |||
4 | def __new__(mcs, name, bases, attrs): |
||
5 | return type.__new__(mcs, name, bases, attrs) |
||
6 | |||
7 | def __init__(cls, name, bases, attrs): |
||
8 | if '__type__' in attrs: |
||
9 | if isinstance(attrs['__type__'], list): |
||
10 | for _type in attrs['__type__']: |
||
11 | cls.TYPES[_type] = cls |
||
12 | else: |
||
13 | cls.TYPES[attrs['__type__']] = cls |
||
14 | type.__init__(cls, name, bases, attrs) |
||
15 |