<s> from enum import EnumMeta , IntEnum <EOL> from sanpera . _api import ffi <EOL> class CEnumMeta ( EnumMeta ) : <EOL> def __new__ ( meta , name , bases , attrs ) : <EOL> cls = super ( CEnumMeta , meta ) . __new__ ( meta , name , bases , attrs ) <EOL> if '<STR_LIT>' in attrs : <EOL> cls . c = IntEnum ( cls . __ctype__ . cname , cls . __ctype__ . relements ) <EOL> return cls <EOL> class _CEnum ( IntEnum ) : <EOL> def __new__ ( cls , cname ) : <EOL> value = cls . __ctype__ . relements [ cname ] <EOL> obj = int . __new__ ( cls , value ) <EOL> obj . _value_ = value <EOL> return obj <EOL> CEnum = CEnumMeta ( '<STR_LIT>' , ( _CEnum , ) , { } ) <EOL> class Channel ( CEnum ) : <EOL> __ctype__ = ffi . typeof ( '<STR_LIT>' ) <EOL> red = '<STR_LIT>' <EOL> blue = '<STR_LIT>' <EOL> green = '<STR_LIT>' </s>
