Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions arrayfire/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@
def _Enum_Type(v):
return v
except:
class _MetaEnum(type):
def __init__(cls, name, bases, attrs):
for attrname, attrvalue in attrs.iteritems():
if name != '_Enum' and isinstance(attrvalue, _Enum_Type):
attrvalue.__class__ = cls
attrs[attrname] = attrvalue

class _Enum(object):
pass
__metaclass__ = _MetaEnum

class _Enum_Type(object):
def __init__(self, v):
Expand All @@ -31,7 +38,7 @@ class ERR(_Enum):
Error values. For internal use only.
"""

NONE = _Enum_Type(0)
NONE = _Enum_Type(0)

#100-199 Errors in environment
NO_MEM = _Enum_Type(101)
Expand Down